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

Commit 944887a0 authored by András Kurucz's avatar András Kurucz Committed by Android (Google) Code Review
Browse files

Merge "[Flexiglass] Set Stack bounds directly on the NSSL" into main

parents fceb7ecc d49a2c48
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -40,16 +40,19 @@ import com.android.systemui.notifications.ui.composable.ConstrainedNotificationS
import com.android.systemui.res.R
import com.android.systemui.shade.LargeScreenHeaderHelper
import com.android.systemui.statusbar.notification.stack.NotificationStackScrollLayout
import com.android.systemui.statusbar.notification.stack.ui.view.NotificationScrollView
import com.android.systemui.statusbar.notification.stack.ui.view.SharedNotificationContainer
import com.android.systemui.statusbar.notification.stack.ui.viewbinder.SharedNotificationContainerBinder
import com.android.systemui.statusbar.notification.stack.ui.viewmodel.NotificationsPlaceholderViewModel
import com.android.systemui.statusbar.notification.stack.ui.viewmodel.SharedNotificationContainerViewModel
import dagger.Lazy
import javax.inject.Inject

@SysUISingleton
class NotificationSection
@Inject
constructor(
    private val stackScrollView: Lazy<NotificationScrollView>,
    private val viewModel: NotificationsPlaceholderViewModel,
    private val aodBurnInViewModel: AodBurnInViewModel,
    sharedNotificationContainer: SharedNotificationContainer,
@@ -103,6 +106,7 @@ constructor(
        }

        ConstrainedNotificationStack(
            stackScrollView = stackScrollView.get(),
            viewModel = viewModel,
            modifier =
                modifier
+6 −4
Original line number Diff line number Diff line
@@ -138,6 +138,7 @@ fun SceneScope.HeadsUpNotificationSpace(
/** Adds the space where notification stack should appear in the scene. */
@Composable
fun SceneScope.ConstrainedNotificationStack(
    stackScrollView: NotificationScrollView,
    viewModel: NotificationsPlaceholderViewModel,
    modifier: Modifier = Modifier,
) {
@@ -146,6 +147,7 @@ fun SceneScope.ConstrainedNotificationStack(
            modifier.onSizeChanged { viewModel.onConstrainedAvailableSpaceChanged(it.height) }
    ) {
        NotificationPlaceholder(
            stackScrollView = stackScrollView,
            viewModel = viewModel,
            modifier = Modifier.fillMaxSize(),
        )
@@ -334,6 +336,7 @@ fun SceneScope.NotificationScrollingStack(
                    .debugBackground(viewModel, DEBUG_BOX_COLOR)
        ) {
            NotificationPlaceholder(
                stackScrollView = stackScrollView,
                viewModel = viewModel,
                modifier =
                    Modifier.verticalNestedScrollToScene(
@@ -390,6 +393,7 @@ fun SceneScope.NotificationShelfSpace(

@Composable
private fun SceneScope.NotificationPlaceholder(
    stackScrollView: NotificationScrollView,
    viewModel: NotificationsPlaceholderViewModel,
    modifier: Modifier = Modifier,
) {
@@ -408,10 +412,8 @@ private fun SceneScope.NotificationPlaceholder(
                            " bounds=${coordinates.boundsInWindow()}"
                    }
                    // NOTE: positionInWindow.y scrolls off screen, but boundsInWindow.top will not
                    viewModel.onStackBoundsChanged(
                        top = positionInWindow.y,
                        bottom = positionInWindow.y + coordinates.size.height,
                    )
                    stackScrollView.setStackTop(positionInWindow.y)
                    stackScrollView.setStackBottom(positionInWindow.y + coordinates.size.height)
                }
    ) {
        content {}
+0 −9
Original line number Diff line number Diff line
@@ -44,13 +44,4 @@ class NotificationsPlaceholderViewModelTest : SysuiTestCase() {
                collectLastValue(kosmos.notificationStackAppearanceInteractor.shadeScrimBounds)
            assertThat(stackBounds).isEqualTo(bounds)
        }

    @Test
    fun onStackBoundsChanged() =
        kosmos.testScope.runTest {
            underTest.onStackBoundsChanged(top = 5f, bottom = 500f)
            assertThat(kosmos.notificationStackAppearanceInteractor.stackTop.value).isEqualTo(5f)
            assertThat(kosmos.notificationStackAppearanceInteractor.stackBottom.value)
                .isEqualTo(500f)
        }
}
+0 −9
Original line number Diff line number Diff line
@@ -660,9 +660,6 @@ class SharedNotificationContainerViewModelTest(flags: FlagsParameterization) : S

            overrideResource(R.bool.config_use_split_notification_shade, false)
            configurationRepository.onAnyConfigurationChange()
            keyguardInteractor.setNotificationContainerBounds(
                NotificationContainerBounds(top = 1f, bottom = 2f)
            )

            assertThat(maxNotifications).isEqualTo(10)

@@ -691,9 +688,6 @@ class SharedNotificationContainerViewModelTest(flags: FlagsParameterization) : S

            overrideResource(R.bool.config_use_split_notification_shade, false)
            configurationRepository.onAnyConfigurationChange()
            keyguardInteractor.setNotificationContainerBounds(
                NotificationContainerBounds(top = 1f, bottom = 2f)
            )

            assertThat(maxNotifications).isEqualTo(10)

@@ -728,9 +722,6 @@ class SharedNotificationContainerViewModelTest(flags: FlagsParameterization) : S

            overrideResource(R.bool.config_use_split_notification_shade, false)
            configurationRepository.onAnyConfigurationChange()
            keyguardInteractor.setNotificationContainerBounds(
                NotificationContainerBounds(top = 1f, bottom = 2f)
            )

            // -1 means No Limit
            assertThat(maxNotifications).isEqualTo(-1)
+2 −0
Original line number Diff line number Diff line
@@ -97,6 +97,7 @@ constructor(

    /** Bounds of the notification container. */
    val notificationContainerBounds: StateFlow<NotificationContainerBounds> by lazy {
        SceneContainerFlag.assertInLegacyMode()
        combine(
                _notificationPlaceholderBounds,
                sharedNotificationContainerInteractor.get().configurationBasedDimensions,
@@ -115,6 +116,7 @@ constructor(
    }

    fun setNotificationContainerBounds(position: NotificationContainerBounds) {
        SceneContainerFlag.assertInLegacyMode()
        _notificationPlaceholderBounds.value = position
    }

Loading