Loading core/java/android/app/Notification.java +31 −0 Original line number Diff line number Diff line Loading @@ -6453,6 +6453,13 @@ public class Notification implements Parcelable big.setColorStateList(R.id.snooze_button, "setImageTintList", actionColor); big.setColorStateList(R.id.bubble_button, "setImageTintList", actionColor); if (Flags.notificationsRedesignTemplates()) { int margin = getContentMarginTop(mContext, R.dimen.notification_2025_content_margin_top); big.setViewLayoutMargin(R.id.notification_main_column, RemoteViews.MARGIN_TOP, margin, TypedValue.COMPLEX_UNIT_PX); } boolean validRemoteInput = false; // In the UI, contextual actions appear separately from the standard actions, so we Loading Loading @@ -6549,6 +6556,30 @@ public class Notification implements Parcelable return big; } /** * Calculate the top margin for the content in px, to allow enough space for the top line * above, using the given resource ID for the desired spacing. * * @hide */ public static int getContentMarginTop(Context context, @DimenRes int spacingRes) { final Resources resources = context.getResources(); // The margin above the text, at the top of the notification (originally in dp) int notifMargin = resources.getDimensionPixelSize(R.dimen.notification_2025_margin); // Spacing between the text lines, scaling with the font size (originally in sp) int spacing = resources.getDimensionPixelSize(spacingRes); // Size of the text in the notification top line (originally in sp) int[] textSizeAttr = new int[] { android.R.attr.textSize }; TypedArray typedArray = context.obtainStyledAttributes( R.style.TextAppearance_DeviceDefault_Notification_Info, textSizeAttr); int textSize = typedArray.getDimensionPixelSize(0 /* index */, -1 /* default */); typedArray.recycle(); // Adding up all the values as pixels return notifMargin + spacing + textSize; } private boolean hasValidRemoteInput(Action action) { if (TextUtils.isEmpty(action.title) || action.actionIntent == null) { // Weird actions Loading core/java/com/android/internal/widget/NotificationExpandButton.java +12 −2 Original line number Diff line number Diff line Loading @@ -16,6 +16,8 @@ package com.android.internal.widget; import static android.app.Flags.notificationsRedesignTemplates; import android.annotation.ColorInt; import android.annotation.Nullable; import android.content.Context; Loading Loading @@ -130,10 +132,18 @@ public class NotificationExpandButton extends FrameLayout { int drawableId; int contentDescriptionId; if (mExpanded) { if (notificationsRedesignTemplates()) { drawableId = R.drawable.ic_notification_2025_collapse; } else { drawableId = R.drawable.ic_collapse_notification; } contentDescriptionId = R.string.expand_button_content_description_expanded; } else { if (notificationsRedesignTemplates()) { drawableId = R.drawable.ic_notification_2025_expand; } else { drawableId = R.drawable.ic_expand_notification; } contentDescriptionId = R.string.expand_button_content_description_collapsed; } setContentDescription(mContext.getText(contentDescriptionId)); Loading core/res/res/drawable/ic_notification_2025_collapse.xml 0 → 100644 +25 −0 Original line number Diff line number Diff line <!-- ~ Copyright (C) 2024 The Android Open Source Project ~ ~ Licensed under the Apache License, Version 2.0 (the "License"); ~ you may not use this file except in compliance with the License. ~ You may obtain a copy of the License at ~ ~ http://www.apache.org/licenses/LICENSE-2.0 ~ ~ Unless required by applicable law or agreed to in writing, software ~ distributed under the License is distributed on an "AS IS" BASIS, ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ~ See the License for the specific language governing permissions and ~ limitations under the License. --> <vector xmlns:android="http://schemas.android.com/apk/res/android" android:width="24dp" android:height="24dp" android:viewportWidth="960" android:viewportHeight="960" android:tint="?attr/colorControlNormal"> <path android:fillColor="@android:color/white" android:pathData="M480,432L296,616L240,560L480,320L720,560L664,616L480,432Z"/> </vector> core/res/res/drawable/ic_notification_2025_expand.xml 0 → 100644 +25 −0 Original line number Diff line number Diff line <!-- ~ Copyright (C) 2024 The Android Open Source Project ~ ~ Licensed under the Apache License, Version 2.0 (the "License"); ~ you may not use this file except in compliance with the License. ~ You may obtain a copy of the License at ~ ~ http://www.apache.org/licenses/LICENSE-2.0 ~ ~ Unless required by applicable law or agreed to in writing, software ~ distributed under the License is distributed on an "AS IS" BASIS, ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ~ See the License for the specific language governing permissions and ~ limitations under the License. --> <vector xmlns:android="http://schemas.android.com/apk/res/android" android:width="24dp" android:height="24dp" android:viewportWidth="960" android:viewportHeight="960" android:tint="?attr/colorControlNormal"> <path android:fillColor="@android:color/white" android:pathData="M480,616L240,376L296,320L480,504L664,320L720,376L480,616Z"/> </vector> core/res/res/drawable/notification_2025_expand_button_pill_bg.xml 0 → 100644 +29 −0 Original line number Diff line number Diff line <!-- ~ Copyright (C) 2024 The Android Open Source Project ~ ~ Licensed under the Apache License, Version 2.0 (the "License"); ~ you may not use this file except in compliance with the License. ~ You may obtain a copy of the License at ~ ~ http://www.apache.org/licenses/LICENSE-2.0 ~ ~ Unless required by applicable law or agreed to in writing, software ~ distributed under the License is distributed on an "AS IS" BASIS, ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ~ See the License for the specific language governing permissions and ~ limitations under the License. --> <layer-list xmlns:android="http://schemas.android.com/apk/res/android"> <item android:id="@+id/expand_button_pill_colorized_layer"> <shape xmlns:android="http://schemas.android.com/apk/res/android"> <corners android:radius="@dimen/notification_2025_expand_button_pill_height" /> <solid android:color="@android:color/white" /> </shape> </item> <item> <shape xmlns:android="http://schemas.android.com/apk/res/android"> <corners android:radius="@dimen/notification_2025_expand_button_pill_height" /> <solid android:color="@color/notification_expand_button_state_tint" /> </shape> </item> </layer-list> Loading
core/java/android/app/Notification.java +31 −0 Original line number Diff line number Diff line Loading @@ -6453,6 +6453,13 @@ public class Notification implements Parcelable big.setColorStateList(R.id.snooze_button, "setImageTintList", actionColor); big.setColorStateList(R.id.bubble_button, "setImageTintList", actionColor); if (Flags.notificationsRedesignTemplates()) { int margin = getContentMarginTop(mContext, R.dimen.notification_2025_content_margin_top); big.setViewLayoutMargin(R.id.notification_main_column, RemoteViews.MARGIN_TOP, margin, TypedValue.COMPLEX_UNIT_PX); } boolean validRemoteInput = false; // In the UI, contextual actions appear separately from the standard actions, so we Loading Loading @@ -6549,6 +6556,30 @@ public class Notification implements Parcelable return big; } /** * Calculate the top margin for the content in px, to allow enough space for the top line * above, using the given resource ID for the desired spacing. * * @hide */ public static int getContentMarginTop(Context context, @DimenRes int spacingRes) { final Resources resources = context.getResources(); // The margin above the text, at the top of the notification (originally in dp) int notifMargin = resources.getDimensionPixelSize(R.dimen.notification_2025_margin); // Spacing between the text lines, scaling with the font size (originally in sp) int spacing = resources.getDimensionPixelSize(spacingRes); // Size of the text in the notification top line (originally in sp) int[] textSizeAttr = new int[] { android.R.attr.textSize }; TypedArray typedArray = context.obtainStyledAttributes( R.style.TextAppearance_DeviceDefault_Notification_Info, textSizeAttr); int textSize = typedArray.getDimensionPixelSize(0 /* index */, -1 /* default */); typedArray.recycle(); // Adding up all the values as pixels return notifMargin + spacing + textSize; } private boolean hasValidRemoteInput(Action action) { if (TextUtils.isEmpty(action.title) || action.actionIntent == null) { // Weird actions Loading
core/java/com/android/internal/widget/NotificationExpandButton.java +12 −2 Original line number Diff line number Diff line Loading @@ -16,6 +16,8 @@ package com.android.internal.widget; import static android.app.Flags.notificationsRedesignTemplates; import android.annotation.ColorInt; import android.annotation.Nullable; import android.content.Context; Loading Loading @@ -130,10 +132,18 @@ public class NotificationExpandButton extends FrameLayout { int drawableId; int contentDescriptionId; if (mExpanded) { if (notificationsRedesignTemplates()) { drawableId = R.drawable.ic_notification_2025_collapse; } else { drawableId = R.drawable.ic_collapse_notification; } contentDescriptionId = R.string.expand_button_content_description_expanded; } else { if (notificationsRedesignTemplates()) { drawableId = R.drawable.ic_notification_2025_expand; } else { drawableId = R.drawable.ic_expand_notification; } contentDescriptionId = R.string.expand_button_content_description_collapsed; } setContentDescription(mContext.getText(contentDescriptionId)); Loading
core/res/res/drawable/ic_notification_2025_collapse.xml 0 → 100644 +25 −0 Original line number Diff line number Diff line <!-- ~ Copyright (C) 2024 The Android Open Source Project ~ ~ Licensed under the Apache License, Version 2.0 (the "License"); ~ you may not use this file except in compliance with the License. ~ You may obtain a copy of the License at ~ ~ http://www.apache.org/licenses/LICENSE-2.0 ~ ~ Unless required by applicable law or agreed to in writing, software ~ distributed under the License is distributed on an "AS IS" BASIS, ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ~ See the License for the specific language governing permissions and ~ limitations under the License. --> <vector xmlns:android="http://schemas.android.com/apk/res/android" android:width="24dp" android:height="24dp" android:viewportWidth="960" android:viewportHeight="960" android:tint="?attr/colorControlNormal"> <path android:fillColor="@android:color/white" android:pathData="M480,432L296,616L240,560L480,320L720,560L664,616L480,432Z"/> </vector>
core/res/res/drawable/ic_notification_2025_expand.xml 0 → 100644 +25 −0 Original line number Diff line number Diff line <!-- ~ Copyright (C) 2024 The Android Open Source Project ~ ~ Licensed under the Apache License, Version 2.0 (the "License"); ~ you may not use this file except in compliance with the License. ~ You may obtain a copy of the License at ~ ~ http://www.apache.org/licenses/LICENSE-2.0 ~ ~ Unless required by applicable law or agreed to in writing, software ~ distributed under the License is distributed on an "AS IS" BASIS, ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ~ See the License for the specific language governing permissions and ~ limitations under the License. --> <vector xmlns:android="http://schemas.android.com/apk/res/android" android:width="24dp" android:height="24dp" android:viewportWidth="960" android:viewportHeight="960" android:tint="?attr/colorControlNormal"> <path android:fillColor="@android:color/white" android:pathData="M480,616L240,376L296,320L480,504L664,320L720,376L480,616Z"/> </vector>
core/res/res/drawable/notification_2025_expand_button_pill_bg.xml 0 → 100644 +29 −0 Original line number Diff line number Diff line <!-- ~ Copyright (C) 2024 The Android Open Source Project ~ ~ Licensed under the Apache License, Version 2.0 (the "License"); ~ you may not use this file except in compliance with the License. ~ You may obtain a copy of the License at ~ ~ http://www.apache.org/licenses/LICENSE-2.0 ~ ~ Unless required by applicable law or agreed to in writing, software ~ distributed under the License is distributed on an "AS IS" BASIS, ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ~ See the License for the specific language governing permissions and ~ limitations under the License. --> <layer-list xmlns:android="http://schemas.android.com/apk/res/android"> <item android:id="@+id/expand_button_pill_colorized_layer"> <shape xmlns:android="http://schemas.android.com/apk/res/android"> <corners android:radius="@dimen/notification_2025_expand_button_pill_height" /> <solid android:color="@android:color/white" /> </shape> </item> <item> <shape xmlns:android="http://schemas.android.com/apk/res/android"> <corners android:radius="@dimen/notification_2025_expand_button_pill_height" /> <solid android:color="@color/notification_expand_button_state_tint" /> </shape> </item> </layer-list>