Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f83103ed authored by Eric Laurent's avatar Eric Laurent
Browse files

AudioDeviceInventory: better error handling in clearDevicesRole

Return an error when no role has been set for a given device
to match the API documentation.

Test: atest AudioServiceHostTest#testPreferredDeviceRouting
Test: atet AudioServiceHostTest#testPreferredDeviceRoutingForCapturePres
Bug: 280929860
Change-Id: I462eb3a1ad0eb9d606279b6b62ce2cfb6b059b7f
parent e38a303d
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -1100,7 +1100,8 @@ public class AudioDeviceInventory {
        synchronized (rolesMap) {
            Pair<Integer, Integer> key = new Pair<>(useCase, role);
            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);
            if (status == AudioSystem.SUCCESS) {