Loading packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/viewmodel/LockscreenToGoneTransitionViewModelTest.kt +3 −1 Original line number Diff line number Diff line Loading @@ -68,7 +68,9 @@ class LockscreenToGoneTransitionViewModelTest : SysuiTestCase() { repository.sendTransitionStep(step(0f)) assertThat(alpha).isEqualTo(0.5f) // Before the halfway point, it will have reached zero repository.sendTransitionStep(step(0.25f)) assertThat(alpha).isEqualTo(0.25f) repository.sendTransitionStep(step(.5f)) assertThat(alpha).isEqualTo(0f) } Loading packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/stack/ui/viewmodel/SharedNotificationContainerViewModelTest.kt +0 −53 Original line number Diff line number Diff line Loading @@ -719,59 +719,6 @@ class SharedNotificationContainerViewModelTest : SysuiTestCase() { assertThat(alpha).isEqualTo(1f) } @Test fun alphaDoesNotUpdateWhileGoneTransitionIsRunning() = testScope.runTest { val viewState = ViewStateAccessor() val alpha by collectLastValue(underTest.keyguardAlpha(viewState)) showLockscreen() // GONE transition gets to 90% complete keyguardTransitionRepository.sendTransitionStep( TransitionStep( from = KeyguardState.LOCKSCREEN, to = KeyguardState.GONE, transitionState = TransitionState.STARTED, value = 0f, ) ) runCurrent() keyguardTransitionRepository.sendTransitionStep( TransitionStep( from = KeyguardState.LOCKSCREEN, to = KeyguardState.GONE, transitionState = TransitionState.RUNNING, value = 0.9f, ) ) runCurrent() // At this point, alpha should be zero assertThat(alpha).isEqualTo(0f) // An attempt to override by the shade should be ignored shadeRepository.setQsExpansion(0.5f) assertThat(alpha).isEqualTo(0f) } @Test fun alphaWhenGoneIsSetToOne() = testScope.runTest { val viewState = ViewStateAccessor() val alpha by collectLastValue(underTest.keyguardAlpha(viewState)) showLockscreen() keyguardTransitionRepository.sendTransitionSteps( from = KeyguardState.LOCKSCREEN, to = KeyguardState.GONE, testScope ) keyguardRepository.setStatusBarState(StatusBarState.SHADE) assertThat(alpha).isEqualTo(1f) } @Test fun shadeCollapseFadeIn() = testScope.runTest { Loading packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/FromLockscreenTransitionInteractor.kt +16 −5 Original line number Diff line number Diff line Loading @@ -289,10 +289,7 @@ constructor( .collect { pair -> val (isKeyguardGoingAway, lastStartedStep) = pair if (isKeyguardGoingAway && lastStartedStep.to == KeyguardState.LOCKSCREEN) { startTransitionTo( KeyguardState.GONE, modeOnCanceled = TransitionModeOnCanceled.RESET, ) startTransitionTo(KeyguardState.GONE) } } } Loading @@ -306,6 +303,20 @@ constructor( startTransitionTo(KeyguardState.GONE) } } return } scope.launch { keyguardInteractor.isKeyguardGoingAway .sample(startedKeyguardTransitionStep, ::Pair) .collect { pair -> KeyguardWmStateRefactor.assertInLegacyMode() val (isKeyguardGoingAway, lastStartedStep) = pair if (isKeyguardGoingAway && lastStartedStep.to == KeyguardState.LOCKSCREEN) { startTransitionTo(KeyguardState.GONE) } } } } Loading Loading @@ -402,7 +413,7 @@ constructor( val TO_OCCLUDED_DURATION = 450.milliseconds val TO_AOD_DURATION = 500.milliseconds val TO_PRIMARY_BOUNCER_DURATION = DEFAULT_DURATION val TO_GONE_DURATION = 633.milliseconds val TO_GONE_DURATION = DEFAULT_DURATION val TO_GLANCEABLE_HUB_DURATION = 1.seconds } } packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/KeyguardTransitionInteractor.kt +0 −1 Original line number Diff line number Diff line Loading @@ -86,7 +86,6 @@ constructor( return transitionValueCache.getOrPut(state) { MutableSharedFlow<Float>( extraBufferCapacity = 2, replay = 1, onBufferOverflow = BufferOverflow.DROP_OLDEST ) } Loading packages/SystemUI/src/com/android/systemui/keyguard/ui/viewmodel/AodToLockscreenTransitionViewModel.kt +18 −17 Original line number Diff line number Diff line Loading @@ -30,6 +30,8 @@ import javax.inject.Inject import kotlin.time.Duration.Companion.milliseconds import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.combine import kotlinx.coroutines.flow.map /** * Breaks down AOD->LOCKSCREEN transition into discrete steps for corresponding views to consume. Loading @@ -51,8 +53,6 @@ constructor( to = KeyguardState.LOCKSCREEN, ) private var isShadeExpanded = false /** * Begin the transition from wherever the y-translation value is currently. This helps ensure a * smooth transition if a transition in canceled. Loading @@ -77,21 +77,22 @@ constructor( } val notificationAlpha: Flow<Float> = combine( shadeInteractor.shadeExpansion.map { it > 0f }, shadeInteractor.qsExpansion.map { it > 0f }, transitionAnimation.sharedFlow( duration = 500.milliseconds, onStart = { isShadeExpanded = shadeInteractor.shadeExpansion.value > 0f || shadeInteractor.qsExpansion.value > 0f }, onStep = { if (isShadeExpanded) { onStep = { it }, onCancel = { 1f }, ), ) { isShadeExpanded, isQsExpanded, alpha -> if (isShadeExpanded || isQsExpanded) { // One example of this happening is dragging a notification while pulsing on AOD 1f } else { it alpha } } }, ) val shortcutsAlpha: Flow<Float> = transitionAnimation.sharedFlow( Loading Loading
packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/viewmodel/LockscreenToGoneTransitionViewModelTest.kt +3 −1 Original line number Diff line number Diff line Loading @@ -68,7 +68,9 @@ class LockscreenToGoneTransitionViewModelTest : SysuiTestCase() { repository.sendTransitionStep(step(0f)) assertThat(alpha).isEqualTo(0.5f) // Before the halfway point, it will have reached zero repository.sendTransitionStep(step(0.25f)) assertThat(alpha).isEqualTo(0.25f) repository.sendTransitionStep(step(.5f)) assertThat(alpha).isEqualTo(0f) } Loading
packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/stack/ui/viewmodel/SharedNotificationContainerViewModelTest.kt +0 −53 Original line number Diff line number Diff line Loading @@ -719,59 +719,6 @@ class SharedNotificationContainerViewModelTest : SysuiTestCase() { assertThat(alpha).isEqualTo(1f) } @Test fun alphaDoesNotUpdateWhileGoneTransitionIsRunning() = testScope.runTest { val viewState = ViewStateAccessor() val alpha by collectLastValue(underTest.keyguardAlpha(viewState)) showLockscreen() // GONE transition gets to 90% complete keyguardTransitionRepository.sendTransitionStep( TransitionStep( from = KeyguardState.LOCKSCREEN, to = KeyguardState.GONE, transitionState = TransitionState.STARTED, value = 0f, ) ) runCurrent() keyguardTransitionRepository.sendTransitionStep( TransitionStep( from = KeyguardState.LOCKSCREEN, to = KeyguardState.GONE, transitionState = TransitionState.RUNNING, value = 0.9f, ) ) runCurrent() // At this point, alpha should be zero assertThat(alpha).isEqualTo(0f) // An attempt to override by the shade should be ignored shadeRepository.setQsExpansion(0.5f) assertThat(alpha).isEqualTo(0f) } @Test fun alphaWhenGoneIsSetToOne() = testScope.runTest { val viewState = ViewStateAccessor() val alpha by collectLastValue(underTest.keyguardAlpha(viewState)) showLockscreen() keyguardTransitionRepository.sendTransitionSteps( from = KeyguardState.LOCKSCREEN, to = KeyguardState.GONE, testScope ) keyguardRepository.setStatusBarState(StatusBarState.SHADE) assertThat(alpha).isEqualTo(1f) } @Test fun shadeCollapseFadeIn() = testScope.runTest { Loading
packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/FromLockscreenTransitionInteractor.kt +16 −5 Original line number Diff line number Diff line Loading @@ -289,10 +289,7 @@ constructor( .collect { pair -> val (isKeyguardGoingAway, lastStartedStep) = pair if (isKeyguardGoingAway && lastStartedStep.to == KeyguardState.LOCKSCREEN) { startTransitionTo( KeyguardState.GONE, modeOnCanceled = TransitionModeOnCanceled.RESET, ) startTransitionTo(KeyguardState.GONE) } } } Loading @@ -306,6 +303,20 @@ constructor( startTransitionTo(KeyguardState.GONE) } } return } scope.launch { keyguardInteractor.isKeyguardGoingAway .sample(startedKeyguardTransitionStep, ::Pair) .collect { pair -> KeyguardWmStateRefactor.assertInLegacyMode() val (isKeyguardGoingAway, lastStartedStep) = pair if (isKeyguardGoingAway && lastStartedStep.to == KeyguardState.LOCKSCREEN) { startTransitionTo(KeyguardState.GONE) } } } } Loading Loading @@ -402,7 +413,7 @@ constructor( val TO_OCCLUDED_DURATION = 450.milliseconds val TO_AOD_DURATION = 500.milliseconds val TO_PRIMARY_BOUNCER_DURATION = DEFAULT_DURATION val TO_GONE_DURATION = 633.milliseconds val TO_GONE_DURATION = DEFAULT_DURATION val TO_GLANCEABLE_HUB_DURATION = 1.seconds } }
packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/KeyguardTransitionInteractor.kt +0 −1 Original line number Diff line number Diff line Loading @@ -86,7 +86,6 @@ constructor( return transitionValueCache.getOrPut(state) { MutableSharedFlow<Float>( extraBufferCapacity = 2, replay = 1, onBufferOverflow = BufferOverflow.DROP_OLDEST ) } Loading
packages/SystemUI/src/com/android/systemui/keyguard/ui/viewmodel/AodToLockscreenTransitionViewModel.kt +18 −17 Original line number Diff line number Diff line Loading @@ -30,6 +30,8 @@ import javax.inject.Inject import kotlin.time.Duration.Companion.milliseconds import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.combine import kotlinx.coroutines.flow.map /** * Breaks down AOD->LOCKSCREEN transition into discrete steps for corresponding views to consume. Loading @@ -51,8 +53,6 @@ constructor( to = KeyguardState.LOCKSCREEN, ) private var isShadeExpanded = false /** * Begin the transition from wherever the y-translation value is currently. This helps ensure a * smooth transition if a transition in canceled. Loading @@ -77,21 +77,22 @@ constructor( } val notificationAlpha: Flow<Float> = combine( shadeInteractor.shadeExpansion.map { it > 0f }, shadeInteractor.qsExpansion.map { it > 0f }, transitionAnimation.sharedFlow( duration = 500.milliseconds, onStart = { isShadeExpanded = shadeInteractor.shadeExpansion.value > 0f || shadeInteractor.qsExpansion.value > 0f }, onStep = { if (isShadeExpanded) { onStep = { it }, onCancel = { 1f }, ), ) { isShadeExpanded, isQsExpanded, alpha -> if (isShadeExpanded || isQsExpanded) { // One example of this happening is dragging a notification while pulsing on AOD 1f } else { it alpha } } }, ) val shortcutsAlpha: Flow<Float> = transitionAnimation.sharedFlow( Loading