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

Commit 474093d6 authored by chaviw's avatar chaviw
Browse files

Set canTurnScreenOn to false for any window with flag.

There are cases where the window has the flag TURN_SCREEN_ON but
the other checks aren't satisfied. In those cases, canTurnScreenOn
will still be true allowing another relayout to turn the screen on.
Instead, set canTurnScreenOn flag to false if any window has the
flag TURN_SCREEN_ON, regardless if the other conditions are met.

The previous fix If8ff9ba1afb1f7f9632e8c911ed475aed531b880 broke
the testTurnScreenOnActivity_withRelayout test so this is a more
correct solution.

Change-Id: I3fa6285cd5f246e96f9034a7af76b8828e16c15d
Fixes: 74086704
Test: testTurnScreenOnActivity_withRelayout
parent f9500e9c
Loading
Loading
Loading
Loading
+7 −6
Original line number Diff line number Diff line
@@ -2284,13 +2284,14 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
        // interactive, the value may persist until the next animation, which could potentially
        // be occurring while turning off the screen. This would lead to the screen incorrectly
        // turning back on.
        if (hasTurnScreenOnFlag && allowTheaterMode && canTurnScreenOn
                && !mPowerManagerWrapper.isInteractive()) {
        if (hasTurnScreenOnFlag) {
            if (allowTheaterMode && canTurnScreenOn && !mPowerManagerWrapper.isInteractive()) {
                if (DEBUG_VISIBILITY || DEBUG_POWER) {
                    Slog.v(TAG, "Relayout window turning screen on: " + this);
                }
                mPowerManagerWrapper.wakeUp(SystemClock.uptimeMillis(),
                        "android.server.wm:TURN_ON");
            }

            if (mAppToken != null) {
                mAppToken.setCanTurnScreenOn(false);