Merge "Merge Android R"
diff --git a/src/java/com/android/server/sip/SipService.java b/src/java/com/android/server/sip/SipService.java
index 7c6daf8..ca91943 100644
--- a/src/java/com/android/server/sip/SipService.java
+++ b/src/java/com/android/server/sip/SipService.java
@@ -472,8 +472,8 @@
         mContext.enforceCallingOrSelfPermission(
                 android.Manifest.permission.USE_SIP, message);
 
-        return mAppOps.noteOp(AppOpsManager.OP_USE_SIP, Binder.getCallingUid(),
-                packageName) == AppOpsManager.MODE_ALLOWED;
+        return mAppOps.noteOp(AppOpsManager.OPSTR_USE_SIP, Binder.getCallingUid(),
+                packageName, null, message) == AppOpsManager.MODE_ALLOWED;
     }
 
     private class SipSessionGroupExt extends SipSessionAdapter {
diff --git a/src/jni/rtp/Android.bp b/src/jni/rtp/Android.bp
index c938224..b6c8588 100644
--- a/src/jni/rtp/Android.bp
+++ b/src/jni/rtp/Android.bp
@@ -28,6 +28,7 @@
     ],
     header_libs: [
         "libmedia_headers",
+        "libmediametrics_headers",
     ],
 
     shared_libs: [
diff --git a/src/jni/rtp/AudioGroup.cpp b/src/jni/rtp/AudioGroup.cpp
index 64e50f8..5f9cae8 100644
--- a/src/jni/rtp/AudioGroup.cpp
+++ b/src/jni/rtp/AudioGroup.cpp
@@ -819,6 +819,10 @@
     // Initialize AudioTrack and AudioRecord.
     sp<AudioTrack> track = new AudioTrack();
     sp<AudioRecord> record = new AudioRecord(mGroup->mOpPackageName);
+    // Set caller name so it can be logged in destructor.
+    // MediaMetricsConstants.h: AMEDIAMETRICS_PROP_CALLERNAME_VALUE_RTP
+    track->setCallerName("rtp");
+    record->setCallerName("rtp");
     if (track->set(AUDIO_STREAM_VOICE_CALL, sampleRate, AUDIO_FORMAT_PCM_16_BIT,
                 AUDIO_CHANNEL_OUT_MONO, output, AUDIO_OUTPUT_FLAG_NONE, NULL /*callback_t*/,
                 NULL /*user*/, 0 /*notificationFrames*/, 0 /*sharedBuffer*/,