Show only 1 entry for hearing aid devices without killing the activity.

This CL tries to detect Bluetooth hearing aid devices and tries to
combine the entry of the hearing aids with the same HiSyncIds and
show only 1 entry for each pair in the connected devices list.

This CL also shows 2 battery status in the device details page.

This change shows the combined entry after a user returns to the
settings activity after pressing the back button or somehow
without killing it. It also combines the entries just after pairing.

Test: RunSettingsRoboTests
Bug: 74204427

Change-Id: I47fb0bdd96b1cc972d88a4aef85d0113985d63bb
This commit is contained in:
Isha Bobra
2018-02-08 16:09:39 -08:00
committed by Stanley Tng
parent 6baefa4b51
commit 35e217f91f
9 changed files with 88 additions and 7 deletions

View File

@@ -106,6 +106,16 @@ public class BluetoothDeviceUpdaterTest {
assertThat(mBluetoothDeviceUpdater.mPreferenceMap.containsKey(mBluetoothDevice)).isFalse();
}
@Test
public void testOnDeviceDeleted_deviceExists_removePreference() {
mBluetoothDeviceUpdater.mPreferenceMap.put(mBluetoothDevice, mPreference);
mBluetoothDeviceUpdater.onDeviceDeleted(mCachedBluetoothDevice);
verify(mDevicePreferenceCallback).onDeviceRemoved(mPreference);
assertThat(mBluetoothDeviceUpdater.mPreferenceMap.containsKey(mBluetoothDevice)).isFalse();
}
@Test
public void testRemovePreference_deviceNotExist_doNothing() {
mBluetoothDeviceUpdater.removePreference(mCachedBluetoothDevice);