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

Commit 2f6cdb0d authored by Ioana Alexandru's avatar Ioana Alexandru
Browse files

[Notif redesign] Show title in legacy messaging notifs

Previously, we were collapsing the title into the top line when a legacy
messaging notification was being expanded. Now we're showing it
normally, as we do for other styles incl. the new conversation layout.

Test: manual + screenshot tests
Flag: android.app.notifications_redesign_templates
Bug: 378660052
Change-Id: I68b3d749c2927ca6810a979c1ef61660fdba0f9e
parent eab16f80
Loading
Loading
Loading
Loading
+20 −31
Original line number Diff line number Diff line
@@ -6004,8 +6004,7 @@ public class Notification implements Parcelable
            // Update margins to leave space for the top line (but not for headerless views like
            // HUNS, which use a different layout that already accounts for that). Templates that
            // have content that will be displayed under the small icon also use a different margin.
            if (Flags.notificationsRedesignTemplates()
                    && !p.mHeaderless && !p.mSkipTopLineAlignment) {
            if (Flags.notificationsRedesignTemplates() && !p.mHeaderless) {
                int margin = getContentMarginTop(mContext,
                        R.dimen.notification_2025_content_margin_top);
                contentView.setViewLayoutMargin(R.id.notification_main_column,
@@ -9471,7 +9470,7 @@ public class Notification implements Parcelable
            boolean hideRightIcons = viewType != StandardTemplateParams.VIEW_TYPE_NORMAL;
            boolean isConversationLayout = mConversationType != CONVERSATION_TYPE_LEGACY;
            boolean isImportantConversation = mConversationType == CONVERSATION_TYPE_IMPORTANT;
            boolean isHeaderless = !isConversationLayout && isCollapsed;
            boolean isLegacyHeaderless = !isConversationLayout && isCollapsed;
            //TODO (b/217799515): ensure mConversationTitle always returns the correct
            // conversationTitle, probably set mConversationTitle = conversationTitle after this
@@ -9492,7 +9491,7 @@ public class Notification implements Parcelable
            } else {
                isOneToOne = !isGroupConversation();
            }
            if ((isHeaderless || notificationsRedesignTemplates())
            if ((isLegacyHeaderless || notificationsRedesignTemplates())
                    && isOneToOne && TextUtils.isEmpty(conversationTitle)) {
                conversationTitle = getOtherPersonName();
            }
@@ -9507,14 +9506,11 @@ public class Notification implements Parcelable
                    .hideLeftIcon(isOneToOne)
                    .hideRightIcon(hideRightIcons || isOneToOne);
            if (notificationsRedesignTemplates()) {
                p.title((isConversationLayout || isCollapsed) ? conversationTitle : null)
                        .headerTextSecondary(
                                (isConversationLayout || isCollapsed) ? null : conversationTitle)
                        .hideAppName(isCollapsed)
                        .skipTopLineAlignment(!isConversationLayout && !isCollapsed);
                p.title(conversationTitle)
                        .hideAppName(isCollapsed);
            } else {
                p.title(isHeaderless ? conversationTitle : null)
                        .headerTextSecondary(isHeaderless ? null : conversationTitle);
                p.title(isLegacyHeaderless ? conversationTitle : null)
                        .headerTextSecondary(isLegacyHeaderless ? null : conversationTitle);
            }
            RemoteViews contentView = mBuilder.applyStandardTemplateWithActions(
                    getMessagingLayoutResource(isConversationLayout, isCollapsed),
@@ -9552,6 +9548,7 @@ public class Notification implements Parcelable
                        "setShortcutIcon", mShortcutIcon);
                contentView.setBoolean(R.id.status_bar_latest_event_content,
                        "setIsImportantConversation", isImportantConversation);
            }
            if (notificationsRedesignTemplates() && !isCollapsed) {
                // Align the title to the app/small icon in the expanded form. In other layouts,
                // this margin is added directly to the notification_main_column parent, but for
@@ -9563,8 +9560,7 @@ public class Notification implements Parcelable
                contentView.setViewLayoutMargin(R.id.title,
                        RemoteViews.MARGIN_START, marginStart, TypedValue.COMPLEX_UNIT_PX);
            }
            }
            if (isHeaderless) {
            if (isLegacyHeaderless) {
                // Collapsed legacy messaging style has a 1-line limit.
                contentView.setInt(R.id.notification_messaging, "setMaxDisplayedLines", 1);
            }
@@ -14729,7 +14725,6 @@ public class Notification implements Parcelable
        Icon mPromotedPicture;
        boolean mCallStyleActions;
        boolean mAllowTextWithProgress;
        boolean mSkipTopLineAlignment;
        int mTitleViewId;
        int mTextViewId;
        @Nullable CharSequence mTitle;
@@ -14755,7 +14750,6 @@ public class Notification implements Parcelable
            mPromotedPicture = null;
            mCallStyleActions = false;
            mAllowTextWithProgress = false;
            mSkipTopLineAlignment = false;
            mTitleViewId = R.id.title;
            mTextViewId = R.id.text;
            mTitle = null;
@@ -14822,11 +14816,6 @@ public class Notification implements Parcelable
            return this;
        }
        public StandardTemplateParams skipTopLineAlignment(boolean skipTopLineAlignment) {
            mSkipTopLineAlignment = skipTopLineAlignment;
            return this;
        }
        final StandardTemplateParams hideSnoozeButton(boolean hideSnoozeButton) {
            this.mHideSnoozeButton = hideSnoozeButton;
            return this;
+0 −1
Original line number Diff line number Diff line
@@ -44,7 +44,6 @@
            android:layout_height="wrap_content"
            android:layout_gravity="top"
            android:layout_weight="1"
            android:layout_marginTop="@dimen/notification_2025_header_height"
            android:layout_marginEnd="@dimen/notification_content_margin_end"
            android:orientation="vertical"
            android:clipChildren="false"
+5 −1
Original line number Diff line number Diff line
@@ -36,17 +36,21 @@
            android:clipChildren="false"
            android:orientation="vertical">

        <!-- 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_gravity="top"
            android:layout_weight="1"
            android:layout_marginTop="@dimen/notification_2025_header_height"
            android:layout_marginEnd="@dimen/notification_content_margin_end"
            android:orientation="vertical"
            android:clipChildren="false"
            >

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

            <com.android.internal.widget.MessagingLinearLayout
                android:id="@+id/notification_messaging"
                android:layout_width="match_parent"