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

Commit 9e5e6cd6 authored by Shashwat Razdan's avatar Shashwat Razdan Committed by Android (Google) Code Review
Browse files

Merge "Start activity under screenshot." into main

parents ed754cbe e0138fc3
Loading
Loading
Loading
Loading
+20 −0
Original line number Diff line number Diff line
@@ -414,6 +414,7 @@ class ActivityStarter {
        int filterCallingUid;
        PendingIntentRecord originatingPendingIntent;
        BackgroundStartPrivileges forcedBalByPiSender;
        boolean freezeScreen;

        final StringBuilder logMessage = new StringBuilder();

@@ -477,6 +478,7 @@ class ActivityStarter {
            filterCallingUid = UserHandle.USER_NULL;
            originatingPendingIntent = null;
            forcedBalByPiSender = BackgroundStartPrivileges.NONE;
            freezeScreen = false;
            errorCallbackToken = null;
        }

@@ -520,6 +522,7 @@ class ActivityStarter {
            filterCallingUid = request.filterCallingUid;
            originatingPendingIntent = request.originatingPendingIntent;
            forcedBalByPiSender = request.forcedBalByPiSender;
            freezeScreen = request.freezeScreen;
            errorCallbackToken = request.errorCallbackToken;
        }

@@ -1525,6 +1528,18 @@ class ActivityStarter {
        Transition newTransition = transitionController.isShellTransitionsEnabled()
                ? transitionController.createAndStartCollecting(TRANSIT_OPEN) : null;
        RemoteTransition remoteTransition = r.takeRemoteTransition();
        // Create a display snapshot as soon as possible.
        if (newTransition != null && mRequest.freezeScreen) {
            final TaskDisplayArea tda = mLaunchParams.hasPreferredTaskDisplayArea()
                    ? mLaunchParams.mPreferredTaskDisplayArea
                    : mRootWindowContainer.getDefaultTaskDisplayArea();
            final DisplayContent dc = mRootWindowContainer.getDisplayContentOrCreate(
                    tda.getDisplayId());
            if (dc != null) {
                transitionController.collect(dc);
                transitionController.collectVisibleChange(dc);
            }
        }
        try {
            mService.deferWindowLayout();
            transitionController.collect(r);
@@ -3270,6 +3285,11 @@ class ActivityStarter {
        return this;
    }

    ActivityStarter setFreezeScreen(boolean freezeScreen) {
        mRequest.freezeScreen = freezeScreen;
        return this;
    }

    ActivityStarter setErrorCallbackToken(@Nullable IBinder errorCallbackToken) {
        mRequest.errorCallbackToken = errorCallbackToken;
        return this;
+13 −0
Original line number Diff line number Diff line
@@ -274,6 +274,19 @@ public abstract class ActivityTaskManagerInternal {
            @Nullable String callingFeatureId, Intent intent, @Nullable IBinder resultTo,
            int startFlags, @Nullable Bundle options, int userId);

    /**
     * Start activity {@code intent} with initially under screenshot. The screen of launching
     * display will be frozen before transition occur.
     *
     * - DO NOT call it with the calling UID cleared.
     * - The caller must do the calling user ID check.
     *
     * @return error codes used by {@link IActivityManager#startActivity} and its siblings.
     */
    public abstract int startActivityWithScreenshot(@NonNull Intent intent,
            @NonNull String callingPackage, int callingUid, int callingPid,
            @Nullable IBinder resultTo, @Nullable Bundle options, int userId);

    /**
     * Called after virtual display Id is updated by
     * {@link com.android.server.vr.Vr2dDisplay} with a specific
+18 −0
Original line number Diff line number Diff line
@@ -6014,6 +6014,24 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub {
                    false /*validateIncomingUser*/);
        }

        @Override
        public int startActivityWithScreenshot(@NonNull Intent intent,
                @NonNull String callingPackage, int callingUid, int callingPid,
                @Nullable IBinder resultTo, @Nullable Bundle options, int userId) {
            return getActivityStartController()
                    .obtainStarter(intent, "startActivityWithScreenshot")
                    .setCallingUid(callingUid)
                    .setCallingPid(callingPid)
                    .setCallingPackage(callingPackage)
                    .setResultTo(resultTo)
                    .setActivityOptions(createSafeActivityOptionsWithBalAllowed(options))
                    .setRealCallingUid(Binder.getCallingUid())
                    .setUserId(userId)
                    .setBackgroundStartPrivileges(BackgroundStartPrivileges.ALLOW_BAL)
                    .setFreezeScreen(true)
                    .execute();
        }

        /**
         * Called after virtual display Id is updated by
         * {@link com.android.server.vr.Vr2dDisplay} with a specific