diff options
2 files changed, 27 insertions, 2 deletions
diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/NotificationStackAppearanceIntegrationTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/NotificationStackAppearanceIntegrationTest.kt index 23b28e37a4db..1df2553d0eb8 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/NotificationStackAppearanceIntegrationTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/NotificationStackAppearanceIntegrationTest.kt @@ -27,6 +27,8 @@ import com.android.systemui.coroutines.collectLastValue import com.android.systemui.flags.EnableSceneContainer import com.android.systemui.flags.Flags import com.android.systemui.flags.fakeFeatureFlagsClassic +import com.android.systemui.keyguard.data.repository.fakeKeyguardRepository +import com.android.systemui.keyguard.shared.model.StatusBarState import com.android.systemui.kosmos.testScope import com.android.systemui.scene.domain.interactor.sceneInteractor import com.android.systemui.scene.shared.model.Scenes @@ -64,6 +66,7 @@ class NotificationStackAppearanceIntegrationTest : SysuiTestCase() { private val placeholderViewModel by lazy { kosmos.notificationsPlaceholderViewModel } private val scrollViewModel by lazy { kosmos.notificationScrollViewModel } private val sceneInteractor by lazy { kosmos.sceneInteractor } + private val fakeKeyguardRepository by lazy { kosmos.fakeKeyguardRepository } private val fakeSceneDataSource by lazy { kosmos.fakeSceneDataSource } @Test @@ -73,9 +76,11 @@ class NotificationStackAppearanceIntegrationTest : SysuiTestCase() { val leftOffset = MutableStateFlow(0) val shape by collectLastValue(scrollViewModel.shadeScrimShape(radius, leftOffset)) + // When: receive scrim bounds placeholderViewModel.onScrimBoundsChanged( ShadeScrimBounds(left = 0f, top = 200f, right = 100f, bottom = 550f) ) + // Then: shape is updated assertThat(shape) .isEqualTo( ShadeScrimShape( @@ -86,11 +91,13 @@ class NotificationStackAppearanceIntegrationTest : SysuiTestCase() { ) ) + // When: receive new scrim bounds leftOffset.value = 200 radius.value = 24 placeholderViewModel.onScrimBoundsChanged( ShadeScrimBounds(left = 210f, top = 200f, right = 300f, bottom = 550f) ) + // Then: shape is updated assertThat(shape) .isEqualTo( ShadeScrimShape( @@ -100,6 +107,16 @@ class NotificationStackAppearanceIntegrationTest : SysuiTestCase() { bottomRadius = 0 ) ) + + // When: QuickSettings shows up full screen + fakeKeyguardRepository.setStatusBarState(StatusBarState.SHADE) + val transitionState = + MutableStateFlow<ObservableTransitionState>( + ObservableTransitionState.Idle(Scenes.QuickSettings) + ) + sceneInteractor.setTransitionState(transitionState) + // Then: shape is null + assertThat(shape).isNull() } @Test diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/ui/viewmodel/NotificationScrollViewModel.kt b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/ui/viewmodel/NotificationScrollViewModel.kt index 57e52b7dc2ad..2ba79a8612bb 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/ui/viewmodel/NotificationScrollViewModel.kt +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/ui/viewmodel/NotificationScrollViewModel.kt @@ -112,14 +112,22 @@ constructor( private operator fun SceneKey.contains(scene: SceneKey) = sceneInteractor.isSceneInFamily(scene, this) + private val qsAllowsClipping: Flow<Boolean> = + combine(shadeInteractor.shadeMode, shadeInteractor.qsExpansion) { shadeMode, qsExpansion -> + qsExpansion < 0.5f || shadeMode != ShadeMode.Single + } + .distinctUntilChanged() + /** The bounds of the notification stack in the current scene. */ private val shadeScrimClipping: Flow<ShadeScrimClipping?> = combine( + qsAllowsClipping, stackAppearanceInteractor.shadeScrimBounds, stackAppearanceInteractor.shadeScrimRounding, - ) { bounds, rounding -> - bounds?.let { ShadeScrimClipping(it, rounding) } + ) { qsAllowsClipping, bounds, rounding -> + bounds?.takeIf { qsAllowsClipping }?.let { ShadeScrimClipping(it, rounding) } } + .distinctUntilChanged() .dumpWhileCollecting("stackClipping") fun shadeScrimShape( |