Disable the Bt categorization list when audio type is known
The audio framework can deduce the type with the help of the BluetoothDevice metadata API. In case this is known we will grey out the list with the manual selection of the audio device type. Test: adb shell device_config put media_audio android.media.audio.automatic_bt_device_type true Test: atest BluetoothDetailsAudioDeviceTypeControllerTest Bug: 302323921 Change-Id: Ia2cab27f2dce5493aa4326333699b5908d8a09ee
This commit is contained in:
@@ -18,6 +18,7 @@ package com.android.settings.bluetooth;
|
||||
|
||||
import static android.bluetooth.BluetoothDevice.DEVICE_TYPE_LE;
|
||||
import static android.media.AudioManager.AUDIO_DEVICE_CATEGORY_SPEAKER;
|
||||
import static android.media.audio.Flags.automaticBtDeviceType;
|
||||
|
||||
import static com.google.common.truth.Truth.assertThat;
|
||||
|
||||
@@ -97,8 +98,12 @@ public class BluetoothDetailsAudioDeviceTypeControllerTest extends
|
||||
@Test
|
||||
public void createAudioDeviceTypePreference_btDeviceIsCategorized_checkSelection() {
|
||||
int deviceType = AUDIO_DEVICE_CATEGORY_SPEAKER;
|
||||
when(mAudioManager.getBluetoothAudioDeviceCategory(MAC_ADDRESS, /*isBle=*/true)).thenReturn(
|
||||
deviceType);
|
||||
if (automaticBtDeviceType()) {
|
||||
when(mAudioManager.getBluetoothAudioDeviceCategory(MAC_ADDRESS)).thenReturn(deviceType);
|
||||
} else {
|
||||
when(mAudioManager.getBluetoothAudioDeviceCategory_legacy(MAC_ADDRESS, /*isBle=*/
|
||||
true)).thenReturn(deviceType);
|
||||
}
|
||||
|
||||
mController.createAudioDeviceTypePreference(mContext);
|
||||
mAudioDeviceTypePref = mController.getAudioDeviceTypePreference();
|
||||
@@ -113,7 +118,12 @@ public class BluetoothDetailsAudioDeviceTypeControllerTest extends
|
||||
|
||||
mController.onPreferenceChange(mAudioDeviceTypePref, Integer.toString(deviceType));
|
||||
|
||||
verify(mAudioManager).setBluetoothAudioDeviceCategory(eq(MAC_ADDRESS), eq(true),
|
||||
eq(AUDIO_DEVICE_CATEGORY_SPEAKER));
|
||||
if (automaticBtDeviceType()) {
|
||||
verify(mAudioManager).setBluetoothAudioDeviceCategory(eq(MAC_ADDRESS),
|
||||
eq(AUDIO_DEVICE_CATEGORY_SPEAKER));
|
||||
} else {
|
||||
verify(mAudioManager).setBluetoothAudioDeviceCategory_legacy(eq(MAC_ADDRESS), eq(true),
|
||||
eq(AUDIO_DEVICE_CATEGORY_SPEAKER));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user