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

Commit 26fc2c9e authored by Issei Suzuki's avatar Issei Suzuki
Browse files

Stop the window manager acquiring a sleep token in dozing state.

This logic is not necessary anymore, and makes transition of the
windows manager flaky.

Bug: 119217735
Test: atest CtsActivityManagerDeviceTestCases:KeyguardTransitionTests
Change-Id: I953b40737f6673b83d27b096dd1f8e81b0cc6e46
parent b24884e3
Loading
Loading
Loading
Loading
+0 −13
Original line number Diff line number Diff line
@@ -1751,15 +1751,6 @@ public interface WindowManager extends ViewManager {
         */
        public static final int PRIVATE_FLAG_IS_ROUNDED_CORNERS_OVERLAY = 0x00100000;

        /**
         * If this flag is set on the window, window manager will acquire a sleep token that puts
         * all activities to sleep as long as this window is visible. When this flag is set, the
         * window needs to occlude all activity windows.
         * @hide
         */
        @RequiresPermission(permission.DEVICE_POWER)
        public static final int PRIVATE_FLAG_ACQUIRES_SLEEP_TOKEN = 0x00200000;

        /**
         * Flag to indicate that this window should be considered a screen decoration similar to the
         * nav bar and status bar. This will cause this window to affect the window insets reported
@@ -1871,10 +1862,6 @@ public interface WindowManager extends ViewManager {
                        mask = PRIVATE_FLAG_IS_ROUNDED_CORNERS_OVERLAY,
                        equals = PRIVATE_FLAG_IS_ROUNDED_CORNERS_OVERLAY,
                        name = "IS_ROUNDED_CORNERS_OVERLAY"),
                @ViewDebug.FlagToString(
                        mask = PRIVATE_FLAG_ACQUIRES_SLEEP_TOKEN,
                        equals = PRIVATE_FLAG_ACQUIRES_SLEEP_TOKEN,
                        name = "ACQUIRES_SLEEP_TOKEN"),
                @ViewDebug.FlagToString(
                        mask = PRIVATE_FLAG_IS_SCREEN_DECOR,
                        equals = PRIVATE_FLAG_IS_SCREEN_DECOR,
+0 −9
Original line number Diff line number Diff line
@@ -283,7 +283,6 @@ public class StatusBarWindowController implements Callback, Dumpable, Configurat
        applyModalFlag(state);
        applyBrightness(state);
        applyHasTopUi(state);
        applySleepToken(state);
        applyNotTouchable(state);
        if (mLp.copyFrom(mLpChanged) != 0) {
            mWindowManager.updateViewLayout(mStatusBarView, mLp);
@@ -328,14 +327,6 @@ public class StatusBarWindowController implements Callback, Dumpable, Configurat
        mHasTopUiChanged = isExpanded(state);
    }

    private void applySleepToken(State state) {
        if (state.dozing) {
            mLpChanged.privateFlags |= LayoutParams.PRIVATE_FLAG_ACQUIRES_SLEEP_TOKEN;
        } else {
            mLpChanged.privateFlags &= ~LayoutParams.PRIVATE_FLAG_ACQUIRES_SLEEP_TOKEN;
        }
    }

    private void applyNotTouchable(State state) {
        if (state.notTouchable) {
            mLpChanged.flags |= LayoutParams.FLAG_NOT_TOUCHABLE;
+0 −7
Original line number Diff line number Diff line
@@ -45,7 +45,6 @@ import static android.view.WindowManager.LayoutParams.LAST_APPLICATION_WINDOW;
import static android.view.WindowManager.LayoutParams.LAST_SUB_WINDOW;
import static android.view.WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_ALWAYS;
import static android.view.WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_DEFAULT;
import static android.view.WindowManager.LayoutParams.PRIVATE_FLAG_ACQUIRES_SLEEP_TOKEN;
import static android.view.WindowManager.LayoutParams.PRIVATE_FLAG_FORCE_DRAW_STATUS_BAR_BACKGROUND;
import static android.view.WindowManager.LayoutParams.PRIVATE_FLAG_FORCE_STATUS_BAR_VISIBLE_TRANSPARENT;
import static android.view.WindowManager.LayoutParams.PRIVATE_FLAG_INHERIT_TRANSLUCENT_DECOR;
@@ -2322,12 +2321,6 @@ public class DisplayPolicy {
                && windowingMode == WINDOWING_MODE_SPLIT_SCREEN_PRIMARY) {
            mTopDockedOpaqueOrDimmingWindowState = win;
        }

        // Take note if a window wants to acquire a sleep token.
        if ((attrs.privateFlags & PRIVATE_FLAG_ACQUIRES_SLEEP_TOKEN) != 0
                && win.canAcquireSleepToken()) {
            mWindowSleepTokenNeeded = true;
        }
    }

    /**