diff options
| author | 2024-06-12 13:51:07 +0000 | |
|---|---|---|
| committer | 2024-06-12 13:59:34 +0000 | |
| commit | a27d881defefb1fcef01eded9dde29862c4078e3 (patch) | |
| tree | 98016899056db7258bf47f055643df6d9d5be92c | |
| parent | d233902bcec701b3352cb5ab2eefe2de63ef2380 (diff) | |
Fix stack bounds when requesting pulsing on AOD
When AOD is enabled, and we are requesting pulsing, a new transition
starts from GONE to AOD. At the end of this transition we receive
multiple steps, where the progress is 1.0f. This breaks the
interpolation, and sends invalid bounds to the NSSL.
Fixes: 346557361
Test: atest SharedNotificationContainerViewModelTest
Test: go to AOD, receive a HUN (pulsing), observe the HUN's position
Flag: com.android.systemui.migrate_clocks_to_blueprint
Change-Id: I9b922834b6378183738bf7c301ad947bfafa076d
2 files changed, 26 insertions, 1 deletions
diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/stack/ui/viewmodel/SharedNotificationContainerViewModelTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/stack/ui/viewmodel/SharedNotificationContainerViewModelTest.kt index c35c165ba761..497484f90ca9 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/stack/ui/viewmodel/SharedNotificationContainerViewModelTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/stack/ui/viewmodel/SharedNotificationContainerViewModelTest.kt @@ -42,6 +42,7 @@ import com.android.systemui.keyguard.domain.interactor.keyguardInteractor import com.android.systemui.keyguard.shared.model.BurnInModel import com.android.systemui.keyguard.shared.model.KeyguardState import com.android.systemui.keyguard.shared.model.KeyguardState.AOD +import com.android.systemui.keyguard.shared.model.KeyguardState.GONE import com.android.systemui.keyguard.shared.model.KeyguardState.LOCKSCREEN import com.android.systemui.keyguard.shared.model.StatusBarState import com.android.systemui.keyguard.shared.model.TransitionState @@ -842,6 +843,30 @@ class SharedNotificationContainerViewModelTest(flags: FlagsParameterization) : S } @Test + @DisableSceneContainer + fun updateBounds_fromGone_withoutTransitions() = + testScope.runTest { + // Start step is already at 1.0 + val runningStep = TransitionStep(GONE, AOD, 1.0f, TransitionState.RUNNING) + val finishStep = TransitionStep(GONE, AOD, 1.0f, TransitionState.FINISHED) + + val bounds by collectLastValue(underTest.bounds) + val top = 123f + val bottom = 456f + + kosmos.fakeKeyguardTransitionRepository.sendTransitionStep(runningStep) + runCurrent() + kosmos.fakeKeyguardTransitionRepository.sendTransitionStep(finishStep) + runCurrent() + keyguardRootViewModel.onNotificationContainerBoundsChanged(top, bottom) + runCurrent() + + assertThat(bounds).isEqualTo( + NotificationContainerBounds(top = top, bottom = bottom) + ) + } + + @Test fun alphaOnFullQsExpansion() = testScope.runTest { val viewState = ViewStateAccessor() diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/KeyguardInteractor.kt b/packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/KeyguardInteractor.kt index 73835a3c1c96..5dcc99e8bd5b 100644 --- a/packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/KeyguardInteractor.kt +++ b/packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/KeyguardInteractor.kt @@ -110,7 +110,7 @@ constructor( keyguardTransitionInteractor.transitionState.map { step -> val startingProgress = lastChangeStep.value val progress = step.value - if (step.to == AOD && progress >= startingProgress) { + if (step.to == AOD && progress >= startingProgress && startingProgress < 1f) { val adjustedProgress = ((progress - startingProgress) / (1F - startingProgress)).coerceIn( 0F, |