diff options
| author | 2023-03-08 19:53:42 +0000 | |
|---|---|---|
| committer | 2023-03-08 20:01:16 +0000 | |
| commit | ec72d790fb1829b1262fd278f1984e186b90485f (patch) | |
| tree | 88944e8203093c96ab6ab9f3f52ea42545f1f2a4 | |
| parent | 12d37b60f7a932ed35c66e87dc8a89e5a0bb10d0 (diff) | |
Fix clock fading in incorrectly
In some cases, when going from AOD->LOCKSCREEN, the isDreaming value
may still be true after the transition is started, producing a visual
flicker as the lockscreen comes up.
Don't allow DREAMING to interrupt AOD->LOCKSCREEN
Fixes: 271919264
Test: atest KeyguardTransitionScenariosTest
Test: manual test transitions for both T & U devices
Change-Id: If1028d4a98b52133790a0d97aee798c8d659ab6b
2 files changed, 49 insertions, 1 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/FromLockscreenTransitionInteractor.kt b/packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/FromLockscreenTransitionInteractor.kt index 911861ddde47..28cc69758308 100644 --- a/packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/FromLockscreenTransitionInteractor.kt +++ b/packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/FromLockscreenTransitionInteractor.kt @@ -64,7 +64,11 @@ constructor( .sample(keyguardTransitionInteractor.startedKeyguardTransitionStep, ::Pair) .collect { pair -> val (isAbleToDream, lastStartedTransition) = pair - if (isAbleToDream && lastStartedTransition.to == KeyguardState.LOCKSCREEN) { + if ( + isAbleToDream && + lastStartedTransition.to == KeyguardState.LOCKSCREEN && + lastStartedTransition.from != KeyguardState.AOD + ) { keyguardTransitionRepository.startTransition( TransitionInfo( name, diff --git a/packages/SystemUI/tests/src/com/android/systemui/keyguard/domain/interactor/KeyguardTransitionScenariosTest.kt b/packages/SystemUI/tests/src/com/android/systemui/keyguard/domain/interactor/KeyguardTransitionScenariosTest.kt index fc3a6383cd88..5cd24e675a54 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/keyguard/domain/interactor/KeyguardTransitionScenariosTest.kt +++ b/packages/SystemUI/tests/src/com/android/systemui/keyguard/domain/interactor/KeyguardTransitionScenariosTest.kt @@ -358,6 +358,50 @@ class KeyguardTransitionScenariosTest : SysuiTestCase() { } @Test + fun `LOCKSCREEN to DREAMING`() = + testScope.runTest { + // GIVEN a device that is not dreaming or dozing + keyguardRepository.setDreamingWithOverlay(false) + keyguardRepository.setWakefulnessModel(startingToWake()) + keyguardRepository.setDozeTransitionModel( + DozeTransitionModel(from = DozeStateModel.DOZE, to = DozeStateModel.FINISH) + ) + runCurrent() + + // GIVEN a prior transition has run to LOCKSCREEN + runner.startTransition( + testScope, + TransitionInfo( + ownerName = "", + from = KeyguardState.GONE, + to = KeyguardState.LOCKSCREEN, + animator = + ValueAnimator().apply { + duration = 10 + interpolator = Interpolators.LINEAR + }, + ) + ) + reset(mockTransitionRepository) + + // WHEN the device begins to dream + keyguardRepository.setDreamingWithOverlay(true) + advanceUntilIdle() + + val info = + withArgCaptor<TransitionInfo> { + verify(mockTransitionRepository).startTransition(capture(), anyBoolean()) + } + // THEN a transition to DREAMING should occur + assertThat(info.ownerName).isEqualTo("FromLockscreenTransitionInteractor") + assertThat(info.from).isEqualTo(KeyguardState.LOCKSCREEN) + assertThat(info.to).isEqualTo(KeyguardState.DREAMING) + assertThat(info.animator).isNotNull() + + coroutineContext.cancelChildren() + } + + @Test fun `LOCKSCREEN to DOZING`() = testScope.runTest { // GIVEN a device with AOD not available |