The UI only shows the active LE device

At the media device, it only shows the active LE device which is
connected.

Bug: 232892046
Test: make RunSettingsRoboTests ROBOTEST_FILTER=AvailableMediaBluetoothDeviceUpdaterTest
make RunSettingsRoboTests ROBOTEST_FILTER=ConnectedBluetoothDeviceUpdaterTest
make RunSettingsRoboTests ROBOTEST_FILTER=SavedBluetoothDeviceUpdaterTest

Change-Id: Iac661206def4d43bc40ab9bb1938f084926899c2
Merged-In: Iac661206def4d43bc40ab9bb1938f084926899c2
This commit is contained in:
SongFerngWang
2022-06-15 21:52:37 +08:00
parent 2b57ca5c98
commit 7f6fcce1d5
7 changed files with 114 additions and 11 deletions

View File

@@ -66,7 +66,7 @@ public class AvailableMediaBluetoothDeviceUpdater extends BluetoothDeviceUpdater
}
boolean isFilterMatched = false;
if (isDeviceConnected(cachedDevice)) {
if (isDeviceConnected(cachedDevice) && isDeviceInCachedDevicesList(cachedDevice)) {
if (DBG) {
Log.d(TAG, "isFilterMatched() current audio profile : " + currentAudioProfile);
}
@@ -74,6 +74,8 @@ public class AvailableMediaBluetoothDeviceUpdater extends BluetoothDeviceUpdater
// It would show in Available Devices group.
if (cachedDevice.isConnectedHearingAidDevice()
|| cachedDevice.isConnectedLeAudioDevice()) {
Log.d(TAG, "isFilterMatched() device : " +
cachedDevice.getName() + ", the profile is connected.");
return true;
}
// According to the current audio profile type,

View File

@@ -326,4 +326,8 @@ public abstract class BluetoothDeviceUpdater implements BluetoothCallback,
((BluetoothDevicePreference) preference).onPreferenceAttributesChanged();
}
}
protected boolean isDeviceInCachedDevicesList(CachedBluetoothDevice cachedDevice){
return mLocalManager.getCachedDeviceManager().getCachedDevicesCopy().contains(cachedDevice);
}
}

View File

@@ -66,7 +66,7 @@ public class ConnectedBluetoothDeviceUpdater extends BluetoothDeviceUpdater {
}
boolean isFilterMatched = false;
if (isDeviceConnected(cachedDevice)) {
if (isDeviceConnected(cachedDevice) && isDeviceInCachedDevicesList(cachedDevice)) {
if (DBG) {
Log.d(TAG, "isFilterMatched() current audio profile : " + currentAudioProfile);
}

View File

@@ -105,7 +105,8 @@ public class SavedBluetoothDeviceUpdater extends BluetoothDeviceUpdater
+ cachedDevice.isConnected());
}
return device.getBondState() == BluetoothDevice.BOND_BONDED
&& (mDisplayConnected || !device.isConnected());
&& (mDisplayConnected || (!device.isConnected() && isDeviceInCachedDevicesList(
cachedDevice)));
}
@Override