From 96faf81d62fd784b0c66906f0c72c1879192dbe3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20G=C3=B6llner?= Date: Wed, 9 Mar 2022 14:08:44 +0100 Subject: [PATCH] Fix left margin too big on split shade Test: Manually Bug: 223537376 Change-Id: I298761fa0351b9417540f6b4d7dfceab4882a4fd --- .../NotificationsQSContainerController.kt | 2 +- .../NotificationQSContainerControllerTest.kt | 20 +++++++++++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationsQSContainerController.kt b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationsQSContainerController.kt index e4161a37e52e8..7764d33856ca8 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationsQSContainerController.kt +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationsQSContainerController.kt @@ -234,7 +234,7 @@ class NotificationsQSContainerController @Inject constructor( val endConstraintId = if (splitShadeEnabled) R.id.qs_edge_guideline else PARENT_ID constraintSet.apply { connect(R.id.qs_frame, END, endConstraintId, END) - setMargin(R.id.qs_frame, START, panelMarginHorizontal) + setMargin(R.id.qs_frame, START, if (splitShadeEnabled) 0 else panelMarginHorizontal) setMargin(R.id.qs_frame, END, if (splitShadeEnabled) 0 else panelMarginHorizontal) setMargin(R.id.qs_frame, TOP, topMargin) } diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NotificationQSContainerControllerTest.kt b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NotificationQSContainerControllerTest.kt index d65cc7833a681..a49c14994c4bf 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NotificationQSContainerControllerTest.kt +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NotificationQSContainerControllerTest.kt @@ -457,6 +457,26 @@ class NotificationQSContainerControllerTest : SysuiTestCase() { .isEqualTo(0) } + @Test + fun testSplitShadeLayout_qsFrameHasHorizontalMarginsOfZero() { + enableSplitShade() + controller.updateResources() + assertThat(getConstraintSetLayout(R.id.qs_frame).endMargin).isEqualTo(0) + assertThat(getConstraintSetLayout(R.id.qs_frame).startMargin).isEqualTo(0) + } + + @Test + fun testSinglePaneShadeLayout_qsFrameHasHorizontalMarginsSetToCorrectValue() { + disableSplitShade() + controller.updateResources() + val notificationPanelMarginHorizontal = context.resources + .getDimensionPixelSize(R.dimen.notification_panel_margin_horizontal) + assertThat(getConstraintSetLayout(R.id.qs_frame).endMargin) + .isEqualTo(notificationPanelMarginHorizontal) + assertThat(getConstraintSetLayout(R.id.qs_frame).startMargin) + .isEqualTo(notificationPanelMarginHorizontal) + } + @Test fun testSinglePaneShadeLayout_isAlignedToParent() { disableSplitShade()