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

Commit cd2a8556 authored by Gareth Vaughan's avatar Gareth Vaughan Committed by Gerrit Code Review
Browse files

Merge "Fixing test that is breaking in some environments. Test: atest...

Merge "Fixing test that is breaking in some environments. Test: atest com.android.server.pm.CrossProfileAppsServiceImplTest#startActivityAsUser_sameTask_fromProfile_success Bug: 252837119"
parents 936f6610 f261a3e8
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));