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 Merged-In: I5aecfa4b5a8e371b914573ddd080acb98078bfca Change-Id: I5aecfa4b5a8e371b914573ddd080acb98078bfca
This commit is contained in:
@@ -58,11 +58,11 @@ public class BluetoothHDAudioPreferenceController extends AbstractBluetoothPrefe
|
||||
mPreference.setEnabled(false);
|
||||
return;
|
||||
}
|
||||
final boolean supported = (bluetoothA2dp.supportsOptionalCodecs(activeDevice)
|
||||
final boolean supported = (bluetoothA2dp.isOptionalCodecsSupported(activeDevice)
|
||||
== BluetoothA2dp.OPTIONAL_CODECS_SUPPORTED);
|
||||
mPreference.setEnabled(supported);
|
||||
if (supported) {
|
||||
final boolean isEnabled = bluetoothA2dp.getOptionalCodecsEnabled(activeDevice)
|
||||
final boolean isEnabled = bluetoothA2dp.isOptionalCodecsEnabled(activeDevice)
|
||||
== BluetoothA2dp.OPTIONAL_CODECS_PREF_ENABLED;
|
||||
((SwitchPreference) mPreference).setChecked(isEnabled);
|
||||
}
|
||||
@@ -84,11 +84,16 @@ public class BluetoothHDAudioPreferenceController extends AbstractBluetoothPrefe
|
||||
final int prefValue = enabled
|
||||
? BluetoothA2dp.OPTIONAL_CODECS_PREF_ENABLED
|
||||
: BluetoothA2dp.OPTIONAL_CODECS_PREF_DISABLED;
|
||||
bluetoothA2dp.setOptionalCodecsEnabled(bluetoothA2dp.getActiveDevice(), prefValue);
|
||||
BluetoothDevice activeDevice = bluetoothA2dp.getActiveDevice();
|
||||
if (activeDevice == null) {
|
||||
mPreference.setEnabled(false);
|
||||
return true;
|
||||
}
|
||||
bluetoothA2dp.setOptionalCodecsEnabled(activeDevice, prefValue);
|
||||
if (enabled) {
|
||||
bluetoothA2dp.enableOptionalCodecs(null); // Use current active device
|
||||
bluetoothA2dp.enableOptionalCodecs(activeDevice);
|
||||
} else {
|
||||
bluetoothA2dp.disableOptionalCodecs(null); // Use current active device
|
||||
bluetoothA2dp.disableOptionalCodecs(activeDevice);
|
||||
}
|
||||
mCallback.onBluetoothHDAudioEnabled(enabled);
|
||||
return true;
|
||||
|
Reference in New Issue
Block a user