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

Commit fa9ed96f authored by Jorim Jaggi's avatar Jorim Jaggi
Browse files

Fix mNoAnimActivities

Since we split tasks into separate stacks, mNoAnimActivites from
other tasks/stacks were pretty much never cleared, leading to
skipped animations in the following cases:
- Enter/exit multi-window, relaunch anything, animation was
always skipped.
- Reopen PIP activity from notification shade

Now, we make this a global list which we immediately clear
after using it.

Test: go/wm-smoke
Test: Enter/exit multi-window, relaunch
Bug: 64674361
Change-Id: Ic36d278b263d6b3c6a7ec7416c8b94c4eed8e440
parent cbd5a384
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -1695,7 +1695,7 @@ final class ActivityRecord extends ConfigurationContainer implements AppWindowCo

        resumeKeyDispatchingLocked();
        final ActivityStack stack = getStack();
        stack.mNoAnimActivities.clear();
        mStackSupervisor.mNoAnimActivities.clear();

        // Mark the point when the activity is resuming
        // TODO: To be more accurate, the mark should be before the onCreate,
+9 −19
Original line number Diff line number Diff line
@@ -276,12 +276,6 @@ class ActivityStack<T extends StackWindowController> extends ConfigurationContai
     */
    final ArrayList<ActivityRecord> mLRUActivities = new ArrayList<>();

    /**
     * Animations that for the current transition have requested not to
     * be considered for the transition animation.
     */
    final ArrayList<ActivityRecord> mNoAnimActivities = new ArrayList<>();

    /**
     * When we are in the process of pausing an activity, before starting the
     * next one, this variable holds the activity that is currently being paused.
@@ -550,7 +544,7 @@ class ActivityStack<T extends StackWindowController> extends ConfigurationContai
        wm.deferSurfaceLayout();
        try {
            if (!animate && topActivity != null) {
                mNoAnimActivities.add(topActivity);
                mStackSupervisor.mNoAnimActivities.add(topActivity);
            }
            super.setWindowingMode(windowingMode);

@@ -2460,7 +2454,7 @@ class ActivityStack<T extends StackWindowController> extends ConfigurationContai
            if (prev.finishing) {
                if (DEBUG_TRANSITION) Slog.v(TAG_TRANSITION,
                        "Prepare close transition: prev=" + prev);
                if (mNoAnimActivities.contains(prev)) {
                if (mStackSupervisor.mNoAnimActivities.contains(prev)) {
                    anim = false;
                    mWindowManager.prepareAppTransition(TRANSIT_NONE, false);
                } else {
@@ -2472,7 +2466,7 @@ class ActivityStack<T extends StackWindowController> extends ConfigurationContai
            } else {
                if (DEBUG_TRANSITION) Slog.v(TAG_TRANSITION,
                        "Prepare open transition: prev=" + prev);
                if (mNoAnimActivities.contains(next)) {
                if (mStackSupervisor.mNoAnimActivities.contains(next)) {
                    anim = false;
                    mWindowManager.prepareAppTransition(TRANSIT_NONE, false);
                } else {
@@ -2485,7 +2479,7 @@ class ActivityStack<T extends StackWindowController> extends ConfigurationContai
            }
        } else {
            if (DEBUG_TRANSITION) Slog.v(TAG_TRANSITION, "Prepare open transition: no previous");
            if (mNoAnimActivities.contains(next)) {
            if (mStackSupervisor.mNoAnimActivities.contains(next)) {
                anim = false;
                mWindowManager.prepareAppTransition(TRANSIT_NONE, false);
            } else {
@@ -2493,17 +2487,14 @@ class ActivityStack<T extends StackWindowController> extends ConfigurationContai
            }
        }

        Bundle resumeAnimOptions = null;
        if (anim) {
            ActivityOptions opts = next.getOptionsForTargetActivityLocked();
            if (opts != null) {
                resumeAnimOptions = opts.toBundle();
            }
            next.applyOptionsLocked();
        } else {
            next.clearOptionsLocked();
        }

        mStackSupervisor.mNoAnimActivities.clear();

        ActivityStack lastStack = mStackSupervisor.getLastStack();
        if (next.app != null && next.app.thread != null) {
            if (DEBUG_SWITCH) Slog.v(TAG_SWITCH, "Resume running: " + next
@@ -2859,7 +2850,7 @@ class ActivityStack<T extends StackWindowController> extends ConfigurationContai
                    "Prepare open transition: starting " + r);
            if ((r.intent.getFlags() & Intent.FLAG_ACTIVITY_NO_ANIMATION) != 0) {
                mWindowManager.prepareAppTransition(TRANSIT_NONE, keepCurTransition);
                mNoAnimActivities.add(r);
                mStackSupervisor.mNoAnimActivities.add(r);
            } else {
                int transit = TRANSIT_ACTIVITY_OPEN;
                if (newTask) {
@@ -2878,7 +2869,7 @@ class ActivityStack<T extends StackWindowController> extends ConfigurationContai
                    }
                }
                mWindowManager.prepareAppTransition(transit, keepCurTransition);
                mNoAnimActivities.remove(r);
                mStackSupervisor.mNoAnimActivities.remove(r);
            }
            boolean doShow = true;
            if (newTask) {
@@ -4497,7 +4488,7 @@ class ActivityStack<T extends StackWindowController> extends ConfigurationContai
        if (noAnimation) {
            mWindowManager.prepareAppTransition(TRANSIT_NONE, false);
            if (r != null) {
                mNoAnimActivities.add(r);
                mStackSupervisor.mNoAnimActivities.add(r);
            }
            ActivityOptions.abort(options);
        } else {
@@ -5190,7 +5181,6 @@ class ActivityStack<T extends StackWindowController> extends ConfigurationContai

    void executeAppTransition(ActivityOptions options) {
        mWindowManager.executeAppTransition();
        mNoAnimActivities.clear();
        ActivityOptions.abort(options);
    }

+6 −0
Original line number Diff line number Diff line
@@ -357,6 +357,12 @@ public class ActivityStackSupervisor extends ConfigurationContainer implements D
     * application */
    final ArrayList<ActivityRecord> mPipModeChangedActivities = new ArrayList<>();

    /**
     * Animations that for the current transition have requested not to
     * be considered for the transition animation.
     */
    final ArrayList<ActivityRecord> mNoAnimActivities = new ArrayList<>();

    /** The target stack bounds for the picture-in-picture mode changed that we need to report to
     * the application */
    Rect mPipModeChangedTargetStackBounds;
+1 −1
Original line number Diff line number Diff line
@@ -150,7 +150,7 @@ class RecentsAnimation implements RecentsAnimationCallbacks {
                    if (moveHomeToTop) {
                        // Bring the home stack to the front
                        final ActivityStack homeStack = homeActivity.getStack();
                        homeStack.mNoAnimActivities.add(homeActivity);
                        mStackSupervisor.mNoAnimActivities.add(homeActivity);
                        homeStack.moveToFront("RecentsAnimation.onAnimationFinished()");
                    } else {
                        // Restore the home stack to its previous position
+1 −1
Original line number Diff line number Diff line
@@ -695,7 +695,7 @@ class TaskRecord extends ConfigurationContainer implements TaskWindowContainerLi
                        wasPaused, reason);
            }
            if (!animate) {
                toStack.mNoAnimActivities.add(topActivity);
                mService.mStackSupervisor.mNoAnimActivities.add(topActivity);
            }

            // We might trigger a configuration change. Save the current task bounds for freezing.