Loading core/java/android/content/pm/CrossProfileApps.java +5 −1 Original line number Original line Diff line number Diff line Loading @@ -64,7 +64,11 @@ public class CrossProfileApps { public void startMainActivity(@NonNull ComponentName component, public void startMainActivity(@NonNull ComponentName component, @NonNull UserHandle targetUser) { @NonNull UserHandle targetUser) { try { try { mService.startActivityAsUser(mContext.getPackageName(), component, targetUser); mService.startActivityAsUser( mContext.getIApplicationThread(), mContext.getPackageName(), component, targetUser); } catch (RemoteException ex) { } catch (RemoteException ex) { throw ex.rethrowFromSystemServer(); throw ex.rethrowFromSystemServer(); } } Loading core/java/android/content/pm/ICrossProfileApps.aidl +3 −2 Original line number Original line Diff line number Diff line Loading @@ -16,6 +16,7 @@ package android.content.pm; package android.content.pm; import android.app.IApplicationThread; import android.content.ComponentName; import android.content.ComponentName; import android.content.Intent; import android.content.Intent; import android.graphics.Rect; import android.graphics.Rect; Loading @@ -26,7 +27,7 @@ import android.os.UserHandle; * @hide * @hide */ */ interface ICrossProfileApps { interface ICrossProfileApps { void startActivityAsUser(in String callingPackage, in ComponentName component, void startActivityAsUser(in IApplicationThread caller, in String callingPackage, in UserHandle user); in ComponentName component, in UserHandle user); List<UserHandle> getTargetUserProfiles(in String callingPackage); List<UserHandle> getTargetUserProfiles(in String callingPackage); } } No newline at end of file services/core/java/com/android/server/pm/CrossProfileAppsServiceImpl.java +15 −9 Original line number Original line Diff line number Diff line Loading @@ -19,8 +19,10 @@ import static android.content.pm.PackageManager.MATCH_DIRECT_BOOT_AWARE; import static android.content.pm.PackageManager.MATCH_DIRECT_BOOT_UNAWARE; import static android.content.pm.PackageManager.MATCH_DIRECT_BOOT_UNAWARE; import android.annotation.UserIdInt; import android.annotation.UserIdInt; import android.app.ActivityManagerInternal; import android.app.ActivityOptions; import android.app.ActivityOptions; import android.app.AppOpsManager; import android.app.AppOpsManager; import android.app.IApplicationThread; import android.content.ComponentName; import android.content.ComponentName; import android.content.Context; import android.content.Context; import android.content.Intent; import android.content.Intent; Loading Loading @@ -71,6 +73,7 @@ public class CrossProfileAppsServiceImpl extends ICrossProfileApps.Stub { @Override @Override public void startActivityAsUser( public void startActivityAsUser( IApplicationThread caller, String callingPackage, String callingPackage, ComponentName component, ComponentName component, UserHandle user) throws RemoteException { UserHandle user) throws RemoteException { Loading Loading @@ -107,15 +110,12 @@ public class CrossProfileAppsServiceImpl extends ICrossProfileApps.Stub { launchIntent.setPackage(component.getPackageName()); launchIntent.setPackage(component.getPackageName()); verifyActivityCanHandleIntentAndExported(launchIntent, component, callingUid, user); verifyActivityCanHandleIntentAndExported(launchIntent, component, callingUid, user); final long ident = mInjector.clearCallingIdentity(); try { launchIntent.setPackage(null); launchIntent.setPackage(null); launchIntent.setComponent(component); launchIntent.setComponent(component); mContext.startActivityAsUser(launchIntent, mInjector.getActivityManagerInternal().startActivityAsUser( ActivityOptions.makeOpenCrossProfileAppsAnimation().toBundle(), user); caller, callingPackage, launchIntent, } finally { ActivityOptions.makeOpenCrossProfileAppsAnimation().toBundle(), mInjector.restoreCallingIdentity(ident); user.getIdentifier()); } } } private List<UserHandle> getTargetUserProfilesUnchecked( private List<UserHandle> getTargetUserProfilesUnchecked( Loading Loading @@ -236,6 +236,11 @@ public class CrossProfileAppsServiceImpl extends ICrossProfileApps.Stub { public AppOpsManager getAppOpsManager() { public AppOpsManager getAppOpsManager() { return mContext.getSystemService(AppOpsManager.class); return mContext.getSystemService(AppOpsManager.class); } } @Override public ActivityManagerInternal getActivityManagerInternal() { return LocalServices.getService(ActivityManagerInternal.class); } } } @VisibleForTesting @VisibleForTesting Loading @@ -258,5 +263,6 @@ public class CrossProfileAppsServiceImpl extends ICrossProfileApps.Stub { AppOpsManager getAppOpsManager(); AppOpsManager getAppOpsManager(); ActivityManagerInternal getActivityManagerInternal(); } } } } services/tests/servicestests/src/com/android/server/pm/CrossProfileAppsServiceImplTest.java +45 −14 Original line number Original line Diff line number Diff line Loading @@ -13,7 +13,9 @@ import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; import static org.mockito.Mockito.when; import static org.testng.Assert.assertThrows; import static org.testng.Assert.assertThrows; import android.app.ActivityManagerInternal; import android.app.AppOpsManager; import android.app.AppOpsManager; import android.app.IApplicationThread; import android.content.ComponentName; import android.content.ComponentName; import android.content.Context; import android.content.Context; import android.content.Intent; import android.content.Intent; Loading Loading @@ -68,10 +70,13 @@ public class CrossProfileAppsServiceImplTest { private PackageManagerInternal mPackageManagerInternal; private PackageManagerInternal mPackageManagerInternal; @Mock @Mock private AppOpsManager mAppOpsManager; private AppOpsManager mAppOpsManager; @Mock private ActivityManagerInternal mActivityManagerInternal; private TestInjector mTestInjector; private TestInjector mTestInjector; private ActivityInfo mActivityInfo; private ActivityInfo mActivityInfo; private CrossProfileAppsServiceImpl mCrossProfileAppsServiceImpl; private CrossProfileAppsServiceImpl mCrossProfileAppsServiceImpl; private IApplicationThread mIApplicationThread; private SparseArray<Boolean> mUserEnabled = new SparseArray<>(); private SparseArray<Boolean> mUserEnabled = new SparseArray<>(); Loading Loading @@ -200,15 +205,18 @@ public class CrossProfileAppsServiceImplTest { SecurityException.class, SecurityException.class, () -> () -> mCrossProfileAppsServiceImpl.startActivityAsUser( mCrossProfileAppsServiceImpl.startActivityAsUser( mIApplicationThread, PACKAGE_ONE, PACKAGE_ONE, ACTIVITY_COMPONENT, ACTIVITY_COMPONENT, UserHandle.of(PRIMARY_USER))); UserHandle.of(PRIMARY_USER))); verify(mContext, never()) verify(mActivityManagerInternal, never()) .startActivityAsUser( .startActivityAsUser( nullable(IApplicationThread.class), anyString(), any(Intent.class), any(Intent.class), nullable(Bundle.class), nullable(Bundle.class), any(UserHandle.class)); anyInt()); } } @Test @Test Loading @@ -219,15 +227,18 @@ public class CrossProfileAppsServiceImplTest { SecurityException.class, SecurityException.class, () -> () -> mCrossProfileAppsServiceImpl.startActivityAsUser( mCrossProfileAppsServiceImpl.startActivityAsUser( mIApplicationThread, PACKAGE_ONE, PACKAGE_ONE, ACTIVITY_COMPONENT, ACTIVITY_COMPONENT, UserHandle.of(PROFILE_OF_PRIMARY_USER))); UserHandle.of(PROFILE_OF_PRIMARY_USER))); verify(mContext, never()) verify(mActivityManagerInternal, never()) .startActivityAsUser( .startActivityAsUser( nullable(IApplicationThread.class), anyString(), any(Intent.class), any(Intent.class), nullable(Bundle.class), nullable(Bundle.class), any(UserHandle.class)); anyInt()); } } @Test @Test Loading @@ -236,15 +247,18 @@ public class CrossProfileAppsServiceImplTest { SecurityException.class, SecurityException.class, () -> () -> mCrossProfileAppsServiceImpl.startActivityAsUser( mCrossProfileAppsServiceImpl.startActivityAsUser( mIApplicationThread, PACKAGE_TWO, PACKAGE_TWO, ACTIVITY_COMPONENT, ACTIVITY_COMPONENT, UserHandle.of(PROFILE_OF_PRIMARY_USER))); UserHandle.of(PROFILE_OF_PRIMARY_USER))); verify(mContext, never()) verify(mActivityManagerInternal, never()) .startActivityAsUser( .startActivityAsUser( nullable(IApplicationThread.class), anyString(), any(Intent.class), any(Intent.class), nullable(Bundle.class), nullable(Bundle.class), any(UserHandle.class)); anyInt()); } } @Test @Test Loading @@ -255,15 +269,18 @@ public class CrossProfileAppsServiceImplTest { SecurityException.class, SecurityException.class, () -> () -> mCrossProfileAppsServiceImpl.startActivityAsUser( mCrossProfileAppsServiceImpl.startActivityAsUser( mIApplicationThread, PACKAGE_ONE, PACKAGE_ONE, ACTIVITY_COMPONENT, ACTIVITY_COMPONENT, UserHandle.of(PROFILE_OF_PRIMARY_USER))); UserHandle.of(PROFILE_OF_PRIMARY_USER))); verify(mContext, never()) verify(mActivityManagerInternal, never()) .startActivityAsUser( .startActivityAsUser( nullable(IApplicationThread.class), anyString(), any(Intent.class), any(Intent.class), nullable(Bundle.class), nullable(Bundle.class), any(UserHandle.class)); anyInt()); } } @Test @Test Loading @@ -272,15 +289,18 @@ public class CrossProfileAppsServiceImplTest { SecurityException.class, SecurityException.class, () -> () -> mCrossProfileAppsServiceImpl.startActivityAsUser( mCrossProfileAppsServiceImpl.startActivityAsUser( mIApplicationThread, PACKAGE_ONE, PACKAGE_ONE, new ComponentName(PACKAGE_TWO, "test"), new ComponentName(PACKAGE_TWO, "test"), UserHandle.of(PROFILE_OF_PRIMARY_USER))); UserHandle.of(PROFILE_OF_PRIMARY_USER))); verify(mContext, never()) verify(mActivityManagerInternal, never()) .startActivityAsUser( .startActivityAsUser( nullable(IApplicationThread.class), anyString(), any(Intent.class), any(Intent.class), nullable(Bundle.class), nullable(Bundle.class), any(UserHandle.class)); anyInt()); } } @Test @Test Loading @@ -289,15 +309,18 @@ public class CrossProfileAppsServiceImplTest { SecurityException.class, SecurityException.class, () -> () -> mCrossProfileAppsServiceImpl.startActivityAsUser( mCrossProfileAppsServiceImpl.startActivityAsUser( mIApplicationThread, PACKAGE_ONE, PACKAGE_ONE, ACTIVITY_COMPONENT, ACTIVITY_COMPONENT, UserHandle.of(SECONDARY_USER))); UserHandle.of(SECONDARY_USER))); verify(mContext, never()) verify(mActivityManagerInternal, never()) .startActivityAsUser( .startActivityAsUser( nullable(IApplicationThread.class), anyString(), any(Intent.class), any(Intent.class), nullable(Bundle.class), nullable(Bundle.class), any(UserHandle.class)); anyInt()); } } @Test @Test Loading @@ -305,15 +328,18 @@ public class CrossProfileAppsServiceImplTest { mTestInjector.setCallingUserId(PROFILE_OF_PRIMARY_USER); mTestInjector.setCallingUserId(PROFILE_OF_PRIMARY_USER); mCrossProfileAppsServiceImpl.startActivityAsUser( mCrossProfileAppsServiceImpl.startActivityAsUser( mIApplicationThread, PACKAGE_ONE, PACKAGE_ONE, ACTIVITY_COMPONENT, ACTIVITY_COMPONENT, UserHandle.of(PRIMARY_USER)); UserHandle.of(PRIMARY_USER)); verify(mContext) verify(mActivityManagerInternal) .startActivityAsUser( .startActivityAsUser( nullable(IApplicationThread.class), eq(PACKAGE_ONE), any(Intent.class), any(Intent.class), nullable(Bundle.class), nullable(Bundle.class), eq(UserHandle.of(PRIMARY_USER))); eq(PRIMARY_USER)); } } private void mockAppsInstalled(String packageName, int user, boolean installed) { private void mockAppsInstalled(String packageName, int user, boolean installed) { Loading Loading @@ -401,5 +427,10 @@ public class CrossProfileAppsServiceImplTest { public AppOpsManager getAppOpsManager() { public AppOpsManager getAppOpsManager() { return mAppOpsManager; return mAppOpsManager; } } @Override public ActivityManagerInternal getActivityManagerInternal() { return mActivityManagerInternal; } } } } } Loading
core/java/android/content/pm/CrossProfileApps.java +5 −1 Original line number Original line Diff line number Diff line Loading @@ -64,7 +64,11 @@ public class CrossProfileApps { public void startMainActivity(@NonNull ComponentName component, public void startMainActivity(@NonNull ComponentName component, @NonNull UserHandle targetUser) { @NonNull UserHandle targetUser) { try { try { mService.startActivityAsUser(mContext.getPackageName(), component, targetUser); mService.startActivityAsUser( mContext.getIApplicationThread(), mContext.getPackageName(), component, targetUser); } catch (RemoteException ex) { } catch (RemoteException ex) { throw ex.rethrowFromSystemServer(); throw ex.rethrowFromSystemServer(); } } Loading
core/java/android/content/pm/ICrossProfileApps.aidl +3 −2 Original line number Original line Diff line number Diff line Loading @@ -16,6 +16,7 @@ package android.content.pm; package android.content.pm; import android.app.IApplicationThread; import android.content.ComponentName; import android.content.ComponentName; import android.content.Intent; import android.content.Intent; import android.graphics.Rect; import android.graphics.Rect; Loading @@ -26,7 +27,7 @@ import android.os.UserHandle; * @hide * @hide */ */ interface ICrossProfileApps { interface ICrossProfileApps { void startActivityAsUser(in String callingPackage, in ComponentName component, void startActivityAsUser(in IApplicationThread caller, in String callingPackage, in UserHandle user); in ComponentName component, in UserHandle user); List<UserHandle> getTargetUserProfiles(in String callingPackage); List<UserHandle> getTargetUserProfiles(in String callingPackage); } } No newline at end of file
services/core/java/com/android/server/pm/CrossProfileAppsServiceImpl.java +15 −9 Original line number Original line Diff line number Diff line Loading @@ -19,8 +19,10 @@ import static android.content.pm.PackageManager.MATCH_DIRECT_BOOT_AWARE; import static android.content.pm.PackageManager.MATCH_DIRECT_BOOT_UNAWARE; import static android.content.pm.PackageManager.MATCH_DIRECT_BOOT_UNAWARE; import android.annotation.UserIdInt; import android.annotation.UserIdInt; import android.app.ActivityManagerInternal; import android.app.ActivityOptions; import android.app.ActivityOptions; import android.app.AppOpsManager; import android.app.AppOpsManager; import android.app.IApplicationThread; import android.content.ComponentName; import android.content.ComponentName; import android.content.Context; import android.content.Context; import android.content.Intent; import android.content.Intent; Loading Loading @@ -71,6 +73,7 @@ public class CrossProfileAppsServiceImpl extends ICrossProfileApps.Stub { @Override @Override public void startActivityAsUser( public void startActivityAsUser( IApplicationThread caller, String callingPackage, String callingPackage, ComponentName component, ComponentName component, UserHandle user) throws RemoteException { UserHandle user) throws RemoteException { Loading Loading @@ -107,15 +110,12 @@ public class CrossProfileAppsServiceImpl extends ICrossProfileApps.Stub { launchIntent.setPackage(component.getPackageName()); launchIntent.setPackage(component.getPackageName()); verifyActivityCanHandleIntentAndExported(launchIntent, component, callingUid, user); verifyActivityCanHandleIntentAndExported(launchIntent, component, callingUid, user); final long ident = mInjector.clearCallingIdentity(); try { launchIntent.setPackage(null); launchIntent.setPackage(null); launchIntent.setComponent(component); launchIntent.setComponent(component); mContext.startActivityAsUser(launchIntent, mInjector.getActivityManagerInternal().startActivityAsUser( ActivityOptions.makeOpenCrossProfileAppsAnimation().toBundle(), user); caller, callingPackage, launchIntent, } finally { ActivityOptions.makeOpenCrossProfileAppsAnimation().toBundle(), mInjector.restoreCallingIdentity(ident); user.getIdentifier()); } } } private List<UserHandle> getTargetUserProfilesUnchecked( private List<UserHandle> getTargetUserProfilesUnchecked( Loading Loading @@ -236,6 +236,11 @@ public class CrossProfileAppsServiceImpl extends ICrossProfileApps.Stub { public AppOpsManager getAppOpsManager() { public AppOpsManager getAppOpsManager() { return mContext.getSystemService(AppOpsManager.class); return mContext.getSystemService(AppOpsManager.class); } } @Override public ActivityManagerInternal getActivityManagerInternal() { return LocalServices.getService(ActivityManagerInternal.class); } } } @VisibleForTesting @VisibleForTesting Loading @@ -258,5 +263,6 @@ public class CrossProfileAppsServiceImpl extends ICrossProfileApps.Stub { AppOpsManager getAppOpsManager(); AppOpsManager getAppOpsManager(); ActivityManagerInternal getActivityManagerInternal(); } } } }
services/tests/servicestests/src/com/android/server/pm/CrossProfileAppsServiceImplTest.java +45 −14 Original line number Original line Diff line number Diff line Loading @@ -13,7 +13,9 @@ import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; import static org.mockito.Mockito.when; import static org.testng.Assert.assertThrows; import static org.testng.Assert.assertThrows; import android.app.ActivityManagerInternal; import android.app.AppOpsManager; import android.app.AppOpsManager; import android.app.IApplicationThread; import android.content.ComponentName; import android.content.ComponentName; import android.content.Context; import android.content.Context; import android.content.Intent; import android.content.Intent; Loading Loading @@ -68,10 +70,13 @@ public class CrossProfileAppsServiceImplTest { private PackageManagerInternal mPackageManagerInternal; private PackageManagerInternal mPackageManagerInternal; @Mock @Mock private AppOpsManager mAppOpsManager; private AppOpsManager mAppOpsManager; @Mock private ActivityManagerInternal mActivityManagerInternal; private TestInjector mTestInjector; private TestInjector mTestInjector; private ActivityInfo mActivityInfo; private ActivityInfo mActivityInfo; private CrossProfileAppsServiceImpl mCrossProfileAppsServiceImpl; private CrossProfileAppsServiceImpl mCrossProfileAppsServiceImpl; private IApplicationThread mIApplicationThread; private SparseArray<Boolean> mUserEnabled = new SparseArray<>(); private SparseArray<Boolean> mUserEnabled = new SparseArray<>(); Loading Loading @@ -200,15 +205,18 @@ public class CrossProfileAppsServiceImplTest { SecurityException.class, SecurityException.class, () -> () -> mCrossProfileAppsServiceImpl.startActivityAsUser( mCrossProfileAppsServiceImpl.startActivityAsUser( mIApplicationThread, PACKAGE_ONE, PACKAGE_ONE, ACTIVITY_COMPONENT, ACTIVITY_COMPONENT, UserHandle.of(PRIMARY_USER))); UserHandle.of(PRIMARY_USER))); verify(mContext, never()) verify(mActivityManagerInternal, never()) .startActivityAsUser( .startActivityAsUser( nullable(IApplicationThread.class), anyString(), any(Intent.class), any(Intent.class), nullable(Bundle.class), nullable(Bundle.class), any(UserHandle.class)); anyInt()); } } @Test @Test Loading @@ -219,15 +227,18 @@ public class CrossProfileAppsServiceImplTest { SecurityException.class, SecurityException.class, () -> () -> mCrossProfileAppsServiceImpl.startActivityAsUser( mCrossProfileAppsServiceImpl.startActivityAsUser( mIApplicationThread, PACKAGE_ONE, PACKAGE_ONE, ACTIVITY_COMPONENT, ACTIVITY_COMPONENT, UserHandle.of(PROFILE_OF_PRIMARY_USER))); UserHandle.of(PROFILE_OF_PRIMARY_USER))); verify(mContext, never()) verify(mActivityManagerInternal, never()) .startActivityAsUser( .startActivityAsUser( nullable(IApplicationThread.class), anyString(), any(Intent.class), any(Intent.class), nullable(Bundle.class), nullable(Bundle.class), any(UserHandle.class)); anyInt()); } } @Test @Test Loading @@ -236,15 +247,18 @@ public class CrossProfileAppsServiceImplTest { SecurityException.class, SecurityException.class, () -> () -> mCrossProfileAppsServiceImpl.startActivityAsUser( mCrossProfileAppsServiceImpl.startActivityAsUser( mIApplicationThread, PACKAGE_TWO, PACKAGE_TWO, ACTIVITY_COMPONENT, ACTIVITY_COMPONENT, UserHandle.of(PROFILE_OF_PRIMARY_USER))); UserHandle.of(PROFILE_OF_PRIMARY_USER))); verify(mContext, never()) verify(mActivityManagerInternal, never()) .startActivityAsUser( .startActivityAsUser( nullable(IApplicationThread.class), anyString(), any(Intent.class), any(Intent.class), nullable(Bundle.class), nullable(Bundle.class), any(UserHandle.class)); anyInt()); } } @Test @Test Loading @@ -255,15 +269,18 @@ public class CrossProfileAppsServiceImplTest { SecurityException.class, SecurityException.class, () -> () -> mCrossProfileAppsServiceImpl.startActivityAsUser( mCrossProfileAppsServiceImpl.startActivityAsUser( mIApplicationThread, PACKAGE_ONE, PACKAGE_ONE, ACTIVITY_COMPONENT, ACTIVITY_COMPONENT, UserHandle.of(PROFILE_OF_PRIMARY_USER))); UserHandle.of(PROFILE_OF_PRIMARY_USER))); verify(mContext, never()) verify(mActivityManagerInternal, never()) .startActivityAsUser( .startActivityAsUser( nullable(IApplicationThread.class), anyString(), any(Intent.class), any(Intent.class), nullable(Bundle.class), nullable(Bundle.class), any(UserHandle.class)); anyInt()); } } @Test @Test Loading @@ -272,15 +289,18 @@ public class CrossProfileAppsServiceImplTest { SecurityException.class, SecurityException.class, () -> () -> mCrossProfileAppsServiceImpl.startActivityAsUser( mCrossProfileAppsServiceImpl.startActivityAsUser( mIApplicationThread, PACKAGE_ONE, PACKAGE_ONE, new ComponentName(PACKAGE_TWO, "test"), new ComponentName(PACKAGE_TWO, "test"), UserHandle.of(PROFILE_OF_PRIMARY_USER))); UserHandle.of(PROFILE_OF_PRIMARY_USER))); verify(mContext, never()) verify(mActivityManagerInternal, never()) .startActivityAsUser( .startActivityAsUser( nullable(IApplicationThread.class), anyString(), any(Intent.class), any(Intent.class), nullable(Bundle.class), nullable(Bundle.class), any(UserHandle.class)); anyInt()); } } @Test @Test Loading @@ -289,15 +309,18 @@ public class CrossProfileAppsServiceImplTest { SecurityException.class, SecurityException.class, () -> () -> mCrossProfileAppsServiceImpl.startActivityAsUser( mCrossProfileAppsServiceImpl.startActivityAsUser( mIApplicationThread, PACKAGE_ONE, PACKAGE_ONE, ACTIVITY_COMPONENT, ACTIVITY_COMPONENT, UserHandle.of(SECONDARY_USER))); UserHandle.of(SECONDARY_USER))); verify(mContext, never()) verify(mActivityManagerInternal, never()) .startActivityAsUser( .startActivityAsUser( nullable(IApplicationThread.class), anyString(), any(Intent.class), any(Intent.class), nullable(Bundle.class), nullable(Bundle.class), any(UserHandle.class)); anyInt()); } } @Test @Test Loading @@ -305,15 +328,18 @@ public class CrossProfileAppsServiceImplTest { mTestInjector.setCallingUserId(PROFILE_OF_PRIMARY_USER); mTestInjector.setCallingUserId(PROFILE_OF_PRIMARY_USER); mCrossProfileAppsServiceImpl.startActivityAsUser( mCrossProfileAppsServiceImpl.startActivityAsUser( mIApplicationThread, PACKAGE_ONE, PACKAGE_ONE, ACTIVITY_COMPONENT, ACTIVITY_COMPONENT, UserHandle.of(PRIMARY_USER)); UserHandle.of(PRIMARY_USER)); verify(mContext) verify(mActivityManagerInternal) .startActivityAsUser( .startActivityAsUser( nullable(IApplicationThread.class), eq(PACKAGE_ONE), any(Intent.class), any(Intent.class), nullable(Bundle.class), nullable(Bundle.class), eq(UserHandle.of(PRIMARY_USER))); eq(PRIMARY_USER)); } } private void mockAppsInstalled(String packageName, int user, boolean installed) { private void mockAppsInstalled(String packageName, int user, boolean installed) { Loading Loading @@ -401,5 +427,10 @@ public class CrossProfileAppsServiceImplTest { public AppOpsManager getAppOpsManager() { public AppOpsManager getAppOpsManager() { return mAppOpsManager; return mAppOpsManager; } } @Override public ActivityManagerInternal getActivityManagerInternal() { return mActivityManagerInternal; } } } } }