Loading packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/viewmodel/KeyguardRootViewModelTest.kt +39 −0 Original line number Diff line number Diff line Loading @@ -503,6 +503,45 @@ class KeyguardRootViewModelTest(flags: FlagsParameterization) : SysuiTestCase() assertThat(alpha).isEqualTo(1f) } @Test @DisableSceneContainer fun alphaFromShadeExpansion_doesNotEmitWhenLockscreenToDreamTransitionRunning() = testScope.runTest { keyguardTransitionRepository.sendTransitionSteps( from = KeyguardState.AOD, to = KeyguardState.LOCKSCREEN, testScope, ) val alpha by collectLastValue(underTest.alpha(viewState)) shadeTestUtil.setQsExpansion(0f) assertThat(alpha).isEqualTo(1f) keyguardTransitionRepository.sendTransitionSteps( listOf( TransitionStep( from = KeyguardState.LOCKSCREEN, to = KeyguardState.DREAMING, transitionState = TransitionState.STARTED, value = 0f, ), TransitionStep( from = KeyguardState.LOCKSCREEN, to = KeyguardState.DREAMING, transitionState = TransitionState.RUNNING, value = 0.1f, ), ), testScope, ) val alphaBeforeExpansion = alpha shadeTestUtil.setQsExpansion(0.5f) // Alpha should remain unchanged instead of being affected by expansion. assertThat(alpha).isEqualTo(alphaBeforeExpansion) } @Test fun alpha_shadeClosedOverLockscreen_isOne() = testScope.runTest { Loading packages/SystemUI/src/com/android/systemui/keyguard/ui/viewmodel/KeyguardRootViewModel.kt +15 −19 Original line number Diff line number Diff line Loading @@ -162,6 +162,7 @@ constructor( private val alphaOnShadeExpansion: Flow<Float> = combineTransform( anyOf( keyguardTransitionInteractor.isInTransition( edge = Edge.create(from = LOCKSCREEN, to = Scenes.Gone), edgeWithoutSceneContainer = Edge.create(from = LOCKSCREEN, to = GONE), Loading @@ -171,21 +172,16 @@ constructor( edgeWithoutSceneContainer = Edge.create(from = PRIMARY_BOUNCER, to = LOCKSCREEN), ), keyguardTransitionInteractor.isInTransition( Edge.create(from = LOCKSCREEN, to = DREAMING) ), ), isOnLockscreen, shadeInteractor.qsExpansion, shadeInteractor.shadeExpansion, ) { lockscreenToGoneTransitionRunning, primaryBouncerToLockscreenTransitionRunning, isOnLockscreen, qsExpansion, shadeExpansion -> ) { disabledTransitionRunning, isOnLockscreen, qsExpansion, shadeExpansion -> // Fade out quickly as the shade expands if ( isOnLockscreen && !lockscreenToGoneTransitionRunning && !primaryBouncerToLockscreenTransitionRunning ) { if (isOnLockscreen && !disabledTransitionRunning) { val alpha = 1f - MathUtils.constrainedMap( Loading Loading
packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/viewmodel/KeyguardRootViewModelTest.kt +39 −0 Original line number Diff line number Diff line Loading @@ -503,6 +503,45 @@ class KeyguardRootViewModelTest(flags: FlagsParameterization) : SysuiTestCase() assertThat(alpha).isEqualTo(1f) } @Test @DisableSceneContainer fun alphaFromShadeExpansion_doesNotEmitWhenLockscreenToDreamTransitionRunning() = testScope.runTest { keyguardTransitionRepository.sendTransitionSteps( from = KeyguardState.AOD, to = KeyguardState.LOCKSCREEN, testScope, ) val alpha by collectLastValue(underTest.alpha(viewState)) shadeTestUtil.setQsExpansion(0f) assertThat(alpha).isEqualTo(1f) keyguardTransitionRepository.sendTransitionSteps( listOf( TransitionStep( from = KeyguardState.LOCKSCREEN, to = KeyguardState.DREAMING, transitionState = TransitionState.STARTED, value = 0f, ), TransitionStep( from = KeyguardState.LOCKSCREEN, to = KeyguardState.DREAMING, transitionState = TransitionState.RUNNING, value = 0.1f, ), ), testScope, ) val alphaBeforeExpansion = alpha shadeTestUtil.setQsExpansion(0.5f) // Alpha should remain unchanged instead of being affected by expansion. assertThat(alpha).isEqualTo(alphaBeforeExpansion) } @Test fun alpha_shadeClosedOverLockscreen_isOne() = testScope.runTest { Loading
packages/SystemUI/src/com/android/systemui/keyguard/ui/viewmodel/KeyguardRootViewModel.kt +15 −19 Original line number Diff line number Diff line Loading @@ -162,6 +162,7 @@ constructor( private val alphaOnShadeExpansion: Flow<Float> = combineTransform( anyOf( keyguardTransitionInteractor.isInTransition( edge = Edge.create(from = LOCKSCREEN, to = Scenes.Gone), edgeWithoutSceneContainer = Edge.create(from = LOCKSCREEN, to = GONE), Loading @@ -171,21 +172,16 @@ constructor( edgeWithoutSceneContainer = Edge.create(from = PRIMARY_BOUNCER, to = LOCKSCREEN), ), keyguardTransitionInteractor.isInTransition( Edge.create(from = LOCKSCREEN, to = DREAMING) ), ), isOnLockscreen, shadeInteractor.qsExpansion, shadeInteractor.shadeExpansion, ) { lockscreenToGoneTransitionRunning, primaryBouncerToLockscreenTransitionRunning, isOnLockscreen, qsExpansion, shadeExpansion -> ) { disabledTransitionRunning, isOnLockscreen, qsExpansion, shadeExpansion -> // Fade out quickly as the shade expands if ( isOnLockscreen && !lockscreenToGoneTransitionRunning && !primaryBouncerToLockscreenTransitionRunning ) { if (isOnLockscreen && !disabledTransitionRunning) { val alpha = 1f - MathUtils.constrainedMap( Loading