Update the LE audio device into the media device category

Bug: 178981521
Test: make RunSettingsRoboTests
ROBOTEST_FILTER=AvailableMediaBluetoothDeviceUpdater
Test: make RunSettingsRoboTests
ROBOTEST_FILTER=ConnectedBluetoothDeviceUpdater

Change-Id: I094ba6beb66fdebd7f3ef0a7c12bbed0e5b870e8
Merged-In: I094ba6beb66fdebd7f3ef0a7c12bbed0e5b870e8
This commit is contained in:
Alice Kuo
2021-03-03 17:08:36 +08:00
parent 629611a43e
commit 3487843496
4 changed files with 59 additions and 4 deletions

View File

@@ -234,6 +234,33 @@ public class ConnectedBluetoothDeviceUpdaterTest {
verify(mBluetoothDeviceUpdater).removePreference(mCachedBluetoothDevice);
}
@Test
public void onProfileConnectionStateChanged_leAudioDeviceConnected_inCall_removePreference() {
mAudioManager.setMode(AudioManager.MODE_IN_CALL);
when(mBluetoothDeviceUpdater
.isDeviceConnected(any(CachedBluetoothDevice.class))).thenReturn(true);
when(mCachedBluetoothDevice.isConnectedLeAudioDevice()).thenReturn(true);
mBluetoothDeviceUpdater.onProfileConnectionStateChanged(mCachedBluetoothDevice,
BluetoothProfile.STATE_CONNECTED, BluetoothProfile.LE_AUDIO);
verify(mBluetoothDeviceUpdater).removePreference(mCachedBluetoothDevice);
}
@Test
public void onProfileConnectionStateChanged_leAudioDeviceConnected_notInCall_removePreference()
{
mAudioManager.setMode(AudioManager.MODE_NORMAL);
when(mBluetoothDeviceUpdater
.isDeviceConnected(any(CachedBluetoothDevice.class))).thenReturn(true);
when(mCachedBluetoothDevice.isConnectedLeAudioDevice()).thenReturn(true);
mBluetoothDeviceUpdater.onProfileConnectionStateChanged(mCachedBluetoothDevice,
BluetoothProfile.STATE_CONNECTED, BluetoothProfile.LE_AUDIO);
verify(mBluetoothDeviceUpdater).removePreference(mCachedBluetoothDevice);
}
@Test
public void onProfileConnectionStateChanged_deviceDisconnected_removePreference() {
mBluetoothDeviceUpdater.onProfileConnectionStateChanged(mCachedBluetoothDevice,