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

Commit 735a3d61 authored by Gareth Vaughan's avatar Gareth Vaughan
Browse files

Fixing test that is breaking in some environments.

Test: atest com.android.server.pm.CrossProfileAppsServiceImplTest#startActivityAsUser_sameTask_fromProfile_success
Bug: 252837119

Cherry picked from: Ie0ca41247b80f927ef1377866d1a2d2d2deb5333

Change-Id: Ibd312b482ffe2df04eb1e33303800e2377fe203f
parent ed8cd54d
Loading
Loading
Loading
Loading
+12 −23
Original line number Diff line number Diff line
@@ -38,6 +38,7 @@ import android.content.pm.PackageManager;
import android.content.pm.PackageManagerInternal;
import android.content.pm.PermissionInfo;
import android.content.pm.ResolveInfo;
import android.os.Binder;
import android.os.Bundle;
import android.os.IBinder;
import android.os.UserHandle;
@@ -47,7 +48,6 @@ import android.permission.PermissionManager;
import android.platform.test.annotations.Presubmit;
import android.util.SparseArray;

import com.android.activitycontext.ActivityContext;
import com.android.internal.util.FunctionalUtils.ThrowingRunnable;
import com.android.internal.util.FunctionalUtils.ThrowingSupplier;
import com.android.server.LocalServices;
@@ -611,9 +611,7 @@ public class CrossProfileAppsServiceImplTest {
        mTestInjector.setCallingUserId(PROFILE_OF_PRIMARY_USER);

        Bundle options = ActivityOptions.makeOpenCrossProfileAppsAnimation().toBundle();
        IBinder result = ActivityContext.getWithContext(activity -> {
            try {
                IBinder targetTask = activity.getActivityToken();
        Binder targetTask = new Binder();
        mCrossProfileAppsServiceImpl.startActivityAsUser(
                mIApplicationThread,
                PACKAGE_ONE,
@@ -623,22 +621,13 @@ public class CrossProfileAppsServiceImplTest {
                true,
                targetTask,
                options);
                return targetTask;
            } catch (Exception re) {
                return null;
            }
        });
        if (result == null) {
            throw new Exception();
        }

        verify(mActivityTaskManagerInternal)
                .startActivityAsUser(
                        nullable(IApplicationThread.class),
                        eq(PACKAGE_ONE),
                        eq(FEATURE_ID),
                        any(Intent.class),
                        eq(result),
                        eq(targetTask),
                        anyInt(),
                        eq(options),
                        eq(PRIMARY_USER));