Merge "AudioService: fix removeDeviceAsNonDefaultForStrategy regression" into udc-dev

This commit is contained in:
Jean-Michel Trivi
2023-05-05 18:12:55 +00:00
committed by Android (Google) Code Review

View File

@@ -1031,7 +1031,8 @@ public class AudioDeviceInventory {
synchronized (rolesMap) { synchronized (rolesMap) {
Pair<Integer, Integer> key = new Pair<>(useCase, role); Pair<Integer, Integer> key = new Pair<>(useCase, role);
if (!rolesMap.containsKey(key)) { if (!rolesMap.containsKey(key)) {
return AudioSystem.SUCCESS; // trying to remove a role for a device that wasn't set
return AudioSystem.BAD_VALUE;
} }
List<AudioDeviceAttributes> roleDevices = rolesMap.get(key); List<AudioDeviceAttributes> roleDevices = rolesMap.get(key);
List<AudioDeviceAttributes> appliedDevices = new ArrayList<>(); List<AudioDeviceAttributes> appliedDevices = new ArrayList<>();