summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorandroid-build-team Robot <android-build-team-robot@google.com>2020-03-06 03:01:52 +0000
committerandroid-build-team Robot <android-build-team-robot@google.com>2020-03-06 03:01:52 +0000
commit3d1281cef08aedf06a4865c1ad7e59deb31ab77c (patch)
tree141c050f54124ebcb09d4cb746bed2ce08e37c4b
parent8e151eb0789d9001301b9b72f56c0a70af23ffe8 (diff)
parent39b5b839bddc216ba8102d36c1f955190b2ec100 (diff)
downloadplatform_packages_apps_Test_connectivity-android11-tests-release.tar.gz
platform_packages_apps_Test_connectivity-android11-tests-release.tar.bz2
platform_packages_apps_Test_connectivity-android11-tests-release.zip
Change-Id: I307b1e38c255ad8992ebbb1ed3450de20a61e4a3
-rw-r--r--PMC/src/com/android/pmc/A2dpReceiver.java14
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;