Check the device is connected when receive onProfileConnectionStateChanged()

Use isFilterMatched() to decide the prefernce should be added
or removed when receive onProfileConnectionStateChanged()

Bug: 80161203
Test: make -j42 RunSettingsRoboTests
Change-Id: Icccdb9007b587d3f481a23856edd7b2f7c9b04e0
This commit is contained in:
hughchen
2018-07-31 16:09:17 +08:00
parent 75bafefa49
commit 70758584dc
5 changed files with 10 additions and 48 deletions

View File

@@ -48,16 +48,6 @@ public class SavedBluetoothDeviceUpdater extends BluetoothDeviceUpdater
super(fragment, devicePreferenceCallback, localBluetoothManager);
}
@Override
public void onProfileConnectionStateChanged(CachedBluetoothDevice cachedDevice, int state,
int bluetoothProfile) {
if (state == BluetoothProfile.STATE_CONNECTED) {
removePreference(cachedDevice);
} else if (state == BluetoothProfile.STATE_DISCONNECTED) {
addPreference(cachedDevice);
}
}
@Override
public boolean isFilterMatched(CachedBluetoothDevice cachedDevice) {
final BluetoothDevice device = cachedDevice.getDevice();