The UI only shows the active LE device
At the media device, it only shows the active LE device which is connected. Bug: 232892046 Test: make RunSettingsRoboTests ROBOTEST_FILTER=AvailableMediaBluetoothDeviceUpdaterTest make RunSettingsRoboTests ROBOTEST_FILTER=ConnectedBluetoothDeviceUpdaterTest make RunSettingsRoboTests ROBOTEST_FILTER=SavedBluetoothDeviceUpdaterTest Change-Id: Iac661206def4d43bc40ab9bb1938f084926899c2
This commit is contained in:
@@ -86,6 +86,7 @@ public class AvailableMediaBluetoothDeviceUpdaterTest {
|
||||
mShadowCachedBluetoothDeviceManager = Shadow.extract(
|
||||
Utils.getLocalBtManager(mContext).getCachedDeviceManager());
|
||||
mCachedDevices = new ArrayList<>();
|
||||
mCachedDevices.add(mCachedBluetoothDevice);
|
||||
mShadowCachedBluetoothDeviceManager.setCachedDevicesCopy(mCachedDevices);
|
||||
Pair<Drawable, String> pairs = new Pair<>(mDrawable, "fake_device");
|
||||
|
||||
@@ -109,7 +110,6 @@ public class AvailableMediaBluetoothDeviceUpdaterTest {
|
||||
when(mBluetoothDeviceUpdater.
|
||||
isDeviceConnected(any(CachedBluetoothDevice.class))).thenReturn(true);
|
||||
when(mCachedBluetoothDevice.isConnectedHfpDevice()).thenReturn(true);
|
||||
mCachedDevices.add(mCachedBluetoothDevice);
|
||||
|
||||
mBluetoothDeviceUpdater.onAudioModeChanged();
|
||||
|
||||
@@ -122,7 +122,6 @@ public class AvailableMediaBluetoothDeviceUpdaterTest {
|
||||
when(mBluetoothDeviceUpdater.
|
||||
isDeviceConnected(any(CachedBluetoothDevice.class))).thenReturn(true);
|
||||
when(mCachedBluetoothDevice.isConnectedHfpDevice()).thenReturn(true);
|
||||
mCachedDevices.add(mCachedBluetoothDevice);
|
||||
|
||||
mBluetoothDeviceUpdater.onAudioModeChanged();
|
||||
|
||||
@@ -135,7 +134,6 @@ public class AvailableMediaBluetoothDeviceUpdaterTest {
|
||||
when(mBluetoothDeviceUpdater.
|
||||
isDeviceConnected(any(CachedBluetoothDevice.class))).thenReturn(true);
|
||||
when(mCachedBluetoothDevice.isConnectedA2dpDevice()).thenReturn(true);
|
||||
mCachedDevices.add(mCachedBluetoothDevice);
|
||||
|
||||
mBluetoothDeviceUpdater.onAudioModeChanged();
|
||||
|
||||
@@ -148,7 +146,6 @@ public class AvailableMediaBluetoothDeviceUpdaterTest {
|
||||
when(mBluetoothDeviceUpdater.
|
||||
isDeviceConnected(any(CachedBluetoothDevice.class))).thenReturn(true);
|
||||
when(mCachedBluetoothDevice.isConnectedA2dpDevice()).thenReturn(true);
|
||||
mCachedDevices.add(mCachedBluetoothDevice);
|
||||
|
||||
mBluetoothDeviceUpdater.onAudioModeChanged();
|
||||
|
||||
@@ -260,6 +257,35 @@ public class AvailableMediaBluetoothDeviceUpdaterTest {
|
||||
verify(mBluetoothDeviceUpdater).addPreference(mCachedBluetoothDevice);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void
|
||||
onProfileConnectionStateChanged_deviceIsNotInList_notInCall_invokesRemovePreference() {
|
||||
mAudioManager.setMode(AudioManager.MODE_NORMAL);
|
||||
when(mBluetoothDeviceUpdater
|
||||
.isDeviceConnected(any(CachedBluetoothDevice.class))).thenReturn(true);
|
||||
when(mCachedBluetoothDevice.isConnectedLeAudioDevice()).thenReturn(true);
|
||||
mCachedDevices.clear();
|
||||
|
||||
mBluetoothDeviceUpdater.onProfileConnectionStateChanged(mCachedBluetoothDevice,
|
||||
BluetoothProfile.STATE_CONNECTED, BluetoothProfile.LE_AUDIO);
|
||||
|
||||
verify(mBluetoothDeviceUpdater).removePreference(mCachedBluetoothDevice);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void onProfileConnectionStateChanged_deviceIsNotInList_inCall_invokesRemovePreference() {
|
||||
mAudioManager.setMode(AudioManager.MODE_IN_CALL);
|
||||
when(mBluetoothDeviceUpdater
|
||||
.isDeviceConnected(any(CachedBluetoothDevice.class))).thenReturn(true);
|
||||
when(mCachedBluetoothDevice.isConnectedLeAudioDevice()).thenReturn(true);
|
||||
mCachedDevices.clear();
|
||||
|
||||
mBluetoothDeviceUpdater.onProfileConnectionStateChanged(mCachedBluetoothDevice,
|
||||
BluetoothProfile.STATE_CONNECTED, BluetoothProfile.LE_AUDIO);
|
||||
|
||||
verify(mBluetoothDeviceUpdater).removePreference(mCachedBluetoothDevice);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void onProfileConnectionStateChanged_deviceDisconnected_removePreference() {
|
||||
mBluetoothDeviceUpdater.onProfileConnectionStateChanged(mCachedBluetoothDevice,
|
||||
|
Reference in New Issue
Block a user