Merge "AudioDeviceInventory: better error handling in clearDevicesRole" into udc-dev

This commit is contained in:
Treehugger Robot
2023-05-12 16:02:08 +00:00
committed by Android (Google) Code Review

View File

@@ -1100,7 +1100,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 clear a role for a device that wasn't set
return AudioSystem.BAD_VALUE;
} }
final int status = asi.deviceRoleAction(useCase, role, null); final int status = asi.deviceRoleAction(useCase, role, null);
if (status == AudioSystem.SUCCESS) { if (status == AudioSystem.SUCCESS) {