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

Commit 74206918 authored by 0's avatar 0
Browse files

[flexiglass] Update NSSL clipping based on Composable placeholder

NSSL's rounded clipping bounds are now updated based on the Composable placeholder's bounds, fixing the issue where NSSL was invisible due to the clipping bounds not being set in Flexiglass. The corner radius has also been moved from being hardcoded in the Composable into NotificationStackAppearanceRepository.

Bug: 296118689
Test: manually verified NSSL is visible with Flexiglass flags on.
Flag: ACONFIG com.android.systemui.scene_container DEVELOPMENT
Change-Id: Iaa16af6f17aa806c40cc955170c40841cf3b8d9e
parent 6bef4eb9
Loading
Loading
Loading
Loading
+10 −1
Original line number Diff line number Diff line
@@ -27,11 +27,13 @@ import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.collectAsState
import androidx.compose.runtime.getValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.graphicsLayer
import androidx.compose.ui.layout.LayoutCoordinates
import androidx.compose.ui.layout.boundsInWindow
import androidx.compose.ui.layout.onPlaced
@@ -89,13 +91,18 @@ fun SceneScope.NotificationStack(
    isScrimVisible: Boolean,
    modifier: Modifier = Modifier,
) {
    val cornerRadius by viewModel.cornerRadiusDp.collectAsState()

    Box(modifier = modifier) {
        if (isScrimVisible) {
            Box(
                modifier =
                    Modifier.element(Notifications.Elements.NotificationScrim)
                        .fillMaxSize()
                        .clip(RoundedCornerShape(32.dp))
                        .graphicsLayer {
                            shape = RoundedCornerShape(cornerRadius.dp)
                            clip = true
                        }
                        .background(MaterialTheme.colorScheme.surface)
            )
        }
@@ -167,7 +174,9 @@ private fun SceneScope.NotificationPlaceholder(
                    }
                    val boundsInWindow = coordinates.boundsInWindow()
                    viewModel.onBoundsChanged(
                        left = boundsInWindow.left,
                        top = boundsInWindow.top,
                        right = boundsInWindow.right,
                        bottom = boundsInWindow.bottom,
                    )
                }
+17 −2
Original line number Diff line number Diff line
@@ -67,9 +67,24 @@ class NotificationStackAppearanceIntegrationTest : SysuiTestCase() {
            val bounds by collectLastValue(appearanceViewModel.stackBounds)

            val top = 200f
            val left = 0f
            val bottom = 550f
            placeholderViewModel.onBoundsChanged(top, bottom)
            assertThat(bounds).isEqualTo(NotificationContainerBounds(top = top, bottom = bottom))
            val right = 100f
            placeholderViewModel.onBoundsChanged(
                left = left,
                top = top,
                right = right,
                bottom = bottom
            )
            assertThat(bounds)
                .isEqualTo(
                    NotificationContainerBounds(
                        left = left,
                        top = top,
                        right = right,
                        bottom = bottom
                    )
                )
        }

    @Test
+4 −0
Original line number Diff line number Diff line
@@ -18,8 +18,12 @@ package com.android.systemui.common.shared.model

/** Models the bounds of the notification container. */
data class NotificationContainerBounds(
    /** The position of the left of the container in its window coordinate system, in pixels. */
    val left: Float = 0f,
    /** The position of the top of the container in its window coordinate system, in pixels. */
    val top: Float = 0f,
    /** The position of the right of the container in its window coordinate system, in pixels. */
    val right: Float = 0f,
    /** The position of the bottom of the container in its window coordinate system, in pixels. */
    val bottom: Float = 0f,
    /** Whether any modifications to top/bottom should be smoothly animated. */
+1 −1
Original line number Diff line number Diff line
@@ -85,9 +85,9 @@ constructor(
            )
        if (sceneContainerFlags.flexiNotifsEnabled()) {
            NotificationStackAppearanceViewBinder.bind(
                context,
                sharedNotificationContainer,
                notificationStackAppearanceViewModel,
                sceneContainerFlags,
                ambientState,
                controller,
            )
+3 −1
Original line number Diff line number Diff line
@@ -225,7 +225,9 @@ constructor(
            .distinctUntilChanged()

    fun onNotificationContainerBoundsChanged(top: Float, bottom: Float) {
        keyguardInteractor.setNotificationContainerBounds(NotificationContainerBounds(top, bottom))
        keyguardInteractor.setNotificationContainerBounds(
            NotificationContainerBounds(top = top, bottom = bottom)
        )
    }

    /** Is there an expanded pulse, are we animating in response? */
Loading