Merge "Fix clock fading in incorrectly" into tm-qpr-dev

This commit is contained in:
Matt Pietal
2023-03-09 16:06:04 +00:00
committed by Android (Google) Code Review
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 {