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

Commit f2b6807c authored by Michael Wright's avatar Michael Wright Committed by Android (Google) Code Review
Browse files

Merge "Defer sleeping / waking the device on device state changes."

parents 07e69f96 be9ebef0
Loading
Loading
Loading
Loading
+8 −4
Original line number Diff line number Diff line
@@ -397,12 +397,16 @@ class LogicalDisplayMapper implements DisplayDeviceRepository.Listener {
                // We already told the displays to turn off, now we need to wake the device as
                // we transition to this new state. We do it here so that the waking happens
                // between the transition from one layout to another.
                mHandler.post(() -> {
                    mPowerManager.wakeUp(SystemClock.uptimeMillis(),
                            PowerManager.WAKE_REASON_UNFOLD_DEVICE, "server.display:unfold");
                });
            } else if (sleepDevice) {
                // Send the device to sleep when required.
                mHandler.post(() -> {
                    mPowerManager.goToSleep(SystemClock.uptimeMillis(),
                            PowerManager.GO_TO_SLEEP_REASON_DEVICE_FOLD, 0);
                });
            }
        }