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:
@@ -59,25 +59,6 @@ public class AvailableMediaBluetoothDeviceUpdater extends BluetoothDeviceUpdater
|
||||
forceUpdate();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onProfileConnectionStateChanged(CachedBluetoothDevice cachedDevice, int state,
|
||||
int bluetoothProfile) {
|
||||
if (DBG) {
|
||||
Log.d(TAG, "onProfileConnectionStateChanged() device: " +
|
||||
cachedDevice.getName() + ", state: " + state + ", bluetoothProfile: "
|
||||
+ bluetoothProfile);
|
||||
}
|
||||
if (state == BluetoothProfile.STATE_CONNECTED) {
|
||||
if (isFilterMatched(cachedDevice)) {
|
||||
addPreference(cachedDevice);
|
||||
} else {
|
||||
removePreference(cachedDevice);
|
||||
}
|
||||
} else if (state == BluetoothProfile.STATE_DISCONNECTED) {
|
||||
removePreference(cachedDevice);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isFilterMatched(CachedBluetoothDevice cachedDevice) {
|
||||
final int audioMode = mAudioManager.getMode();
|
||||
|
Reference in New Issue
Block a user