Merge "Removed getActiveDevice call to BluetoothProfile"

This commit is contained in:
Etienne Ruffieux
2022-02-03 17:35:35 +00:00
committed by Gerrit Code Review

View File

@@ -223,7 +223,7 @@ public class A2dpProfile implements LocalBluetoothProfile {
} }
public boolean supportsHighQualityAudio(BluetoothDevice device) { public boolean supportsHighQualityAudio(BluetoothDevice device) {
BluetoothDevice bluetoothDevice = (device != null) ? device : mService.getActiveDevice(); BluetoothDevice bluetoothDevice = (device != null) ? device : getActiveDevice();
if (bluetoothDevice == null) { if (bluetoothDevice == null) {
return false; return false;
} }
@@ -236,7 +236,7 @@ public class A2dpProfile implements LocalBluetoothProfile {
*/ */
@RequiresApi(Build.VERSION_CODES.TIRAMISU) @RequiresApi(Build.VERSION_CODES.TIRAMISU)
public boolean isHighQualityAudioEnabled(BluetoothDevice device) { public boolean isHighQualityAudioEnabled(BluetoothDevice device) {
BluetoothDevice bluetoothDevice = (device != null) ? device : mService.getActiveDevice(); BluetoothDevice bluetoothDevice = (device != null) ? device : getActiveDevice();
if (bluetoothDevice == null) { if (bluetoothDevice == null) {
return false; return false;
} }
@@ -262,7 +262,7 @@ public class A2dpProfile implements LocalBluetoothProfile {
} }
public void setHighQualityAudioEnabled(BluetoothDevice device, boolean enabled) { public void setHighQualityAudioEnabled(BluetoothDevice device, boolean enabled) {
BluetoothDevice bluetoothDevice = (device != null) ? device : mService.getActiveDevice(); BluetoothDevice bluetoothDevice = (device != null) ? device : getActiveDevice();
if (bluetoothDevice == null) { if (bluetoothDevice == null) {
return; return;
} }
@@ -288,7 +288,7 @@ public class A2dpProfile implements LocalBluetoothProfile {
*/ */
@RequiresApi(Build.VERSION_CODES.TIRAMISU) @RequiresApi(Build.VERSION_CODES.TIRAMISU)
public String getHighQualityAudioOptionLabel(BluetoothDevice device) { public String getHighQualityAudioOptionLabel(BluetoothDevice device) {
BluetoothDevice bluetoothDevice = (device != null) ? device : mService.getActiveDevice(); BluetoothDevice bluetoothDevice = (device != null) ? device : getActiveDevice();
int unknownCodecId = R.string.bluetooth_profile_a2dp_high_quality_unknown_codec; int unknownCodecId = R.string.bluetooth_profile_a2dp_high_quality_unknown_codec;
if (bluetoothDevice == null || !supportsHighQualityAudio(device) if (bluetoothDevice == null || !supportsHighQualityAudio(device)
|| getConnectionStatus(device) != BluetoothProfile.STATE_CONNECTED) { || getConnectionStatus(device) != BluetoothProfile.STATE_CONNECTED) {