Loading packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/stack/ui/viewmodel/SharedNotificationContainerViewModelTest.kt +39 −0 Original line number Original line Diff line number Diff line Loading @@ -635,6 +635,45 @@ class SharedNotificationContainerViewModelTest(flags: FlagsParameterization) : S assertThat(bounds).isEqualTo(NotificationContainerBounds(top = 1f, bottom = 2f)) assertThat(bounds).isEqualTo(NotificationContainerBounds(top = 1f, bottom = 2f)) } } @Test @DisableSceneContainer fun boundsStableWhenGoingToAlternateBouncer() = testScope.runTest { val bounds by collectLastValue(underTest.bounds) // Start on lockscreen showLockscreen() keyguardInteractor.setNotificationContainerBounds( NotificationContainerBounds(top = 1f, bottom = 2f) ) assertThat(bounds).isEqualTo(NotificationContainerBounds(top = 1f, bottom = 2f)) // Begin transition to AOD keyguardTransitionRepository.sendTransitionStep( TransitionStep(LOCKSCREEN, ALTERNATE_BOUNCER, 0f, TransitionState.STARTED) ) runCurrent() keyguardTransitionRepository.sendTransitionStep( TransitionStep(LOCKSCREEN, ALTERNATE_BOUNCER, 0f, TransitionState.RUNNING) ) runCurrent() // This is the last step before FINISHED is sent, which could trigger a change in bounds keyguardTransitionRepository.sendTransitionStep( TransitionStep(LOCKSCREEN, ALTERNATE_BOUNCER, 1f, TransitionState.RUNNING) ) runCurrent() assertThat(bounds).isEqualTo(NotificationContainerBounds(top = 1f, bottom = 2f)) keyguardTransitionRepository.sendTransitionStep( TransitionStep(LOCKSCREEN, ALTERNATE_BOUNCER, 1f, TransitionState.FINISHED) ) runCurrent() assertThat(bounds).isEqualTo(NotificationContainerBounds(top = 1f, bottom = 2f)) } @Test @Test @DisableSceneContainer @DisableSceneContainer fun boundsDoNotChangeWhileLockscreenToAodTransitionIsActive() = fun boundsDoNotChangeWhileLockscreenToAodTransitionIsActive() = Loading packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/ui/viewmodel/SharedNotificationContainerViewModel.kt +9 −7 Original line number Original line Diff line number Diff line Loading @@ -221,13 +221,15 @@ constructor( /** If the user is visually on one of the unoccluded lockscreen states. */ /** If the user is visually on one of the unoccluded lockscreen states. */ val isOnLockscreen: Flow<Boolean> = val isOnLockscreen: Flow<Boolean> = anyOf( anyOf( keyguardTransitionInteractor.isFinishedIn(AOD), keyguardTransitionInteractor.transitionValue(AOD).map { it > 0f }, keyguardTransitionInteractor.isFinishedIn(DOZING), keyguardTransitionInteractor.transitionValue(DOZING).map { it > 0f }, keyguardTransitionInteractor.isFinishedIn(ALTERNATE_BOUNCER), keyguardTransitionInteractor.transitionValue(ALTERNATE_BOUNCER).map { it > 0f }, keyguardTransitionInteractor.isFinishedIn( keyguardTransitionInteractor .transitionValue( scene = Scenes.Bouncer, scene = Scenes.Bouncer, stateWithoutSceneContainer = PRIMARY_BOUNCER, stateWithoutSceneContainer = PRIMARY_BOUNCER, ), ) .map { it > 0f }, keyguardTransitionInteractor.transitionValue(LOCKSCREEN).map { it > 0f }, keyguardTransitionInteractor.transitionValue(LOCKSCREEN).map { it > 0f }, ) ) .flowName("isOnLockscreen") .flowName("isOnLockscreen") Loading Loading
packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/stack/ui/viewmodel/SharedNotificationContainerViewModelTest.kt +39 −0 Original line number Original line Diff line number Diff line Loading @@ -635,6 +635,45 @@ class SharedNotificationContainerViewModelTest(flags: FlagsParameterization) : S assertThat(bounds).isEqualTo(NotificationContainerBounds(top = 1f, bottom = 2f)) assertThat(bounds).isEqualTo(NotificationContainerBounds(top = 1f, bottom = 2f)) } } @Test @DisableSceneContainer fun boundsStableWhenGoingToAlternateBouncer() = testScope.runTest { val bounds by collectLastValue(underTest.bounds) // Start on lockscreen showLockscreen() keyguardInteractor.setNotificationContainerBounds( NotificationContainerBounds(top = 1f, bottom = 2f) ) assertThat(bounds).isEqualTo(NotificationContainerBounds(top = 1f, bottom = 2f)) // Begin transition to AOD keyguardTransitionRepository.sendTransitionStep( TransitionStep(LOCKSCREEN, ALTERNATE_BOUNCER, 0f, TransitionState.STARTED) ) runCurrent() keyguardTransitionRepository.sendTransitionStep( TransitionStep(LOCKSCREEN, ALTERNATE_BOUNCER, 0f, TransitionState.RUNNING) ) runCurrent() // This is the last step before FINISHED is sent, which could trigger a change in bounds keyguardTransitionRepository.sendTransitionStep( TransitionStep(LOCKSCREEN, ALTERNATE_BOUNCER, 1f, TransitionState.RUNNING) ) runCurrent() assertThat(bounds).isEqualTo(NotificationContainerBounds(top = 1f, bottom = 2f)) keyguardTransitionRepository.sendTransitionStep( TransitionStep(LOCKSCREEN, ALTERNATE_BOUNCER, 1f, TransitionState.FINISHED) ) runCurrent() assertThat(bounds).isEqualTo(NotificationContainerBounds(top = 1f, bottom = 2f)) } @Test @Test @DisableSceneContainer @DisableSceneContainer fun boundsDoNotChangeWhileLockscreenToAodTransitionIsActive() = fun boundsDoNotChangeWhileLockscreenToAodTransitionIsActive() = Loading
packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/ui/viewmodel/SharedNotificationContainerViewModel.kt +9 −7 Original line number Original line Diff line number Diff line Loading @@ -221,13 +221,15 @@ constructor( /** If the user is visually on one of the unoccluded lockscreen states. */ /** If the user is visually on one of the unoccluded lockscreen states. */ val isOnLockscreen: Flow<Boolean> = val isOnLockscreen: Flow<Boolean> = anyOf( anyOf( keyguardTransitionInteractor.isFinishedIn(AOD), keyguardTransitionInteractor.transitionValue(AOD).map { it > 0f }, keyguardTransitionInteractor.isFinishedIn(DOZING), keyguardTransitionInteractor.transitionValue(DOZING).map { it > 0f }, keyguardTransitionInteractor.isFinishedIn(ALTERNATE_BOUNCER), keyguardTransitionInteractor.transitionValue(ALTERNATE_BOUNCER).map { it > 0f }, keyguardTransitionInteractor.isFinishedIn( keyguardTransitionInteractor .transitionValue( scene = Scenes.Bouncer, scene = Scenes.Bouncer, stateWithoutSceneContainer = PRIMARY_BOUNCER, stateWithoutSceneContainer = PRIMARY_BOUNCER, ), ) .map { it > 0f }, keyguardTransitionInteractor.transitionValue(LOCKSCREEN).map { it > 0f }, keyguardTransitionInteractor.transitionValue(LOCKSCREEN).map { it > 0f }, ) ) .flowName("isOnLockscreen") .flowName("isOnLockscreen") Loading