summaryrefslogtreecommitdiff
path: root/src/com/android/settings/development/bluetooth/AbstractBluetoothDialogPreferenceController.java
diff options
context:
space:
mode:
authorRahul Sabnis <rahulsabnis@google.com>2020-02-25 22:28:00 +0000
committerRahul Sabnis <rahulsabnis@google.com>2020-02-27 17:00:24 -0800
commitfc8115d91bc3ded8918c7a3c6cb6fcf2fc9e5657 (patch)
tree2592f167b906b44574209b8cb35e0db9208f5844 /src/com/android/settings/development/bluetooth/AbstractBluetoothDialogPreferenceController.java
parent149508de8c4baab5fa5c81fa63affeab842d0090 (diff)
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: robotests Change-Id: I5aecfa4b5a8e371b914573ddd080acb98078bfca
Diffstat (limited to 'src/com/android/settings/development/bluetooth/AbstractBluetoothDialogPreferenceController.java')
-rw-r--r--src/com/android/settings/development/bluetooth/AbstractBluetoothDialogPreferenceController.java27
1 files changed, 23 insertions, 4 deletions
diff --git a/src/com/android/settings/development/bluetooth/AbstractBluetoothDialogPreferenceController.java b/src/com/android/settings/development/bluetooth/AbstractBluetoothDialogPreferenceController.java
index 71907b6f9f..6bc9175ba8 100644
--- a/src/com/android/settings/development/bluetooth/AbstractBluetoothDialogPreferenceController.java
+++ b/src/com/android/settings/development/bluetooth/AbstractBluetoothDialogPreferenceController.java
@@ -80,7 +80,10 @@ public abstract class AbstractBluetoothDialogPreferenceController extends
}
writeConfigurationValues(index);
final BluetoothCodecConfig codecConfig = mBluetoothA2dpConfigStore.createCodecConfig();
- bluetoothA2dp.setCodecConfigPreference(null, codecConfig);
+ BluetoothDevice activeDevice = mBluetoothA2dp.getActiveDevice();
+ if (activeDevice != null) {
+ bluetoothA2dp.setCodecConfigPreference(activeDevice, codecConfig);
+ }
mPreference.setSummary(((BaseBluetoothDialogPreference) mPreference).generateSummary(
index));
}
@@ -146,7 +149,13 @@ public abstract class AbstractBluetoothDialogPreferenceController extends
if (bluetoothA2dp == null) {
return null;
}
- final BluetoothCodecStatus codecStatus = bluetoothA2dp.getCodecStatus(null);
+ BluetoothDevice activeDevice = bluetoothA2dp.getActiveDevice();
+ if (activeDevice == null) {
+ Log.d(TAG, "Unable to get current codec config. No active device.");
+ return null;
+ }
+ final BluetoothCodecStatus codecStatus =
+ bluetoothA2dp.getCodecStatus(activeDevice);
if (codecStatus == null) {
Log.d(TAG, "Unable to get current codec config. Codec status is null");
return null;
@@ -164,7 +173,12 @@ public abstract class AbstractBluetoothDialogPreferenceController extends
if (bluetoothA2dp == null) {
return null;
}
- final BluetoothCodecStatus codecStatus = bluetoothA2dp.getCodecStatus(device);
+ BluetoothDevice bluetoothDevice =
+ (device != null) ? device : bluetoothA2dp.getActiveDevice();
+ if (bluetoothDevice == null) {
+ return null;
+ }
+ final BluetoothCodecStatus codecStatus = bluetoothA2dp.getCodecStatus(bluetoothDevice);
if (codecStatus != null) {
return codecStatus.getCodecsSelectableCapabilities();
}
@@ -177,7 +191,12 @@ public abstract class AbstractBluetoothDialogPreferenceController extends
* @return {@link BluetoothCodecConfig}.
*/
protected BluetoothCodecConfig getSelectableByCodecType(int codecTypeValue) {
- final BluetoothCodecConfig[] configs = getSelectableConfigs(null);
+ BluetoothDevice activeDevice = mBluetoothA2dp.getActiveDevice();
+ if (activeDevice == null) {
+ Log.d(TAG, "Unable to get selectable config. No active device.");
+ return null;
+ }
+ final BluetoothCodecConfig[] configs = getSelectableConfigs(activeDevice);
if (configs == null) {
Log.d(TAG, "Unable to get selectable config. Selectable configs is empty.");
return null;