Add attributionTag to audio-recordings
... by replacing packageName/uid/pid by the Identity class.
This allows us to track which parts of the app trigger audio-recordings.
90% of the code is just sending around the additional parameters.
This adds it for the Java and native API.
Test: atest CtsAppOpsTestCases
CtsNativeMediaAAudioTestCases
Fixes: 160150145
Change-Id: Ibd7b884f7fcd4668a4e27f997e59cfc3217a9e89
diff --git a/services/oboeservice/AAudioEndpointManager.cpp b/services/oboeservice/AAudioEndpointManager.cpp
index 407f6d5..3224cfc 100644
--- a/services/oboeservice/AAudioEndpointManager.cpp
+++ b/services/oboeservice/AAudioEndpointManager.cpp
@@ -24,6 +24,7 @@
#include <mutex>
#include <sstream>
#include <utility/AAudioUtilities.h>
+#include <media/AidlConversion.h>
#include "AAudioClientTracker.h"
#include "AAudioEndpointManager.h"
@@ -182,7 +183,9 @@
// and START calls. This will help preserve app compatibility.
// An app can avoid having this happen by closing their streams when
// the app is paused.
- AAudioClientTracker::getInstance().setExclusiveEnabled(request.getProcessId(), false);
+ pid_t pid = VALUE_OR_FATAL(
+ aidl2legacy_int32_t_pid_t(request.getIdentity().pid));
+ AAudioClientTracker::getInstance().setExclusiveEnabled(pid, false);
endpointToSteal = endpoint; // return it to caller
}
return nullptr;