aaudio: disable exclusive mode after steal
Prevent a process that had its exclusive stream stolen
from obtaining another exclusive stream.
This can prevent a collision between two processes after
they both try to open EXCLUSIVE streams after
a DISCONNECT event.
Bug: 157777324
Test: adb shell test_steal_exclusive -r0 -d100
Change-Id: I0fe12be95a8fbd05ed03f10796e1ca716025c885
diff --git a/services/oboeservice/AAudioService.cpp b/services/oboeservice/AAudioService.cpp
index 82b12d6..22cdb35 100644
--- a/services/oboeservice/AAudioService.cpp
+++ b/services/oboeservice/AAudioService.cpp
@@ -117,7 +117,8 @@
return AAUDIO_ERROR_ILLEGAL_ARGUMENT;
}
- if (sharingMode == AAUDIO_SHARING_MODE_EXCLUSIVE) {
+ if (sharingMode == AAUDIO_SHARING_MODE_EXCLUSIVE
+ && AAudioClientTracker::getInstance().isExclusiveEnabled(request.getProcessId())) {
// only trust audioserver for in service indication
bool inService = false;
if (isCallerInService()) {