Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 23e1b37b authored by András Kurucz's avatar András Kurucz
Browse files

[Flexiglass] Don't clip HUNs on the QS

Don't clip Notifications if they need to appear outside of the Scrim.
Currently this only happens in the fully sceen QuickSettings scene.

Fixes: 339181697
Test: check if HUNs are displayed correctly in Gone, Shade and QuickSettings
Test: atest StackScrollAlgorithmTest NotificationStackScrollLayoutTest
Flag: com.android.systemui.scene_container
Change-Id: I9204883fe691a55d2121e25691fa1a91dd2e2e78
parent 9fd5292c
Loading
Loading
Loading
Loading
+17 −0
Original line number Diff line number Diff line
@@ -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
+10 −2
Original line number Diff line number Diff line
@@ -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(