From af7d8a312564bf89e33de98cab23029ab4a69358 Mon Sep 17 00:00:00 2001 From: Xiaowen Lei Date: Fri, 19 Aug 2022 00:26:05 +0000 Subject: [PATCH] Delay awaken from Dream to avoid wallpaper flickering. Bug: 240452659 Fix: 240452659 Test: repeatedly unlocking from Dream. Change-Id: Iba6ee6fcfce9083f4e348c5f4ad60903262f3705 --- .../systemui/keyguard/KeyguardViewMediator.java | 15 +++++++++++---- .../phone/BiometricUnlockController.java | 3 ++- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java index dbf218a115cb0..d4ef4675392d6 100644 --- a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java +++ b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java @@ -2383,10 +2383,10 @@ public class KeyguardViewMediator extends CoreStartable implements Dumpable, private void handleHide() { Trace.beginSection("KeyguardViewMediator#handleHide"); - // It's possible that the device was unlocked in a dream state. It's time to wake up. - if (mAodShowing || mDreamOverlayShowing) { - PowerManager pm = mContext.getSystemService(PowerManager.class); - pm.wakeUp(SystemClock.uptimeMillis(), PowerManager.WAKE_REASON_GESTURE, + // It's possible that the device was unlocked (via BOUNCER) while dozing. It's time to + // wake up. + if (mAodShowing) { + mPM.wakeUp(SystemClock.uptimeMillis(), PowerManager.WAKE_REASON_GESTURE, "com.android.systemui:BOUNCER_DOZING"); } @@ -2415,6 +2415,13 @@ public class KeyguardViewMediator extends CoreStartable implements Dumpable, null /* nonApps */, null /* finishedCallback */); }); } + + // It's possible that the device was unlocked (via BOUNCER or Fingerprint) while + // dreaming. It's time to wake up. + if (mDreamOverlayShowing) { + mPM.wakeUp(SystemClock.uptimeMillis(), PowerManager.WAKE_REASON_GESTURE, + "com.android.systemui:UNLOCK_DREAMING"); + } } Trace.endSection(); } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/BiometricUnlockController.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/BiometricUnlockController.java index 65ba5adddd60b..e754d5db41866 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/BiometricUnlockController.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/BiometricUnlockController.java @@ -512,7 +512,8 @@ public class BiometricUnlockController extends KeyguardUpdateMonitorCallback imp Trace.beginSection("MODE_WAKE_AND_UNLOCK"); } else { Trace.beginSection("MODE_WAKE_AND_UNLOCK_FROM_DREAM"); - mUpdateMonitor.awakenFromDream(); + // Don't call awaken from Dream here. In order to avoid flickering, wait until + // later to awaken. } mNotificationShadeWindowController.setNotificationShadeFocusable(false); mKeyguardViewMediator.onWakeAndUnlocking();