AudioDeviceInventory: fix purge of device role cache.

Commit ace96019 which modifies purgeRoles() method compares
device address strings with == but it should use equals() operator
instead.

Bug: 282907547
Test: repro steps in the bug.
Change-Id: I302e470bd6a0fbcd288508d3e6bf394087de9361
This commit is contained in:
Eric Laurent
2023-06-15 20:00:17 +02:00
parent b4b4f2042d
commit 75f1cff15d

View File

@@ -1199,11 +1199,16 @@ public class AudioDeviceInventory {
AudioDeviceInfo device = Stream.of(connectedDevices)
.filter(d -> d.getInternalType() == ada.getInternalType())
.filter(d -> (!AudioSystem.isBluetoothDevice(d.getInternalType())
|| (d.getAddress() == ada.getAddress())))
|| (d.getAddress().equals(ada.getAddress()))))
.findFirst()
.orElse(null);
if (device == null) {
if (AudioService.DEBUG_DEVICES) {
Slog.i(TAG, "purgeRoles() removing device: " + ada.toString()
+ ", for strategy: " + keyRole.first
+ " and role: " + keyRole.second);
}
asi.deviceRoleAction(keyRole.first, keyRole.second, Arrays.asList(ada));
itDev.remove();
}