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

Commit 9b9cca94 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Add TransitionController to member of WindowContainer" into sc-v2-dev

parents 69c8b1ae 5da73506
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -1072,7 +1072,7 @@ class ActivityClientController extends IActivityClientController.Stub {
                r.mDisplayContent.mAppTransition.overridePendingAppTransition(
                        packageName, enterAnim, exitAnim, null, null,
                        r.mOverrideTaskTransition);
                mService.getTransitionController().setOverrideAnimation(
                r.mTransitionController.setOverrideAnimation(
                        TransitionInfo.AnimationOptions.makeCustomAnimOptions(packageName,
                                enterAnim, exitAnim, r.mOverrideTaskTransition),
                        null /* startCallback */, null /* finishCallback */);
+19 −21
Original line number Diff line number Diff line
@@ -1531,7 +1531,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
        }

        // TODO(b/169035022): move to a more-appropriate place.
        mAtmService.getTransitionController().collect(this);
        mTransitionController.collect(this);
        if (prevDc.mOpeningApps.remove(this)) {
            // Transfer opening transition to new display.
            mDisplayContent.mOpeningApps.add(this);
@@ -3096,9 +3096,9 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A

        mAtmService.deferWindowLayout();
        try {
            final Transition newTransition = (!mAtmService.getTransitionController().isCollecting()
                    && mAtmService.getTransitionController().getTransitionPlayer() != null)
                    ? mAtmService.getTransitionController().createTransition(TRANSIT_CLOSE) : null;
            final Transition newTransition = (!mTransitionController.isCollecting()
                    && mTransitionController.getTransitionPlayer() != null)
                    ? mTransitionController.createTransition(TRANSIT_CLOSE) : null;
            mTaskSupervisor.mNoHistoryActivities.remove(this);
            makeFinishingLocked();
            // Make a local reference to its task since this.task could be set to null once this
@@ -3131,7 +3131,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
            final boolean endTask = task.getTopNonFinishingActivity() == null
                    && !task.isClearingToReuseTask();
            if (newTransition != null) {
                mAtmService.getTransitionController().requestStartTransition(newTransition,
                mTransitionController.requestStartTransition(newTransition,
                        endTask ? task : null, null /* remote */);
            }
            if (isState(RESUMED)) {
@@ -3559,12 +3559,12 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
        if (stopped) {
            abortAndClearOptionsAnimation();
        }
        if (mAtmService.getTransitionController().isCollecting()) {
        if (mTransitionController.isCollecting()) {
            // We don't want the finishing to change the transition ready state since there will not
            // be corresponding setReady for finishing.
            mAtmService.getTransitionController().collectExistenceChange(this);
            mTransitionController.collectExistenceChange(this);
        } else {
            mAtmService.getTransitionController().requestTransitionIfNeeded(TRANSIT_CLOSE, this);
            mTransitionController.requestTransitionIfNeeded(TRANSIT_CLOSE, this);
        }
    }

@@ -3816,7 +3816,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
        } else if (getDisplayContent().mAppTransition.isTransitionSet()) {
            getDisplayContent().mClosingApps.add(this);
            delayed = true;
        } else if (mAtmService.getTransitionController().inTransition()) {
        } else if (mTransitionController.inTransition()) {
            delayed = true;
        }

@@ -3828,7 +3828,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
        }

        // TODO(b/169035022): move to a more-appropriate place.
        mAtmService.getTransitionController().collect(this);
        mTransitionController.collect(this);

        ProtoLog.v(WM_DEBUG_APP_TRANSITIONS,
                "Removing app %s delayed=%b animation=%s animating=%b", this, delayed,
@@ -4029,7 +4029,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A

                ProtoLog.v(WM_DEBUG_ADD_REMOVE,
                        "Removing starting %s from %s", tStartingWindow, fromActivity);
                mAtmService.getTransitionController().collect(tStartingWindow);
                mTransitionController.collect(tStartingWindow);
                tStartingWindow.reparent(this, POSITION_TOP);

                // Propagate other interesting state between the tokens. If the old token is displayed,
@@ -4055,7 +4055,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
                    // the token we transfer the animation over. Thus, set this flag to indicate
                    // we've transferred the animation.
                    mUseTransferredAnimation = true;
                } else if (mAtmService.getTransitionController().getTransitionPlayer() != null) {
                } else if (mTransitionController.getTransitionPlayer() != null) {
                    // In the new transit system, just set this every time we transfer the window
                    mUseTransferredAnimation = true;
                }
@@ -4552,8 +4552,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
        }

        if (options != null) {
            mAtmService.getTransitionController().setOverrideAnimation(options,
                    startCallback, finishCallback);
            mTransitionController.setOverrideAnimation(options, startCallback, finishCallback);
        }
    }

@@ -4784,7 +4783,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
                Debug.getCallers(6));

        // Before setting mVisibleRequested so we can track changes.
        mAtmService.getTransitionController().collect(this);
        mTransitionController.collect(this);

        onChildVisibilityRequested(visible);

@@ -4856,7 +4855,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
        }

        // If in a transition, defer commits for activities that are going invisible
        if (!visible && mAtmService.getTransitionController().inTransition(this)) {
        if (!visible && inTransition()) {
            return;
        }
        // If we are preparing an app transition, then delay changing
@@ -4983,8 +4982,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
     *                this has become invisible.
     */
    private void postApplyAnimation(boolean visible) {
        final boolean usingShellTransitions =
                mAtmService.getTransitionController().getTransitionPlayer() != null;
        final boolean usingShellTransitions = mTransitionController.isShellTransitionsEnabled();
        final boolean delayed = isAnimating(TRANSITION | PARENTS | CHILDREN,
                ANIMATION_TYPE_APP_TRANSITION | ANIMATION_TYPE_WINDOW_ANIMATION
                        | ANIMATION_TYPE_RECENTS);
@@ -5434,7 +5432,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
            // returns. Just need to confirm this reasoning makes sense.
            final boolean deferHidingClient = canEnterPictureInPicture
                    && !isState(STARTED, STOPPING, STOPPED, PAUSED);
            if (!mAtmService.getTransitionController().isShellTransitionsEnabled()
            if (!mTransitionController.isShellTransitionsEnabled()
                    && deferHidingClient && pictureInPictureArgs.isAutoEnterEnabled()) {
                // Go ahead and just put the activity in pip if it supports auto-pip.
                mAtmService.enterPictureInPictureMode(this, pictureInPictureArgs);
@@ -5956,7 +5954,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
    }

    void startFreezingScreen(int overrideOriginalDisplayRotation) {
        if (mAtmService.getTransitionController().isShellTransitionsEnabled()) {
        if (mTransitionController.isShellTransitionsEnabled()) {
            return;
        }
        ProtoLog.i(WM_DEBUG_ORIENTATION,
@@ -7602,7 +7600,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
    }

    boolean isInTransition() {
        return mAtmService.getTransitionController().inTransition() // Shell transitions.
        return mTransitionController.inTransition() // Shell transitions.
                || isAnimating(PARENTS | TRANSITION); // Legacy transitions.
    }

+10 −9
Original line number Diff line number Diff line
@@ -1564,14 +1564,15 @@ class ActivityStarter {
        // startActivityInner. Otherwise, logic in startActivityInner could start a different
        // transition based on a sub-action.
        // Only do the create here (and defer requestStart) since startActivityInner might abort.
        final Transition newTransition = (!mService.getTransitionController().isCollecting()
                && mService.getTransitionController().getTransitionPlayer() != null)
                ? mService.getTransitionController().createTransition(TRANSIT_OPEN) : null;
        final TransitionController transitionController = r.mTransitionController;
        final Transition newTransition = (!transitionController.isCollecting()
                && transitionController.getTransitionPlayer() != null)
                ? transitionController.createTransition(TRANSIT_OPEN) : null;
        RemoteTransition remoteTransition = r.takeRemoteTransition();
        if (newTransition != null && remoteTransition != null) {
            newTransition.setRemoteTransition(remoteTransition);
        }
        mService.getTransitionController().collect(r);
        transitionController.collect(r);
        final boolean isTransient = r.getOptions() != null && r.getOptions().getTransientLaunch();
        try {
            mService.deferWindowLayout();
@@ -1618,19 +1619,19 @@ class ActivityStarter {
                if (started) {
                    // The activity is started new rather than just brought forward, so record
                    // it as an existence change.
                    mService.getTransitionController().collectExistenceChange(r);
                    transitionController.collectExistenceChange(r);
                }
                if (isTransient) {
                    // `r` isn't guaranteed to be the actual relevant activity, so we must wait
                    // until after we launched to identify the relevant activity.
                    mService.getTransitionController().setTransientLaunch(mLastStartActivityRecord);
                    transitionController.setTransientLaunch(mLastStartActivityRecord);
                }
                if (newTransition != null) {
                    mService.getTransitionController().requestStartTransition(newTransition,
                    transitionController.requestStartTransition(newTransition,
                            mTargetTask, remoteTransition);
                } else if (started) {
                    // Make the collecting transition wait until this request is ready.
                    mService.getTransitionController().setReady(r, false);
                    transitionController.setReady(r, false);
                }
            }
        }
@@ -2769,7 +2770,7 @@ class ActivityStarter {
                mNewTaskInfo != null ? mNewTaskInfo : mStartActivity.info,
                mNewTaskIntent != null ? mNewTaskIntent : mIntent, mVoiceSession,
                mVoiceInteractor, toTop, mStartActivity, mSourceRecord, mOptions);
        mService.getTransitionController().collectExistenceChange(task);
        task.mTransitionController.collectExistenceChange(task);
        addOrReparentStartingActivity(task, "setTaskFromReuseOrCreateNewTask - mReuseTask");

        ProtoLog.v(WM_DEBUG_TASKS, "Starting new activity %s in new task %s",
+7 −7
Original line number Diff line number Diff line
@@ -1387,7 +1387,7 @@ public class ActivityTaskSupervisor implements RecentTasks.Callbacks {
                mUserLeaving = true;
            }

            mService.getTransitionController().requestTransitionIfNeeded(TRANSIT_TO_FRONT,
            task.mTransitionController.requestTransitionIfNeeded(TRANSIT_TO_FRONT,
                    0 /* flags */, task, task /* readyGroupRef */,
                    options != null ? options.getRemoteTransition() : null);
            reason = reason + " findTaskToMoveToFront";
@@ -1563,17 +1563,17 @@ public class ActivityTaskSupervisor implements RecentTasks.Callbacks {
            return;
        }
        if (task.isVisible()) {
            if (mService.getTransitionController().isCollecting()) {
            if (task.mTransitionController.isCollecting()) {
                // We don't want the finishing to change the transition ready state since there will
                // not be corresponding setReady for finishing.
                mService.getTransitionController().collectExistenceChange(task);
                task.mTransitionController.collectExistenceChange(task);
            } else {
                mService.getTransitionController().requestTransitionIfNeeded(TRANSIT_CLOSE, task);
                task.mTransitionController.requestTransitionIfNeeded(TRANSIT_CLOSE, task);
            }
        } else {
            // Removing a non-visible task doesn't require a transition, but if there is one
            // collecting, this should be a member just in case.
            mService.getTransitionController().collect(task);
            task.mTransitionController.collect(task);
        }
        task.mInRemoveTask = true;
        try {
@@ -1887,7 +1887,7 @@ public class ActivityTaskSupervisor implements RecentTasks.Callbacks {
            final ActivityRecord s = mStoppingActivities.get(i);
            final boolean animating = s.isAnimating(TRANSITION | PARENTS,
                    ANIMATION_TYPE_APP_TRANSITION | ANIMATION_TYPE_RECENTS)
                    || mService.getTransitionController().inTransition(s);
                    || s.inTransition();
            ProtoLog.v(WM_DEBUG_STATES, "Stopping %s: nowVisible=%b animating=%b "
                    + "finishing=%s", s, s.nowVisible, animating, s.finishing);
            if (!animating || mService.mShuttingDown) {
@@ -2188,7 +2188,7 @@ public class ActivityTaskSupervisor implements RecentTasks.Callbacks {
        }

        if (!task.supportsSplitScreenWindowingMode() || forceNonResizable) {
            if (mService.getTransitionController().getTransitionPlayer() != null) return;
            if (task.mTransitionController.isShellTransitionsEnabled()) return;
            // Dismiss docked root task. If task appeared to be in docked root task but is not
            // resizable - we need to move it to top of fullscreen root task, otherwise it will
            // be covered.
+1 −1
Original line number Diff line number Diff line
@@ -1547,7 +1547,7 @@ public class AppTransition implements Dump {
    }

    boolean prepareAppTransition(@TransitionType int transit, @TransitionFlags int flags) {
        if (mService.mAtmService.getTransitionController().getTransitionPlayer() != null) {
        if (mDisplayContent.mTransitionController.isShellTransitionsEnabled()) {
            return false;
        }
        mNextAppTransitionRequests.add(transit);
Loading