Add preference group for saved devcies.

Currently it only contains bluetooth devices.

Bug: 3240835
Test: RunSettingsRoboTests
Change-Id: Ief102e7174a4c4610dbda6b728419b303ff928f9
This commit is contained in:
jackqdyulei
2017-11-21 10:44:21 -08:00
parent d5fff3645a
commit aec5543841
8 changed files with 299 additions and 16 deletions

View File

@@ -51,16 +51,8 @@ public class ConnectedBluetoothDeviceUpdater extends BluetoothDeviceUpdater {
}
@Override
public void update(CachedBluetoothDevice cachedDevice) {
public boolean isFilterMatched(CachedBluetoothDevice cachedDevice) {
final BluetoothDevice device = cachedDevice.getDevice();
final boolean filterMatch =
device.getBondState() == BluetoothDevice.BOND_BONDED && device.isConnected();
if (filterMatch) {
// Add the preference if it is new one
addPreference(cachedDevice);
} else {
removePreference(cachedDevice);
}
return device.getBondState() == BluetoothDevice.BOND_BONDED && device.isConnected();
}
}