Merge "Fixing issue with adding existing connections which start in a conference." into sc-dev am: beb4dd05c2 am: 53c3b42ea6

Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/services/Telecomm/+/15113220

Change-Id: I68b445d669022d3ff4c5dd46f247103ff1a552f5
diff --git a/Android.bp b/Android.bp
index b7eb450..88cffb8 100644
--- a/Android.bp
+++ b/Android.bp
@@ -25,6 +25,9 @@
         ":Telecom-srcs",
         "proto/**/*.proto",
     ],
+    static_libs: [
+        "androidx.annotation_annotation",
+    ],
     resource_dirs: ["res"],
     proto: {
         type: "nano",
@@ -37,7 +40,6 @@
     optimize: {
         proguard_flags_files: ["proguard.flags"],
     },
-    defaults: ["SettingsLibDefaults"],
 }
 
 android_test {
diff --git a/TEST_MAPPING b/TEST_MAPPING
index 2e14650..9be1710 100644
--- a/TEST_MAPPING
+++ b/TEST_MAPPING
@@ -15,6 +15,46 @@
           "exclude-annotation": "androidx.test.filters.FlakyTest"
         }
       ]
+    },
+    {
+      "name": "CtsTelephonySdk28TestCases",
+      "options": [
+        {
+          "exclude-annotation": "androidx.test.filters.FlakyTest"
+        }
+      ]
+    },
+    {
+      "name": "CtsTelephony2TestCases",
+      "options": [
+        {
+          "exclude-annotation": "androidx.test.filters.FlakyTest"
+        }
+      ]
+    },
+    {
+      "name": "CtsTelephony3TestCases",
+      "options": [
+        {
+          "exclude-annotation": "androidx.test.filters.FlakyTest"
+        }
+      ]
+    },
+    {
+      "name": "CtsSimRestrictedApisTestCases",
+      "options": [
+        {
+          "exclude-annotation": "androidx.test.filters.FlakyTest"
+        }
+      ]
+    },
+    {
+      "name": "CtsTelephonyProviderTestCases",
+      "options": [
+        {
+          "exclude-annotation": "androidx.test.filters.FlakyTest"
+        }
+      ]
     }
   ],
   "presubmit-large": [
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 01bb88c..8d6e084 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -375,4 +375,6 @@
          blocking functionality (for test purposes).
          DO NOT TRANSLATE -->
     <string name="developer_enhanced_call_blocking" translatable="false">Enhanced Call Blocking</string>
+    <!-- Button label for generic cancel action [CHAR LIMIT=20] -->
+    <string name="cancel">Cancel</string>
 </resources>
diff --git a/src/com/android/server/telecom/Call.java b/src/com/android/server/telecom/Call.java
index 0218124..36d2db7 100644
--- a/src/com/android/server/telecom/Call.java
+++ b/src/com/android/server/telecom/Call.java
@@ -831,10 +831,10 @@
     }
 
     public void initAnalytics() {
-        initAnalytics(null);
+        initAnalytics(null, null);
     }
 
-    public void initAnalytics(String callingPackage) {
+    public void initAnalytics(String callingPackage, String extraCreationLogs) {
         int analyticsDirection;
         switch (mCallDirection) {
             case CALL_DIRECTION_OUTGOING:
@@ -850,7 +850,7 @@
         }
         mAnalytics = Analytics.initiateCallAnalytics(mId, analyticsDirection);
         mAnalytics.setCallIsEmergency(mIsEmergencyCall);
-        Log.addEvent(this, LogUtils.Events.CREATED, callingPackage);
+        Log.addEvent(this, LogUtils.Events.CREATED, callingPackage + ";" + extraCreationLogs);
     }
 
     public Analytics.CallInfo getAnalytics() {
diff --git a/src/com/android/server/telecom/CallAudioRouteStateMachine.java b/src/com/android/server/telecom/CallAudioRouteStateMachine.java
index e5a6ecc..7033a15 100644
--- a/src/com/android/server/telecom/CallAudioRouteStateMachine.java
+++ b/src/com/android/server/telecom/CallAudioRouteStateMachine.java
@@ -1678,8 +1678,8 @@
                     // may run as a separate user from the foreground user. If we
                     // used AudioManager directly, we would change mute for the system's
                     // user and not the current foreground, which we want to avoid.
-                    audio.setMicrophoneMute(
-                            mute, mContext.getOpPackageName(), getCurrentUserId());
+                    audio.setMicrophoneMute(mute, mContext.getOpPackageName(),
+                            getCurrentUserId(), mContext.getAttributionTag());
                 } catch (RemoteException e) {
                     Log.e(this, e, "Remote exception while toggling mute.");
                 }
diff --git a/src/com/android/server/telecom/CallsManager.java b/src/com/android/server/telecom/CallsManager.java
index ea45abb..e4922b0 100755
--- a/src/com/android/server/telecom/CallsManager.java
+++ b/src/com/android/server/telecom/CallsManager.java
@@ -1526,6 +1526,16 @@
         Bundle phoneAccountExtra = account != null ? account.getExtras() : null;
         boolean isSelfManaged = account != null && account.isSelfManaged();
 
+        StringBuffer creationLogs = new StringBuffer();
+        creationLogs.append("requestedAcct:");
+        if (requestedAccountHandle == null) {
+            creationLogs.append("none");
+        } else {
+            creationLogs.append(requestedAccountHandle);
+        }
+        creationLogs.append(", selfMgd:");
+        creationLogs.append(isSelfManaged);
+
         // Create a call with original handle. The handle may be changed when the call is attached
         // to a connection service, but in most cases will remain the same.
         if (call == null) {
@@ -1544,7 +1554,7 @@
                     isConference, /* isConference */
                     mClockProxy,
                     mToastFactory);
-            call.initAnalytics(callingPackage);
+            call.initAnalytics(callingPackage, creationLogs.toString());
 
             // Ensure new calls related to self-managed calls/connections are set as such.  This
             // will be overridden when the actual connection is returned in startCreateConnection,
@@ -1616,7 +1626,8 @@
         // retrieved.
         CompletableFuture<List<PhoneAccountHandle>> setAccountHandle =
                 accountsForCall.whenCompleteAsync((potentialPhoneAccounts, exception) -> {
-                    Log.i(CallsManager.this, "set outgoing call phone acct stage");
+                    Log.i(CallsManager.this, "set outgoing call phone acct; potentialAccts=%s",
+                            potentialPhoneAccounts);
                     PhoneAccountHandle phoneAccountHandle;
                     if (potentialPhoneAccounts.size() == 1) {
                         phoneAccountHandle = potentialPhoneAccounts.get(0);
@@ -2032,6 +2043,8 @@
 
         return userPreferredAccountForContact.thenApply(phoneAccountHandle -> {
             if (phoneAccountHandle != null) {
+                Log.i(CallsManager.this, "findOutgoingCallPhoneAccount; contactPrefAcct=%s",
+                        phoneAccountHandle);
                 return Collections.singletonList(phoneAccountHandle);
             }
             // No preset account, check if default exists that supports the URI scheme for the
@@ -2041,6 +2054,8 @@
                             handle.getScheme(), initiatingUser);
             if (defaultPhoneAccountHandle != null &&
                     possibleAccounts.contains(defaultPhoneAccountHandle)) {
+                Log.i(CallsManager.this, "findOutgoingCallPhoneAccount; defaultAcctForScheme=%s",
+                        defaultPhoneAccountHandle);
                 return Collections.singletonList(defaultPhoneAccountHandle);
             }
             return possibleAccounts;
diff --git a/src/com/android/server/telecom/PhoneAccountRegistrar.java b/src/com/android/server/telecom/PhoneAccountRegistrar.java
index 5ef3dd5..bce6e43 100644
--- a/src/com/android/server/telecom/PhoneAccountRegistrar.java
+++ b/src/com/android/server/telecom/PhoneAccountRegistrar.java
@@ -1226,6 +1226,14 @@
                     = mState.defaultOutgoingAccountHandles.get(Process.myUserHandle());
             pw.println("defaultOutgoing: " + (defaultPhoneAccountHandle == null ? "none" :
                     defaultPhoneAccountHandle.phoneAccountHandle));
+            PhoneAccountHandle defaultOutgoing =
+                    getOutgoingPhoneAccountForScheme(PhoneAccount.SCHEME_TEL, mCurrentUserHandle);
+            pw.print("outgoingPhoneAccountForTelScheme: ");
+            if (defaultOutgoing == null) {
+                pw.println("none");
+            } else {
+                pw.println(defaultOutgoing);
+            }
             pw.println("simCallManager: " + getSimCallManager(mCurrentUserHandle));
             pw.println("phoneAccounts:");
             pw.increaseIndent();
diff --git a/src/com/android/server/telecom/RingtoneFactory.java b/src/com/android/server/telecom/RingtoneFactory.java
index df89ee7..6a121f7 100644
--- a/src/com/android/server/telecom/RingtoneFactory.java
+++ b/src/com/android/server/telecom/RingtoneFactory.java
@@ -90,8 +90,14 @@
             if (UserManager.get(contextToUse).isUserUnlocked(contextToUse.getUserId())) {
                 defaultRingtoneUri = RingtoneManager.getActualDefaultRingtoneUri(contextToUse,
                         RingtoneManager.TYPE_RINGTONE);
+                if (defaultRingtoneUri == null) {
+                    Log.i(this, "getRingtone: defaultRingtoneUri for user is null.");
+                }
             } else {
                 defaultRingtoneUri = Settings.System.DEFAULT_RINGTONE_URI;
+                if (defaultRingtoneUri == null) {
+                    Log.i(this, "getRingtone: Settings.System.DEFAULT_RINGTONE_URI is null.");
+                }
             }
             if (defaultRingtoneUri == null) {
                 return null;
diff --git a/src/com/android/server/telecom/TelecomServiceImpl.java b/src/com/android/server/telecom/TelecomServiceImpl.java
index 86d5ebc..6b95aca 100644
--- a/src/com/android/server/telecom/TelecomServiceImpl.java
+++ b/src/com/android/server/telecom/TelecomServiceImpl.java
@@ -117,7 +117,7 @@
         public PhoneAccountHandle getDefaultOutgoingPhoneAccount(String uriScheme,
                 String callingPackage, String callingFeatureId) {
             try {
-                Log.startSession("TSI.gDOPA");
+                Log.startSession("TSI.gDOPA", Log.getPackageAbbreviation(callingPackage));
                 synchronized (mLock) {
                     PhoneAccountHandle phoneAccountHandle = null;
                     final UserHandle callingUserHandle = Binder.getCallingUserHandle();
@@ -149,7 +149,7 @@
         public PhoneAccountHandle getUserSelectedOutgoingPhoneAccount(String callingPackage) {
             synchronized (mLock) {
                 try {
-                    Log.startSession("TSI.gUSOPA");
+                    Log.startSession("TSI.gUSOPA", Log.getPackageAbbreviation(callingPackage));
                     if (!isDialerOrPrivileged(callingPackage, "getDefaultOutgoingPhoneAccount")) {
                         throw new SecurityException("Only the default dialer, or caller with "
                                 + "READ_PRIVILEGED_PHONE_STATE can call this method.");
@@ -193,7 +193,7 @@
         public List<PhoneAccountHandle> getCallCapablePhoneAccounts(
                 boolean includeDisabledAccounts, String callingPackage, String callingFeatureId) {
             try {
-                Log.startSession("TSI.gCCPA");
+                Log.startSession("TSI.gCCPA", Log.getPackageAbbreviation(callingPackage));
                 if (includeDisabledAccounts &&
                         !canReadPrivilegedPhoneState(
                                 callingPackage, "getCallCapablePhoneAccounts")) {
@@ -225,7 +225,7 @@
         public List<PhoneAccountHandle> getSelfManagedPhoneAccounts(String callingPackage,
                 String callingFeatureId) {
             try {
-                Log.startSession("TSI.gSMPA");
+                Log.startSession("TSI.gSMPA", Log.getPackageAbbreviation(callingPackage));
                 if (!canReadPhoneState(callingPackage, callingFeatureId,
                         "Requires READ_PHONE_STATE permission.")) {
                     throw new SecurityException("Requires READ_PHONE_STATE permission.");
@@ -252,7 +252,7 @@
         public List<PhoneAccountHandle> getPhoneAccountsSupportingScheme(String uriScheme,
                 String callingPackage) {
             try {
-                Log.startSession("TSI.gPASS");
+                Log.startSession("TSI.gPASS", Log.getPackageAbbreviation(callingPackage));
                 try {
                     enforceModifyPermission(
                             "getPhoneAccountsSupportingScheme requires MODIFY_PHONE_STATE");
@@ -973,7 +973,7 @@
         @Override
         public boolean endCall(String callingPackage) {
             try {
-                Log.startSession("TSI.eC");
+                Log.startSession("TSI.eC", Log.getPackageAbbreviation(callingPackage));
                 synchronized (mLock) {
                     if (!enforceAnswerCallPermission(callingPackage, Binder.getCallingUid())) {
                         throw new SecurityException("requires ANSWER_PHONE_CALLS permission");
@@ -997,7 +997,7 @@
         @Override
         public void acceptRingingCall(String packageName) {
             try {
-                Log.startSession("TSI.aRC");
+                Log.startSession("TSI.aRC", Log.getPackageAbbreviation(packageName));
                 synchronized (mLock) {
                     if (!enforceAnswerCallPermission(packageName, Binder.getCallingUid())) return;
 
@@ -1020,7 +1020,7 @@
         @Override
         public void acceptRingingCallWithVideoState(String packageName, int videoState) {
             try {
-                Log.startSession("TSI.aRCWVS");
+                Log.startSession("TSI.aRCWVS", Log.getPackageAbbreviation(packageName));
                 synchronized (mLock) {
                     if (!enforceAnswerCallPermission(packageName, Binder.getCallingUid())) return;
 
@@ -1043,7 +1043,7 @@
         public void showInCallScreen(boolean showDialpad, String callingPackage,
                 String callingFeatureId) {
             try {
-                Log.startSession("TSI.sICS");
+                Log.startSession("TSI.sICS", Log.getPackageAbbreviation(callingPackage));
                 if (!canReadPhoneState(callingPackage, callingFeatureId, "showInCallScreen")) {
                     return;
                 }
@@ -1068,7 +1068,7 @@
         @Override
         public void cancelMissedCallsNotification(String callingPackage) {
             try {
-                Log.startSession("TSI.cMCN");
+                Log.startSession("TSI.cMCN", Log.getPackageAbbreviation(callingPackage));
                 synchronized (mLock) {
                     enforcePermissionOrPrivilegedDialer(MODIFY_PHONE_STATE, callingPackage);
                     UserHandle userHandle = Binder.getCallingUserHandle();
@@ -1089,7 +1089,7 @@
         @Override
         public boolean handlePinMmi(String dialString, String callingPackage) {
             try {
-                Log.startSession("TSI.hPM");
+                Log.startSession("TSI.hPM", Log.getPackageAbbreviation(callingPackage));
                 enforcePermissionOrPrivilegedDialer(MODIFY_PHONE_STATE, callingPackage);
 
                 // Switch identity so that TelephonyManager checks Telecom's permissions
@@ -1117,7 +1117,7 @@
         public boolean handlePinMmiForPhoneAccount(PhoneAccountHandle accountHandle,
                 String dialString, String callingPackage) {
             try {
-                Log.startSession("TSI.hPMFPA");
+                Log.startSession("TSI.hPMFPA", Log.getPackageAbbreviation(callingPackage));
 
                 enforcePermissionOrPrivilegedDialer(MODIFY_PHONE_STATE, callingPackage);
                 UserHandle callingUserHandle = Binder.getCallingUserHandle();
@@ -1158,7 +1158,7 @@
         public Uri getAdnUriForPhoneAccount(PhoneAccountHandle accountHandle,
                 String callingPackage) {
             try {
-                Log.startSession("TSI.aAUFPA");
+                Log.startSession("TSI.aAUFPA", Log.getPackageAbbreviation(callingPackage));
                 enforcePermissionOrPrivilegedDialer(MODIFY_PHONE_STATE, callingPackage);
                 synchronized (mLock) {
                     if (!isPhoneAccountHandleVisibleToCallingUser(accountHandle,
@@ -1192,7 +1192,7 @@
         @Override
         public boolean isTtySupported(String callingPackage, String callingFeatureId) {
             try {
-                Log.startSession("TSI.iTS");
+                Log.startSession("TSI.iTS", Log.getPackageAbbreviation(callingPackage));
                 if (!canReadPhoneState(callingPackage, callingFeatureId, "isTtySupported")) {
                     throw new SecurityException("Only default dialer or an app with" +
                             "READ_PRIVILEGED_PHONE_STATE or READ_PHONE_STATE can call this api");
@@ -1212,7 +1212,7 @@
         @Override
         public int getCurrentTtyMode(String callingPackage, String callingFeatureId) {
             try {
-                Log.startSession("TSI.gCTM");
+                Log.startSession("TSI.gCTM", Log.getPackageAbbreviation(callingPackage));
                 if (!canReadPhoneState(callingPackage, callingFeatureId, "getCurrentTtyMode")) {
                     return TelecomManager.TTY_MODE_OFF;
                 }
@@ -1444,7 +1444,7 @@
         public void startConference(List<Uri> participants, Bundle extras,
                 String callingPackage) {
             try {
-                Log.startSession("TSI.sC");
+                Log.startSession("TSI.sC", Log.getPackageAbbreviation(callingPackage));
                 if (!canCallPhone(callingPackage, "startConference")) {
                     throw new SecurityException("Package " + callingPackage + " is not allowed"
                             + " to start conference call");
@@ -1463,7 +1463,7 @@
         public void placeCall(Uri handle, Bundle extras, String callingPackage,
                 String callingFeatureId) {
             try {
-                Log.startSession("TSI.pC");
+                Log.startSession("TSI.pC", Log.getPackageAbbreviation(callingPackage));
                 enforceCallingPackage(callingPackage);
 
                 PhoneAccountHandle phoneAccountHandle = null;
@@ -1696,10 +1696,14 @@
          * @see android.telecom.TelecomManager#isIncomingCallPermitted(PhoneAccountHandle)
          */
         @Override
-        public boolean isIncomingCallPermitted(PhoneAccountHandle phoneAccountHandle) {
+        public boolean isIncomingCallPermitted(PhoneAccountHandle phoneAccountHandle,
+                String callingPackage) {
+            Log.startSession("TSI.iICP");
             try {
-                Log.startSession("TSI.iICP");
+                enforceCallingPackage(callingPackage);
+                enforcePhoneAccountHandleMatchesCaller(phoneAccountHandle, callingPackage);
                 enforcePermission(android.Manifest.permission.MANAGE_OWN_CALLS);
+                enforceUserHandleMatchesCaller(phoneAccountHandle);
                 synchronized (mLock) {
                     long token = Binder.clearCallingIdentity();
                     try {
@@ -1717,10 +1721,14 @@
          * @see android.telecom.TelecomManager#isOutgoingCallPermitted(PhoneAccountHandle)
          */
         @Override
-        public boolean isOutgoingCallPermitted(PhoneAccountHandle phoneAccountHandle) {
+        public boolean isOutgoingCallPermitted(PhoneAccountHandle phoneAccountHandle,
+                String callingPackage) {
+            Log.startSession("TSI.iOCP");
             try {
-                Log.startSession("TSI.iOCP");
+                enforceCallingPackage(callingPackage);
+                enforcePhoneAccountHandleMatchesCaller(phoneAccountHandle, callingPackage);
                 enforcePermission(android.Manifest.permission.MANAGE_OWN_CALLS);
+                enforceUserHandleMatchesCaller(phoneAccountHandle);
                 synchronized (mLock) {
                     long token = Binder.clearCallingIdentity();
                     try {
@@ -2281,6 +2289,13 @@
         }
     }
 
+    private void enforcePhoneAccountHandleMatchesCaller(PhoneAccountHandle phoneAccountHandle,
+            String callingPackage) {
+        if (!callingPackage.equals(phoneAccountHandle.getComponentName().getPackageName())) {
+            throw new SecurityException("Caller does not own the PhoneAccountHandle");
+        }
+    }
+
     private void enforceCrossUserPermission(int callingUid) {
         if (callingUid != Process.SYSTEM_UID && callingUid != 0) {
             mContext.enforceCallingOrSelfPermission(
diff --git a/src/com/android/server/telecom/callfiltering/CallScreeningServiceFilter.java b/src/com/android/server/telecom/callfiltering/CallScreeningServiceFilter.java
index 4a308e0..51b1bc6 100644
--- a/src/com/android/server/telecom/callfiltering/CallScreeningServiceFilter.java
+++ b/src/com/android/server/telecom/callfiltering/CallScreeningServiceFilter.java
@@ -313,11 +313,14 @@
 
     private void bindCallScreeningService(
             CompletableFuture<CallFilteringResult> resultFuture) {
-        mConnection = new CallScreeningServiceConnection(resultFuture);
+        CallScreeningServiceConnection connection = new CallScreeningServiceConnection(
+                resultFuture);
         if (!CallScreeningServiceHelper.bindCallScreeningService(mContext,
-                mCallsManager.getCurrentUserHandle(), mPackageName, mConnection)) {
+                mCallsManager.getCurrentUserHandle(), mPackageName, connection)) {
             Log.i(this, "Call screening service binding failed.");
             resultFuture.complete(mPriorStageResult);
+        } else {
+            mConnection = connection;
         }
     }
 
diff --git a/src/com/android/server/telecom/callredirection/CallRedirectionProcessor.java b/src/com/android/server/telecom/callredirection/CallRedirectionProcessor.java
index a1f357b..adeb311 100644
--- a/src/com/android/server/telecom/callredirection/CallRedirectionProcessor.java
+++ b/src/com/android/server/telecom/callredirection/CallRedirectionProcessor.java
@@ -124,6 +124,17 @@
             }
         }
 
+        public void notifyTimeout() {
+            if (mService != null) {
+                try {
+                    mService.notifyTimeout();
+                } catch (RemoteException e) {
+                    Log.e(this, e, "Failed to notify call redirection timed out to "
+                            + mServiceType + " call redirection service");
+                }
+            }
+        }
+
         private class CallRedirectionServiceConnection implements ServiceConnection {
             @Override
             public void onServiceConnected(ComponentName componentName, IBinder service) {
@@ -394,6 +405,7 @@
                     Log.addEvent(mCall, serviceType.equals(SERVICE_TYPE_USER_DEFINED)
                             ? LogUtils.Events.REDIRECTION_TIMED_OUT_USER
                             : LogUtils.Events.REDIRECTION_TIMED_OUT_CARRIER);
+                    mAttempt.notifyTimeout();
                     if (serviceType.equals(SERVICE_TYPE_USER_DEFINED)) {
                         mUiAction = UI_TYPE_USER_DEFINED_TIMEOUT;
                         mShouldCancelCall = true;
diff --git a/tests/src/com/android/server/telecom/tests/BasicCallTests.java b/tests/src/com/android/server/telecom/tests/BasicCallTests.java
index a3b8654..b695f32 100644
--- a/tests/src/com/android/server/telecom/tests/BasicCallTests.java
+++ b/tests/src/com/android/server/telecom/tests/BasicCallTests.java
@@ -618,10 +618,12 @@
 
         mInCallServiceFixtureX.mInCallAdapter.mute(true);
         verify(mAudioService, timeout(TEST_TIMEOUT))
-                .setMicrophoneMute(eq(true), any(String.class), any(Integer.class));
+                .setMicrophoneMute(eq(true), any(String.class), any(Integer.class),
+                        nullable(String.class));
         mInCallServiceFixtureX.mInCallAdapter.mute(false);
         verify(mAudioService, timeout(TEST_TIMEOUT))
-                .setMicrophoneMute(eq(false), any(String.class), any(Integer.class));
+                .setMicrophoneMute(eq(false), any(String.class), any(Integer.class),
+                        nullable(String.class));
 
         mInCallServiceFixtureX.mInCallAdapter.setAudioRoute(CallAudioState.ROUTE_SPEAKER, null);
         waitForHandlerAction(mTelecomSystem.getCallsManager().getCallAudioManager()
@@ -1033,7 +1035,9 @@
     @Test
     public void testIsOutgoingCallPermitted() throws Exception {
         assertTrue(mTelecomSystem.getTelecomServiceImpl().getBinder()
-                .isOutgoingCallPermitted(mPhoneAccountSelfManaged.getAccountHandle()));
+                .isOutgoingCallPermitted(mPhoneAccountSelfManaged.getAccountHandle(),
+                        mPhoneAccountSelfManaged.getAccountHandle().getComponentName()
+                                .getPackageName()));
     }
 
     /**
@@ -1050,7 +1054,9 @@
         assertEquals(Call.STATE_ACTIVE, mInCallServiceFixtureX.getCall(ids.mCallId).getState());
 
         assertTrue(mTelecomSystem.getTelecomServiceImpl().getBinder()
-                .isOutgoingCallPermitted(mPhoneAccountSelfManaged.getAccountHandle()));
+                .isOutgoingCallPermitted(mPhoneAccountSelfManaged.getAccountHandle(),
+                        mPhoneAccountSelfManaged.getAccountHandle().getComponentName()
+                                .getPackageName()));
     }
 
     /**
@@ -1068,7 +1074,9 @@
         assertEquals(Call.STATE_ACTIVE, mInCallServiceFixtureX.getCall(ids.mCallId).getState());
 
         assertTrue(mTelecomSystem.getTelecomServiceImpl().getBinder()
-                .isOutgoingCallPermitted(mPhoneAccountSelfManaged.getAccountHandle()));
+                .isOutgoingCallPermitted(mPhoneAccountSelfManaged.getAccountHandle(),
+                        mPhoneAccountSelfManaged.getAccountHandle().getComponentName()
+                                .getPackageName()));
     }
 
     /**
@@ -1185,7 +1193,7 @@
 
         ArgumentCaptor<Boolean> muteValueCaptor = ArgumentCaptor.forClass(Boolean.class);
         verify(mAudioService, times(2)).setMicrophoneMute(muteValueCaptor.capture(),
-                any(String.class), any(Integer.class));
+                any(String.class), any(Integer.class), nullable(String.class));
         List<Boolean> muteValues = muteValueCaptor.getAllValues();
         // Check mute status was changed twice with true and false.
         assertTrue(muteValues.get(0));
diff --git a/tests/src/com/android/server/telecom/tests/TelecomSystemTest.java b/tests/src/com/android/server/telecom/tests/TelecomSystemTest.java
index 7f462d4..2d6fa4c 100644
--- a/tests/src/com/android/server/telecom/tests/TelecomSystemTest.java
+++ b/tests/src/com/android/server/telecom/tests/TelecomSystemTest.java
@@ -604,8 +604,8 @@
                     doReturn(args[0]).when(fakeAudioManager).isMicrophoneMute();
                     return null;
                 }
-            }).when(audioService)
-                    .setMicrophoneMute(any(Boolean.class), any(String.class), any(Integer.class));
+            }).when(audioService).setMicrophoneMute(any(Boolean.class), any(String.class),
+                    any(Integer.class), nullable(String.class));
 
         } catch (android.os.RemoteException e) {
             // Do nothing, leave the faked microphone state as-is