Merge "Don't clear force camp satellite on destroy" into main
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index 3dc9e08..feb5a78 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -599,7 +599,7 @@
 
         <receiver
             android:name=".security.SafetySourceReceiver"
-            android:exported="false"
+            android:exported="true"
             androidprv:systemUserOnly="true">
             <intent-filter>
                 <action android:name="android.safetycenter.action.REFRESH_SAFETY_SOURCES"/>
diff --git a/src/com/android/phone/CallFeaturesSetting.java b/src/com/android/phone/CallFeaturesSetting.java
index 1dfcde7..1c55256 100644
--- a/src/com/android/phone/CallFeaturesSetting.java
+++ b/src/com/android/phone/CallFeaturesSetting.java
@@ -35,6 +35,7 @@
 import android.os.HandlerExecutor;
 import android.os.Looper;
 import android.os.PersistableBundle;
+import android.os.UserHandle;
 import android.os.UserManager;
 import android.preference.Preference;
 import android.preference.PreferenceActivity;
@@ -233,7 +234,7 @@
                                         getString(R.string.mobile_network_settings_package),
                                         getString(R.string.mobile_network_settings_class));
                                 intent.setComponent(mobileNetworkSettingsComponent);
-                                startActivity(intent);
+                                startActivityAsUser(intent, UserHandle.CURRENT);
                             }
                         };
                 builder.setMessage(getResourcesForSubId().getString(
@@ -622,7 +623,7 @@
         Intent intent = subscriptionInfoHelper.getIntent(CallFeaturesSetting.class);
         intent.setAction(Intent.ACTION_MAIN);
         intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
-        activity.startActivity(intent);
+        activity.startActivityAsUser(intent, UserHandle.CURRENT);
         activity.finish();
     }
 
diff --git a/src/com/android/phone/EmergencyCallbackModeService.java b/src/com/android/phone/EmergencyCallbackModeService.java
index 464db6f..70eb017 100644
--- a/src/com/android/phone/EmergencyCallbackModeService.java
+++ b/src/com/android/phone/EmergencyCallbackModeService.java
@@ -129,9 +129,9 @@
             // Show dialog box
             else if (intent.getAction().equals(
                     TelephonyIntents.ACTION_SHOW_NOTICE_ECM_BLOCK_OTHERS)) {
-                    context.startActivity(
+                    context.startActivityAsUser(
                             new Intent(TelephonyIntents.ACTION_SHOW_NOTICE_ECM_BLOCK_OTHERS)
-                    .setFlags(Intent.FLAG_ACTIVITY_NEW_TASK));
+                                    .setFlags(Intent.FLAG_ACTIVITY_NEW_TASK), UserHandle.CURRENT);
             }
         }
     };
diff --git a/src/com/android/phone/EmergencyDialer.java b/src/com/android/phone/EmergencyDialer.java
index a608b1b..d4fdca6 100644
--- a/src/com/android/phone/EmergencyDialer.java
+++ b/src/com/android/phone/EmergencyDialer.java
@@ -40,6 +40,7 @@
 import android.os.AsyncTask;
 import android.os.Bundle;
 import android.os.PersistableBundle;
+import android.os.UserHandle;
 import android.provider.Settings;
 import android.telecom.PhoneAccount;
 import android.telecom.TelecomManager;
@@ -511,7 +512,7 @@
 
         Intent intent = (Intent) button.getTag(R.id.tag_intent);
         if (intent != null) {
-            startActivity(intent);
+            startActivityAsUser(intent, UserHandle.CURRENT);
         }
     }
 
diff --git a/src/com/android/phone/PhoneInterfaceManager.java b/src/com/android/phone/PhoneInterfaceManager.java
index 9f9c615..ea3dbab 100644
--- a/src/com/android/phone/PhoneInterfaceManager.java
+++ b/src/com/android/phone/PhoneInterfaceManager.java
@@ -2613,7 +2613,7 @@
             if (state != PhoneConstants.State.OFFHOOK && state != PhoneConstants.State.RINGING) {
                 Intent intent = new Intent(Intent.ACTION_DIAL, Uri.parse(url));
                 intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
-                mApp.startActivity(intent);
+                mApp.startActivityAsUser(intent, UserHandle.CURRENT);
             }
         } finally {
             Binder.restoreCallingIdentity(identity);
@@ -2628,7 +2628,7 @@
         if (DBG) log("call: " + number);
 
         // This is just a wrapper around the ACTION_CALL intent, but we still
-        // need to do a permission check since we're calling startActivity()
+        // need to do a permission check since we're calling startActivityAsUser()
         // from the context of the phone app.
         enforceCallPermission();
 
@@ -2664,7 +2664,7 @@
             Intent intent = new Intent(Intent.ACTION_CALL, Uri.parse(url));
             intent.putExtra(SUBSCRIPTION_KEY, subId);
             intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
-            mApp.startActivity(intent);
+            mApp.startActivityAsUser(intent, UserHandle.CURRENT);
         } finally {
             Binder.restoreCallingIdentity(identity);
         }
@@ -9597,7 +9597,7 @@
 
     private WorkSource getWorkSource(int uid) {
         String packageName = mApp.getPackageManager().getNameForUid(uid);
-        if (uid == Process.ROOT_UID && packageName == null) {
+        if (UserHandle.isSameApp(uid, Process.ROOT_UID) && packageName == null) {
             // Downstream WorkSource attribution inside the RIL requires both a UID and package name
             // to be set for wakelock tracking, otherwise RIL requests fail with a runtime
             // exception. ROOT_UID seems not to have a valid package name returned by
@@ -11032,7 +11032,7 @@
         // Bring up choose default SMS subscription dialog right now
         intent.putExtra(PickSmsSubscriptionActivity.DIALOG_TYPE_KEY,
                 PickSmsSubscriptionActivity.SMS_PICK_FOR_MESSAGE);
-        mApp.startActivity(intent);
+        mApp.startActivityAsUser(intent, UserHandle.CURRENT);
     }
 
     @Override
@@ -11045,13 +11045,13 @@
             Intent intent = new Intent(Intent.ACTION_SENDTO);
             intent.setData(Uri.parse("smsto:"));
             intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
-            mApp.startActivity(intent);
+            mApp.startActivityAsUser(intent, UserHandle.CURRENT);
         } catch (ActivityNotFoundException e) {
             Log.w(LOG_TAG, "Unable to show intent forwarder, try showing error dialog instead");
             Intent intent = new Intent();
             intent.setClass(mApp, ErrorDialogActivity.class);
             intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
-            mApp.startActivity(intent);
+            mApp.startActivityAsUser(intent, UserHandle.CURRENT);
         }
     }
 
@@ -11319,7 +11319,7 @@
         // In fact, the current code acquires way too many,
         // and probably has lurking deadlocks.
 
-        if (Binder.getCallingUid() != Process.SYSTEM_UID) {
+        if (!UserHandle.isSameApp(Binder.getCallingUid(), Process.SYSTEM_UID)) {
             throw new SecurityException("Only the OS may call notifyUserActivity()");
         }
 
diff --git a/src/com/android/phone/SimContacts.java b/src/com/android/phone/SimContacts.java
index 4229482..d5f7840 100644
--- a/src/com/android/phone/SimContacts.java
+++ b/src/com/android/phone/SimContacts.java
@@ -33,6 +33,7 @@
 import android.net.Uri;
 import android.os.Bundle;
 import android.os.RemoteException;
+import android.os.UserHandle;
 import android.provider.ContactsContract;
 import android.provider.ContactsContract.CommonDataKinds.Email;
 import android.provider.ContactsContract.CommonDataKinds.GroupMembership;
@@ -372,7 +373,7 @@
                             Uri.fromParts(PhoneAccount.SCHEME_TEL, phoneNumber, null));
                     intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK
                                           | Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS);
-                    startActivity(intent);
+                    startActivityAsUser(intent, UserHandle.CURRENT);
                     finish();
                     return true;
                 }
diff --git a/src/com/android/phone/SpecialCharSequenceMgr.java b/src/com/android/phone/SpecialCharSequenceMgr.java
index 8fe084b..d0fe2c1 100644
--- a/src/com/android/phone/SpecialCharSequenceMgr.java
+++ b/src/com/android/phone/SpecialCharSequenceMgr.java
@@ -21,6 +21,7 @@
 import android.content.ActivityNotFoundException;
 import android.content.Context;
 import android.content.Intent;
+import android.os.UserHandle;
 import android.os.UserManager;
 import android.provider.Settings;
 import android.telephony.PhoneNumberUtils;
@@ -186,7 +187,7 @@
                                     "com.android.phone.SimContacts");
                 intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
                 intent.putExtra("index", index);
-                PhoneGlobals.getInstance().startActivity(intent);
+                PhoneGlobals.getInstance().startActivityAsUser(intent, UserHandle.CURRENT);
 
                 return true;
             } catch (NumberFormatException ex) {}
@@ -313,9 +314,9 @@
             log("handleRegulatoryInfoDisplay() sending intent to settings app");
             Intent showRegInfoIntent = new Intent(Settings.ACTION_SHOW_REGULATORY_INFO);
             try {
-                context.startActivity(showRegInfoIntent);
+                context.startActivityAsUser(showRegInfoIntent, UserHandle.CURRENT);
             } catch (ActivityNotFoundException e) {
-                Log.e(TAG, "startActivity() failed: " + e);
+                Log.e(TAG, "startActivityAsUser() failed: " + e);
             }
             return true;
         }
diff --git a/src/com/android/phone/TelephonyShellCommand.java b/src/com/android/phone/TelephonyShellCommand.java
index 08b041b..bfc93e0 100644
--- a/src/com/android/phone/TelephonyShellCommand.java
+++ b/src/com/android/phone/TelephonyShellCommand.java
@@ -34,6 +34,7 @@
 import android.os.Process;
 import android.os.RemoteException;
 import android.os.ServiceSpecificException;
+import android.os.UserHandle;
 import android.provider.BlockedNumberContract;
 import android.telephony.BarringInfo;
 import android.telephony.CarrierConfigManager;
@@ -1119,7 +1120,8 @@
         }
         // Verify that the user is allowed to run the command. Only allowed in rooted device in a
         // non user build.
-        if (Binder.getCallingUid() != Process.ROOT_UID || TelephonyUtils.IS_USER) {
+        if (!UserHandle.isSameApp(Binder.getCallingUid(), Process.ROOT_UID)
+                || TelephonyUtils.IS_USER) {
             errPw.println("cc: Permission denied.");
             return -1;
         }
@@ -1685,14 +1687,15 @@
 
     private boolean checkShellUid() {
         // adb can run as root or as shell, depending on whether the device is rooted.
-        return Binder.getCallingUid() == Process.SHELL_UID
-                || Binder.getCallingUid() == Process.ROOT_UID;
+        return UserHandle.isSameApp(Binder.getCallingUid(), Process.SHELL_UID)
+                || UserHandle.isSameApp(Binder.getCallingUid(), Process.ROOT_UID);
     }
 
     private int handleCcCommand() {
         // Verify that the user is allowed to run the command. Only allowed in rooted device in a
         // non user build.
-        if (Binder.getCallingUid() != Process.ROOT_UID || TelephonyUtils.IS_USER) {
+        if (!UserHandle.isSameApp(Binder.getCallingUid(), Process.ROOT_UID)
+                || TelephonyUtils.IS_USER) {
             getErrPrintWriter().println("cc: Permission denied.");
             return -1;
         }
@@ -2248,7 +2251,8 @@
     private int handleRestartModemCommand() {
         // Verify that the user is allowed to run the command. Only allowed in rooted device in a
         // non user build.
-        if (Binder.getCallingUid() != Process.ROOT_UID || TelephonyUtils.IS_USER) {
+        if (!UserHandle.isSameApp(Binder.getCallingUid(), Process.ROOT_UID)
+                || TelephonyUtils.IS_USER) {
             getErrPrintWriter().println("RestartModem: Permission denied.");
             return -1;
         }
@@ -2262,7 +2266,8 @@
     private int handleGetImei() {
         // Verify that the user is allowed to run the command. Only allowed in rooted device in a
         // non user build.
-        if (Binder.getCallingUid() != Process.ROOT_UID || TelephonyUtils.IS_USER) {
+        if (!UserHandle.isSameApp(Binder.getCallingUid(), Process.ROOT_UID)
+                || TelephonyUtils.IS_USER) {
             getErrPrintWriter().println("Device IMEI: Permission denied.");
             return -1;
         }
@@ -2293,7 +2298,8 @@
     private int handleUnattendedReboot() {
         // Verify that the user is allowed to run the command. Only allowed in rooted device in a
         // non user build.
-        if (Binder.getCallingUid() != Process.ROOT_UID || TelephonyUtils.IS_USER) {
+        if (!UserHandle.isSameApp(Binder.getCallingUid(), Process.ROOT_UID)
+                || TelephonyUtils.IS_USER) {
             getErrPrintWriter().println("UnattendedReboot: Permission denied.");
             return -1;
         }
@@ -2307,7 +2313,8 @@
     private int handleGetSimSlotsMapping() {
         // Verify that the user is allowed to run the command. Only allowed in rooted device in a
         // non user build.
-        if (Binder.getCallingUid() != Process.ROOT_UID || TelephonyUtils.IS_USER) {
+        if (!UserHandle.isSameApp(Binder.getCallingUid(), Process.ROOT_UID)
+                || TelephonyUtils.IS_USER) {
             getErrPrintWriter().println("GetSimSlotsMapping: Permission denied.");
             return -1;
         }
diff --git a/src/com/android/phone/euicc/EuiccUiDispatcherActivity.java b/src/com/android/phone/euicc/EuiccUiDispatcherActivity.java
index 3e44062..a75f26f 100644
--- a/src/com/android/phone/euicc/EuiccUiDispatcherActivity.java
+++ b/src/com/android/phone/euicc/EuiccUiDispatcherActivity.java
@@ -90,7 +90,7 @@
             }
 
             euiccUiIntent.setFlags(Intent.FLAG_ACTIVITY_FORWARD_RESULT);
-            startActivity(euiccUiIntent);
+            startActivityAsUser(euiccUiIntent, UserHandle.CURRENT);
         } finally {
             // Since we're using Theme.NO_DISPLAY, we must always finish() at the end of onCreate().
             finish();
diff --git a/src/com/android/phone/settings/RadioInfo.java b/src/com/android/phone/settings/RadioInfo.java
index dd749a6..8b004d9 100644
--- a/src/com/android/phone/settings/RadioInfo.java
+++ b/src/com/android/phone/settings/RadioInfo.java
@@ -44,6 +44,7 @@
 import android.os.Message;
 import android.os.PersistableBundle;
 import android.os.SystemProperties;
+import android.os.UserHandle;
 import android.os.UserManager;
 import android.telephony.AccessNetworkConstants;
 import android.telephony.CarrierConfigManager;
@@ -791,13 +792,15 @@
             }
             mSatelliteEnableNonEmergencyModeButton.setVisibility(View.GONE);
         } else {
-            mEsosButton.setOnClickListener(v -> startActivity(
+            mEsosButton.setOnClickListener(v -> startActivityAsUser(
                     new Intent(mActionEsos).addFlags(
-                            Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK))
+                            Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK),
+                    UserHandle.CURRENT)
             );
-            mEsosDemoButton.setOnClickListener(v -> startActivity(
+            mEsosDemoButton.setOnClickListener(v -> startActivityAsUser(
                     new Intent(mActionEsosDemo).addFlags(
-                            Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK))
+                            Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK),
+                    UserHandle.CURRENT)
             );
             mSatelliteEnableNonEmergencyModeButton.setOnClickListener(v ->
                     enableSatelliteNonEmergencyMode());
@@ -1672,49 +1675,50 @@
 
     private MenuItem.OnMenuItemClickListener mViewADNCallback =
             new MenuItem.OnMenuItemClickListener() {
-        public boolean onMenuItemClick(MenuItem item) {
-            Intent intent = new Intent(Intent.ACTION_VIEW);
-            // XXX We need to specify the component here because if we don't
-            // the activity manager will try to resolve the type by calling
-            // the content provider, which causes it to be loaded in a process
-            // other than the Dialer process, which causes a lot of stuff to
-            // break.
-            intent.setClassName("com.android.phone", "com.android.phone.SimContacts");
-            startActivity(intent);
-            return true;
-        }
-    };
+                public boolean onMenuItemClick(MenuItem item) {
+                    Intent intent = new Intent(Intent.ACTION_VIEW);
+                    // XXX We need to specify the component here because if we don't
+                    // the activity manager will try to resolve the type by calling
+                    // the content provider, which causes it to be loaded in a process
+                    // other than the Dialer process, which causes a lot of stuff to
+                    // break.
+                    intent.setClassName("com.android.phone", "com.android.phone.SimContacts");
+                    startActivityAsUser(intent, UserHandle.CURRENT);
+                    return true;
+                }
+            };
 
     private MenuItem.OnMenuItemClickListener mViewFDNCallback =
             new MenuItem.OnMenuItemClickListener() {
-        public boolean onMenuItemClick(MenuItem item) {
-            Intent intent = new Intent(Intent.ACTION_VIEW);
-            // XXX We need to specify the component here because if we don't
-            // the activity manager will try to resolve the type by calling
-            // the content provider, which causes it to be loaded in a process
-            // other than the Dialer process, which causes a lot of stuff to
-            // break.
-            intent.setClassName("com.android.phone", "com.android.phone.settings.fdn.FdnList");
-            startActivity(intent);
-            return true;
-        }
-    };
+                public boolean onMenuItemClick(MenuItem item) {
+                    Intent intent = new Intent(Intent.ACTION_VIEW);
+                    // XXX We need to specify the component here because if we don't
+                    // the activity manager will try to resolve the type by calling
+                    // the content provider, which causes it to be loaded in a process
+                    // other than the Dialer process, which causes a lot of stuff to
+                    // break.
+                    intent.setClassName("com.android.phone",
+                            "com.android.phone.settings.fdn.FdnList");
+                    startActivityAsUser(intent, UserHandle.CURRENT);
+                    return true;
+                }
+            };
 
     private MenuItem.OnMenuItemClickListener mViewSDNCallback =
             new MenuItem.OnMenuItemClickListener() {
-        public boolean onMenuItemClick(MenuItem item) {
-            Intent intent = new Intent(
-                    Intent.ACTION_VIEW, Uri.parse("content://icc/sdn"));
-            // XXX We need to specify the component here because if we don't
-            // the activity manager will try to resolve the type by calling
-            // the content provider, which causes it to be loaded in a process
-            // other than the Dialer process, which causes a lot of stuff to
-            // break.
-            intent.setClassName("com.android.phone", "com.android.phone.ADNList");
-            startActivity(intent);
-            return true;
-        }
-    };
+                public boolean onMenuItemClick(MenuItem item) {
+                    Intent intent = new Intent(
+                            Intent.ACTION_VIEW, Uri.parse("content://icc/sdn"));
+                    // XXX We need to specify the component here because if we don't
+                    // the activity manager will try to resolve the type by calling
+                    // the content provider, which causes it to be loaded in a process
+                    // other than the Dialer process, which causes a lot of stuff to
+                    // break.
+                    intent.setClassName("com.android.phone", "com.android.phone.ADNList");
+                    startActivityAsUser(intent, UserHandle.CURRENT);
+                    return true;
+                }
+            };
 
     private MenuItem.OnMenuItemClickListener mGetImsStatus =
             new MenuItem.OnMenuItemClickListener() {
@@ -2293,7 +2297,7 @@
         public void onClick(View v) {
             Intent intent = new Intent(OEM_RADIO_INFO_INTENT);
             try {
-                startActivity(intent);
+                startActivityAsUser(intent, UserHandle.CURRENT);
             } catch (android.content.ActivityNotFoundException ex) {
                 log("OEM-specific Info/Settings Activity Not Found : " + ex);
                 // If the activity does not exist, there are no OEM
diff --git a/src/com/android/phone/settings/SuppServicesUiUtil.java b/src/com/android/phone/settings/SuppServicesUiUtil.java
index 785d66a..bf4df6b 100644
--- a/src/com/android/phone/settings/SuppServicesUiUtil.java
+++ b/src/com/android/phone/settings/SuppServicesUiUtil.java
@@ -22,6 +22,7 @@
 import android.content.Context;
 import android.content.DialogInterface;
 import android.content.Intent;
+import android.os.UserHandle;
 import android.telephony.TelephonyManager;
 import android.text.TextUtils;
 import android.util.Log;
@@ -72,7 +73,7 @@
                                 context.getString(R.string.mobile_network_settings_package),
                                 context.getString(R.string.sims_settings_class));
                         intent.setComponent(mobileNetworkSettingsComponent);
-                        context.startActivity(intent);
+                        context.startActivityAsUser(intent, UserHandle.CURRENT);
                     }
                 };
         return builder.setMessage(message)
diff --git a/src/com/android/phone/settings/VoicemailSettingsActivity.java b/src/com/android/phone/settings/VoicemailSettingsActivity.java
index 817ca4c..909a3ad 100644
--- a/src/com/android/phone/settings/VoicemailSettingsActivity.java
+++ b/src/com/android/phone/settings/VoicemailSettingsActivity.java
@@ -42,7 +42,6 @@
 import android.text.TextUtils;
 import android.util.Log;
 import android.view.MenuItem;
-import android.view.WindowManager;
 import android.widget.ListAdapter;
 import android.widget.Toast;
 
@@ -495,7 +494,7 @@
                             Intent i = new Intent(ACTION_ADD_VOICEMAIL);
                             i.putExtra(IGNORE_PROVIDER_EXTRA, victim);
                             i.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
-                            this.startActivity(i);
+                            this.startActivityAsUser(i, UserHandle.CURRENT);
                         }
                         return;
                     }
diff --git a/src/com/android/phone/settings/fdn/EditFdnContactScreen.java b/src/com/android/phone/settings/fdn/EditFdnContactScreen.java
index 0884e12..6bf41f3 100644
--- a/src/com/android/phone/settings/fdn/EditFdnContactScreen.java
+++ b/src/com/android/phone/settings/fdn/EditFdnContactScreen.java
@@ -346,7 +346,7 @@
             Intent intent = mSubscriptionInfoHelper.getIntent(DeleteFdnContactScreen.class);
             intent.putExtra(INTENT_EXTRA_NAME, mName);
             intent.putExtra(INTENT_EXTRA_NUMBER, mNumber);
-            startActivity(intent);
+            startActivityAsUser(intent, UserHandle.CURRENT);
         }
         finish();
     }
diff --git a/src/com/android/phone/settings/fdn/FdnList.java b/src/com/android/phone/settings/fdn/FdnList.java
index c2ecbc6..1b5a7af 100644
--- a/src/com/android/phone/settings/fdn/FdnList.java
+++ b/src/com/android/phone/settings/fdn/FdnList.java
@@ -23,6 +23,7 @@
 import android.net.Uri;
 import android.os.Bundle;
 import android.os.PersistableBundle;
+import android.os.UserHandle;
 import android.telecom.PhoneAccount;
 import android.telephony.CarrierConfigManager;
 import android.telephony.SubscriptionManager;
@@ -167,7 +168,7 @@
                 Intent intent = mSubscriptionInfoHelper.getIntent(FdnSetting.class);
                 intent.setAction(Intent.ACTION_MAIN);
                 intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
-                startActivity(intent);
+                startActivityAsUser(intent, UserHandle.CURRENT);
                 finish();
                 return true;
 
@@ -200,7 +201,7 @@
     private void addContact() {
         //If there is no INTENT_EXTRA_NAME provided, EditFdnContactScreen treats it as an "add".
         Intent intent = mSubscriptionInfoHelper.getIntent(EditFdnContactScreen.class);
-        startActivity(intent);
+        startActivityAsUser(intent, UserHandle.CURRENT);
     }
 
     /**
@@ -224,7 +225,7 @@
             Intent intent = mSubscriptionInfoHelper.getIntent(EditFdnContactScreen.class);
             intent.putExtra(INTENT_EXTRA_NAME, name);
             intent.putExtra(INTENT_EXTRA_NUMBER, number);
-            startActivity(intent);
+            startActivityAsUser(intent, UserHandle.CURRENT);
         }
     }
 
@@ -240,7 +241,7 @@
             Intent intent = mSubscriptionInfoHelper.getIntent(DeleteFdnContactScreen.class);
             intent.putExtra(INTENT_EXTRA_NAME, name);
             intent.putExtra(INTENT_EXTRA_NUMBER, number);
-            startActivity(intent);
+            startActivityAsUser(intent, UserHandle.CURRENT);
         }
     }
 
@@ -254,7 +255,7 @@
             if (!TextUtils.isEmpty(number)) {
                 Uri uri = Uri.fromParts(PhoneAccount.SCHEME_TEL, number, null);
                 final Intent intent = new Intent(Intent.ACTION_CALL_PRIVILEGED, uri);
-                startActivity(intent);
+                startActivityAsUser(intent, UserHandle.CURRENT);
             }
         }
     }
diff --git a/src/com/android/services/telephony/TelephonyConnectionService.java b/src/com/android/services/telephony/TelephonyConnectionService.java
index 7467e74..3280c04 100644
--- a/src/com/android/services/telephony/TelephonyConnectionService.java
+++ b/src/com/android/services/telephony/TelephonyConnectionService.java
@@ -41,6 +41,7 @@
 import android.os.Bundle;
 import android.os.ParcelUuid;
 import android.os.PersistableBundle;
+import android.os.UserHandle;
 import android.telecom.Conference;
 import android.telecom.Conferenceable;
 import android.telecom.Connection;
@@ -1588,7 +1589,7 @@
                                 simUnlockUiPackage, simUnlockUiClass));
                         simUnlockIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
                         try {
-                            context.startActivity(simUnlockIntent);
+                            context.startActivityAsUser(simUnlockIntent, UserHandle.CURRENT);
                         } catch (ActivityNotFoundException exception) {
                             Log.e(this, exception, "Unable to find SIM unlock UI activity.");
                         }
@@ -2484,7 +2485,7 @@
             if (SubscriptionManager.isValidSubscriptionId(subId)) {
                 SubscriptionManager.putSubscriptionIdExtra(intent, subId);
             }
-            startActivity(intent);
+            startActivityAsUser(intent, UserHandle.CURRENT);
         }
         return disconnectCause;
     }
@@ -4383,7 +4384,7 @@
                                                 context.getString(
                                                     R.string.sims_settings_class));
                                     intent.setComponent(mobileNetworkSettingsComponent);
-                                    context.startActivity(intent);
+                                    context.startActivityAsUser(intent, UserHandle.CURRENT);
                                 }
                             };
                     Dialog dialog = builder.setMessage(message)
diff --git a/testapps/ImsTestService/src/com/android/phone/testapps/imstestapp/ImsTestServiceApp.java b/testapps/ImsTestService/src/com/android/phone/testapps/imstestapp/ImsTestServiceApp.java
index 6b78a30..c71f4f8 100644
--- a/testapps/ImsTestService/src/com/android/phone/testapps/imstestapp/ImsTestServiceApp.java
+++ b/testapps/ImsTestService/src/com/android/phone/testapps/imstestapp/ImsTestServiceApp.java
@@ -19,6 +19,7 @@
 import android.app.Activity;
 import android.content.Intent;
 import android.os.Bundle;
+import android.os.UserHandle;
 import android.widget.Button;
 import android.widget.LinearLayout;
 
@@ -52,16 +53,16 @@
 
     private void launchRegistrationActivity() {
         Intent intent = new Intent(this, ImsRegistrationActivity.class);
-        startActivity(intent);
+        startActivityAsUser(intent, UserHandle.CURRENT);
     }
 
     private void launchCallingActivity() {
         Intent intent = new Intent(this, ImsCallingActivity.class);
-        startActivity(intent);
+        startActivityAsUser(intent, UserHandle.CURRENT);
     }
 
     private void launchConfigActivity() {
         Intent intent = new Intent(this, ImsConfigActivity.class);
-        startActivity(intent);
+        startActivityAsUser(intent, UserHandle.CURRENT);
     }
 }
diff --git a/testapps/SmsManagerTestApp/src/com/android/phone/testapps/smsmanagertestapp/SmsManagerTestApp.java b/testapps/SmsManagerTestApp/src/com/android/phone/testapps/smsmanagertestapp/SmsManagerTestApp.java
index cc3769e..6d3460b 100644
--- a/testapps/SmsManagerTestApp/src/com/android/phone/testapps/smsmanagertestapp/SmsManagerTestApp.java
+++ b/testapps/SmsManagerTestApp/src/com/android/phone/testapps/smsmanagertestapp/SmsManagerTestApp.java
@@ -24,6 +24,7 @@
 import android.content.Intent;
 import android.content.pm.PackageManager;
 import android.os.Bundle;
+import android.os.UserHandle;
 import android.telephony.SmsManager;
 import android.telephony.SubscriptionManager;
 import android.telephony.TelephonyManager;
@@ -184,7 +185,7 @@
         intent.setComponent(SETTINGS_SUB_PICK_ACTIVITY);
         intent.putExtra(DIALOG_TYPE_KEY, SMS_PICK);
         try {
-            startActivity(intent, null);
+            startActivityAsUser(intent, UserHandle.CURRENT);
         } catch (ActivityNotFoundException anfe) {
             // If Settings is not installed, only log the error as we do not want to break
             // legacy applications.
diff --git a/testapps/TelephonyManagerTestApp/src/com/android/phone/testapps/telephonymanagertestapp/TelephonyManagerTestApp.java b/testapps/TelephonyManagerTestApp/src/com/android/phone/testapps/telephonymanagertestapp/TelephonyManagerTestApp.java
index 815c7e8..d6e8e86 100644
--- a/testapps/TelephonyManagerTestApp/src/com/android/phone/testapps/telephonymanagertestapp/TelephonyManagerTestApp.java
+++ b/testapps/TelephonyManagerTestApp/src/com/android/phone/testapps/telephonymanagertestapp/TelephonyManagerTestApp.java
@@ -20,6 +20,7 @@
 import android.app.SearchManager;
 import android.content.Intent;
 import android.os.Bundle;
+import android.os.UserHandle;
 import android.telephony.TelephonyManager;
 import android.view.Menu;
 import android.view.View;
@@ -138,7 +139,7 @@
         sCurrentMethod = mFilteredMethods.get(position);
         Intent intent = new Intent(this, CallingMethodActivity.class);
 
-        startActivity(intent);
+        startActivityAsUser(intent, UserHandle.CURRENT);
     }
 
     @Override
diff --git a/testapps/TestRcsApp/TestApp/src/com/google/android/sample/rcsclient/ContactListActivity.java b/testapps/TestRcsApp/TestApp/src/com/google/android/sample/rcsclient/ContactListActivity.java
index b641606..362ec83 100644
--- a/testapps/TestRcsApp/TestApp/src/com/google/android/sample/rcsclient/ContactListActivity.java
+++ b/testapps/TestRcsApp/TestApp/src/com/google/android/sample/rcsclient/ContactListActivity.java
@@ -23,6 +23,7 @@
 import android.os.Bundle;
 import android.os.Handler;
 import android.os.Message;
+import android.os.UserHandle;
 import android.telephony.SubscriptionManager;
 import android.util.Log;
 import android.view.MenuItem;
@@ -77,7 +78,7 @@
         mStartChatButton = findViewById(R.id.start_chat_btn);
         mStartChatButton.setOnClickListener(view -> {
             Intent intent = new Intent(ContactListActivity.this, PhoneNumberActivity.class);
-            ContactListActivity.this.startActivity(intent);
+            ContactListActivity.this.startActivityAsUser(intent, UserHandle.CURRENT);
         });
         setButtonClickable(false);
 
@@ -187,7 +188,7 @@
                 Intent intent = new Intent(ContactListActivity.this, ChatActivity.class);
                 intent.putExtra(ChatActivity.EXTRA_REMOTE_PHONE_NUMBER,
                         mContactList.get(position).phoneNumber);
-                ContactListActivity.this.startActivity(intent);
+                ContactListActivity.this.startActivityAsUser(intent, UserHandle.CURRENT);
             });
         } else {
             mListview.setOnItemClickListener(null);
diff --git a/testapps/TestRcsApp/TestApp/src/com/google/android/sample/rcsclient/MainActivity.java b/testapps/TestRcsApp/TestApp/src/com/google/android/sample/rcsclient/MainActivity.java
index 5d2db73..7b9a7c4 100644
--- a/testapps/TestRcsApp/TestApp/src/com/google/android/sample/rcsclient/MainActivity.java
+++ b/testapps/TestRcsApp/TestApp/src/com/google/android/sample/rcsclient/MainActivity.java
@@ -21,6 +21,7 @@
 import android.content.pm.PackageInfo;
 import android.content.pm.PackageManager;
 import android.os.Bundle;
+import android.os.UserHandle;
 import android.text.TextUtils;
 import android.util.Log;
 import android.view.MenuItem;
@@ -62,30 +63,30 @@
         mCarrierLockModeListBtn = findViewById(R.id.setCarrierLockMode);
         mProvisionButton.setOnClickListener(view -> {
             Intent intent = new Intent(this, ProvisioningActivity.class);
-            MainActivity.this.startActivity(intent);
+            MainActivity.this.startActivityAsUser(intent, UserHandle.CURRENT);
         });
 
         mDelegateButton.setOnClickListener(view -> {
             Intent intent = new Intent(this, DelegateActivity.class);
-            MainActivity.this.startActivity(intent);
+            MainActivity.this.startActivityAsUser(intent, UserHandle.CURRENT);
         });
 
         mUceButton.setOnClickListener(view -> {
             Intent intent = new Intent(this, UceActivity.class);
-            MainActivity.this.startActivity(intent);
+            MainActivity.this.startActivityAsUser(intent, UserHandle.CURRENT);
         });
 
         mGbaButton.setOnClickListener(view -> {
             Intent intent = new Intent(this, GbaActivity.class);
-            MainActivity.this.startActivity(intent);
+            MainActivity.this.startActivityAsUser(intent, UserHandle.CURRENT);
         });
         mMessageClientButton.setOnClickListener(view -> {
             Intent intent = new Intent(this, ContactListActivity.class);
-            MainActivity.this.startActivity(intent);
+            MainActivity.this.startActivityAsUser(intent, UserHandle.CURRENT);
         });
         mFileUploadButton.setOnClickListener(view -> {
             Intent intent = new Intent(this, FileUploadActivity.class);
-            MainActivity.this.startActivity(intent);
+            MainActivity.this.startActivityAsUser(intent, UserHandle.CURRENT);
         });
 
         String appVersionName = getVersionCode(getPackageName());
@@ -97,7 +98,7 @@
 
         mCarrierLockModeListBtn.setOnClickListener(view -> {
             Intent intent = new Intent(this, CarrieLockModeListActivity.class);
-            MainActivity.this.startActivity(intent);
+            MainActivity.this.startActivityAsUser(intent, UserHandle.CURRENT);
         });
     }
 
diff --git a/testapps/TestRcsApp/TestApp/src/com/google/android/sample/rcsclient/PhoneNumberActivity.java b/testapps/TestRcsApp/TestApp/src/com/google/android/sample/rcsclient/PhoneNumberActivity.java
index b432979..34f63c9 100644
--- a/testapps/TestRcsApp/TestApp/src/com/google/android/sample/rcsclient/PhoneNumberActivity.java
+++ b/testapps/TestRcsApp/TestApp/src/com/google/android/sample/rcsclient/PhoneNumberActivity.java
@@ -18,6 +18,7 @@
 
 import android.content.Intent;
 import android.os.Bundle;
+import android.os.UserHandle;
 import android.util.Log;
 import android.view.MenuItem;
 import android.widget.Button;
@@ -51,7 +52,7 @@
             if (formattedNumber != null) {
                 Intent intent = new Intent(PhoneNumberActivity.this, ChatActivity.class);
                 intent.putExtra(ChatActivity.EXTRA_REMOTE_PHONE_NUMBER, formattedNumber);
-                PhoneNumberActivity.this.startActivity(intent);
+                PhoneNumberActivity.this.startActivityAsUser(intent, UserHandle.CURRENT);
             } else {
                 Toast.makeText(this, "Invalid Number format!",
                         Toast.LENGTH_LONG).show();
diff --git a/testapps/TestSatelliteApp/src/com/android/phone/testapps/satellitetestapp/Datagram.java b/testapps/TestSatelliteApp/src/com/android/phone/testapps/satellitetestapp/Datagram.java
index 6c0b227..9d34532 100644
--- a/testapps/TestSatelliteApp/src/com/android/phone/testapps/satellitetestapp/Datagram.java
+++ b/testapps/TestSatelliteApp/src/com/android/phone/testapps/satellitetestapp/Datagram.java
@@ -29,6 +29,7 @@
 import android.content.Intent;
 import android.content.SharedPreferences;
 import android.os.Bundle;
+import android.os.UserHandle;
 import android.telephony.satellite.EnableRequestAttributes;
 import android.telephony.satellite.PointingInfo;
 import android.telephony.satellite.SatelliteDatagram;
@@ -108,7 +109,8 @@
         findViewById(R.id.Back).setOnClickListener(new OnClickListener() {
             @Override
             public void onClick(View view) {
-                startActivity(new Intent(Datagram.this, SatelliteTestApp.class));
+                startActivityAsUser(new Intent(Datagram.this, SatelliteTestApp.class),
+                        UserHandle.CURRENT);
             }
         });
     }
diff --git a/testapps/TestSatelliteApp/src/com/android/phone/testapps/satellitetestapp/MultipleSendReceive.java b/testapps/TestSatelliteApp/src/com/android/phone/testapps/satellitetestapp/MultipleSendReceive.java
index 723f690..f8fd412 100644
--- a/testapps/TestSatelliteApp/src/com/android/phone/testapps/satellitetestapp/MultipleSendReceive.java
+++ b/testapps/TestSatelliteApp/src/com/android/phone/testapps/satellitetestapp/MultipleSendReceive.java
@@ -19,6 +19,7 @@
 import android.app.Activity;
 import android.content.Intent;
 import android.os.Bundle;
+import android.os.UserHandle;
 import android.telephony.satellite.EnableRequestAttributes;
 import android.telephony.satellite.SatelliteDatagram;
 import android.telephony.satellite.SatelliteManager;
@@ -56,7 +57,8 @@
         findViewById(R.id.Back).setOnClickListener(new OnClickListener() {
             @Override
             public void onClick(View view) {
-                startActivity(new Intent(MultipleSendReceive.this, SatelliteTestApp.class));
+                startActivityAsUser(new Intent(MultipleSendReceive.this, SatelliteTestApp.class),
+                        UserHandle.CURRENT);
             }
         });
     }
diff --git a/testapps/TestSatelliteApp/src/com/android/phone/testapps/satellitetestapp/NbIotSatellite.java b/testapps/TestSatelliteApp/src/com/android/phone/testapps/satellitetestapp/NbIotSatellite.java
index 17646f0..192f81a 100644
--- a/testapps/TestSatelliteApp/src/com/android/phone/testapps/satellitetestapp/NbIotSatellite.java
+++ b/testapps/TestSatelliteApp/src/com/android/phone/testapps/satellitetestapp/NbIotSatellite.java
@@ -24,6 +24,7 @@
 import android.content.SharedPreferences;
 import android.os.Bundle;
 import android.os.OutcomeReceiver;
+import android.os.UserHandle;
 import android.telephony.satellite.SatelliteManager;
 import android.telephony.satellite.SatelliteSupportedStateCallback;
 import android.util.Log;
@@ -69,7 +70,8 @@
         findViewById(R.id.Back).setOnClickListener(new OnClickListener() {
             @Override
             public void onClick(View view) {
-                startActivity(new Intent(NbIotSatellite.this, SatelliteTestApp.class));
+                startActivityAsUser(new Intent(NbIotSatellite.this, SatelliteTestApp.class),
+                        UserHandle.CURRENT);
             }
         });
 
diff --git a/testapps/TestSatelliteApp/src/com/android/phone/testapps/satellitetestapp/Provisioning.java b/testapps/TestSatelliteApp/src/com/android/phone/testapps/satellitetestapp/Provisioning.java
index 15c8fd8..da4070e 100644
--- a/testapps/TestSatelliteApp/src/com/android/phone/testapps/satellitetestapp/Provisioning.java
+++ b/testapps/TestSatelliteApp/src/com/android/phone/testapps/satellitetestapp/Provisioning.java
@@ -22,6 +22,7 @@
 import android.os.Bundle;
 import android.os.CancellationSignal;
 import android.os.OutcomeReceiver;
+import android.os.UserHandle;
 import android.telephony.satellite.SatelliteManager;
 import android.telephony.satellite.SatelliteProvisionStateCallback;
 import android.telephony.satellite.stub.SatelliteResult;
@@ -69,7 +70,8 @@
         findViewById(R.id.Back).setOnClickListener(new OnClickListener() {
             @Override
             public void onClick(View view) {
-                startActivity(new Intent(Provisioning.this, SatelliteTestApp.class));
+                startActivityAsUser(new Intent(Provisioning.this, SatelliteTestApp.class),
+                        UserHandle.CURRENT);
             }
         });
     }
diff --git a/testapps/TestSatelliteApp/src/com/android/phone/testapps/satellitetestapp/SatelliteControl.java b/testapps/TestSatelliteApp/src/com/android/phone/testapps/satellitetestapp/SatelliteControl.java
index 379fc74..efad3aa 100644
--- a/testapps/TestSatelliteApp/src/com/android/phone/testapps/satellitetestapp/SatelliteControl.java
+++ b/testapps/TestSatelliteApp/src/com/android/phone/testapps/satellitetestapp/SatelliteControl.java
@@ -20,6 +20,7 @@
 import android.content.Intent;
 import android.os.Bundle;
 import android.os.OutcomeReceiver;
+import android.os.UserHandle;
 import android.telephony.SubscriptionInfo;
 import android.telephony.SubscriptionManager;
 import android.telephony.satellite.EnableRequestAttributes;
@@ -95,7 +96,8 @@
         findViewById(R.id.Back).setOnClickListener(new OnClickListener() {
             @Override
             public void onClick(View view) {
-                startActivity(new Intent(SatelliteControl.this, SatelliteTestApp.class));
+                startActivityAsUser(new Intent(SatelliteControl.this, SatelliteTestApp.class),
+                        UserHandle.CURRENT);
             }
         });
     }
diff --git a/testapps/TestSatelliteApp/src/com/android/phone/testapps/satellitetestapp/SatelliteTestApp.java b/testapps/TestSatelliteApp/src/com/android/phone/testapps/satellitetestapp/SatelliteTestApp.java
index 7c4ae00..d686cd6 100644
--- a/testapps/TestSatelliteApp/src/com/android/phone/testapps/satellitetestapp/SatelliteTestApp.java
+++ b/testapps/TestSatelliteApp/src/com/android/phone/testapps/satellitetestapp/SatelliteTestApp.java
@@ -23,6 +23,7 @@
 import android.content.ServiceConnection;
 import android.os.Bundle;
 import android.os.IBinder;
+import android.os.UserHandle;
 import android.telephony.satellite.stub.SatelliteDatagram;
 import android.util.Log;
 import android.view.View;
@@ -58,49 +59,49 @@
             @Override
             public void onClick(View view) {
                 Intent intent = new Intent(SatelliteTestApp.this, SatelliteControl.class);
-                startActivity(intent);
+                startActivityAsUser(intent, UserHandle.CURRENT);
             }
         });
         findViewById(R.id.Datagram).setOnClickListener(new OnClickListener() {
             @Override
             public void onClick(View view) {
                 Intent intent = new Intent(SatelliteTestApp.this, Datagram.class);
-                startActivity(intent);
+                startActivityAsUser(intent, UserHandle.CURRENT);
             }
         });
         findViewById(R.id.Provisioning).setOnClickListener(new OnClickListener() {
             @Override
             public void onClick(View view) {
                 Intent intent = new Intent(SatelliteTestApp.this, Provisioning.class);
-                startActivity(intent);
+                startActivityAsUser(intent, UserHandle.CURRENT);
             }
         });
         findViewById(R.id.MultipleSendReceive).setOnClickListener(new OnClickListener() {
             @Override
             public void onClick(View view) {
                 Intent intent = new Intent(SatelliteTestApp.this, MultipleSendReceive.class);
-                startActivity(intent);
+                startActivityAsUser(intent, UserHandle.CURRENT);
             }
         });
         findViewById(R.id.SendReceive).setOnClickListener(new OnClickListener() {
             @Override
             public void onClick(View view) {
                 Intent intent = new Intent(SatelliteTestApp.this, SendReceive.class);
-                startActivity(intent);
+                startActivityAsUser(intent, UserHandle.CURRENT);
             }
         });
         findViewById(R.id.NbIotSatellite).setOnClickListener(new OnClickListener() {
             @Override
             public void onClick(View view) {
                 Intent intent = new Intent(SatelliteTestApp.this, NbIotSatellite.class);
-                startActivity(intent);
+                startActivityAsUser(intent, UserHandle.CURRENT);
             }
         });
         findViewById(R.id.TestSatelliteWrapper).setOnClickListener(new OnClickListener() {
             @Override
             public void onClick(View view) {
                 Intent intent = new Intent(SatelliteTestApp.this, TestSatelliteWrapper.class);
-                startActivity(intent);
+                startActivityAsUser(intent, UserHandle.CURRENT);
             }
         });
     }
diff --git a/testapps/TestSatelliteApp/src/com/android/phone/testapps/satellitetestapp/SendReceive.java b/testapps/TestSatelliteApp/src/com/android/phone/testapps/satellitetestapp/SendReceive.java
index ede2377..5ce2b65 100644
--- a/testapps/TestSatelliteApp/src/com/android/phone/testapps/satellitetestapp/SendReceive.java
+++ b/testapps/TestSatelliteApp/src/com/android/phone/testapps/satellitetestapp/SendReceive.java
@@ -21,6 +21,7 @@
 import android.os.Bundle;
 import android.os.CancellationSignal;
 import android.os.OutcomeReceiver;
+import android.os.UserHandle;
 import android.telephony.satellite.EnableRequestAttributes;
 import android.telephony.satellite.PointingInfo;
 import android.telephony.satellite.SatelliteCapabilities;
@@ -72,7 +73,8 @@
         findViewById(R.id.Back).setOnClickListener(new OnClickListener() {
             @Override
             public void onClick(View view) {
-                startActivity(new Intent(SendReceive.this, SatelliteTestApp.class));
+                startActivityAsUser(new Intent(SendReceive.this, SatelliteTestApp.class),
+                        UserHandle.CURRENT);
             }
         });
     }
diff --git a/testapps/TestSatelliteApp/src/com/android/phone/testapps/satellitetestapp/TestSatelliteWrapper.java b/testapps/TestSatelliteApp/src/com/android/phone/testapps/satellitetestapp/TestSatelliteWrapper.java
index d8e6e7c..ff1c5fa 100644
--- a/testapps/TestSatelliteApp/src/com/android/phone/testapps/satellitetestapp/TestSatelliteWrapper.java
+++ b/testapps/TestSatelliteApp/src/com/android/phone/testapps/satellitetestapp/TestSatelliteWrapper.java
@@ -21,6 +21,7 @@
 import android.content.Intent;
 import android.os.Bundle;
 import android.os.OutcomeReceiver;
+import android.os.UserHandle;
 import android.telephony.SubscriptionInfo;
 import android.telephony.SubscriptionManager;
 import android.telephony.satellite.wrapper.CarrierRoamingNtnModeListenerWrapper2;
@@ -121,7 +122,8 @@
         findViewById(R.id.Back).setOnClickListener(new OnClickListener() {
             @Override
             public void onClick(View view) {
-                startActivity(new Intent(TestSatelliteWrapper.this, SatelliteTestApp.class));
+                startActivityAsUser(new Intent(TestSatelliteWrapper.this, SatelliteTestApp.class),
+                        UserHandle.CURRENT);
             }
         });
         findViewById(R.id.ClearLog).setOnClickListener(new OnClickListener() {
diff --git a/tests/src/com/android/TestContext.java b/tests/src/com/android/TestContext.java
index a96ce2e..e464ad5 100644
--- a/tests/src/com/android/TestContext.java
+++ b/tests/src/com/android/TestContext.java
@@ -33,6 +33,7 @@
 import android.os.Looper;
 import android.os.PersistableBundle;
 import android.os.Process;
+import android.os.UserHandle;
 import android.os.UserManager;
 import android.telecom.TelecomManager;
 import android.telephony.CarrierConfigManager;
@@ -112,6 +113,11 @@
     }
 
     @Override
+    public void startActivityAsUser(Intent intent, UserHandle user) {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
     public void sendBroadcast(Intent intent) {
         mIntent = intent;
     }
diff --git a/tests/src/com/android/phone/tests/CallDialTest.java b/tests/src/com/android/phone/tests/CallDialTest.java
index 6e78be0..cafa7f2 100644
--- a/tests/src/com/android/phone/tests/CallDialTest.java
+++ b/tests/src/com/android/phone/tests/CallDialTest.java
@@ -22,6 +22,7 @@
 import android.net.Uri;
 import android.os.Bundle;
 import android.os.RemoteException;
+import android.os.UserHandle;
 import android.telecom.PhoneAccount;
 import android.telephony.PhoneNumberUtils;
 import android.telephony.TelephonyFrameworkInitializer;
@@ -136,13 +137,13 @@
         log("==> intent: " + intent);
 
         try {
-            startActivity(intent);
+            startActivityAsUser(intent, UserHandle.CURRENT);
             Toast.makeText(this, "Starting activity...", Toast.LENGTH_SHORT).show();
         } catch (ActivityNotFoundException e) {
             Log.w(LOG_TAG, "testCall: ActivityNotFoundException for intent: " + intent);
             Toast.makeText(this, e.toString(), Toast.LENGTH_LONG).show();
         } catch (Exception e) {
-            Log.w(LOG_TAG, "testCall: Unexpected exception from startActivity(): " + e);
+            Log.w(LOG_TAG, "testCall: Unexpected exception from startActivityAsUser(): " + e);
             Toast.makeText(this, e.toString(), Toast.LENGTH_LONG).show();
         }
     }
diff --git a/tests/src/com/android/services/telephony/TelephonyConnectionServiceTest.java b/tests/src/com/android/services/telephony/TelephonyConnectionServiceTest.java
index 6eb9416..463e9ae 100644
--- a/tests/src/com/android/services/telephony/TelephonyConnectionServiceTest.java
+++ b/tests/src/com/android/services/telephony/TelephonyConnectionServiceTest.java
@@ -1347,7 +1347,7 @@
         callback.getValue().onComplete(null, true);
 
         try {
-            doAnswer(invocation -> null).when(mContext).startActivity(any());
+            doAnswer(invocation -> null).when(mContext).startActivityAsUser(any(), any());
             verify(testPhone).dial(anyString(), any(), any());
         } catch (CallStateException e) {
             // This shouldn't happen
@@ -1462,7 +1462,7 @@
         callback.getValue().onComplete(null, true);
 
         try {
-            doAnswer(invocation -> null).when(mContext).startActivity(any());
+            doAnswer(invocation -> null).when(mContext).startActivityAsUser(any(), any());
             verify(testPhone).dial(anyString(), any(), any());
         } catch (CallStateException e) {
             // This shouldn't happen
@@ -2158,7 +2158,7 @@
             throws Exception {
         setupForCallTest();
         when(mTelephonyManagerProxy.isConcurrentCallsPossible()).thenReturn(true);
-        doNothing().when(mContext).startActivity(any());
+        doNothing().when(mContext).startActivityAsUser(any(), any());
 
         mBinderStub.createConnection(PHONE_ACCOUNT_HANDLE_1, "TC@1",
                 new ConnectionRequest(PHONE_ACCOUNT_HANDLE_1, Uri.parse("tel:16505551212"),
@@ -2191,7 +2191,7 @@
             throws Exception {
         setupForCallTest();
         when(mTelephonyManagerProxy.isConcurrentCallsPossible()).thenReturn(true);
-        doNothing().when(mContext).startActivity(any());
+        doNothing().when(mContext).startActivityAsUser(any(), any());
 
         doReturn(true).when(mTelephonyManagerProxy).isCurrentEmergencyNumber(anyString());
         mBinderStub.createConnection(PHONE_ACCOUNT_HANDLE_1, "TC@1",
@@ -2227,7 +2227,7 @@
             throws Exception {
         setupForCallTest();
         when(mTelephonyManagerProxy.isConcurrentCallsPossible()).thenReturn(true);
-        doNothing().when(mContext).startActivity(any());
+        doNothing().when(mContext).startActivityAsUser(any(), any());
 
         doReturn(true).when(mTelephonyManagerProxy).isCurrentEmergencyNumber(anyString());
         getTestContext().getCarrierConfig(0 /*subId*/).putBoolean(
@@ -3682,7 +3682,7 @@
     @Test
     public void testDomainSelectionWithMmiCode() {
         //UT domain selection should not be handled by new domain selector.
-        doNothing().when(mContext).startActivity(any());
+        doNothing().when(mContext).startActivityAsUser(any(), any());
         setupForCallTest();
         setupForDialForDomainSelection(mPhone0, 0, false);
         mTestConnectionService.onCreateOutgoingConnection(PHONE_ACCOUNT_HANDLE_1,