diff options
2 files changed, 19 insertions, 2 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/UnlockedScreenOffAnimationController.kt b/packages/SystemUI/src/com/android/systemui/statusbar/phone/UnlockedScreenOffAnimationController.kt index 37f032b464b7..2c15e27b8148 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/UnlockedScreenOffAnimationController.kt +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/UnlockedScreenOffAnimationController.kt @@ -125,6 +125,7 @@ class UnlockedScreenOffAnimationController @Inject constructor( // FrameCallback used to delay starting the light reveal animation until the next frame private val startLightRevealCallback = TraceUtils.namedRunnable("startLightReveal") { + lightRevealAnimationPlaying = true lightRevealAnimator.start() } @@ -268,7 +269,6 @@ class UnlockedScreenOffAnimationController @Inject constructor( decidedToAnimateGoingToSleep = true shouldAnimateInKeyguard = true - lightRevealAnimationPlaying = true // Start the animation on the next frame. startAnimation() is called after // PhoneWindowManager makes a binder call to System UI on @@ -283,7 +283,8 @@ class UnlockedScreenOffAnimationController @Inject constructor( // dispatched, a race condition could make it possible for this callback to be run // as the device is waking up. That results in the AOD UI being shown while we wake // up, with unpredictable consequences. - if (!powerManager.isInteractive(Display.DEFAULT_DISPLAY)) { + if (!powerManager.isInteractive(Display.DEFAULT_DISPLAY) && + shouldAnimateInKeyguard) { aodUiAnimationPlaying = true // Show AOD. That'll cause the KeyguardVisibilityHelper to call diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/UnlockedScreenOffAnimationControllerTest.kt b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/UnlockedScreenOffAnimationControllerTest.kt index e76f26d8128e..e6f8c4861a94 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/UnlockedScreenOffAnimationControllerTest.kt +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/UnlockedScreenOffAnimationControllerTest.kt @@ -134,6 +134,22 @@ class UnlockedScreenOffAnimationControllerTest : SysuiTestCase() { verify(shadeViewController, times(1)).showAodUi() } + @Test + fun testAodUiShowNotInvokedIfWakingUp() { + `when`(dozeParameters.canControlUnlockedScreenOff()).thenReturn(true) + `when`(powerManager.isInteractive).thenReturn(false) + + val callbackCaptor = ArgumentCaptor.forClass(Runnable::class.java) + controller.startAnimation() + controller.onStartedWakingUp() + + verify(handler).postDelayed(callbackCaptor.capture(), anyLong()) + + callbackCaptor.value.run() + + verify(shadeViewController, never()).showAodUi() + } + /** * The AOD UI is shown during the screen off animation, after a delay to allow the light reveal * animation to start. If the device is woken up during the screen off, we should *never* do |