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
This commit is contained in:
Matt Pietal
2023-03-08 19:53:42 +00:00
parent 12d37b60f7
commit ec72d790fb
2 changed files with 49 additions and 1 deletions

View File

@@ -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,

View File

@@ -357,6 +357,50 @@ class KeyguardTransitionScenariosTest : SysuiTestCase() {
coroutineContext.cancelChildren()
}
@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 {