summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Ioana Alexandru <aioana@google.com> 2025-02-03 02:23:08 -0800
committer Android (Google) Code Review <android-gerrit@google.com> 2025-02-03 02:23:08 -0800
commite583f8c0a8f0bc1d786a4373d17a184c5116433c (patch)
tree8ea34e6adec1dbbe28947cca992996d51ac835b1
parentcf8688002ca728c4c62184dbd49deaf2ad1739c9 (diff)
parent377d8a6a233a36194b25effe4d7b77eafc2b6d4c (diff)
Merge "[Notif redesign] Increase the NSSL's bottom margin" into main
-rw-r--r--packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/stack/StackScrollAlgorithmTest.kt7
-rw-r--r--packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/stack/ui/viewmodel/SharedNotificationContainerViewModelTest.kt17
-rw-r--r--packages/SystemUI/res/layout/notification_stack_scroll_layout.xml1
-rw-r--r--packages/SystemUI/res/values/dimens.xml2
-rw-r--r--packages/SystemUI/src/com/android/systemui/shade/NotificationsQSContainerController.kt4
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayout.java18
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/StackScrollAlgorithm.java2
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/domain/interactor/SharedNotificationContainerInteractor.kt4
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/ui/viewmodel/SharedNotificationContainerViewModel.kt4
-rw-r--r--packages/SystemUI/tests/src/com/android/systemui/shade/NotificationsQSContainerControllerLegacyTest.kt17
-rw-r--r--packages/SystemUI/tests/src/com/android/systemui/shade/NotificationsQSContainerControllerTest.kt17
11 files changed, 85 insertions, 8 deletions
diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/stack/StackScrollAlgorithmTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/stack/StackScrollAlgorithmTest.kt
index 39cff63f363e..4f9beb6ffc73 100644
--- a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/stack/StackScrollAlgorithmTest.kt
+++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/stack/StackScrollAlgorithmTest.kt
@@ -6,6 +6,7 @@ import android.platform.test.flag.junit.FlagsParameterization
import android.widget.FrameLayout
import androidx.test.filters.SmallTest
import com.android.keyguard.BouncerPanelExpansionCalculator.aboutToShowBouncerProgress
+import com.android.systemui.Flags
import com.android.systemui.SysuiTestCase
import com.android.systemui.animation.ShadeInterpolation.getContentAlpha
import com.android.systemui.dump.DumpManager
@@ -481,7 +482,11 @@ class StackScrollAlgorithmTest(flags: FlagsParameterization) : SysuiTestCase() {
stackScrollAlgorithm.resetViewStates(ambientState, /* speedBumpIndex= */ 0)
val marginBottom =
- context.resources.getDimensionPixelSize(R.dimen.notification_panel_margin_bottom)
+ context.resources.getDimensionPixelSize(
+ if (Flags.notificationsRedesignFooterView())
+ R.dimen.notification_2025_panel_margin_bottom
+ else R.dimen.notification_panel_margin_bottom
+ )
val fullHeight = ambientState.layoutMaxHeight + marginBottom - ambientState.stackY
val centeredY = ambientState.stackY + fullHeight / 2f - emptyShadeView.height / 2f
assertThat(emptyShadeView.viewState.yTranslation).isEqualTo(centeredY)
diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/stack/ui/viewmodel/SharedNotificationContainerViewModelTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/stack/ui/viewmodel/SharedNotificationContainerViewModelTest.kt
index 786b3590facb..77f02c050098 100644
--- a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/stack/ui/viewmodel/SharedNotificationContainerViewModelTest.kt
+++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/stack/ui/viewmodel/SharedNotificationContainerViewModelTest.kt
@@ -19,9 +19,12 @@
package com.android.systemui.statusbar.notification.stack.ui.viewmodel
+import android.platform.test.annotations.DisableFlags
+import android.platform.test.annotations.EnableFlags
import android.platform.test.flag.junit.FlagsParameterization
import androidx.test.filters.SmallTest
import com.android.compose.animation.scene.ObservableTransitionState
+import com.android.systemui.Flags.FLAG_NOTIFICATIONS_REDESIGN_FOOTER_VIEW
import com.android.systemui.SysuiTestCase
import com.android.systemui.bouncer.data.repository.keyguardBouncerRepository
import com.android.systemui.common.shared.model.NotificationContainerBounds
@@ -298,6 +301,7 @@ class SharedNotificationContainerViewModelTest(flags: FlagsParameterization) : S
}
@Test
+ @DisableFlags(FLAG_NOTIFICATIONS_REDESIGN_FOOTER_VIEW)
fun validateMarginBottom() =
testScope.runTest {
overrideResource(R.dimen.notification_panel_margin_bottom, 50)
@@ -310,6 +314,19 @@ class SharedNotificationContainerViewModelTest(flags: FlagsParameterization) : S
}
@Test
+ @EnableFlags(FLAG_NOTIFICATIONS_REDESIGN_FOOTER_VIEW)
+ fun validateMarginBottom_footerRedesign() =
+ testScope.runTest {
+ overrideResource(R.dimen.notification_2025_panel_margin_bottom, 50)
+
+ val dimens by collectLastValue(underTest.configurationBasedDimensions)
+
+ configurationRepository.onAnyConfigurationChange()
+
+ assertThat(dimens!!.marginBottom).isEqualTo(50)
+ }
+
+ @Test
@DisableSceneContainer
fun validateMarginTopWithLargeScreenHeader_usesHelper() =
testScope.runTest {
diff --git a/packages/SystemUI/res/layout/notification_stack_scroll_layout.xml b/packages/SystemUI/res/layout/notification_stack_scroll_layout.xml
index 65cf81ea416b..5954de4012c8 100644
--- a/packages/SystemUI/res/layout/notification_stack_scroll_layout.xml
+++ b/packages/SystemUI/res/layout/notification_stack_scroll_layout.xml
@@ -16,6 +16,7 @@
-->
<!-- This XML is served to be overridden by other OEMs/device types. -->
+<!-- Note: The margins may be overridden in code, see NotificationStackScrollLayout#getBottomMargin -->
<com.android.systemui.statusbar.notification.stack.NotificationStackScrollLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:systemui="http://schemas.android.com/apk/res-auto"
diff --git a/packages/SystemUI/res/values/dimens.xml b/packages/SystemUI/res/values/dimens.xml
index a72342806901..a96ebe7b4fd6 100644
--- a/packages/SystemUI/res/values/dimens.xml
+++ b/packages/SystemUI/res/values/dimens.xml
@@ -574,6 +574,8 @@
<dimen name="notification_panel_margin_bottom">32dp</dimen>
+ <dimen name="notification_2025_panel_margin_bottom">64dp</dimen>
+
<!-- The bottom padding of the panel that holds the list of notifications. -->
<dimen name="notification_panel_padding_bottom">0dp</dimen>
diff --git a/packages/SystemUI/src/com/android/systemui/shade/NotificationsQSContainerController.kt b/packages/SystemUI/src/com/android/systemui/shade/NotificationsQSContainerController.kt
index cf310dd32613..5b44c082bd72 100644
--- a/packages/SystemUI/src/com/android/systemui/shade/NotificationsQSContainerController.kt
+++ b/packages/SystemUI/src/com/android/systemui/shade/NotificationsQSContainerController.kt
@@ -39,6 +39,7 @@ import com.android.systemui.recents.LauncherProxyService.LauncherProxyListener
import com.android.systemui.res.R
import com.android.systemui.shade.domain.interactor.ShadeInteractor
import com.android.systemui.shared.system.QuickStepContract
+import com.android.systemui.statusbar.notification.stack.NotificationStackScrollLayout
import com.android.systemui.statusbar.notification.stack.NotificationStackScrollLayoutController
import com.android.systemui.statusbar.policy.SplitShadeStateController
import com.android.systemui.util.LargeScreenUtils
@@ -155,8 +156,7 @@ constructor(
val splitShadeEnabledChanged = newSplitShadeEnabled != splitShadeEnabled
splitShadeEnabled = newSplitShadeEnabled
largeScreenShadeHeaderActive = LargeScreenUtils.shouldUseLargeScreenShadeHeader(resources)
- notificationsBottomMargin =
- resources.getDimensionPixelSize(R.dimen.notification_panel_margin_bottom)
+ notificationsBottomMargin = NotificationStackScrollLayout.getBottomMargin(context)
largeScreenShadeHeaderHeight = calculateLargeShadeHeaderHeight()
shadeHeaderHeight = calculateShadeHeaderHeight()
panelMarginHorizontal =
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayout.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayout.java
index 876090101f6e..ce1fc97cbffe 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayout.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayout.java
@@ -26,6 +26,7 @@ import static com.android.internal.jank.InteractionJankMonitor.CUJ_NOTIFICATION_
import static com.android.internal.jank.InteractionJankMonitor.CUJ_SHADE_CLEAR_ALL;
import static com.android.systemui.Flags.magneticNotificationSwipes;
import static com.android.systemui.Flags.notificationOverExpansionClippingFix;
+import static com.android.systemui.Flags.notificationsRedesignFooterView;
import static com.android.systemui.statusbar.notification.stack.NotificationPriorityBucketKt.BUCKET_SILENT;
import static com.android.systemui.statusbar.notification.stack.StackStateAnimator.ANIMATION_DURATION_SWIPE;
import static com.android.systemui.statusbar.notification.stack.shared.model.AccessibilityScrollEvent.SCROLL_DOWN;
@@ -694,11 +695,28 @@ public class NotificationStackScrollLayout
protected void onFinishInflate() {
super.onFinishInflate();
+ if (notificationsRedesignFooterView()) {
+ int bottomMargin = getBottomMargin(getContext());
+ MarginLayoutParams lp = (MarginLayoutParams) getLayoutParams();
+ lp.setMargins(lp.leftMargin, lp.topMargin, lp.rightMargin, bottomMargin);
+ setLayoutParams(lp);
+ }
+
if (!ModesEmptyShadeFix.isEnabled()) {
inflateEmptyShadeView();
}
}
+ /** Get the pixel value of the bottom margin, taking flags into account. */
+ public static int getBottomMargin(Context context) {
+ Resources res = context.getResources();
+ if (notificationsRedesignFooterView()) {
+ return res.getDimensionPixelSize(R.dimen.notification_2025_panel_margin_bottom);
+ } else {
+ return res.getDimensionPixelSize(R.dimen.notification_panel_margin_bottom);
+ }
+ }
+
/**
* Sets whether keyguard bypass is enabled. If true, this layout will be rendered in bypass
* mode when it is on the keyguard.
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/StackScrollAlgorithm.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/StackScrollAlgorithm.java
index 06b989aaab57..673eb9f85ec3 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/StackScrollAlgorithm.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/StackScrollAlgorithm.java
@@ -107,7 +107,7 @@ public class StackScrollAlgorithm {
mGapHeightOnLockscreen = res.getDimensionPixelSize(
R.dimen.notification_section_divider_height_lockscreen);
mNotificationScrimPadding = res.getDimensionPixelSize(R.dimen.notification_side_paddings);
- mMarginBottom = res.getDimensionPixelSize(R.dimen.notification_panel_margin_bottom);
+ mMarginBottom = NotificationStackScrollLayout.getBottomMargin(context);
mQuickQsOffsetHeight = SystemBarUtils.getQuickQsOffsetHeight(context);
mSmallCornerRadius = res.getDimension(R.dimen.notification_corner_radius_small);
mLargeCornerRadius = res.getDimension(R.dimen.notification_corner_radius);
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/domain/interactor/SharedNotificationContainerInteractor.kt b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/domain/interactor/SharedNotificationContainerInteractor.kt
index 107875df6bfa..c8b3341a0240 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/domain/interactor/SharedNotificationContainerInteractor.kt
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/domain/interactor/SharedNotificationContainerInteractor.kt
@@ -26,6 +26,7 @@ import com.android.systemui.res.R
import com.android.systemui.scene.shared.flag.SceneContainerFlag
import com.android.systemui.shade.LargeScreenHeaderHelper
import com.android.systemui.shade.ShadeDisplayAware
+import com.android.systemui.statusbar.notification.stack.NotificationStackScrollLayout
import com.android.systemui.statusbar.policy.SplitShadeStateController
import dagger.Lazy
import javax.inject.Inject
@@ -79,8 +80,7 @@ constructor(
getBoolean(R.bool.config_use_large_screen_shade_header),
marginHorizontal =
getDimensionPixelSize(R.dimen.notification_panel_margin_horizontal),
- marginBottom =
- getDimensionPixelSize(R.dimen.notification_panel_margin_bottom),
+ marginBottom = NotificationStackScrollLayout.getBottomMargin(context),
marginTop = getDimensionPixelSize(R.dimen.notification_panel_margin_top),
marginTopLargeScreen =
largeScreenHeaderHelperLazy.get().getLargeScreenHeaderHeight(),
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/ui/viewmodel/SharedNotificationContainerViewModel.kt b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/ui/viewmodel/SharedNotificationContainerViewModel.kt
index b6d89ecf29f2..d6e4add4eee3 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/ui/viewmodel/SharedNotificationContainerViewModel.kt
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/ui/viewmodel/SharedNotificationContainerViewModel.kt
@@ -80,6 +80,7 @@ import com.android.systemui.shade.shared.model.ShadeMode.Dual
import com.android.systemui.shade.shared.model.ShadeMode.Single
import com.android.systemui.shade.shared.model.ShadeMode.Split
import com.android.systemui.statusbar.notification.domain.interactor.HeadsUpNotificationInteractor
+import com.android.systemui.statusbar.notification.stack.NotificationStackScrollLayout
import com.android.systemui.statusbar.notification.stack.domain.interactor.NotificationStackAppearanceInteractor
import com.android.systemui.statusbar.notification.stack.domain.interactor.SharedNotificationContainerInteractor
import com.android.systemui.unfold.domain.interactor.UnfoldTransitionInteractor
@@ -263,8 +264,7 @@ constructor(
horizontalPosition = horizontalPosition,
marginStart = if (shadeMode is Split) 0 else marginHorizontal,
marginEnd = marginHorizontal,
- marginBottom =
- getDimensionPixelSize(R.dimen.notification_panel_margin_bottom),
+ marginBottom = NotificationStackScrollLayout.getBottomMargin(context),
// y position of the NSSL in the window needs to be 0 under scene
// container
marginTop = 0,
diff --git a/packages/SystemUI/tests/src/com/android/systemui/shade/NotificationsQSContainerControllerLegacyTest.kt b/packages/SystemUI/tests/src/com/android/systemui/shade/NotificationsQSContainerControllerLegacyTest.kt
index 9abe9aa5e598..3de7db76deae 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/shade/NotificationsQSContainerControllerLegacyTest.kt
+++ b/packages/SystemUI/tests/src/com/android/systemui/shade/NotificationsQSContainerControllerLegacyTest.kt
@@ -16,6 +16,8 @@
package com.android.systemui.shade
+import android.platform.test.annotations.DisableFlags
+import android.platform.test.annotations.EnableFlags
import android.testing.AndroidTestingRunner
import android.testing.TestableLooper
import android.view.View
@@ -26,6 +28,7 @@ import androidx.annotation.IdRes
import androidx.constraintlayout.widget.ConstraintLayout
import androidx.constraintlayout.widget.ConstraintSet
import androidx.test.filters.SmallTest
+import com.android.systemui.Flags
import com.android.systemui.SysuiTestCase
import com.android.systemui.fragments.FragmentHostManager
import com.android.systemui.fragments.FragmentService
@@ -122,6 +125,7 @@ class NotificationsQSContainerControllerLegacyTest : SysuiTestCase() {
overrideResource(R.dimen.split_shade_notifications_scrim_margin_bottom, SCRIM_MARGIN)
overrideResource(R.dimen.notification_panel_margin_bottom, NOTIFICATIONS_MARGIN)
+ overrideResource(R.dimen.notification_2025_panel_margin_bottom, NOTIFICATIONS_MARGIN)
overrideResource(R.bool.config_use_split_notification_shade, false)
overrideResource(R.dimen.qs_footer_actions_bottom_padding, FOOTER_ACTIONS_PADDING)
overrideResource(R.dimen.qs_footer_action_inset, FOOTER_ACTIONS_INSET)
@@ -360,6 +364,7 @@ class NotificationsQSContainerControllerLegacyTest : SysuiTestCase() {
}
@Test
+ @DisableFlags(Flags.FLAG_NOTIFICATIONS_REDESIGN_FOOTER_VIEW)
fun testNotificationsMarginBottomIsUpdated() {
Mockito.clearInvocations(view)
enableSplitShade()
@@ -371,6 +376,18 @@ class NotificationsQSContainerControllerLegacyTest : SysuiTestCase() {
}
@Test
+ @EnableFlags(Flags.FLAG_NOTIFICATIONS_REDESIGN_FOOTER_VIEW)
+ fun testNotificationsMarginBottomIsUpdated_footerRedesign() {
+ Mockito.clearInvocations(view)
+ enableSplitShade()
+ verify(view).setNotificationsMarginBottom(NOTIFICATIONS_MARGIN)
+
+ overrideResource(R.dimen.notification_2025_panel_margin_bottom, 100)
+ disableSplitShade()
+ verify(view).setNotificationsMarginBottom(100)
+ }
+
+ @Test
fun testSplitShadeLayout_qsFrameHasHorizontalMarginsOfZero() {
enableSplitShade()
underTest.updateResources()
diff --git a/packages/SystemUI/tests/src/com/android/systemui/shade/NotificationsQSContainerControllerTest.kt b/packages/SystemUI/tests/src/com/android/systemui/shade/NotificationsQSContainerControllerTest.kt
index 4c12cc886e33..552fe8d5bc55 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/shade/NotificationsQSContainerControllerTest.kt
+++ b/packages/SystemUI/tests/src/com/android/systemui/shade/NotificationsQSContainerControllerTest.kt
@@ -16,6 +16,8 @@
package com.android.systemui.shade
+import android.platform.test.annotations.DisableFlags
+import android.platform.test.annotations.EnableFlags
import android.testing.AndroidTestingRunner
import android.testing.TestableLooper
import android.view.View
@@ -26,6 +28,7 @@ import androidx.annotation.IdRes
import androidx.constraintlayout.widget.ConstraintLayout
import androidx.constraintlayout.widget.ConstraintSet
import androidx.test.filters.SmallTest
+import com.android.systemui.Flags
import com.android.systemui.SysuiTestCase
import com.android.systemui.fragments.FragmentHostManager
import com.android.systemui.fragments.FragmentService
@@ -122,6 +125,7 @@ class NotificationsQSContainerControllerTest : SysuiTestCase() {
overrideResource(R.dimen.split_shade_notifications_scrim_margin_bottom, SCRIM_MARGIN)
overrideResource(R.dimen.notification_panel_margin_bottom, NOTIFICATIONS_MARGIN)
+ overrideResource(R.dimen.notification_2025_panel_margin_bottom, NOTIFICATIONS_MARGIN)
overrideResource(R.bool.config_use_split_notification_shade, false)
overrideResource(R.dimen.qs_footer_actions_bottom_padding, FOOTER_ACTIONS_PADDING)
overrideResource(R.dimen.qs_footer_action_inset, FOOTER_ACTIONS_INSET)
@@ -358,6 +362,7 @@ class NotificationsQSContainerControllerTest : SysuiTestCase() {
}
@Test
+ @DisableFlags(Flags.FLAG_NOTIFICATIONS_REDESIGN_FOOTER_VIEW)
fun testNotificationsMarginBottomIsUpdated() {
Mockito.clearInvocations(view)
enableSplitShade()
@@ -369,6 +374,18 @@ class NotificationsQSContainerControllerTest : SysuiTestCase() {
}
@Test
+ @EnableFlags(Flags.FLAG_NOTIFICATIONS_REDESIGN_FOOTER_VIEW)
+ fun testNotificationsMarginBottomIsUpdated_footerRedesign() {
+ Mockito.clearInvocations(view)
+ enableSplitShade()
+ verify(view).setNotificationsMarginBottom(NOTIFICATIONS_MARGIN)
+
+ overrideResource(R.dimen.notification_2025_panel_margin_bottom, 100)
+ disableSplitShade()
+ verify(view).setNotificationsMarginBottom(100)
+ }
+
+ @Test
fun testSplitShadeLayout_isAlignedToGuideline() {
enableSplitShade()
underTest.updateResources()