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

Commit 1154b310 authored by Kazuki Takise's avatar Kazuki Takise
Browse files

Check IsSleeping to start WAKE transition

Currently, DisplayPolicy#isAwake() is used to see if a WAKE
transition gets started. This assumes that applySleepTokens() is
called before DisplayPolicy#mAwake is updated, but the order is
different depending on how the device is woken up. For example,
if a vendor directly calls PowerManager#wakeUp(), it will be a
race.

With this CL, DisplayContent#mSleeping is checked instead. This
property is updated only in the same function, so there will be
no race whoever wakes up the system.

Bug: 284788259
Test: Manually wake up an app via adb and the window gets shown.
Change-Id: Ic82499cc35ae924478ab7f7484b6cd782c55618e
parent 4f7007cf
Loading
Loading
Loading
Loading
+2 −3
Original line number Diff line number Diff line
@@ -2481,6 +2481,7 @@ class RootWindowContainer extends WindowContainer<DisplayContent>
            if (displayShouldSleep == display.isSleeping()) {
                continue;
            }
            final boolean wasSleeping = display.isSleeping();
            display.setIsSleeping(displayShouldSleep);

            if (display.mTransitionController.isShellTransitionsEnabled()
@@ -2506,9 +2507,7 @@ class RootWindowContainer extends WindowContainer<DisplayContent>
                // Use NONE if keyguard is not showing.
                int transit = TRANSIT_NONE;
                Task startTask = null;
                if (!display.getDisplayPolicy().isAwake()) {
                    // Note that currently this only happens on default display because non-default
                    // display is always awake.
                if (wasSleeping) {
                    transit = TRANSIT_WAKE;
                } else if (display.isKeyguardOccluded()) {
                    // The display was awake so this is resuming activity for occluding keyguard.