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

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

Merge changes from topic "notif_redesign_calls" into main

* changes:
  [Notif redesign] Update call layouts
  [Notif redesign] Add verification icon to top line views
parents 3c002eea 7498fce7
Loading
Loading
Loading
Loading
+17 −5
Original line number Diff line number Diff line
@@ -5966,7 +5966,9 @@ public class Notification implements Parcelable
                    || resId == getMessagingCompactHeadsUpLayoutResource()
                    || resId == getCollapsedMessagingLayoutResource()
                    || resId == getCollapsedMediaLayoutResource()
                    || resId == getCollapsedConversationLayoutResource());
                    || resId == getCollapsedConversationLayoutResource()
                    || (notificationsRedesignTemplates()
                    && resId == getCollapsedCallLayoutResource()));
            RemoteViews contentView = new BuilderRemoteViews(mContext.getApplicationInfo(), resId);
            resetStandardTemplate(contentView);
@@ -11035,6 +11037,7 @@ public class Notification implements Parcelable
        private RemoteViews makeCallLayout(int viewType) {
            final boolean isCollapsed = viewType == StandardTemplateParams.VIEW_TYPE_NORMAL;
            final boolean isHeadsUp = viewType == StandardTemplateParams.VIEW_TYPE_HEADS_UP;
            Bundle extras = mBuilder.mN.extras;
            CharSequence title = mPerson != null ? mPerson.getName() : null;
            CharSequence text = mBuilder.processLegacyText(extras.getCharSequence(EXTRA_TEXT));
@@ -11050,22 +11053,31 @@ public class Notification implements Parcelable
                    .hideLeftIcon(true)
                    .hideRightIcon(true)
                    .hideAppName(isCollapsed)
                    .titleViewId(R.id.conversation_text)
                    .title(title)
                    .text(text)
                    .text(text);
            if (!notificationsRedesignTemplates()) {
                // We're using the normal title in the redesign, not a special text.
                p.titleViewId(R.id.conversation_text)
                        // The verification text is now part of the top line views, so this is no
                        // longer necessary.
                        .summaryText(mBuilder.processLegacyText(mVerificationText));
            }
            mBuilder.mActions = getActionsListWithSystemActions();
            final RemoteViews contentView;
            if (isCollapsed) {
                contentView = mBuilder.applyStandardTemplate(
                        mBuilder.getCollapsedCallLayoutResource(), p, null /* result */);
            } else if (notificationsRedesignTemplates() && isHeadsUp) {
                contentView = mBuilder.applyStandardTemplateWithActions(
                        mBuilder.getCollapsedCallLayoutResource(), p, null /* result */);
            } else {
                contentView = mBuilder.applyStandardTemplateWithActions(
                    mBuilder.getExpandedCallLayoutResource(), p, null /* result */);
            }
            // Bind some extra conversation-specific header fields.
            if (!p.mHideAppName) {
            if (!notificationsRedesignTemplates() && !p.mHideAppName) {
                // Redesign note: This special divider is no longer needed.
                mBuilder.setTextViewColorSecondary(contentView, R.id.app_name_divider, p);
                contentView.setViewVisibility(R.id.app_name_divider, View.VISIBLE);
            }
+155 −33
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?><!--
  ~ Copyright (C) 2024 The Android Open Source Project
  ~ Copyright (C) 2025 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.
@@ -25,48 +25,145 @@
    android:theme="@style/Theme.DeviceDefault.Notification"
    >

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:clipChildren="false"
        android:orientation="vertical"
        >

        <com.android.internal.widget.NotificationMaxHeightFrameLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:minHeight="@dimen/notification_2025_min_height"
            android:clipChildren="false"
            >

            <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_margin="@dimen/notification_2025_margin"
                android:background="@drawable/notification_large_icon_outline"
                android:clipToOutline="true"
                android:importantForAccessibility="no"
                android:scaleType="centerCrop"
                android:visibility="gone"
                />

            <!-- CallLayout shares visual appearance with ConversationLayout, so shares layouts -->
            <include layout="@layout/notification_2025_conversation_icon_container" />

            <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
        xmlns:android="http://schemas.android.com/apk/res/android"
                android:id="@+id/notification_headerless_view_row"
                android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:minHeight="@dimen/notification_2025_min_height"
                android:layout_height="match_parent"
                android:layout_marginStart="@dimen/notification_2025_content_margin_start"
                android:orientation="horizontal"
                android:clipChildren="false"
                >

                <LinearLayout
            android:id="@+id/notification_main_column"
            android:layout_width="match_parent"
                    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_marginStart="@dimen/notification_2025_content_margin_start"
                    android:layout_marginBottom="@dimen/notification_2025_margin"
                    android:layout_marginTop="@dimen/notification_2025_margin"
                    android:clipChildren="false"
                    android:orientation="vertical"
            android:paddingBottom="@dimen/notification_2025_margin"
                    >

            <include
                layout="@layout/notification_template_conversation_header"
                    <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_2025_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_template_text"
                        <include layout="@layout/notification_2025_top_line_views" />

                    </NotificationTopLineView>

                    <LinearLayout
                        android:id="@+id/notification_main_column"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                android:minHeight="@dimen/notification_text_height"
                        android:orientation="vertical"
                        android:clipChildren="false"
                        >
                        <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_2025_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>
                    </LinearLayout>

                </LinearLayout>

                <ImageView
                    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"
                    />

                <FrameLayout
                    android:id="@+id/expand_button_touch_container"
                    android:layout_width="wrap_content"
                    android:layout_height="match_parent"
                    android:minWidth="@dimen/notification_content_margin_end"
                    >

            <include
                layout="@layout/notification_2025_expand_button"
                    <include layout="@layout/notification_2025_expand_button"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_gravity="top|end"
@@ -76,4 +173,29 @@

            </LinearLayout>

            <include layout="@layout/notification_close_button"
                android:id="@+id/close_button"
                android:layout_width="@dimen/notification_close_button_size"
                android:layout_height="@dimen/notification_close_button_size"
                android:layout_gravity="top|end" />

        </com.android.internal.widget.NotificationMaxHeightFrameLayout>

        <LinearLayout
            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">
            <include layout="@layout/notification_template_smart_reply_container"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginTop="@dimen/notification_content_margin"
                android:layout_marginStart="@dimen/notification_2025_content_margin_start"
                android:layout_marginEnd="@dimen/notification_content_margin_end" />
            <include layout="@layout/notification_material_action_list" />
        </LinearLayout>
    </LinearLayout>

</com.android.internal.widget.CallLayout>
+25 −61
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!--
  ~ Copyright (C) 2024 The Android Open Source Project
  ~ Copyright (C) 2025 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.
@@ -27,83 +27,47 @@
    >

    <!-- CallLayout shares visual appearance with ConversationLayout, so shares layouts -->
    <include layout="@layout/notification_2025_conversation_icon_container" />
    <include layout="@layout/notification_2025_conversation_header"/>

    <LinearLayout
    <com.android.internal.widget.RemeasuringLinearLayout
        android:id="@+id/notification_action_list_margin_target"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginBottom="@dimen/notification_content_margin"
        android:orientation="vertical"
        >

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:orientation="horizontal"
            >
        android:layout_gravity="top"
        android:clipChildren="false"
        android:orientation="vertical">

            <LinearLayout
        <!-- Note: the top margin is being set in code based on the estimated space needed for
        the header text. -->
        <com.android.internal.widget.RemeasuringLinearLayout
            android:id="@+id/notification_main_column"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
                android:layout_marginStart="@dimen/notification_2025_content_margin_start"
            android:layout_gravity="top"
            android:layout_weight="1"
            android:layout_marginStart="@dimen/notification_2025_content_margin_start"
            android:layout_marginEnd="@dimen/notification_content_margin_end"
            android:orientation="vertical"
                android:minHeight="68dp"
            android:clipChildren="false"
            >

                <include
                    layout="@layout/notification_template_conversation_header"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    />
            <include layout="@layout/notification_template_part_line1"/>

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

                <include
                    android:layout_width="match_parent"
                    android:layout_height="@dimen/notification_progress_bar_height"
                    android:layout_marginTop="@dimen/notification_progress_margin_top"
                    layout="@layout/notification_template_progress"
                    />
            </LinearLayout>
        </com.android.internal.widget.RemeasuringLinearLayout>

            <FrameLayout
                android:layout_width="wrap_content"
                android:layout_height="match_parent"
                android:minWidth="@dimen/notification_content_margin_end"
                >

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

            </FrameLayout>

        </LinearLayout>

        <ViewStub
            android:layout="@layout/notification_material_reply_text"
            android:id="@+id/notification_material_reply_container"
        <include layout="@layout/notification_template_smart_reply_container"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            />

        <include
            layout="@layout/notification_template_smart_reply_container"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginStart="@dimen/notification_2025_content_margin_start"
            android:layout_marginEnd="@dimen/notification_content_margin_end"
            android:layout_marginTop="@dimen/notification_content_margin"
            />
            android:layout_marginStart="@dimen/notification_2025_content_margin_start"
            android:layout_marginEnd="@dimen/notification_content_margin_end" />

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

    </LinearLayout>
    </com.android.internal.widget.RemeasuringLinearLayout>

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

</com.android.internal.widget.CallLayout>
+36 −0
Original line number Diff line number Diff line
@@ -108,6 +108,42 @@
        android:visibility="gone"
        />

    <TextView
        android:id="@+id/verification_divider"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:textAppearance="@style/TextAppearance.DeviceDefault.Notification.Info"
        android:layout_marginStart="@dimen/notification_header_separating_margin"
        android:layout_marginEnd="@dimen/notification_header_separating_margin"
        android:text="@string/notification_header_divider_symbol"
        android:singleLine="true"
        android:visibility="gone"
        />

    <ImageView
        android:id="@+id/verification_icon"
        android:layout_width="@dimen/notification_2025_badge_size"
        android:layout_height="@dimen/notification_2025_badge_size"
        android:layout_marginStart="@dimen/notification_header_separating_margin"
        android:layout_marginEnd="@dimen/notification_header_separating_margin"
        android:baseline="@dimen/notification_2025_badge_baseline"
        android:scaleType="fitCenter"
        android:visibility="gone"
        />

    <TextView
        android:id="@+id/verification_text"
        android:textAppearance="@style/TextAppearance.DeviceDefault.Notification.Info"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginStart="@dimen/notification_header_separating_margin"
        android:layout_marginEnd="@dimen/notification_header_separating_margin"
        android:layout_weight="100"
        android:showRelative="true"
        android:singleLine="true"
        android:visibility="gone"
        />

    <ImageButton
        android:id="@+id/feedback"
        android:layout_width="@dimen/notification_feedback_size"
+16 −23
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@

package com.android.systemui.statusbar.notification.row.wrapper

import android.app.Flags.notificationsRedesignTemplates
import android.content.Context
import android.view.View
import com.android.internal.widget.CachingIconView
@@ -25,14 +26,10 @@ import com.android.systemui.statusbar.notification.NotificationFadeAware
import com.android.systemui.statusbar.notification.NotificationUtils
import com.android.systemui.statusbar.notification.row.ExpandableNotificationRow

/**
 * Wraps a notification containing a call template
 */
class NotificationCallTemplateViewWrapper constructor(
    ctx: Context,
    view: View,
    row: ExpandableNotificationRow
) : NotificationTemplateViewWrapper(ctx, view, row) {
/** Wraps a notification containing a call template */
class NotificationCallTemplateViewWrapper
constructor(ctx: Context, view: View, row: ExpandableNotificationRow) :
    NotificationTemplateViewWrapper(ctx, view, row) {

    private val minHeightWithActions: Int =
        NotificationUtils.getFontScaledHeight(ctx, R.dimen.notification_max_height)
@@ -54,7 +51,11 @@ class NotificationCallTemplateViewWrapper constructor(
                requireViewById(com.android.internal.R.id.conversation_icon_badge_bg)
            expandBtn = requireViewById(com.android.internal.R.id.expand_button)
            appName = requireViewById(com.android.internal.R.id.app_name_text)
            conversationTitleView = requireViewById(com.android.internal.R.id.conversation_text)
            conversationTitleView =
                requireViewById(
                    if (notificationsRedesignTemplates()) com.android.internal.R.id.title
                    else com.android.internal.R.id.conversation_text
                )
        }
    }

@@ -68,20 +69,12 @@ class NotificationCallTemplateViewWrapper constructor(
    override fun updateTransformedTypes() {
        // This also clears the existing types
        super.updateTransformedTypes()
        addTransformedViews(
                appName,
                conversationTitleView
        )
        addViewsTransformingToSimilar(
                conversationIconView,
                conversationBadgeBg,
                expandBtn
        )
        addTransformedViews(appName, conversationTitleView)
        addViewsTransformingToSimilar(conversationIconView, conversationBadgeBg, expandBtn)
    }

    override fun disallowSingleClick(x: Float, y: Float): Boolean {
        val isOnExpandButton = expandBtn.visibility == View.VISIBLE &&
                isOnView(expandBtn, x, y)
        val isOnExpandButton = expandBtn.visibility == View.VISIBLE && isOnView(expandBtn, x, y)
        return isOnExpandButton || super.disallowSingleClick(x, y)
    }