Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c7a023ea authored by Ioana Alexandru's avatar Ioana Alexandru Committed by Android (Google) Code Review
Browse files

Merge changes I0d65856b,If24e539a into main

* changes:
  [Notif redesign] Bigger "small" icon in header only notif
  [Notif redesign] Bigger "small" icon in collapsed notif
parents d0d76353 9af1abd4
Loading
Loading
Loading
Loading
+23 −2
Original line number Diff line number Diff line
@@ -811,11 +811,20 @@ public class Notification implements Parcelable
    }
    private static boolean isStandardLayout(int layoutId) {
        // TODO: b/359128724 - Add to static list when inlining the flag.
        if (Flags.apiRichOngoing()) {
            if (layoutId == R.layout.notification_template_material_progress) {
                return true;
            }
        }
        // TODO: b/378660052 - Add to static list when inlining the flag.
        if (Flags.notificationsRedesignTemplates()) {
            switch(layoutId) {
                case R.layout.notification_2025_template_collapsed_base:
                case R.layout.notification_2025_template_header:
                    return true;
            }
        }
        return STANDARD_LAYOUTS.contains(layoutId);
    }
@@ -6718,7 +6727,7 @@ public class Notification implements Parcelable
            // Headers on their own are never colorized
            p.disallowColorization();
            RemoteViews header = new BuilderRemoteViews(mContext.getApplicationInfo(),
                    R.layout.notification_template_header);
                    getHeaderLayoutResource());
            resetNotificationHeader(header);
            bindNotificationHeader(header, p);
            return header;
@@ -7478,10 +7487,22 @@ public class Notification implements Parcelable
            return clone;
        }
        private int getHeaderLayoutResource() {
            if (Flags.notificationsRedesignTemplates()) {
                return R.layout.notification_2025_template_header;
            } else {
                return R.layout.notification_template_header;
            }
        }
        @UnsupportedAppUsage
        private int getBaseLayoutResource() {
            if (Flags.notificationsRedesignTemplates()) {
                return R.layout.notification_2025_template_collapsed_base;
            } else {
                return R.layout.notification_template_material_base;
            }
        }
        private int getHeadsUpBaseLayoutResource() {
            return R.layout.notification_template_material_heads_up_base;
+7 −0
Original line number Diff line number Diff line
@@ -12,6 +12,13 @@ flag {
  bug: "371174789"
}

flag {
  name: "notifications_redesign_templates"
  namespace: "systemui"
  description: "Notifications Redesign: Update notification templates"
  bug: "378660052"
}

flag {
  name: "modes_api"
  is_exported: true
+195 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?><!--
  ~ 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
  -->

<FrameLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/status_bar_latest_event_content"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_weight="1"
    android:minHeight="@dimen/notification_headerless_min_height"
    android:tag="base"
    >

    <ImageView
        android:id="@+id/left_icon"
        android:layout_width="@dimen/notification_2025_left_icon_size"
        android:layout_height="@dimen/notification_2025_left_icon_size"
        android:layout_gravity="center_vertical|start"
        android:layout_marginStart="@dimen/notification_left_icon_start"
        android:background="@drawable/notification_large_icon_outline"
        android:clipToOutline="true"
        android:importantForAccessibility="no"
        android:scaleType="centerCrop"
        android:visibility="gone"
        />

    <com.android.internal.widget.NotificationRowIconView
        android:id="@+id/icon"
        android:layout_width="@dimen/notification_2025_icon_circle_size"
        android:layout_height="@dimen/notification_2025_icon_circle_size"
        android:layout_gravity="center_vertical|start"
        android:layout_marginStart="@dimen/notification_icon_circle_start"
        android:background="@drawable/notification_icon_circle"
        android:padding="@dimen/notification_2025_icon_circle_padding"
        android:maxDrawableWidth="@dimen/notification_2025_icon_circle_size"
        android:maxDrawableHeight="@dimen/notification_2025_icon_circle_size"
        />

    <FrameLayout
        android:id="@+id/alternate_expand_target"
        android:layout_width="@dimen/notification_2025_content_margin_start"
        android:layout_height="match_parent"
        android:layout_gravity="start"
        android:importantForAccessibility="no"
        android:focusable="false"
        />

    <LinearLayout
        android:id="@+id/notification_headerless_view_row"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_marginStart="@dimen/notification_2025_content_margin_start"
        android:orientation="horizontal"
        >

        <LinearLayout
            android:id="@+id/notification_headerless_view_column"
            android:layout_width="0px"
            android:layout_height="wrap_content"
            android:layout_gravity="center_vertical"
            android:layout_weight="1"
            android:layout_marginBottom="@dimen/notification_headerless_margin_twoline"
            android:layout_marginTop="@dimen/notification_headerless_margin_twoline"
            android:orientation="vertical"
            >

            <NotificationTopLineView
                android:id="@+id/notification_top_line"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:minHeight="@dimen/notification_headerless_line_height"
                android:clipChildren="false"
                android:theme="@style/Theme.DeviceDefault.Notification"
                >

                <!--
                NOTE: The notification_top_line_views layout contains the app_name_text.
                In order to include the title view at the beginning, the Notification.Builder
                has logic to hide that view whenever this title view is to be visible.
                -->

                <TextView
                    android:id="@+id/title"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_marginEnd="@dimen/notification_header_separating_margin"
                    android:ellipsize="end"
                    android:fadingEdge="horizontal"
                    android:singleLine="true"
                    android:textAlignment="viewStart"
                    android:textAppearance="@style/TextAppearance.DeviceDefault.Notification.Title"
                    />

                <include layout="@layout/notification_top_line_views" />

            </NotificationTopLineView>

            <LinearLayout
                android:id="@+id/notification_main_column"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:orientation="vertical"
                >

                <com.android.internal.widget.NotificationVanishingFrameLayout
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:minHeight="@dimen/notification_headerless_line_height"
                    >
                    <!-- This is the simplest way to keep this text vertically centered without
                     gravity="center_vertical" which causes jumpiness in expansion animations. -->
                    <include
                        layout="@layout/notification_template_text"
                        android:layout_width="match_parent"
                        android:layout_height="@dimen/notification_text_height"
                        android:layout_gravity="center_vertical"
                        android:layout_marginTop="0dp"
                        />
                </com.android.internal.widget.NotificationVanishingFrameLayout>

                <include
                    layout="@layout/notification_template_progress"
                    android:layout_width="match_parent"
                    android:layout_height="@dimen/notification_headerless_line_height"
                    />

            </LinearLayout>

        </LinearLayout>

        <com.android.internal.widget.CachingIconView
            android:id="@+id/right_icon"
            android:layout_width="@dimen/notification_right_icon_size"
            android:layout_height="@dimen/notification_right_icon_size"
            android:layout_gravity="center_vertical|end"
            android:layout_marginTop="@dimen/notification_right_icon_headerless_margin"
            android:layout_marginBottom="@dimen/notification_right_icon_headerless_margin"
            android:layout_marginStart="@dimen/notification_right_icon_content_margin"
            android:background="@drawable/notification_large_icon_outline"
            android:clipToOutline="true"
            android:importantForAccessibility="no"
            android:scaleType="centerCrop"
            android:maxDrawableWidth="@dimen/notification_right_icon_size"
            android:maxDrawableHeight="@dimen/notification_right_icon_size"
            />

        <LinearLayout
            android:id="@+id/notification_buttons_column"
            android:layout_width="wrap_content"
            android:layout_height="match_parent"
            android:layout_alignParentEnd="true"
            android:orientation="vertical"
            >

            <include layout="@layout/notification_close_button"
                android:layout_width="@dimen/notification_close_button_size"
                android:layout_height="@dimen/notification_close_button_size"
                android:layout_gravity="end"
                android:layout_marginEnd="20dp"
                />

            <FrameLayout
                android:id="@+id/expand_button_touch_container"
                android:layout_width="wrap_content"
                android:layout_height="0dp"
                android:layout_weight="1"
                android:minWidth="@dimen/notification_content_margin_end"
                >

                <include layout="@layout/notification_expand_button"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_gravity="center_vertical|end"
                    />

            </FrameLayout>

        </LinearLayout>

    </LinearLayout>

</FrameLayout>
+111 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?><!--
  ~ 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
  -->

<!-- extends RelativeLayout -->
<NotificationHeaderView
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/notification_header"
    android:layout_width="match_parent"
    android:layout_height="@dimen/notification_2025_header_height"
    android:layout_marginBottom="@dimen/notification_header_margin_bottom"
    android:clipChildren="false"
    android:gravity="center_vertical"
    android:orientation="horizontal"
    android:theme="@style/Theme.DeviceDefault.Notification"
    android:importantForAccessibility="no"
    >

    <ImageView
        android:id="@+id/left_icon"
        android:layout_width="@dimen/notification_2025_left_icon_size"
        android:layout_height="@dimen/notification_2025_left_icon_size"
        android:layout_alignParentStart="true"
        android:layout_centerVertical="true"
        android:layout_marginStart="@dimen/notification_left_icon_start"
        android:background="@drawable/notification_large_icon_outline"
        android:clipToOutline="true"
        android:importantForAccessibility="no"
        android:scaleType="centerCrop"
        android:visibility="gone"
        />

    <com.android.internal.widget.NotificationRowIconView
        android:id="@+id/icon"
        android:layout_width="@dimen/notification_2025_icon_circle_size"
        android:layout_height="@dimen/notification_2025_icon_circle_size"
        android:layout_alignParentStart="true"
        android:layout_centerVertical="true"
        android:layout_marginStart="@dimen/notification_icon_circle_start"
        android:background="@drawable/notification_icon_circle"
        android:padding="@dimen/notification_2025_icon_circle_padding"
        android:maxDrawableWidth="@dimen/notification_2025_icon_circle_size"
        android:maxDrawableHeight="@dimen/notification_2025_icon_circle_size"
        />

    <!-- extends ViewGroup -->
    <NotificationTopLineView
        xmlns:android="http://schemas.android.com/apk/res/android"
        android:id="@+id/notification_top_line"
        android:layout_width="wrap_content"
        android:layout_height="match_parent"
        android:layout_alignParentStart="true"
        android:layout_centerVertical="true"
        android:layout_toStartOf="@id/notification_buttons_column"
        android:layout_alignWithParentIfMissing="true"
        android:clipChildren="false"
        android:gravity="center_vertical"
        android:paddingStart="@dimen/notification_2025_content_margin_start"
        android:theme="@style/Theme.DeviceDefault.Notification"
        >

        <include layout="@layout/notification_top_line_views" />

    </NotificationTopLineView>

    <FrameLayout
        android:id="@+id/alternate_expand_target"
        android:layout_width="@dimen/notification_2025_content_margin_start"
        android:layout_height="match_parent"
        android:layout_alignParentStart="true"
        android:importantForAccessibility="no"
        android:focusable="false"
        />

    <LinearLayout
        android:id="@+id/notification_buttons_column"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentEnd="true"
        android:orientation="vertical"
        >

        <include layout="@layout/notification_close_button"
            android:layout_width="@dimen/notification_close_button_size"
            android:layout_height="@dimen/notification_close_button_size"
            android:layout_gravity="end"
            android:layout_marginEnd="20dp"
            />

        <include layout="@layout/notification_expand_button"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentEnd="true"
            android:layout_centerVertical="true"
            />

    </LinearLayout>

</NotificationHeaderView>
+19 −1
Original line number Diff line number Diff line
@@ -247,9 +247,14 @@
    <!-- Default padding for dialogs. -->
    <dimen name="dialog_padding">16dp</dimen>

    <!-- The margin on the start of the content view (accommodates the icon) -->
    <!-- The margin on the start of the content view (accommodates the icon)
     This represents 16dp for the left margin + 24dp for the icon + 12dp for the right margin -->
    <dimen name="notification_content_margin_start">52dp</dimen>

    <!-- The margin on the start of the content view (accommodates the icon), 2025 redesign version
     This represents 16dp for the left margin + 40dp for the icon + 16dp for the right margin -->
    <dimen name="notification_2025_content_margin_start">72dp</dimen>

    <!-- The margin on the end of most content views (ignores the expander) -->
    <dimen name="notification_content_margin_end">16dp</dimen>

@@ -310,6 +315,9 @@
    <!-- height of the notification header -->
    <dimen name="notification_header_height">56dp</dimen>

    <!-- height of the notification header (2025 redesign version) -->
    <dimen name="notification_2025_header_height">72dp</dimen>

    <!-- The height of the background for a notification header on a group -->
    <dimen name="notification_header_background_height">49.5dp</dimen>

@@ -331,9 +339,17 @@
    <!-- size (width and height) of the circle around the icon in the notification header -->
    <dimen name="notification_icon_circle_size">24dp</dimen>

    <!-- size (width and height) of the circular icon in the notification header
         (2025 redesign version) -->
    <dimen name="notification_2025_icon_circle_size">40dp</dimen>

    <!-- padding between the notification icon and the circle containing it -->
    <dimen name="notification_icon_circle_padding">4dp</dimen>

    <!-- padding between the notification icon and the circle containing it
         (2025 redesign version) -->
    <dimen name="notification_2025_icon_circle_padding">8dp</dimen>

    <!-- start margin of the icon circle in the notification view -->
    <dimen name="notification_icon_circle_start">16dp</dimen>

@@ -803,6 +819,8 @@
    <dimen name="notification_right_icon_big_margin_top">16dp</dimen>
    <!-- The size of the left icon -->
    <dimen name="notification_left_icon_size">@dimen/notification_icon_circle_size</dimen>
    <!-- The size of the left icon (2025 redesign version) -->
    <dimen name="notification_2025_left_icon_size">@dimen/notification_2025_icon_circle_size</dimen>
    <!-- The left padding of the left icon -->
    <dimen name="notification_left_icon_start">@dimen/notification_icon_circle_start</dimen>
    <!-- The alpha of a disabled notification button -->
Loading