Loading packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/NotificationStackAppearanceIntegrationTest.kt +17 −0 Original line number Diff line number Diff line Loading @@ -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 Loading Loading @@ -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 Loading @@ -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( Loading @@ -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( Loading @@ -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 Loading packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/ui/viewmodel/NotificationScrollViewModel.kt +10 −2 Original line number Diff line number Diff line Loading @@ -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( Loading Loading
packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/NotificationStackAppearanceIntegrationTest.kt +17 −0 Original line number Diff line number Diff line Loading @@ -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 Loading Loading @@ -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 Loading @@ -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( Loading @@ -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( Loading @@ -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 Loading
packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/ui/viewmodel/NotificationScrollViewModel.kt +10 −2 Original line number Diff line number Diff line Loading @@ -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( Loading