[Temp bonding] Hide temp bond devices from existing lists
The metadata change listener will be added in later changes. Test: atest: com.android.settings.bluetooth.ConnectedBluetoothDeviceUpdaterTest Bug: 362859132 Flag: com.android.settingslib.flags.enable_temporary_bond_devices_ui Change-Id: I3ba5a978ce66e748fc1a7666fa4f6e84144c2c54
This commit is contained in:
@@ -68,6 +68,9 @@ public class ConnectedBluetoothDeviceUpdaterTest {
|
||||
|
||||
private static final String MAC_ADDRESS = "04:52:C7:0B:D8:3C";
|
||||
private static final String TEST_EXCLUSIVE_MANAGER = "com.test.manager";
|
||||
private static final String TEMP_BOND_METADATA =
|
||||
"<TEMP_BOND_TYPE>le_audio_sharing</TEMP_BOND_TYPE>";
|
||||
private static final int METADATA_FAST_PAIR_CUSTOMIZED_FIELDS = 25;
|
||||
|
||||
@Rule
|
||||
public final CheckFlagsRule mCheckFlagsRule = DeviceFlagsValueProvider.createCheckFlagsRule();
|
||||
@@ -405,6 +408,22 @@ public class ConnectedBluetoothDeviceUpdaterTest {
|
||||
verify(mBluetoothDeviceUpdater, never()).addPreference(mCachedBluetoothDevice);
|
||||
}
|
||||
|
||||
@Test
|
||||
@RequiresFlagsEnabled(Flags.FLAG_ENABLE_TEMPORARY_BOND_DEVICES_UI)
|
||||
public void update_temporaryBondDevice_removePreference() {
|
||||
setUpDeviceUpdaterWithAudioMode(AudioManager.MODE_NORMAL);
|
||||
when(mBluetoothDeviceUpdater
|
||||
.isDeviceConnected(any(CachedBluetoothDevice.class))).thenReturn(true);
|
||||
when(mCachedBluetoothDevice.isConnectedHfpDevice()).thenReturn(true);
|
||||
when(mBluetoothDevice.getMetadata(METADATA_FAST_PAIR_CUSTOMIZED_FIELDS))
|
||||
.thenReturn(TEMP_BOND_METADATA.getBytes());
|
||||
|
||||
mBluetoothDeviceUpdater.update(mCachedBluetoothDevice);
|
||||
|
||||
verify(mBluetoothDeviceUpdater).removePreference(mCachedBluetoothDevice);
|
||||
verify(mBluetoothDeviceUpdater, never()).addPreference(mCachedBluetoothDevice);
|
||||
}
|
||||
|
||||
private void setUpDeviceUpdaterWithAudioMode(int audioMode) {
|
||||
mAudioManager.setMode(audioMode);
|
||||
mBluetoothDeviceUpdater = spy(new ConnectedBluetoothDeviceUpdater(mContext,
|
||||
|
Reference in New Issue
Block a user