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/media/libaaudio/src/binding/AAudioStreamRequest.h b/media/libaaudio/src/binding/AAudioStreamRequest.h
index 31d3ea1..02341c8 100644
--- a/media/libaaudio/src/binding/AAudioStreamRequest.h
+++ b/media/libaaudio/src/binding/AAudioStreamRequest.h
@@ -23,6 +23,7 @@
#include <aaudio/StreamRequest.h>
#include "binding/AAudioStreamConfiguration.h"
+#include <android/media/permission/Identity.h>
namespace aaudio {
@@ -33,20 +34,12 @@
// Construct based on a parcelable representation.
explicit AAudioStreamRequest(const StreamRequest& parcelable);
- uid_t getUserId() const {
- return mUserId;
+ const android::media::permission::Identity &getIdentity() const {
+ return mIdentity;
}
- void setUserId(uid_t userId) {
- mUserId = userId;
- }
-
- pid_t getProcessId() const {
- return mProcessId;
- }
-
- void setProcessId(pid_t processId) {
- mProcessId = processId;
+ void setIdentity(const android::media::permission::Identity &identity) {
+ mIdentity = identity;
}
bool isSharingModeMatchRequired() const {
@@ -82,8 +75,7 @@
private:
AAudioStreamConfiguration mConfiguration;
- uid_t mUserId = (uid_t) -1;
- pid_t mProcessId = (pid_t) -1;
+ android::media::permission::Identity mIdentity;
bool mSharingModeMatchRequired = false;
bool mInService = false; // Stream opened by AAudioservice
};