diff options
author | 2025-03-18 12:26:08 -0700 | |
---|---|---|
committer | 2025-03-18 12:26:08 -0700 | |
commit | 5434639a38250ffd4ca7d239829beeb158dcb4ee (patch) | |
tree | 63ebfc7a66d94f0899dd55f1f9e358ffd20c5141 | |
parent | 3e32348b191b8b20253f690e36d923e2c9775774 (diff) | |
parent | ab82f09462346265efe73bbdb21bdcf3d670bb17 (diff) |
Merge "Updates for collapsed notifications" into main
4 files changed, 34 insertions, 7 deletions
diff --git a/core/java/android/app/notification.aconfig b/core/java/android/app/notification.aconfig index 6f0eafe487af..d764c58b2b1e 100644 --- a/core/java/android/app/notification.aconfig +++ b/core/java/android/app/notification.aconfig @@ -385,3 +385,13 @@ flag { description: "Shows summarized notifications in the UI" bug: "390217880" } + +flag { + name: "nm_collapsed_lines" + namespace: "systemui" + description: "Shows 2 lines for collapsed notifications by default" + bug: "390217880" + metadata { + purpose: PURPOSE_BUGFIX + } +} diff --git a/core/java/com/android/internal/widget/ConversationLayout.java b/core/java/com/android/internal/widget/ConversationLayout.java index 3da19220248b..822ef34ad925 100644 --- a/core/java/com/android/internal/widget/ConversationLayout.java +++ b/core/java/com/android/internal/widget/ConversationLayout.java @@ -401,9 +401,19 @@ public class ConversationLayout extends FrameLayout @RemotableViewMethod(asyncImpl = "setIsCollapsedAsync") public void setIsCollapsed(boolean isCollapsed) { mIsCollapsed = isCollapsed; - mMessagingLinearLayout.setMaxDisplayedLines(isCollapsed - ? TextUtils.isEmpty(mSummarizedContent) ? 1 : MAX_SUMMARIZATION_LINES - : Integer.MAX_VALUE); + int maxLines = Integer.MAX_VALUE; + if (isCollapsed) { + if (!TextUtils.isEmpty(mSummarizedContent)) { + maxLines = MAX_SUMMARIZATION_LINES; + } else { + if (android.app.Flags.nmCollapsedLines()) { + maxLines = 2; + } else { + maxLines = 1; + } + } + } + mMessagingLinearLayout.setMaxDisplayedLines(maxLines); updateExpandButton(); updateContentEndPaddings(); } @@ -1177,7 +1187,9 @@ public class ConversationLayout extends FrameLayout nameOverride = mNameReplacement; } newGroup.setShowingAvatar(!mIsOneToOne && !mIsCollapsed); - newGroup.setSingleLine(mIsCollapsed && TextUtils.isEmpty(mSummarizedContent)); + newGroup.setSingleLine(mIsCollapsed + ? !android.app.Flags.nmCollapsedLines() && TextUtils.isEmpty(mSummarizedContent) + : false); newGroup.setIsCollapsed(mIsCollapsed); newGroup.setSender(sender, nameOverride); newGroup.setSending(groupIndex == (groups.size() - 1) && showSpinner); diff --git a/core/java/com/android/internal/widget/MessagingLayout.java b/core/java/com/android/internal/widget/MessagingLayout.java index 4cc4b38f95a5..f9c8228e455d 100644 --- a/core/java/com/android/internal/widget/MessagingLayout.java +++ b/core/java/com/android/internal/widget/MessagingLayout.java @@ -157,6 +157,10 @@ public class MessagingLayout extends FrameLayout @RemotableViewMethod(asyncImpl = "setIsCollapsedAsync") public void setIsCollapsed(boolean isCollapsed) { mIsCollapsed = isCollapsed; + if (mIsCollapsed) { + mMessagingLinearLayout.setMaxDisplayedLines( + android.app.Flags.nmCollapsedLines() ? 2 : 1); + } } /** @@ -549,7 +553,9 @@ public class MessagingLayout extends FrameLayout if (sender != mUser && mNameReplacement != null) { nameOverride = mNameReplacement; } - newGroup.setSingleLine(mIsCollapsed && TextUtils.isEmpty(mSummarizedContent)); + newGroup.setSingleLine(mIsCollapsed + ? !android.app.Flags.nmCollapsedLines() && TextUtils.isEmpty(mSummarizedContent) + : false); newGroup.setShowingAvatar(!mIsCollapsed); newGroup.setIsCollapsed(mIsCollapsed); newGroup.setSender(sender, nameOverride); diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/HybridConversationNotificationView.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/HybridConversationNotificationView.java index ba80f016cad4..4c7c46dfae94 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/HybridConversationNotificationView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/HybridConversationNotificationView.java @@ -51,7 +51,7 @@ import java.util.Objects; */ public class HybridConversationNotificationView extends HybridNotificationView { - private static final int MAX_SUMMARIZATION_LINES = 2; + private static final int MAX_SUMMARIZATION_LINES = 1; private ImageView mConversationIconView; private TextView mConversationSenderName; private ViewStub mConversationFacePileStub; @@ -295,7 +295,6 @@ public class HybridConversationNotificationView extends HybridNotificationView { if (AsyncHybridViewInflation.isUnexpectedlyInLegacyMode()) return; if (!TextUtils.isEmpty(summarization)) { mConversationSenderName.setVisibility(GONE); - titleText = null; contentText = summarization; mTextView.setSingleLine(false); mTextView.setMaxLines(MAX_SUMMARIZATION_LINES); |