From 94cbe1c1bb723ab6b6c0b6c076e2900a1ea2218a Mon Sep 17 00:00:00 2001 From: Adrian Roos Date: Thu, 29 Jun 2017 17:26:27 +0200 Subject: [PATCH] AOD: avoid flicker when turning off screen Avoids a flicker during the turn off sequence where the status bar would not enter the keyguard mode until after AOD has already shown. To avoid this, now also show keyguard if dozing and the device is not yet fully asleep as long as the screen is off. Change-Id: Ic90b33a368332c9a7d7202b4e25a6c7c23b6506c Fixes: 36506840 Test: Enable AOD, go to home screen, press power. Verify that there is no flicker in the transition to AOD. --- .../android/systemui/statusbar/phone/StatusBar.java | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java index 14d0b7ea86b94..429d226d363be 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java @@ -425,6 +425,7 @@ public class StatusBar extends SystemUI implements DemoMode, private boolean mWakeUpComingFromTouch; private PointF mWakeUpTouchLocation; private boolean mScreenTurningOn; + private boolean mScreenFullyOff; int mPixelFormat; Object mQueueLock = new Object(); @@ -2811,7 +2812,9 @@ public class StatusBar extends SystemUI implements DemoMode, } public void onScreenTurnedOff() { + mScreenFullyOff = true; mFalsingManager.onScreenOff(); + updateIsKeyguard(); } public NotificationStackScrollLayout getNotificationScrollLayout() { @@ -4188,8 +4191,11 @@ public class StatusBar extends SystemUI implements DemoMode, private boolean updateIsKeyguard() { // For dozing, keyguard needs to be shown whenever the device is non-interactive. Otherwise - // there's no surface we can show to the user. - boolean keyguardForDozing = mDozingRequested && !mDeviceInteractive; + // there's no surface we can show to the user. Note that the device goes fully interactive + // late in the transition, so we also allow the device to start dozing once the screen has + // turned off fully. + boolean keyguardForDozing = mDozingRequested && + (!mDeviceInteractive || mStartedGoingToSleep && (mScreenFullyOff || mIsKeyguard)); boolean shouldBeKeyguard = mKeyguardRequested || keyguardForDozing; if (keyguardForDozing) { updatePanelExpansionForKeyguard(); @@ -5130,6 +5136,7 @@ public class StatusBar extends SystemUI implements DemoMode, } public void onScreenTurningOn() { + mScreenFullyOff = false; mScreenTurningOn = true; mFalsingManager.onScreenTurningOn(); mNotificationPanel.onScreenTurningOn(); @@ -5297,7 +5304,7 @@ public class StatusBar extends SystemUI implements DemoMode, mDozingRequested = true; DozeLog.traceDozing(mContext, mDozing); updateDozing(); - + updateIsKeyguard(); } }