Switch media fw permissions checks to AttributionSource (wilhelm)

Attribution source is the abstraction to capture the data
flows for private data across apps. Checking permissions
for an attribution source does this for all apps in the
chain that would receive the data as well as the relevant
app ops are checked/noted/started as needed.

bug: 158792096

Test: atest CtsMediaTestCases
      atest CtsPermissionTestCases
      atest CtsPermission2TestCases
      atest CtsPermission3TestCases
      atest CtsPermission4TestCases
      atest CtsPermission5TestCases

Merged-In: I2061d398e8a96fb707ddf42c0412db6e7c68fe7f

Change-Id: I2061d398e8a96fb707ddf42c0412db6e7c68fe7f
diff --git a/src/Android.bp b/src/Android.bp
index 9a41708..9b22260 100644
--- a/src/Android.bp
+++ b/src/Android.bp
@@ -227,6 +227,7 @@
     ],
 
     shared_libs: [
+        "framework-permission-aidl-cpp",
         "liblog",
         "libutils",
         "libmedia",
@@ -242,7 +243,6 @@
         "libdl",
         "libandroid_runtime",
         "libstagefright_http_support",
-        "media_permission-aidl-cpp",
     ],
 
     include_dirs: [
diff --git a/src/android/AudioRecorder_to_android.cpp b/src/android/AudioRecorder_to_android.cpp
index e33b9c6..3d4ad75 100644
--- a/src/android/AudioRecorder_to_android.cpp
+++ b/src/android/AudioRecorder_to_android.cpp
@@ -29,7 +29,7 @@
 #define KEY_RECORDING_PRESET_PARAMSIZE  sizeof(SLuint32)
 #define KEY_PERFORMANCE_MODE_PARAMSIZE  sizeof(SLuint32)
 
-using android::media::permission::Identity;
+using android::content::AttributionSourceState;
 
 //-----------------------------------------------------------------------------
 // Internal utility functions
@@ -695,7 +695,7 @@
             sampleRate,            // sample rate in Hertz
             sles_to_android_sampleFormat(df_pcm),               // format
             channelMask,           // channel mask
-            Identity(),            // client identity (will be filled in later)
+            AttributionSourceState(), // client attribution source (will be filled in later)
             0,                     // frameCount
             audioRecorder_callback,// callback_t
             (void*)ar,             // user, callback data, here the AudioRecorder
diff --git a/src/android/android_Effect.cpp b/src/android/android_Effect.cpp
index 0f14314..a152f4a 100644
--- a/src/android/android_Effect.cpp
+++ b/src/android/android_Effect.cpp
@@ -32,7 +32,7 @@
 
 #include <system/audio.h>
 
-using android::media::permission::Identity;
+using android::content::AttributionSourceState;
 
 static const int EQUALIZER_PARAM_SIZE_MAX = sizeof(effect_param_t) + 2 * sizeof(int32_t)
         + EFFECT_STRING_LEN_MAX;
@@ -667,7 +667,7 @@
         const effect_uuid_t *type) {
     //SL_LOGV("android_fx_initEffectObj on session %d", sessionId);
 
-    effect = new android::AudioEffect(Identity());
+    effect = new android::AudioEffect(AttributionSourceState());
     effect->set(type, EFFECT_UUID_NULL,
             0,// priority
             0,// effect callback
@@ -808,7 +808,7 @@
     }
 
     // create new effect
-    android::sp<android::AudioEffect> pFx = new android::AudioEffect(Identity());
+    android::sp<android::AudioEffect> pFx = new android::AudioEffect(AttributionSourceState());
     pFx->set(NULL, // not using type to create effect
             (const effect_uuid_t*)pUuid,
             0,// priority