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

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/21913426

Change-Id: Ie1bc013b107e07475d4a7b271907e2866207d154
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Matt Pietal
2023-03-09 16:15:15 +00:00
committed by Automerger Merge Worker
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 {