Loading core/res/res/values/config.xml +3 −0 Original line number Diff line number Diff line Loading @@ -6668,4 +6668,7 @@ <!-- Whether or not ActivityManager PSS profiling is disabled. --> <bool name="config_am_disablePssProfiling">false</bool> <!-- Whether unlocking and waking a device are sequenced --> <bool name="config_orderUnlockAndWake">false</bool> </resources> core/res/res/values/symbols.xml +3 −0 Original line number Diff line number Diff line Loading @@ -5214,4 +5214,7 @@ <java-symbol type="bool" name="config_am_disablePssProfiling" /> <java-symbol type="raw" name="default_ringtone_vibration_effect" /> <!-- Whether we order unlocking and waking --> <java-symbol type="bool" name="config_orderUnlockAndWake" /> </resources> packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java +19 −0 Original line number Diff line number Diff line Loading @@ -480,6 +480,11 @@ public class KeyguardViewMediator implements CoreStartable, Dumpable, */ private final int mDreamOpenAnimationDuration; /** * Whether unlock and wake should be sequenced. */ private final boolean mOrderUnlockAndWake; /** * The animation used for hiding keyguard. This is used to fetch the animation timings if * WindowManager is not providing us with them. Loading Loading @@ -1459,6 +1464,9 @@ public class KeyguardViewMediator implements CoreStartable, Dumpable, mDreamingToLockscreenTransitionViewModel = dreamingToLockscreenTransitionViewModel; mWmLockscreenVisibilityManager = wmLockscreenVisibilityManager; mMainDispatcher = mainDispatcher; mOrderUnlockAndWake = context.getResources().getBoolean( com.android.internal.R.bool.config_orderUnlockAndWake); } public void userActivity() { Loading Loading @@ -2844,6 +2852,10 @@ public class KeyguardViewMediator implements CoreStartable, Dumpable, private void setUnlockAndWakeFromDream(boolean updatedValue, @WakeAndUnlockUpdateReason int reason) { if (!mOrderUnlockAndWake) { return; } if (updatedValue == mUnlockingAndWakingFromDream) { return; } Loading Loading @@ -2924,6 +2936,13 @@ public class KeyguardViewMediator implements CoreStartable, Dumpable, mHideAnimation.getDuration()); onKeyguardExitFinished(); } // It's possible that the device was unlocked (via BOUNCER or Fingerprint) while // dreaming. It's time to wake up. if ((mDreamOverlayShowing || mUpdateMonitor.isDreaming()) && !mOrderUnlockAndWake) { mPM.wakeUp(mSystemClock.uptimeMillis(), PowerManager.WAKE_REASON_GESTURE, "com.android.systemui:UNLOCK_DREAMING"); } } Trace.endSection(); } Loading packages/SystemUI/src/com/android/systemui/statusbar/phone/BiometricUnlockController.java +8 −4 Original line number Diff line number Diff line Loading @@ -177,6 +177,7 @@ public class BiometricUnlockController extends KeyguardUpdateMonitorCallback imp private final VibratorHelper mVibratorHelper; private final BiometricUnlockLogger mLogger; private final SystemClock mSystemClock; private final boolean mOrderUnlockAndWake; private long mLastFpFailureUptimeMillis; private int mNumConsecutiveFpFailures; Loading Loading @@ -316,6 +317,8 @@ public class BiometricUnlockController extends KeyguardUpdateMonitorCallback imp mLogger = biometricUnlockLogger; mSystemClock = systemClock; mFeatureFlags = featureFlags; mOrderUnlockAndWake = resources.getBoolean( com.android.internal.R.bool.config_orderUnlockAndWake); dumpManager.registerDumpable(this); } Loading Loading @@ -470,10 +473,11 @@ public class BiometricUnlockController extends KeyguardUpdateMonitorCallback imp Trace.endSection(); }; final boolean wakingFromDream = mMode == MODE_WAKE_AND_UNLOCK_FROM_DREAM && mPowerManager.isInteractive(); final boolean wakeInKeyguard = mMode == MODE_WAKE_AND_UNLOCK_FROM_DREAM && mPowerManager.isInteractive() && mOrderUnlockAndWake && mOrderUnlockAndWake; if (mMode != MODE_NONE && !wakingFromDream) { if (mMode != MODE_NONE && !wakeInKeyguard) { wakeUp.run(); } switch (mMode) { Loading Loading @@ -509,7 +513,7 @@ public class BiometricUnlockController extends KeyguardUpdateMonitorCallback imp // later to awaken. } mNotificationShadeWindowController.setNotificationShadeFocusable(false); mKeyguardViewMediator.onWakeAndUnlocking(wakingFromDream); mKeyguardViewMediator.onWakeAndUnlocking(wakeInKeyguard); Trace.endSection(); break; case MODE_ONLY_WAKE: Loading packages/SystemUI/tests/src/com/android/systemui/keyguard/KeyguardViewMediatorTest.java +38 −1 Original line number Diff line number Diff line Loading @@ -387,10 +387,34 @@ public class KeyguardViewMediatorTest extends SysuiTestCase { @Test @TestableLooper.RunWithLooper(setAsMainLooper = true) public void wakeupFromDreamingWhenKeyguardHides() { public void wakeupFromDreamingWhenKeyguardHides_orderUnlockAndWakeOff() { createAndStartViewMediator(false); mViewMediator.onSystemReady(); TestableLooper.get(this).processAllMessages(); // Given device is dreaming when(mUpdateMonitor.isDreaming()).thenReturn(true); // When keyguard is going away mKeyguardStateController.notifyKeyguardGoingAway(true); // And keyguard is disabled which will call #handleHide mViewMediator.setKeyguardEnabled(false); TestableLooper.get(this).processAllMessages(); // Then dream should wake up verify(mPowerManager).wakeUp(anyLong(), anyInt(), eq("com.android.systemui:UNLOCK_DREAMING")); } @Test @TestableLooper.RunWithLooper(setAsMainLooper = true) public void wakeupFromDreamingWhenKeyguardHides_orderUnlockAndWakeOn() { createAndStartViewMediator(true); mViewMediator.onSystemReady(); TestableLooper.get(this).processAllMessages(); when(mPowerManager.isInteractive()).thenReturn(true); // Given device is dreaming Loading Loading @@ -746,6 +770,9 @@ public class KeyguardViewMediatorTest extends SysuiTestCase { @Test public void testWakeAndUnlockingOverDream() { // Ensure ordering unlock and wake is enabled. createAndStartViewMediator(true); // Send signal to wake mViewMediator.onWakeAndUnlocking(true); Loading Loading @@ -774,6 +801,9 @@ public class KeyguardViewMediatorTest extends SysuiTestCase { @Test public void testWakeAndUnlockingOverDream_signalAuthenticateIfStillShowing() { // Ensure ordering unlock and wake is enabled. createAndStartViewMediator(true); // Send signal to wake mViewMediator.onWakeAndUnlocking(true); Loading Loading @@ -1034,6 +1064,13 @@ public class KeyguardViewMediatorTest extends SysuiTestCase { verify(mStatusBarKeyguardViewManager).reset(true); } private void createAndStartViewMediator() { createAndStartViewMediator(false); } private void createAndStartViewMediator(boolean orderUnlockAndWake) { mContext.getOrCreateTestableResources().addOverride( com.android.internal.R.bool.config_orderUnlockAndWake, orderUnlockAndWake); mViewMediator = new KeyguardViewMediator( mContext, mUiEventLogger, Loading Loading
core/res/res/values/config.xml +3 −0 Original line number Diff line number Diff line Loading @@ -6668,4 +6668,7 @@ <!-- Whether or not ActivityManager PSS profiling is disabled. --> <bool name="config_am_disablePssProfiling">false</bool> <!-- Whether unlocking and waking a device are sequenced --> <bool name="config_orderUnlockAndWake">false</bool> </resources>
core/res/res/values/symbols.xml +3 −0 Original line number Diff line number Diff line Loading @@ -5214,4 +5214,7 @@ <java-symbol type="bool" name="config_am_disablePssProfiling" /> <java-symbol type="raw" name="default_ringtone_vibration_effect" /> <!-- Whether we order unlocking and waking --> <java-symbol type="bool" name="config_orderUnlockAndWake" /> </resources>
packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java +19 −0 Original line number Diff line number Diff line Loading @@ -480,6 +480,11 @@ public class KeyguardViewMediator implements CoreStartable, Dumpable, */ private final int mDreamOpenAnimationDuration; /** * Whether unlock and wake should be sequenced. */ private final boolean mOrderUnlockAndWake; /** * The animation used for hiding keyguard. This is used to fetch the animation timings if * WindowManager is not providing us with them. Loading Loading @@ -1459,6 +1464,9 @@ public class KeyguardViewMediator implements CoreStartable, Dumpable, mDreamingToLockscreenTransitionViewModel = dreamingToLockscreenTransitionViewModel; mWmLockscreenVisibilityManager = wmLockscreenVisibilityManager; mMainDispatcher = mainDispatcher; mOrderUnlockAndWake = context.getResources().getBoolean( com.android.internal.R.bool.config_orderUnlockAndWake); } public void userActivity() { Loading Loading @@ -2844,6 +2852,10 @@ public class KeyguardViewMediator implements CoreStartable, Dumpable, private void setUnlockAndWakeFromDream(boolean updatedValue, @WakeAndUnlockUpdateReason int reason) { if (!mOrderUnlockAndWake) { return; } if (updatedValue == mUnlockingAndWakingFromDream) { return; } Loading Loading @@ -2924,6 +2936,13 @@ public class KeyguardViewMediator implements CoreStartable, Dumpable, mHideAnimation.getDuration()); onKeyguardExitFinished(); } // It's possible that the device was unlocked (via BOUNCER or Fingerprint) while // dreaming. It's time to wake up. if ((mDreamOverlayShowing || mUpdateMonitor.isDreaming()) && !mOrderUnlockAndWake) { mPM.wakeUp(mSystemClock.uptimeMillis(), PowerManager.WAKE_REASON_GESTURE, "com.android.systemui:UNLOCK_DREAMING"); } } Trace.endSection(); } Loading
packages/SystemUI/src/com/android/systemui/statusbar/phone/BiometricUnlockController.java +8 −4 Original line number Diff line number Diff line Loading @@ -177,6 +177,7 @@ public class BiometricUnlockController extends KeyguardUpdateMonitorCallback imp private final VibratorHelper mVibratorHelper; private final BiometricUnlockLogger mLogger; private final SystemClock mSystemClock; private final boolean mOrderUnlockAndWake; private long mLastFpFailureUptimeMillis; private int mNumConsecutiveFpFailures; Loading Loading @@ -316,6 +317,8 @@ public class BiometricUnlockController extends KeyguardUpdateMonitorCallback imp mLogger = biometricUnlockLogger; mSystemClock = systemClock; mFeatureFlags = featureFlags; mOrderUnlockAndWake = resources.getBoolean( com.android.internal.R.bool.config_orderUnlockAndWake); dumpManager.registerDumpable(this); } Loading Loading @@ -470,10 +473,11 @@ public class BiometricUnlockController extends KeyguardUpdateMonitorCallback imp Trace.endSection(); }; final boolean wakingFromDream = mMode == MODE_WAKE_AND_UNLOCK_FROM_DREAM && mPowerManager.isInteractive(); final boolean wakeInKeyguard = mMode == MODE_WAKE_AND_UNLOCK_FROM_DREAM && mPowerManager.isInteractive() && mOrderUnlockAndWake && mOrderUnlockAndWake; if (mMode != MODE_NONE && !wakingFromDream) { if (mMode != MODE_NONE && !wakeInKeyguard) { wakeUp.run(); } switch (mMode) { Loading Loading @@ -509,7 +513,7 @@ public class BiometricUnlockController extends KeyguardUpdateMonitorCallback imp // later to awaken. } mNotificationShadeWindowController.setNotificationShadeFocusable(false); mKeyguardViewMediator.onWakeAndUnlocking(wakingFromDream); mKeyguardViewMediator.onWakeAndUnlocking(wakeInKeyguard); Trace.endSection(); break; case MODE_ONLY_WAKE: Loading
packages/SystemUI/tests/src/com/android/systemui/keyguard/KeyguardViewMediatorTest.java +38 −1 Original line number Diff line number Diff line Loading @@ -387,10 +387,34 @@ public class KeyguardViewMediatorTest extends SysuiTestCase { @Test @TestableLooper.RunWithLooper(setAsMainLooper = true) public void wakeupFromDreamingWhenKeyguardHides() { public void wakeupFromDreamingWhenKeyguardHides_orderUnlockAndWakeOff() { createAndStartViewMediator(false); mViewMediator.onSystemReady(); TestableLooper.get(this).processAllMessages(); // Given device is dreaming when(mUpdateMonitor.isDreaming()).thenReturn(true); // When keyguard is going away mKeyguardStateController.notifyKeyguardGoingAway(true); // And keyguard is disabled which will call #handleHide mViewMediator.setKeyguardEnabled(false); TestableLooper.get(this).processAllMessages(); // Then dream should wake up verify(mPowerManager).wakeUp(anyLong(), anyInt(), eq("com.android.systemui:UNLOCK_DREAMING")); } @Test @TestableLooper.RunWithLooper(setAsMainLooper = true) public void wakeupFromDreamingWhenKeyguardHides_orderUnlockAndWakeOn() { createAndStartViewMediator(true); mViewMediator.onSystemReady(); TestableLooper.get(this).processAllMessages(); when(mPowerManager.isInteractive()).thenReturn(true); // Given device is dreaming Loading Loading @@ -746,6 +770,9 @@ public class KeyguardViewMediatorTest extends SysuiTestCase { @Test public void testWakeAndUnlockingOverDream() { // Ensure ordering unlock and wake is enabled. createAndStartViewMediator(true); // Send signal to wake mViewMediator.onWakeAndUnlocking(true); Loading Loading @@ -774,6 +801,9 @@ public class KeyguardViewMediatorTest extends SysuiTestCase { @Test public void testWakeAndUnlockingOverDream_signalAuthenticateIfStillShowing() { // Ensure ordering unlock and wake is enabled. createAndStartViewMediator(true); // Send signal to wake mViewMediator.onWakeAndUnlocking(true); Loading Loading @@ -1034,6 +1064,13 @@ public class KeyguardViewMediatorTest extends SysuiTestCase { verify(mStatusBarKeyguardViewManager).reset(true); } private void createAndStartViewMediator() { createAndStartViewMediator(false); } private void createAndStartViewMediator(boolean orderUnlockAndWake) { mContext.getOrCreateTestableResources().addOverride( com.android.internal.R.bool.config_orderUnlockAndWake, orderUnlockAndWake); mViewMediator = new KeyguardViewMediator( mContext, mUiEventLogger, Loading