Loading packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/stack/ui/viewmodel/SharedNotificationContainerViewModelTest.kt +25 −0 Original line number Diff line number Diff line Loading @@ -1126,6 +1126,31 @@ class SharedNotificationContainerViewModelTest(flags: FlagsParameterization) : S assertThat(fadeIn[0]).isEqualTo(false) } @Test fun shadeCollapseFadeIn_doesNotRunIfTransitioningToDream() = testScope.runTest { val fadeIn by collectValues(underTest.shadeCollapseFadeIn) // Start on lockscreen without the shade showLockscreen() assertThat(fadeIn[0]).isEqualTo(false) // ... then the shade expands showLockscreenWithShadeExpanded() assertThat(fadeIn[0]).isEqualTo(false) // ... then user hits power to go to dream keyguardTransitionRepository.sendTransitionSteps( from = LOCKSCREEN, to = DREAMING, testScope, ) // ... followed by a shade collapse showLockscreen() // ... does not trigger a fade in assertThat(fadeIn[0]).isEqualTo(false) } @Test @BrokenWithSceneContainer(330311871) fun alpha_isZero_fromPrimaryBouncerToGoneWhileCommunalSceneVisible() = Loading packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/ui/viewmodel/SharedNotificationContainerViewModel.kt +14 −6 Original line number Diff line number Diff line Loading @@ -412,8 +412,8 @@ constructor( .dumpValue("isDreamingWithoutShade") /** * Fade in if the user swipes the shade back up, not if collapsed by going to AOD. This is * needed due to the lack of a SHADE state with existing keyguard transitions. * Fade in if the user swipes the shade back up, not if collapsed by going to AOD or DREAMING. * This is needed due to the lack of a SHADE state with existing keyguard transitions. */ private fun awaitCollapse(): Flow<Boolean> { var aodTransitionIsComplete = true Loading @@ -422,9 +422,13 @@ constructor( keyguardTransitionInteractor.isInTransition( edge = Edge.create(from = LOCKSCREEN, to = AOD) ), ::Pair, keyguardTransitionInteractor.isInTransition( edge = Edge.create(from = LOCKSCREEN, to = DREAMING) ), ::Triple, ) .transformWhile { (isOnLockscreenWithoutShade, aodTransitionIsRunning) -> .transformWhile { (isOnLockscreenWithoutShade, aodTransitionIsRunning, dreamTransitionIsRunning) -> // Wait until the AOD transition is complete before terminating if (!aodTransitionIsComplete && !aodTransitionIsRunning) { aodTransitionIsComplete = true Loading @@ -437,6 +441,9 @@ constructor( // Shade is closed, fade in and terminate emit(true) false } else if (dreamTransitionIsRunning) { emit(false) false } else { true } Loading @@ -452,8 +459,9 @@ constructor( emit(false) // Wait for shade to be fully expanded isShadeLocked.first { it } // ... and then for it to be collapsed OR a transition to AOD begins. // If AOD, do not fade in (a fade out occurs instead). // ... and then for it to be collapsed OR a transition to AOD or DREAMING // begins. // If AOD or DREAMING, do not fade in (a fade out occurs instead). awaitCollapse().collect { doFadeIn -> if (doFadeIn) { emit(true) Loading Loading
packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/stack/ui/viewmodel/SharedNotificationContainerViewModelTest.kt +25 −0 Original line number Diff line number Diff line Loading @@ -1126,6 +1126,31 @@ class SharedNotificationContainerViewModelTest(flags: FlagsParameterization) : S assertThat(fadeIn[0]).isEqualTo(false) } @Test fun shadeCollapseFadeIn_doesNotRunIfTransitioningToDream() = testScope.runTest { val fadeIn by collectValues(underTest.shadeCollapseFadeIn) // Start on lockscreen without the shade showLockscreen() assertThat(fadeIn[0]).isEqualTo(false) // ... then the shade expands showLockscreenWithShadeExpanded() assertThat(fadeIn[0]).isEqualTo(false) // ... then user hits power to go to dream keyguardTransitionRepository.sendTransitionSteps( from = LOCKSCREEN, to = DREAMING, testScope, ) // ... followed by a shade collapse showLockscreen() // ... does not trigger a fade in assertThat(fadeIn[0]).isEqualTo(false) } @Test @BrokenWithSceneContainer(330311871) fun alpha_isZero_fromPrimaryBouncerToGoneWhileCommunalSceneVisible() = Loading
packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/ui/viewmodel/SharedNotificationContainerViewModel.kt +14 −6 Original line number Diff line number Diff line Loading @@ -412,8 +412,8 @@ constructor( .dumpValue("isDreamingWithoutShade") /** * Fade in if the user swipes the shade back up, not if collapsed by going to AOD. This is * needed due to the lack of a SHADE state with existing keyguard transitions. * Fade in if the user swipes the shade back up, not if collapsed by going to AOD or DREAMING. * This is needed due to the lack of a SHADE state with existing keyguard transitions. */ private fun awaitCollapse(): Flow<Boolean> { var aodTransitionIsComplete = true Loading @@ -422,9 +422,13 @@ constructor( keyguardTransitionInteractor.isInTransition( edge = Edge.create(from = LOCKSCREEN, to = AOD) ), ::Pair, keyguardTransitionInteractor.isInTransition( edge = Edge.create(from = LOCKSCREEN, to = DREAMING) ), ::Triple, ) .transformWhile { (isOnLockscreenWithoutShade, aodTransitionIsRunning) -> .transformWhile { (isOnLockscreenWithoutShade, aodTransitionIsRunning, dreamTransitionIsRunning) -> // Wait until the AOD transition is complete before terminating if (!aodTransitionIsComplete && !aodTransitionIsRunning) { aodTransitionIsComplete = true Loading @@ -437,6 +441,9 @@ constructor( // Shade is closed, fade in and terminate emit(true) false } else if (dreamTransitionIsRunning) { emit(false) false } else { true } Loading @@ -452,8 +459,9 @@ constructor( emit(false) // Wait for shade to be fully expanded isShadeLocked.first { it } // ... and then for it to be collapsed OR a transition to AOD begins. // If AOD, do not fade in (a fade out occurs instead). // ... and then for it to be collapsed OR a transition to AOD or DREAMING // begins. // If AOD or DREAMING, do not fade in (a fade out occurs instead). awaitCollapse().collect { doFadeIn -> if (doFadeIn) { emit(true) Loading