diff options
author | Rahul Sabnis <rahulsabnis@google.com> | 2020-03-19 01:37:21 +0000 |
---|---|---|
committer | Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> | 2020-03-19 01:37:21 +0000 |
commit | 1da08e535ce23ff0af359eeb6ffdf59ec0a77c46 (patch) | |
tree | 141c050f54124ebcb09d4cb746bed2ce08e37c4b | |
parent | 4ca008b37a6273463818432584fa6f437671bacb (diff) | |
parent | e5d120d1e9883ebadf32497c54681935c0df057e (diff) | |
download | platform_packages_apps_Test_connectivity-1da08e535ce23ff0af359eeb6ffdf59ec0a77c46.tar.gz platform_packages_apps_Test_connectivity-1da08e535ce23ff0af359eeb6ffdf59ec0a77c46.tar.bz2 platform_packages_apps_Test_connectivity-1da08e535ce23ff0af359eeb6ffdf59ec0a77c46.zip |
Revert "Revert "Pass in active device to all BluetoothA2dp APIs ..." am: e5d120d1e9
Change-Id: I8c6644030e1c6fd310c6fd3845c09d747ec212b8
-rw-r--r-- | PMC/src/com/android/pmc/A2dpReceiver.java | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/PMC/src/com/android/pmc/A2dpReceiver.java b/PMC/src/com/android/pmc/A2dpReceiver.java index 843f7ae..162d864 100644 --- a/PMC/src/com/android/pmc/A2dpReceiver.java +++ b/PMC/src/com/android/pmc/A2dpReceiver.java @@ -403,7 +403,12 @@ public class A2dpReceiver extends BroadcastReceiver { BluetoothCodecConfig[] codecsSelectableCapabilities = null; if (mBluetoothA2dp != null) { - codecStatus = mBluetoothA2dp.getCodecStatus(null); // Use current active device + BluetoothDevice activeDevice = mBluetoothA2dp.getActiveDevice(); + if (activeDevice == null) { + Log.e(TAG, "getCodecValue: Active device is null"); + return null; + } + codecStatus = mBluetoothA2dp.getCodecStatus(activeDevice); if (codecStatus != null) { codecConfig = codecStatus.getCodecConfig(); codecsLocalCapabilities = codecStatus.getCodecsLocalCapabilities(); @@ -465,8 +470,13 @@ public class A2dpReceiver extends BroadcastReceiver { } if (mBluetoothA2dp != null) { + BluetoothDevice activeDevice = mBluetoothA2dp.getActiveDevice(); + if (activeDevice == null) { + Log.e(TAG, "setCodecValue: Active device is null. Codec is not set."); + return false; + } Log.d(TAG, "setCodecConfigPreference()"); - mBluetoothA2dp.setCodecConfigPreference(null, codecConfig); // Use current active device + mBluetoothA2dp.setCodecConfigPreference(mBluetoothA2dp.getActiveDevice(), codecConfig); } else { Log.e(TAG, "mBluetoothA2dp is null. Codec is not set"); return false; |