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

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

Merge changes I2f94c0c4,I016c0ace into main

* changes:
  [flexiglass] Fix the shade bottom paddings finally
  [flexiglass] Remove double footer height from the  stack height
parents 53386ed4 5fcc4549
Loading
Loading
Loading
Loading
+8 −11
Original line number Diff line number Diff line
@@ -284,8 +284,9 @@ fun ContentScope.NotificationScrollingStack(
    viewModel: NotificationsPlaceholderViewModel,
    maxScrimTop: () -> Float,
    shouldPunchHoleBehindScrim: Boolean,
    stackTopPadding: Dp,
    stackBottomPadding: Dp,
    shouldFillMaxSize: Boolean = true,
    shouldReserveSpaceForNavBar: Boolean = true,
    shouldIncludeHeadsUpSpace: Boolean = true,
    shouldShowScrim: Boolean = true,
    supportNestedScrolling: Boolean,
@@ -307,10 +308,7 @@ fun ContentScope.NotificationScrollingStack(
    val expansionFraction by viewModel.expandFraction.collectAsStateWithLifecycle(0f)
    val shadeToQsFraction by viewModel.shadeToQsFraction.collectAsStateWithLifecycle(0f)

    val topPadding = dimensionResource(id = R.dimen.notification_side_paddings)
    val navBarHeight = WindowInsets.systemBars.asPaddingValues().calculateBottomPadding()
    val bottomPadding = if (shouldReserveSpaceForNavBar) navBarHeight else 0.dp

    val screenHeight = with(density) { LocalConfiguration.current.screenHeightDp.dp.toPx() }

    /**
@@ -574,7 +572,7 @@ fun ContentScope.NotificationScrollingStack(
                        }
                        .stackVerticalOverscroll(coroutineScope) { scrollState.canScrollForward }
                        .verticalScroll(scrollState)
                        .padding(top = topPadding)
                        .padding(top = stackTopPadding, bottom = stackBottomPadding)
                        .fillMaxWidth()
                        .onGloballyPositioned { coordinates ->
                            stackBoundsOnScreen.value = coordinates.boundsInWindow()
@@ -587,11 +585,10 @@ fun ContentScope.NotificationScrollingStack(
                        !shouldUseLockscreenStackBounds(layoutState.transitionState)
                    },
                    modifier =
                        Modifier.notificationStackHeight(
                                view = stackScrollView,
                                totalVerticalPadding = topPadding + bottomPadding,
                            )
                            .onSizeChanged { size -> stackHeight.intValue = size.height },
                        Modifier.notificationStackHeight(view = stackScrollView).onSizeChanged {
                            size ->
                            stackHeight.intValue = size.height
                        },
                )
                Spacer(
                    modifier =
@@ -607,7 +604,7 @@ fun ContentScope.NotificationScrollingStack(
                stackScrollView = stackScrollView,
                viewModel = viewModel,
                useHunBounds = { !shouldUseLockscreenHunBounds(layoutState.transitionState) },
                modifier = Modifier.padding(top = topPadding),
                modifier = Modifier.padding(top = stackTopPadding),
            )
        }
    }
+45 −34
Original line number Diff line number Diff line
@@ -16,12 +16,15 @@

package com.android.systemui.notifications.ui.composable

import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.layout.layoutId
import androidx.compose.ui.res.dimensionResource
import com.android.compose.animation.scene.ContentScope
import com.android.compose.animation.scene.ElementKey
import com.android.compose.animation.scene.UserAction
@@ -34,6 +37,7 @@ import com.android.systemui.keyguard.ui.composable.section.DefaultClockSection
import com.android.systemui.lifecycle.rememberViewModel
import com.android.systemui.notifications.ui.viewmodel.NotificationsShadeOverlayActionsViewModel
import com.android.systemui.notifications.ui.viewmodel.NotificationsShadeOverlayContentViewModel
import com.android.systemui.res.R
import com.android.systemui.scene.session.ui.composable.SaveableSession
import com.android.systemui.scene.shared.model.Overlays
import com.android.systemui.scene.ui.composable.Overlay
@@ -61,7 +65,6 @@ constructor(
    private val clockSection: DefaultClockSection,
    private val clockInteractor: KeyguardClockInteractor,
) : Overlay {

    override val key = Overlays.NotificationsShade

    private val actionsViewModel: NotificationsShadeOverlayActionsViewModel by lazy {
@@ -76,6 +79,9 @@ constructor(

    @Composable
    override fun ContentScope.Content(modifier: Modifier) {

        val notificationStackPadding = dimensionResource(id = R.dimen.notification_side_paddings)

        val viewModel =
            rememberViewModel("NotificationsShadeOverlay-viewModel") {
                contentViewModelFactory.create()
@@ -90,6 +96,7 @@ constructor(
            modifier = modifier,
            onScrimClicked = viewModel::onScrimClicked,
        ) {
            Box {
                Column {
                    if (viewModel.showHeader) {
                        val burnIn = rememberBurnIn(clockInteractor)
@@ -119,18 +126,22 @@ constructor(
                        stackScrollView = stackScrollView.get(),
                        viewModel = placeholderViewModel,
                        maxScrimTop = { 0f },
                        stackTopPadding = notificationStackPadding,
                        stackBottomPadding = notificationStackPadding,
                        shouldPunchHoleBehindScrim = false,
                        shouldFillMaxSize = false,
                    shouldReserveSpaceForNavBar = false,
                        shouldShowScrim = false,
                        supportNestedScrolling = false,
                        modifier = Modifier.fillMaxWidth(),
                    )

                }
                // Communicates the bottom position of the drawable area within the shade to NSSL.
                NotificationStackCutoffGuideline(
                    stackScrollView = stackScrollView.get(),
                    viewModel = placeholderViewModel,
                    modifier =
                        Modifier.align(Alignment.BottomCenter)
                            .padding(bottom = notificationStackPadding),
                )
            }
        }
+9 −2
Original line number Diff line number Diff line
@@ -74,7 +74,6 @@ import com.android.compose.animation.scene.UserActionResult
import com.android.compose.animation.scene.animateSceneDpAsState
import com.android.compose.animation.scene.animateSceneFloatAsState
import com.android.compose.animation.scene.content.state.TransitionState
import com.android.compose.modifiers.padding
import com.android.compose.modifiers.thenIf
import com.android.compose.windowsizeclass.LocalWindowSizeClass
import com.android.systemui.battery.BatteryMeterViewController
@@ -433,12 +432,15 @@ private fun SceneScope.QuickSettingsScene(
        // A 1 pixel is added to compensate for any kind of rounding errors to make sure 100% that
        // the notification stack is entirely "below" the entire screen.
        val minNotificationStackTop = screenHeight.roundToInt() + 1
        val notificationStackPadding = dimensionResource(id = R.dimen.notification_side_paddings)
        NotificationScrollingStack(
            shadeSession = shadeSession,
            stackScrollView = notificationStackScrollView,
            viewModel = notificationsPlaceholderViewModel,
            maxScrimTop = { minNotificationStackTop.toFloat() },
            shouldPunchHoleBehindScrim = shouldPunchHoleBehindScrim,
            stackTopPadding = notificationStackPadding,
            stackBottomPadding = navBarBottomHeight,
            shouldIncludeHeadsUpSpace = false,
            supportNestedScrolling = true,
            modifier =
@@ -453,7 +455,12 @@ private fun SceneScope.QuickSettingsScene(
                Modifier.align(Alignment.BottomCenter)
                    .navigationBarsPadding()
                    .offset { IntOffset(x = 0, y = minNotificationStackTop) }
                    .padding(horizontal = shadeHorizontalPadding),
                    .padding(
                        start = shadeHorizontalPadding,
                        top = 0.dp,
                        end = shadeHorizontalPadding,
                        bottom = navBarBottomHeight,
                    ),
        )
    }
}
+9 −7
Original line number Diff line number Diff line
@@ -36,7 +36,6 @@ import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.navigationBars
import androidx.compose.foundation.layout.navigationBarsPadding
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.systemBars
import androidx.compose.foundation.overscroll
@@ -76,7 +75,6 @@ import com.android.compose.modifiers.thenIf
import com.android.systemui.battery.BatteryMeterViewController
import com.android.systemui.common.ui.compose.windowinsets.CutoutLocation
import com.android.systemui.common.ui.compose.windowinsets.LocalDisplayCutout
import com.android.systemui.common.ui.compose.windowinsets.LocalScreenCornerRadius
import com.android.systemui.compose.modifiers.sysuiResTag
import com.android.systemui.dagger.SysUISingleton
import com.android.systemui.lifecycle.ExclusiveActivatable
@@ -283,7 +281,7 @@ private fun SceneScope.SingleShade(
            key = MediaLandscapeTopOffset,
            canOverflow = false,
        )

    val notificationStackPadding = dimensionResource(id = R.dimen.notification_side_paddings)
    val navBarHeight = WindowInsets.systemBars.asPaddingValues().calculateBottomPadding()

    val mediaOffsetProvider = remember {
@@ -383,6 +381,8 @@ private fun SceneScope.SingleShade(
                    viewModel = notificationsPlaceholderViewModel,
                    maxScrimTop = { maxNotifScrimTop.toFloat() },
                    shouldPunchHoleBehindScrim = shouldPunchHoleBehindScrim,
                    stackTopPadding = notificationStackPadding,
                    stackBottomPadding = navBarHeight,
                    supportNestedScrolling = true,
                    onEmptySpaceClick =
                        viewModel::onEmptySpaceClicked.takeIf { isEmptySpaceClickable },
@@ -422,8 +422,6 @@ private fun SceneScope.SplitShade(
    modifier: Modifier = Modifier,
    shadeSession: SaveableSession,
) {
    val screenCornerRadius = LocalScreenCornerRadius.current

    val isCustomizing by viewModel.qsSceneAdapter.isCustomizing.collectAsStateWithLifecycle()
    val isQsEnabled by viewModel.isQsEnabled.collectAsStateWithLifecycle()
    val isCustomizerShowing by
@@ -444,6 +442,7 @@ private fun SceneScope.SplitShade(
    val unfoldTranslationXForEndSide by
        viewModel.unfoldTranslationX(isOnStartSide = false).collectAsStateWithLifecycle(0f)

    val notificationStackPadding = dimensionResource(id = R.dimen.notification_side_paddings)
    val navBarBottomHeight = WindowInsets.navigationBars.asPaddingValues().calculateBottomPadding()
    val bottomPadding by
        animateDpAsState(
@@ -604,8 +603,9 @@ private fun SceneScope.SplitShade(
                    stackScrollView = notificationStackScrollView,
                    viewModel = notificationsPlaceholderViewModel,
                    maxScrimTop = { 0f },
                    stackTopPadding = notificationStackPadding,
                    stackBottomPadding = notificationStackPadding,
                    shouldPunchHoleBehindScrim = false,
                    shouldReserveSpaceForNavBar = false,
                    supportNestedScrolling = false,
                    onEmptySpaceClick =
                        viewModel::onEmptySpaceClicked.takeIf { isEmptySpaceClickable },
@@ -624,7 +624,9 @@ private fun SceneScope.SplitShade(
        NotificationStackCutoffGuideline(
            stackScrollView = notificationStackScrollView,
            viewModel = notificationsPlaceholderViewModel,
            modifier = Modifier.align(Alignment.BottomCenter).navigationBarsPadding(),
            modifier =
                Modifier.align(Alignment.BottomCenter)
                    .padding(bottom = notificationStackPadding + navBarBottomHeight),
        )
    }
}
+4 −11
Original line number Diff line number Diff line
@@ -866,9 +866,9 @@ public class NotificationStackScrollLayout
            y = (int) mAmbientState.getHeadsUpTop();
            drawDebugInfo(canvas, y, Color.GREEN, /* label= */ "getHeadsUpTop() = " + y);

            y += getTopHeadsUpHeight();
            y = (int) (mAmbientState.getStackTop() + mScrollViewFields.getIntrinsicStackHeight());
            drawDebugInfo(canvas, y, Color.BLUE,
                    /* label= */ "getHeadsUpTop() + getTopHeadsUpHeight() = " + y);
                    /* label= */ "getStackTop() + getIntrinsicStackHeight() = " + y);

            return; // the rest of the fields are not important in Flexiglass
        }
@@ -2612,20 +2612,13 @@ public class NotificationStackScrollLayout
        if (SceneContainerFlag.isUnexpectedlyInLegacyMode()) return;

        final int shelfIntrinsicHeight = mShelf != null ? mShelf.getIntrinsicHeight() : 0;
        final int footerIntrinsicHeight =
                mFooterView != null ? mFooterView.getIntrinsicHeight() : 0;
        final int notificationsHeight = (int) mNotificationStackSizeCalculator.computeHeight(
                /* notificationStackScrollLayout= */ this,
                mMaxDisplayedNotifications,
                shelfIntrinsicHeight
        );
        // When there is a limit in the max number of notifications, we never display the footer.
        final int fullStackHeight = mMaxDisplayedNotifications != -1
                ? notificationsHeight
                : notificationsHeight + footerIntrinsicHeight + mBottomPadding;

        if (mScrollViewFields.getIntrinsicStackHeight() != fullStackHeight) {
            mScrollViewFields.setIntrinsicStackHeight(fullStackHeight);
        if (mScrollViewFields.getIntrinsicStackHeight() != notificationsHeight) {
            mScrollViewFields.setIntrinsicStackHeight(notificationsHeight);
            notifyStackHeightChangedListeners();
        }
    }