From 604c074dbeff512aee2ecb250552a3c0061a9b56 Mon Sep 17 00:00:00 2001 From: Jeff DeCew Date: Wed, 2 Jun 2021 20:23:19 -0400 Subject: [PATCH] Notification layout fixes: * "Headerless" notifications no longer capped at 88dp. This allows DecoratedCustomViewStyle content to be sized larger than 48dp, but all that sizing is now controlled by the max heights for the entire notification, which is enforced by the ExpandableNotificationRow, rather than the layout. * Reduce the max heads up height to 136dp (down by 7dp). For standard headerless templates, this won't have any effect, because they would never get that tall. For HUNs with decorated custom content this reduces the custom content area to 96dp without actions (to match RVC) and 56dp with actions (up slightly from 48dp in RVC). * Fixed a bug where the snooze button would be bound when viewType=NORMAL, which only affected messaging style, and was hiding a layout bug if the snooze setting was enabled. * Fixed a bug with the action margin on messaging notifications appearing in the collapsed state and causing oversized notifications. Fixes: 189937886 Test: significant manual testing with notify and notify2, especially with HUNs Change-Id: I775a0bb29944922581d01f237dbbc5580ced00c4 --- core/java/android/app/Notification.java | 2 +- .../res/layout/notification_template_material_base.xml | 5 +++-- .../notification_template_material_heads_up_base.xml | 8 ++++---- .../layout/notification_template_material_messaging.xml | 2 ++ packages/SystemUI/res/values/dimens.xml | 2 +- 5 files changed, 11 insertions(+), 8 deletions(-) diff --git a/core/java/android/app/Notification.java b/core/java/android/app/Notification.java index 64b100f838ba8..05ae4492b1044 100644 --- a/core/java/android/app/Notification.java +++ b/core/java/android/app/Notification.java @@ -5597,7 +5597,7 @@ public class Notification implements Parcelable private void bindSnoozeAction(RemoteViews big, StandardTemplateParams p) { boolean hideSnoozeButton = mN.isForegroundService() || mN.fullScreenIntent != null || isBackgroundColorized(p) - || p.mViewType == StandardTemplateParams.VIEW_TYPE_HEADS_UP; + || p.mViewType != StandardTemplateParams.VIEW_TYPE_BIG; big.setBoolean(R.id.snooze_button, "setEnabled", !hideSnoozeButton); if (hideSnoozeButton) { // Only hide; NotificationContentView will show it when it adds the click listener diff --git a/core/res/res/layout/notification_template_material_base.xml b/core/res/res/layout/notification_template_material_base.xml index e644cd55a86af..614779a792532 100644 --- a/core/res/res/layout/notification_template_material_base.xml +++ b/core/res/res/layout/notification_template_material_base.xml @@ -14,11 +14,12 @@ ~ limitations under the License --> - @@ -166,4 +167,4 @@ - + diff --git a/core/res/res/layout/notification_template_material_heads_up_base.xml b/core/res/res/layout/notification_template_material_heads_up_base.xml index a0d19b409cea0..34d7118b4508f 100644 --- a/core/res/res/layout/notification_template_material_heads_up_base.xml +++ b/core/res/res/layout/notification_template_material_heads_up_base.xml @@ -23,7 +23,7 @@ android:tag="headsUp" > - - - - + + diff --git a/core/res/res/layout/notification_template_material_messaging.xml b/core/res/res/layout/notification_template_material_messaging.xml index eb61ea45b4df0..3564f9755a5de 100644 --- a/core/res/res/layout/notification_template_material_messaging.xml +++ b/core/res/res/layout/notification_template_material_messaging.xml @@ -199,11 +199,13 @@ android:id="@+id/notification_action_list_margin_target" android:layout_width="match_parent" android:layout_height="wrap_content" + android:layout_marginTop="-20dp" android:clipChildren="false" android:orientation="vertical"> diff --git a/packages/SystemUI/res/values/dimens.xml b/packages/SystemUI/res/values/dimens.xml index 0be648f1b9bd6..c1efc1fc247b7 100644 --- a/packages/SystemUI/res/values/dimens.xml +++ b/packages/SystemUI/res/values/dimens.xml @@ -151,7 +151,7 @@ 162dp - 143dp + 136dp 188dp