Loading packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/viewmodel/PrimaryBouncerToGoneTransitionViewModelTest.kt +36 −0 Original line number Diff line number Diff line Loading @@ -149,6 +149,42 @@ class PrimaryBouncerToGoneTransitionViewModelTest : SysuiTestCase() { values.forEach { assertThat(it).isEqualTo(1f) } } @Test fun notificationAlpha() = testScope.runTest { val values by collectValues(underTest.notificationAlpha) runCurrent() keyguardTransitionRepository.sendTransitionSteps( from = KeyguardState.PRIMARY_BOUNCER, to = KeyguardState.GONE, testScope, ) assertThat(values[0]).isEqualTo(1f) // Should fade to zero between here assertThat(values[1]).isEqualTo(0f) } @Test fun notificationAlpha_leaveShadeOpen() = testScope.runTest { val values by collectValues(underTest.notificationAlpha) runCurrent() sysuiStatusBarStateController.setLeaveOpenOnKeyguardHide(true) keyguardTransitionRepository.sendTransitionSteps( from = KeyguardState.PRIMARY_BOUNCER, to = KeyguardState.GONE, testScope, ) assertThat(values.size).isEqualTo(2) // Shade stays open, and alpha should remain visible values.forEach { assertThat(it).isEqualTo(1f) } } private fun step( value: Float, state: TransitionState = TransitionState.RUNNING Loading packages/SystemUI/src/com/android/systemui/keyguard/ui/viewmodel/PrimaryBouncerToGoneTransitionViewModel.kt +17 −0 Original line number Diff line number Diff line Loading @@ -60,6 +60,22 @@ constructor( private var leaveShadeOpen: Boolean = false private var willRunDismissFromKeyguard: Boolean = false val notificationAlpha: Flow<Float> = transitionAnimation.sharedFlow( duration = 200.milliseconds, onStart = { leaveShadeOpen = statusBarStateController.leaveOpenOnKeyguardHide() willRunDismissFromKeyguard = primaryBouncerInteractor.willRunDismissFromKeyguard() }, onStep = { if (willRunDismissFromKeyguard || leaveShadeOpen) { 1f } else { 1f - it } }, ) /** Bouncer container alpha */ val bouncerAlpha: Flow<Float> = if (featureFlags.isEnabled(Flags.REFACTOR_KEYGUARD_DISMISS_INTENT)) { Loading Loading @@ -94,6 +110,7 @@ constructor( } else { createLockscreenAlpha(primaryBouncerInteractor::willRunDismissFromKeyguard) } private fun createLockscreenAlpha(willRunAnimationOnKeyguard: () -> Boolean): Flow<Float> { return transitionAnimation.sharedFlow( duration = 50.milliseconds, Loading packages/SystemUI/src/com/android/systemui/shade/NotificationPanelViewController.java +15 −2 Original line number Diff line number Diff line Loading @@ -1201,7 +1201,12 @@ public final class NotificationPanelViewController implements ShadeSurface, Dump // Primary bouncer->Gone (ensures lockscreen content is not visible on successful auth) if (!migrateClocksToBlueprint()) { collectFlow(mView, mPrimaryBouncerToGoneTransitionViewModel.getLockscreenAlpha(), setTransitionAlpha(mNotificationStackScrollLayoutController), mMainDispatcher); setTransitionAlpha(mNotificationStackScrollLayoutController, /* excludeNotifications=*/ true), mMainDispatcher); collectFlow(mView, mPrimaryBouncerToGoneTransitionViewModel.getNotificationAlpha(), (Float alpha) -> { mNotificationStackScrollLayoutController.setMaxAlphaForExpansion(alpha); }, mMainDispatcher); } } Loading Loading @@ -4725,9 +4730,17 @@ public final class NotificationPanelViewController implements ShadeSurface, Dump private Consumer<Float> setTransitionAlpha( NotificationStackScrollLayoutController stackScroller) { return setTransitionAlpha(stackScroller, /* excludeNotifications= */ false); } private Consumer<Float> setTransitionAlpha( NotificationStackScrollLayoutController stackScroller, boolean excludeNotifications) { return (Float alpha) -> { mKeyguardStatusViewController.setAlpha(alpha); if (!excludeNotifications) { stackScroller.setMaxAlphaForExpansion(alpha); } if (keyguardBottomAreaRefactor()) { mKeyguardInteractor.setAlpha(alpha); Loading packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/ui/viewmodel/SharedNotificationContainerViewModel.kt +1 −1 Original line number Diff line number Diff line Loading @@ -333,7 +333,7 @@ constructor( lockscreenToPrimaryBouncerTransitionViewModel.lockscreenAlpha, occludedToAodTransitionViewModel.lockscreenAlpha, occludedToLockscreenTransitionViewModel.lockscreenAlpha, primaryBouncerToGoneTransitionViewModel.lockscreenAlpha, primaryBouncerToGoneTransitionViewModel.notificationAlpha, primaryBouncerToLockscreenTransitionViewModel.lockscreenAlpha, ) Loading packages/SystemUI/tests/src/com/android/systemui/shade/NotificationPanelViewControllerBaseTest.java +2 −0 Original line number Diff line number Diff line Loading @@ -599,6 +599,8 @@ public class NotificationPanelViewControllerBaseTest extends SysuiTestCase { // Primary Bouncer->Gone when(mPrimaryBouncerToGoneTransitionViewModel.getLockscreenAlpha()) .thenReturn(emptyFlow()); when(mPrimaryBouncerToGoneTransitionViewModel.getNotificationAlpha()) .thenReturn(emptyFlow()); NotificationsKeyguardViewStateRepository notifsKeyguardViewStateRepository = new NotificationsKeyguardViewStateRepository(); Loading Loading
packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/viewmodel/PrimaryBouncerToGoneTransitionViewModelTest.kt +36 −0 Original line number Diff line number Diff line Loading @@ -149,6 +149,42 @@ class PrimaryBouncerToGoneTransitionViewModelTest : SysuiTestCase() { values.forEach { assertThat(it).isEqualTo(1f) } } @Test fun notificationAlpha() = testScope.runTest { val values by collectValues(underTest.notificationAlpha) runCurrent() keyguardTransitionRepository.sendTransitionSteps( from = KeyguardState.PRIMARY_BOUNCER, to = KeyguardState.GONE, testScope, ) assertThat(values[0]).isEqualTo(1f) // Should fade to zero between here assertThat(values[1]).isEqualTo(0f) } @Test fun notificationAlpha_leaveShadeOpen() = testScope.runTest { val values by collectValues(underTest.notificationAlpha) runCurrent() sysuiStatusBarStateController.setLeaveOpenOnKeyguardHide(true) keyguardTransitionRepository.sendTransitionSteps( from = KeyguardState.PRIMARY_BOUNCER, to = KeyguardState.GONE, testScope, ) assertThat(values.size).isEqualTo(2) // Shade stays open, and alpha should remain visible values.forEach { assertThat(it).isEqualTo(1f) } } private fun step( value: Float, state: TransitionState = TransitionState.RUNNING Loading
packages/SystemUI/src/com/android/systemui/keyguard/ui/viewmodel/PrimaryBouncerToGoneTransitionViewModel.kt +17 −0 Original line number Diff line number Diff line Loading @@ -60,6 +60,22 @@ constructor( private var leaveShadeOpen: Boolean = false private var willRunDismissFromKeyguard: Boolean = false val notificationAlpha: Flow<Float> = transitionAnimation.sharedFlow( duration = 200.milliseconds, onStart = { leaveShadeOpen = statusBarStateController.leaveOpenOnKeyguardHide() willRunDismissFromKeyguard = primaryBouncerInteractor.willRunDismissFromKeyguard() }, onStep = { if (willRunDismissFromKeyguard || leaveShadeOpen) { 1f } else { 1f - it } }, ) /** Bouncer container alpha */ val bouncerAlpha: Flow<Float> = if (featureFlags.isEnabled(Flags.REFACTOR_KEYGUARD_DISMISS_INTENT)) { Loading Loading @@ -94,6 +110,7 @@ constructor( } else { createLockscreenAlpha(primaryBouncerInteractor::willRunDismissFromKeyguard) } private fun createLockscreenAlpha(willRunAnimationOnKeyguard: () -> Boolean): Flow<Float> { return transitionAnimation.sharedFlow( duration = 50.milliseconds, Loading
packages/SystemUI/src/com/android/systemui/shade/NotificationPanelViewController.java +15 −2 Original line number Diff line number Diff line Loading @@ -1201,7 +1201,12 @@ public final class NotificationPanelViewController implements ShadeSurface, Dump // Primary bouncer->Gone (ensures lockscreen content is not visible on successful auth) if (!migrateClocksToBlueprint()) { collectFlow(mView, mPrimaryBouncerToGoneTransitionViewModel.getLockscreenAlpha(), setTransitionAlpha(mNotificationStackScrollLayoutController), mMainDispatcher); setTransitionAlpha(mNotificationStackScrollLayoutController, /* excludeNotifications=*/ true), mMainDispatcher); collectFlow(mView, mPrimaryBouncerToGoneTransitionViewModel.getNotificationAlpha(), (Float alpha) -> { mNotificationStackScrollLayoutController.setMaxAlphaForExpansion(alpha); }, mMainDispatcher); } } Loading Loading @@ -4725,9 +4730,17 @@ public final class NotificationPanelViewController implements ShadeSurface, Dump private Consumer<Float> setTransitionAlpha( NotificationStackScrollLayoutController stackScroller) { return setTransitionAlpha(stackScroller, /* excludeNotifications= */ false); } private Consumer<Float> setTransitionAlpha( NotificationStackScrollLayoutController stackScroller, boolean excludeNotifications) { return (Float alpha) -> { mKeyguardStatusViewController.setAlpha(alpha); if (!excludeNotifications) { stackScroller.setMaxAlphaForExpansion(alpha); } if (keyguardBottomAreaRefactor()) { mKeyguardInteractor.setAlpha(alpha); Loading
packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/ui/viewmodel/SharedNotificationContainerViewModel.kt +1 −1 Original line number Diff line number Diff line Loading @@ -333,7 +333,7 @@ constructor( lockscreenToPrimaryBouncerTransitionViewModel.lockscreenAlpha, occludedToAodTransitionViewModel.lockscreenAlpha, occludedToLockscreenTransitionViewModel.lockscreenAlpha, primaryBouncerToGoneTransitionViewModel.lockscreenAlpha, primaryBouncerToGoneTransitionViewModel.notificationAlpha, primaryBouncerToLockscreenTransitionViewModel.lockscreenAlpha, ) Loading
packages/SystemUI/tests/src/com/android/systemui/shade/NotificationPanelViewControllerBaseTest.java +2 −0 Original line number Diff line number Diff line Loading @@ -599,6 +599,8 @@ public class NotificationPanelViewControllerBaseTest extends SysuiTestCase { // Primary Bouncer->Gone when(mPrimaryBouncerToGoneTransitionViewModel.getLockscreenAlpha()) .thenReturn(emptyFlow()); when(mPrimaryBouncerToGoneTransitionViewModel.getNotificationAlpha()) .thenReturn(emptyFlow()); NotificationsKeyguardViewStateRepository notifsKeyguardViewStateRepository = new NotificationsKeyguardViewStateRepository(); Loading