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

@@ -84,7 +84,7 @@ public abstract class AbstractBluetoothDialogPreferenceController extends
}
writeConfigurationValues(index);
final BluetoothCodecConfig codecConfig = mBluetoothA2dpConfigStore.createCodecConfig();
BluetoothDevice activeDevice = mBluetoothA2dp.getActiveDevice();
BluetoothDevice activeDevice = getA2dpActiveDevice();
if (activeDevice != null) {
bluetoothA2dp.setCodecConfigPreference(activeDevice, codecConfig);
}
@@ -153,7 +153,7 @@ public abstract class AbstractBluetoothDialogPreferenceController extends
if (bluetoothA2dp == null) {
return null;
}
BluetoothDevice activeDevice = bluetoothA2dp.getActiveDevice();
BluetoothDevice activeDevice = getA2dpActiveDevice();
if (activeDevice == null) {
Log.d(TAG, "Unable to get current codec config. No active device.");
return null;
@@ -178,7 +178,7 @@ public abstract class AbstractBluetoothDialogPreferenceController extends
return null;
}
BluetoothDevice bluetoothDevice =
(device != null) ? device : bluetoothA2dp.getActiveDevice();
(device != null) ? device : getA2dpActiveDevice();
if (bluetoothDevice == null) {
return null;
}
@@ -195,7 +195,7 @@ public abstract class AbstractBluetoothDialogPreferenceController extends
* @return {@link BluetoothCodecConfig}.
*/
protected BluetoothCodecConfig getSelectableByCodecType(int codecTypeValue) {
BluetoothDevice activeDevice = mBluetoothA2dp.getActiveDevice();
BluetoothDevice activeDevice = getA2dpActiveDevice();
if (activeDevice == null) {
Log.d(TAG, "Unable to get selectable config. No active device.");
return null;