Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5f47c591 authored by Robert Horvath's avatar Robert Horvath
Browse files

Pass callingPackage in UserLifecycleTest#startApp

Calling IActivityTaskManager#startActivity requires the callingPackage
to be set correctly as of ag/8668823, otherwise a SecurityException is
thrown.

Bug: 138095678
Test: Enable multi-user by declaring the
      "android.software.managed_users" feature and setting
      "config_multiuserMaximumUsers" to greather than 1. Then:
      `atest android.multiuser.UserLifecycleTests#managedProfileUnlockAndLaunchApp`

Change-Id: Iab7cf0198a02a976ef5c54e4b87fb127aa7eac9a
parent cac13d44
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -530,10 +530,10 @@ public class UserLifecycleTests {
     */
    private void startApp(int userId, String packageName) throws RemoteException {
        final Context context = InstrumentationRegistry.getContext();
        final WaitResult result = ActivityTaskManager.getService().startActivityAndWait(null, null,
                context.getPackageManager().getLaunchIntentForPackage(packageName),
                null, null, null, 0, 0, null, null,
                userId);
        final WaitResult result = ActivityTaskManager.getService().startActivityAndWait(null,
                context.getPackageName(),
                context.getPackageManager().getLaunchIntentForPackage(packageName), null, null,
                null, 0, 0, null, null, userId);
        attestTrue("User " + userId + " failed to start " + packageName,
                result.result == ActivityManager.START_SUCCESS);
    }