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

Commit 87ca63a7 authored by chaviw's avatar chaviw
Browse files

Don't animate dim layer exit when recents animation finishes.

Recents animation handles animating the entire Task, which includes the
dim layer. After the recents animation is completed, there's no need for
the dim layer to start the exit animation. The recents animation takes
care of fading out the dim layer. Instead, just set the dimmer
mAnimateExit to false so the next call to updateDims will remove the dim
layer instead of starting the exit animation.

Test: Enter quick step with assistant open. Dim no longer flickers
at the end of the quick step animation.
Test: DimmerTests#testRemoveDimImmediately
Fixes: 74606159

Change-Id: Iceb4edde5edffdbba57dca35f258d9b3d7bf74f4
parent 294ad785
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -168,7 +168,7 @@ class RecentsAnimation implements RecentsAnimationCallbacks {
                        "RecentsAnimation#onAnimationFinished_inSurfaceTransaction");
                mWindowManager.deferSurfaceLayout();
                try {
                    mWindowManager.cleanupRecentsAnimation();
                    mWindowManager.cleanupRecentsAnimation(moveHomeToTop);

                    // Move the home stack to the front
                    final ActivityRecord homeActivity = mStackSupervisor.getHomeActivity();
+16 −1
Original line number Diff line number Diff line
@@ -109,6 +109,11 @@ class Dimmer {
        boolean isVisible;
        SurfaceAnimator mSurfaceAnimator;

        /**
         * Determines whether the dim layer should animate before destroying.
         */
        boolean mAnimateExit = true;

        /**
         * Used for Dims not associated with a WindowContainer. See {@link Dimmer#dimAbove} for
         * details on Dim lifecycle.
@@ -260,6 +265,12 @@ class Dimmer {
        }
    }

    void dontAnimateExit() {
        if (mDimState != null) {
            mDimState.mAnimateExit = false;
        }
    }

    /**
     * Call after invoking {@link WindowContainer#prepareSurfaces} on children as
     * described in {@link #resetDimStates}.
@@ -274,7 +285,11 @@ class Dimmer {
        }

        if (!mDimState.mDimming) {
            if (!mDimState.mAnimateExit) {
                t.destroy(mDimState.mDimLayer);
            } else {
                startDimExit(mLastRequestedDimContainer, mDimState.mSurfaceAnimator, t);
            }
            mDimState = null;
            return false;
        } else {
+4 −2
Original line number Diff line number Diff line
@@ -41,7 +41,6 @@ import android.util.Log;
import android.util.Slog;import android.util.proto.ProtoOutputStream;
import android.util.SparseBooleanArray;
import android.util.SparseIntArray;
import android.util.proto.ProtoOutputStream;
import android.view.IRecentsAnimationController;
import android.view.IRecentsAnimationRunner;
import android.view.RemoteAnimationTarget;
@@ -308,12 +307,15 @@ public class RecentsAnimationController {
        mCallbacks.onAnimationFinished(false /* moveHomeToTop */);
    }

    void cleanupAnimation() {
    void cleanupAnimation(boolean moveHomeToTop) {
        if (DEBUG) Log.d(TAG, "cleanupAnimation(): mPendingAnimations="
                + mPendingAnimations.size());
        for (int i = mPendingAnimations.size() - 1; i >= 0; i--) {
            final TaskAnimationAdapter adapter = mPendingAnimations.get(i);
            adapter.mTask.setCanAffectSystemUiFlags(true);
            if (moveHomeToTop) {
                adapter.mTask.dontAnimateDimExit();
            }
            adapter.mCapturedFinishCallback.onAnimationFinished(adapter);
        }
        mPendingAnimations.clear();
+4 −0
Original line number Diff line number Diff line
@@ -645,6 +645,10 @@ class Task extends WindowContainer<AppWindowToken> {
        return mCanAffectSystemUiFlags;
    }

    void dontAnimateDimExit() {
        mDimmer.dontAnimateExit();
    }

    @Override
    public String toString() {
        return "{taskId=" + mTaskId + " appTokens=" + mChildren + " mdr=" + mDeferRemoval + "}";
+2 −2
Original line number Diff line number Diff line
@@ -2702,10 +2702,10 @@ public class WindowManagerService extends IWindowManager.Stub
        }
    }

    public void cleanupRecentsAnimation() {
    public void cleanupRecentsAnimation(boolean moveHomeToTop) {
        synchronized (mWindowMap) {
            if (mRecentsAnimationController != null) {
                mRecentsAnimationController.cleanupAnimation();
                mRecentsAnimationController.cleanupAnimation(moveHomeToTop);
                mRecentsAnimationController = null;
                mAppTransition.updateBooster();
            }
Loading