Merge "Set text for conversation notifications" into main
diff --git a/core/java/android/app/Notification.java b/core/java/android/app/Notification.java
index 1b71e73..cc72d8f 100644
--- a/core/java/android/app/Notification.java
+++ b/core/java/android/app/Notification.java
@@ -9526,14 +9526,21 @@
.viewType(viewType)
.highlightExpander(isConversationLayout)
.hideProgress(true)
- .text(null)
.hideLeftIcon(isOneToOne)
.hideRightIcon(hideRightIcons || isOneToOne);
if (notificationsRedesignTemplates()) {
+ String lastMessage = !mMessages.isEmpty()
+ ? mMessages.getLast().mText.toString() : null;
+
p.title(conversationTitle)
+ // The text is not actually displayed like this (since we're using a
+ // MessagingLinearLayout instead of the regular text), but we're using it to
+ // know whether the notification will have a second line in practice.
+ .text(lastMessage)
.hideAppName(isCollapsed);
} else {
p.title(isLegacyHeaderless ? conversationTitle : null)
+ .text(null)
.headerTextSecondary(isLegacyHeaderless ? null : conversationTitle);
}
RemoteViews contentView = mBuilder.applyStandardTemplateWithActions(