[Audiosharing] Avoid dup volume control entries

Test: atest
Bug: 402384034
Flag: com.android.settingslib.flags.enable_le_audio_sharing
Change-Id: I1c975a39106d50746c692586bf682301dd299f40
This commit is contained in:
Yiyi Shen
2025-03-17 11:48:36 +08:00
parent b96eb497da
commit 049835b568
9 changed files with 259 additions and 54 deletions

View File

@@ -277,7 +277,10 @@ public abstract class BluetoothDeviceUpdater implements BluetoothCallback,
}
}
private void removePreference(BluetoothDevice device) {
/**
* Remove the {@link Preference} that represents the {@code device}
*/
protected void removePreference(BluetoothDevice device) {
if (mPreferenceMap.containsKey(device)) {
if (mPreferenceMap.get(device) instanceof BluetoothDevicePreference preference) {
BluetoothDevice prefDevice = preference.getBluetoothDevice().getDevice();
@@ -362,7 +365,7 @@ public abstract class BluetoothDeviceUpdater implements BluetoothCallback,
return mLocalManager.getCachedDeviceManager().getCachedDevicesCopy().contains(cachedDevice);
}
private boolean isDeviceOfMapInCachedDevicesList(BluetoothDevice inputBluetoothDevice) {
protected boolean isDeviceOfMapInCachedDevicesList(BluetoothDevice inputBluetoothDevice) {
Collection<CachedBluetoothDevice> cachedDevices =
mLocalManager.getCachedDeviceManager().getCachedDevicesCopy();
if (cachedDevices == null || cachedDevices.isEmpty()) {