summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Eric Laurent <elaurent@google.com> 2023-06-15 20:00:17 +0200
committer Eric Laurent <elaurent@google.com> 2023-06-15 20:00:17 +0200
commit75f1cff15d065747329a01b7d17b055a66fe0255 (patch)
tree768900e4bc7cee7f7f4fb98d704cfa8cbe3fc521
parentb4b4f2042d2b5dead672703d214dd7d8d1f39325 (diff)
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
-rw-r--r--services/core/java/com/android/server/audio/AudioDeviceInventory.java7
1 files changed, 6 insertions, 1 deletions
diff --git a/services/core/java/com/android/server/audio/AudioDeviceInventory.java b/services/core/java/com/android/server/audio/AudioDeviceInventory.java
index ec85d577a8e7..0c7f11f98809 100644
--- a/services/core/java/com/android/server/audio/AudioDeviceInventory.java
+++ b/services/core/java/com/android/server/audio/AudioDeviceInventory.java
@@ -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();
}