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

Commit 7636dfbc authored by Craig Mautner's avatar Craig Mautner
Browse files

Do not clear AppWindowToken.allDrawn while animating.

Creating new surfaces for applications clears the allDrawn flag in the
AppWindowToken. If the app windows were animating when this happened
the animation would complete immediately resulting in jank. This fix
defers clearing allDrawn until the animation completes.

Bug 7326635 fixed.

Change-Id: I5abe3b9ecfbefb476de6a6c8acc394373cc11751
parent dc0b84b1
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -100,6 +100,10 @@ public class AppWindowAnimator {
            animInitialized = false;
        }
        clearThumbnail();
        if (mAppToken.deferClearAllDrawn) {
            mAppToken.allDrawn = false;
            mAppToken.deferClearAllDrawn = false;
        }
    }

    public void clearThumbnail() {
+3 −0
Original line number Diff line number Diff line
@@ -64,6 +64,9 @@ class AppWindowToken extends WindowToken {
    int numDrawnWindows;
    boolean inPendingTransaction;
    boolean allDrawn;
    // Set to true when this app creates a surface while in the middle of an animation. In that
    // case do not clear allDrawn until the animation completes.
    boolean deferClearAllDrawn;

    // Is this token going to be hidden in a little while?  If so, it
    // won't be taken into account for setting the screen orientation.
+4 −0
Original line number Diff line number Diff line
@@ -4295,6 +4295,7 @@ public class WindowManagerService extends IWindowManager.Stub
                        // the new one.
                        if (ttoken.allDrawn) {
                            wtoken.allDrawn = true;
                            wtoken.deferClearAllDrawn = ttoken.deferClearAllDrawn;
                        }
                        if (ttoken.firstWindowDrawn) {
                            wtoken.firstWindowDrawn = true;
@@ -4602,6 +4603,7 @@ public class WindowManagerService extends IWindowManager.Stub
                    // its windows to be ready.
                    if (wtoken.hidden) {
                        wtoken.allDrawn = false;
                        wtoken.deferClearAllDrawn = false;
                        wtoken.waitingToShow = true;

                        if (wtoken.clientHidden) {
@@ -8708,6 +8710,7 @@ public class WindowManagerService extends IWindowManager.Stub
                // this guy's animations regardless of whether it's
                // gotten drawn.
                wtoken.allDrawn = true;
                wtoken.deferClearAllDrawn = false;
            }

            if (mNextAppTransitionThumbnail != null && topOpeningApp != null
@@ -8878,6 +8881,7 @@ public class WindowManagerService extends IWindowManager.Stub
                    winAnimator.mDrawState = WindowStateAnimator.DRAW_PENDING;
                    if (w.mAppToken != null) {
                        w.mAppToken.allDrawn = false;
                        w.mAppToken.deferClearAllDrawn = false;
                    }
                }
                if (!mResizingWindows.contains(w)) {
+8 −1
Original line number Diff line number Diff line
@@ -626,7 +626,14 @@ class WindowStateAnimator {
                    "createSurface " + this + ": mDrawState=DRAW_PENDING");
            mDrawState = DRAW_PENDING;
            if (mWin.mAppToken != null) {
                if (mWin.mAppToken.mAppAnimator.animation == null) {
                    mWin.mAppToken.allDrawn = false;
                    mWin.mAppToken.deferClearAllDrawn = false;
                } else {
                    // Currently animating, persist current state of allDrawn until animation
                    // is complete.
                    mWin.mAppToken.deferClearAllDrawn = true;
                }
            }

            mService.makeWindowFreezingScreenIfNeededLocked(mWin);