diff options
| author | Rahul Sabnis <rahulsabnis@google.com> | 2020-02-25 22:28:00 +0000 |
|---|---|---|
| committer | Rahul Sabnis <rahulsabnis@google.com> | 2020-03-03 16:22:26 -0800 |
| commit | 39b5b839bddc216ba8102d36c1f955190b2ec100 (patch) | |
| tree | 141c050f54124ebcb09d4cb746bed2ce08e37c4b | |
| parent | 2ed1d2b427f2ba99bae342d077b104b4a54601c3 (diff) | |
| download | platform_packages_apps_Test_connectivity-android11-dev.tar.gz platform_packages_apps_Test_connectivity-android11-dev.tar.bz2 platform_packages_apps_Test_connectivity-android11-dev.zip | |
Revert "Revert "Pass in active device to all BluetoothA2dp APIs ..."android11-dev
Revert "Revert "Pass in active device to all BluetoothA2dp APIs ..."
Revert submission 10303287-revert-10253996-bt-a2dp-no-null-FQRXACWPIA
Reason for revert: Fixing breakage
Reverted Changes:
I4d9f2f819:Revert "Make sure calls to BluetoothA2dp APIs pass...
I771ca0d57:Revert "Need to now pass in active device instead ...
I76529c7a1:Revert "Pass in active device to all BluetoothA2dp...
I297bda68d:Revert "Require user pass in a non-null BluetoothD...
I525327959:Revert "Pass in active device to all BluetoothA2dp...
I1d8660b11:Revert "Pass in active device to all BluetoothA2dp...
Bug: 147287141
Test: Manual
Merged-In: Ibbfa5cf5f189ca28b3589af827815747dbc4085e
Change-Id: Ibbfa5cf5f189ca28b3589af827815747dbc4085e
| -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; |
