Replacing getActiveDevice by btAdapter.getActiveDevices()

BluetoothProfile.getActiveDevice() is hidden, packages
should call BluetoothAdapter.getActiveDevices(profile)
instead.

Tag: #feature
Bug: 200202780
Test: build
Change-Id: Id18658de82a7e8292942951a3832a36465a69da3
This commit is contained in:
Etienne Ruffieux
2022-02-01 17:08:15 +00:00
parent dac3f891ae
commit 9692c59d3a
13 changed files with 119 additions and 30 deletions

View File

@@ -52,7 +52,7 @@ public class BluetoothHDAudioPreferenceController extends AbstractBluetoothPrefe
mPreference.setEnabled(false);
return;
}
final BluetoothDevice activeDevice = bluetoothA2dp.getActiveDevice();
final BluetoothDevice activeDevice = getA2dpActiveDevice();
if (activeDevice == null) {
Log.e(TAG, "Active device is null. To disable HD audio button");
mPreference.setEnabled(false);
@@ -84,7 +84,7 @@ public class BluetoothHDAudioPreferenceController extends AbstractBluetoothPrefe
final int prefValue = enabled
? BluetoothA2dp.OPTIONAL_CODECS_PREF_ENABLED
: BluetoothA2dp.OPTIONAL_CODECS_PREF_DISABLED;
BluetoothDevice activeDevice = bluetoothA2dp.getActiveDevice();
BluetoothDevice activeDevice = getA2dpActiveDevice();
if (activeDevice == null) {
mPreference.setEnabled(false);
return true;