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

Commit 03206afc authored by Robert Carr's avatar Robert Carr
Browse files

Ignore "mLastHidden" state when deciding whether to turnScreenOn.

In the case of showWhileLocked, turnScreenOn, windows, we may not
hide them or destroy their surface when turning the screen off. In
this case mLastHidden will never be set to true, and we will never
enter the showSurfaceRobustlyLocked path. However this is the path where
we consume turnScreenOn, and so this was preventing such a window
from being able to turn the screen on a second time.

Bug: 62913759
Test: Manual from bug. go/wm-smoke. "At some form at a later date"
Change-Id: Ia72d702e175b82c5f0e628010177f02bf87abf84
parent f99ac67b
Loading
Loading
Loading
Loading
+26 −19
Original line number Diff line number Diff line
@@ -1604,7 +1604,8 @@ class WindowStateAnimator {
                        recoveringMemory);
            mSurfaceController.setLayer(mAnimLayer);

            if (prepared && mLastHidden && mDrawState == HAS_DRAWN) {
            if (prepared && mDrawState == HAS_DRAWN) {
                if (mLastHidden) {
                    if (showSurfaceRobustlyLocked()) {
                        markPreservedSurfaceForDestroy();
                        mAnimator.requestRemovalOfReplacedWindows(w);
@@ -1621,6 +1622,17 @@ class WindowStateAnimator {
                        w.setOrientationChanging(false);
                    }
                }
                // We process mTurnOnScreen even for windows which have already
                // been shown, to handle cases where windows are not necessarily
                // hidden while the screen is turning off.
                // TODO(b/63773439): These cases should be eliminated, though we probably still
                // want to process mTurnOnScreen in this way for clarity.
                if (mWin.mTurnOnScreen) {
                    if (DEBUG_VISIBILITY) Slog.v(TAG, "Show surface turning screen on: " + mWin);
                    mWin.mTurnOnScreen = false;
                    mAnimator.mBulkUpdateParams |= SET_TURN_ON_SCREEN;
                }
            }
            if (hasSurface()) {
                w.mToken.hasVisible = true;
            }
@@ -1730,11 +1742,6 @@ class WindowStateAnimator {
        if (!shown)
            return false;

        if (mWin.mTurnOnScreen) {
            if (DEBUG_VISIBILITY) Slog.v(TAG, "Show surface turning screen on: " + mWin);
            mWin.mTurnOnScreen = false;
            mAnimator.mBulkUpdateParams |= SET_TURN_ON_SCREEN;
        }
        return true;
    }