diff --git a/core/java/android/app/Notification.java b/core/java/android/app/Notification.java
index e108dd6e49660..83a20668b3b49 100644
--- a/core/java/android/app/Notification.java
+++ b/core/java/android/app/Notification.java
@@ -4479,6 +4479,35 @@ public class Notification implements Parcelable
if (!mMessages.isEmpty()) { extras.putParcelableArray(EXTRA_MESSAGES,
Message.getBundleArrayForMessages(mMessages));
}
+
+ fixTitleAndTextExtras(extras);
+ }
+
+ private void fixTitleAndTextExtras(Bundle extras) {
+ Message m = findLatestIncomingMessage();
+ CharSequence text = (m == null) ? null : m.mText;
+ CharSequence sender = m == null ? null
+ : TextUtils.isEmpty(m.mSender) ? mUserDisplayName : m.mSender;
+ CharSequence title;
+ if (!TextUtils.isEmpty(mConversationTitle)) {
+ if (!TextUtils.isEmpty(sender)) {
+ BidiFormatter bidi = BidiFormatter.getInstance();
+ title = mBuilder.mContext.getString(
+ com.android.internal.R.string.notification_messaging_title_template,
+ bidi.unicodeWrap(mConversationTitle), bidi.unicodeWrap(m.mSender));
+ } else {
+ title = mConversationTitle;
+ }
+ } else {
+ title = sender;
+ }
+
+ if (title != null) {
+ extras.putCharSequence(EXTRA_TITLE, title);
+ }
+ if (text != null) {
+ extras.putCharSequence(EXTRA_TEXT, text);
+ }
}
/**
@@ -4524,6 +4553,10 @@ public class Notification implements Parcelable
return m;
}
}
+ if (!mMessages.isEmpty()) {
+ // No incoming messages, fall back to outgoing message
+ return mMessages.get(mMessages.size() - 1);
+ }
return null;
}
diff --git a/core/res/res/values/strings.xml b/core/res/res/values/strings.xml
index 4649e9d6caa52..48744b61b9654 100644
--- a/core/res/res/values/strings.xml
+++ b/core/res/res/values/strings.xml
@@ -4289,6 +4289,10 @@
DO NOT TRANSLATE -->
\u2026
+
+ %1$s: %2$s
+
+
- %1$d selected
diff --git a/core/res/res/values/symbols.xml b/core/res/res/values/symbols.xml
index 9dbe1004669d2..abef7f8e91ac4 100644
--- a/core/res/res/values/symbols.xml
+++ b/core/res/res/values/symbols.xml
@@ -2598,6 +2598,7 @@
+