diff options
10 files changed, 43 insertions, 39 deletions
diff --git a/config/hiddenapi-max-target-o.txt b/config/hiddenapi-max-target-o.txt index 592b4aedf952..3fee56863cf5 100644 --- a/config/hiddenapi-max-target-o.txt +++ b/config/hiddenapi-max-target-o.txt @@ -91672,7 +91672,6 @@ Lcom/android/internal/R$dimen;->notification_media_image_max_height_low_ram:I Lcom/android/internal/R$dimen;->notification_media_image_max_width:I Lcom/android/internal/R$dimen;->notification_media_image_max_width_low_ram:I Lcom/android/internal/R$dimen;->notification_messaging_spacing:I -Lcom/android/internal/R$dimen;->notification_min_content_height:I Lcom/android/internal/R$dimen;->notification_reply_inset:I Lcom/android/internal/R$dimen;->notification_right_icon_size:I Lcom/android/internal/R$dimen;->notification_right_icon_size_low_ram:I diff --git a/core/java/android/app/Notification.java b/core/java/android/app/Notification.java index 70b7d22d51e6..75f7ceca6450 100644 --- a/core/java/android/app/Notification.java +++ b/core/java/android/app/Notification.java @@ -4922,8 +4922,6 @@ public class Notification implements Parcelable contentView.setViewVisibility(textId, View.VISIBLE); } - setContentMinHeight(contentView, showProgress || mN.hasLargeIcon()); - return contentView; } @@ -5081,21 +5079,6 @@ public class Notification implements Parcelable } } - /** - * @param remoteView the remote view to update the minheight in - * @param hasMinHeight does it have a mimHeight - * @hide - */ - void setContentMinHeight(RemoteViews remoteView, boolean hasMinHeight) { - int minHeight = 0; - if (hasMinHeight) { - // we need to set the minHeight of the notification - minHeight = mContext.getResources().getDimensionPixelSize( - com.android.internal.R.dimen.notification_min_content_height); - } - remoteView.setInt(R.id.notification_main_column, "setMinimumHeight", minHeight); - } - private boolean handleProgressBar(RemoteViews contentView, Bundle ex, StandardTemplateParams p) { final int max = ex.getInt(EXTRA_PROGRESS_MAX, 0); @@ -6942,7 +6925,6 @@ public class Notification implements Parcelable mBuilder.setTextViewColorSecondary(contentView, R.id.text, p); contentView.setViewVisibility(R.id.text, View.VISIBLE); } - mBuilder.setContentMinHeight(contentView, mBuilder.mN.hasLargeIcon()); if (mBigLargeIconSet) { mBuilder.mN.mLargeIcon = oldLargeIcon; @@ -8710,7 +8692,7 @@ public class Notification implements Parcelable RemoteViews remoteViews = mBuilder.applyStandardTemplateWithActions( mBuilder.getHeadsUpBaseLayoutResource(), StandardTemplateParams.VIEW_TYPE_HEADS_UP, result); - buildIntoRemoteViewContent(remoteViews, headsUpContentView, result, false); + buildIntoRemoteViewContent(remoteViews, headsUpContentView, result, true); return remoteViews; } @@ -8755,8 +8737,7 @@ public class Notification implements Parcelable Resources resources = mBuilder.mContext.getResources(); int endMargin = resources.getDimensionPixelSize( R.dimen.notification_content_margin_end) + result.getTitleMarginEnd(); - remoteViews.setViewLayoutMarginEnd(R.id.notification_main_column, - endMargin); + remoteViews.setViewLayoutMarginEnd(R.id.notification_main_column, endMargin); } } diff --git a/core/res/res/layout/notification_template_material_base.xml b/core/res/res/layout/notification_template_material_base.xml index 46b3a8f4644f..ded16b7edf87 100644 --- a/core/res/res/layout/notification_template_material_base.xml +++ b/core/res/res/layout/notification_template_material_base.xml @@ -33,16 +33,30 @@ android:padding="@dimen/notification_icon_circle_padding" /> - <com.android.internal.widget.RemeasuringLinearLayout + <LinearLayout android:id="@+id/notification_standard_view_column" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_gravity="center_vertical" - android:layout_marginBottom="@dimen/notification_headerless_margin_vertical" - android:layout_marginTop="@dimen/notification_headerless_margin_vertical" + android:layout_marginBottom="@dimen/notification_headerless_margin_minimum" + android:layout_marginTop="@dimen/notification_headerless_margin_minimum" android:orientation="vertical" > + <!-- + This invisible FrameLayout is here as a collapsible padding. Having a layout_weight=1 is + what causes this view (and it's counterpart at the opposite end) to collapse before the + actual content views do. + This pair of 10dp collapsible paddings (plus the 16dp fixed margins) allow us to support + headerless notifications of 1-3 lines (where each line is 20dp tall) where the 1-line + variant is 56dp and the 2- and 3-line variants are both 76dp. + --> + <FrameLayout + android:layout_width="match_parent" + android:layout_height="@dimen/notification_headerless_margin_extra" + android:layout_weight="1" + /> + <!-- extends ViewGroup --> <NotificationTopLineView android:id="@+id/notification_top_line" @@ -58,6 +72,7 @@ android:id="@+id/title" android:layout_width="wrap_content" android:layout_height="wrap_content" + android:layout_marginEnd="@dimen/notification_header_separating_margin" android:ellipsize="marquee" android:fadingEdge="horizontal" android:singleLine="true" @@ -69,7 +84,7 @@ </NotificationTopLineView> - <com.android.internal.widget.RemeasuringLinearLayout + <LinearLayout android:id="@+id/notification_main_column" android:layout_width="match_parent" android:layout_height="wrap_content" @@ -91,8 +106,23 @@ android:layout_height="@dimen/notification_headerless_line_height" /> - </com.android.internal.widget.RemeasuringLinearLayout> - </com.android.internal.widget.RemeasuringLinearLayout> + </LinearLayout> + + <!-- + This invisible FrameLayout is here as a collapsible padding. Having a layout_weight=1 is + what causes this view (and it's counterpart at the opposite end) to collapse before the + actual content views do. + This pair of 10dp collapsible paddings (plus the 16dp fixed margins) allow us to support + headerless notifications of 1-3 lines (where each line is 20dp tall) where the 1-line + variant is 56dp and the 2- and 3-line variants are both 76dp. + --> + <FrameLayout + android:layout_width="match_parent" + android:layout_height="@dimen/notification_headerless_margin_extra" + android:layout_weight="1" + /> + + </LinearLayout> <ImageView android:id="@+id/right_icon" diff --git a/core/res/res/layout/notification_template_material_big_media.xml b/core/res/res/layout/notification_template_material_big_media.xml index bbe49e5d06fc..4cf323b24f0a 100644 --- a/core/res/res/layout/notification_template_material_big_media.xml +++ b/core/res/res/layout/notification_template_material_big_media.xml @@ -54,7 +54,6 @@ android:layout_marginStart="@dimen/notification_content_margin_start" android:layout_marginBottom="@dimen/notification_content_margin" android:layout_marginEnd="@dimen/notification_content_margin_end" - android:minHeight="@dimen/notification_min_content_height" android:orientation="vertical" > diff --git a/core/res/res/layout/notification_template_material_big_text.xml b/core/res/res/layout/notification_template_material_big_text.xml index b8e827d7d10f..2452a32b21eb 100644 --- a/core/res/res/layout/notification_template_material_big_text.xml +++ b/core/res/res/layout/notification_template_material_big_text.xml @@ -48,7 +48,6 @@ android:paddingStart="@dimen/notification_content_margin_start" android:paddingEnd="@dimen/notification_content_margin_end" android:clipToPadding="false" - android:minHeight="@dimen/notification_min_content_height" android:orientation="vertical" android:layout_weight="1" > diff --git a/core/res/res/layout/notification_template_material_inbox.xml b/core/res/res/layout/notification_template_material_inbox.xml index eb8925819cd3..e6fa50336e00 100644 --- a/core/res/res/layout/notification_template_material_inbox.xml +++ b/core/res/res/layout/notification_template_material_inbox.xml @@ -39,7 +39,6 @@ android:layout_gravity="top" android:paddingStart="@dimen/notification_content_margin_start" android:paddingEnd="@dimen/notification_content_margin_end" - android:minHeight="@dimen/notification_min_content_height" android:layout_weight="1" android:clipToPadding="false" android:orientation="vertical" diff --git a/core/res/res/layout/notification_template_material_media.xml b/core/res/res/layout/notification_template_material_media.xml index 575295b1be45..52053dcdf800 100644 --- a/core/res/res/layout/notification_template_material_media.xml +++ b/core/res/res/layout/notification_template_material_media.xml @@ -55,7 +55,6 @@ android:layout_height="wrap_content" android:layout_gravity="fill_vertical" android:layout_weight="1" - android:minHeight="@dimen/notification_min_content_height" android:paddingBottom="@dimen/notification_content_margin" android:orientation="vertical" > diff --git a/core/res/res/layout/notification_template_material_messaging.xml b/core/res/res/layout/notification_template_material_messaging.xml index de9814b9f1f1..c3fd249d3ad5 100644 --- a/core/res/res/layout/notification_template_material_messaging.xml +++ b/core/res/res/layout/notification_template_material_messaging.xml @@ -40,7 +40,6 @@ android:layout_weight="1" android:layout_marginStart="@dimen/notification_content_margin_start" android:layout_marginEnd="@dimen/notification_content_margin_end" - android:minHeight="@dimen/notification_min_content_height" android:orientation="vertical" > <com.android.internal.widget.MessagingLinearLayout diff --git a/core/res/res/values/dimens.xml b/core/res/res/values/dimens.xml index d7722efbffd4..79eae67e5fba 100644 --- a/core/res/res/values/dimens.xml +++ b/core/res/res/values/dimens.xml @@ -298,8 +298,11 @@ <!-- The top padding for the notification expand button. --> <dimen name="notification_expand_button_padding_top">1dp</dimen> - <!-- vertical margin for the headerless notification content --> - <dimen name="notification_headerless_margin_vertical">18dp</dimen> + <!-- minimum vertical margin for the headerless notification content --> + <dimen name="notification_headerless_margin_minimum">8dp</dimen> + + <!-- extra vertical margin for the headerless notification content --> + <dimen name="notification_headerless_margin_extra">10dp</dimen> <!-- The height of each of the 1 or 2 lines in the headerless notification template --> <dimen name="notification_headerless_line_height">20sp</dimen> @@ -319,9 +322,6 @@ <!-- The minimum width of the app name in the header if it shrinks --> <dimen name="notification_header_shrink_min_width">72dp</dimen> - <!-- The minimum height of the content if there are at least two lines or a picture--> - <dimen name="notification_min_content_height">39dp</dimen> - <!-- The size of the media actions in the media notification. --> <dimen name="media_notification_action_button_size">48dp</dimen> diff --git a/core/res/res/values/symbols.xml b/core/res/res/values/symbols.xml index 756746816576..23733af4455e 100644 --- a/core/res/res/values/symbols.xml +++ b/core/res/res/values/symbols.xml @@ -2871,7 +2871,6 @@ <java-symbol type="drawable" name="ic_collapse_notification" /> <java-symbol type="drawable" name="ic_expand_bundle" /> <java-symbol type="drawable" name="ic_collapse_bundle" /> - <java-symbol type="dimen" name="notification_min_content_height" /> <java-symbol type="dimen" name="notification_header_shrink_min_width" /> <java-symbol type="dimen" name="notification_content_margin_start" /> <java-symbol type="dimen" name="notification_content_margin_end" /> |