Loading core/java/android/app/Notification.java +33 −0 Original line number Diff line number Diff line Loading @@ -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); } } /** Loading Loading @@ -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; } Loading core/res/res/values/strings.xml +4 −0 Original line number Diff line number Diff line Loading @@ -4289,6 +4289,10 @@ DO NOT TRANSLATE --> <string name="notification_inbox_ellipsis">\u2026</string> <!-- Tempalate for Notification.MessagingStyle to join a conversation name with the name of the sender of a message, to make a notification title [CHAR LIMIT=NONE] --> <string name="notification_messaging_title_template"><xliff:g id="conversation_title" example="Tasty Treat Team">%1$s</xliff:g>: <xliff:g id="sender_name" example="Adrian Baker">%2$s</xliff:g></string> <!-- Label describing the number of selected items [CHAR LIMIT=48] --> <plurals name="selected_count"> <item quantity="one"><xliff:g id="count" example="1">%1$d</xliff:g> selected</item> Loading core/res/res/values/symbols.xml +1 −0 Original line number Diff line number Diff line Loading @@ -2601,6 +2601,7 @@ <!-- TV Remote Service package --> <java-symbol type="string" name="config_tvRemoteServicePackage" /> <java-symbol type="string" name="notification_messaging_title_template" /> <java-symbol type="bool" name="config_supportPreRebootSecurityLogs" /> Loading Loading
core/java/android/app/Notification.java +33 −0 Original line number Diff line number Diff line Loading @@ -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); } } /** Loading Loading @@ -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; } Loading
core/res/res/values/strings.xml +4 −0 Original line number Diff line number Diff line Loading @@ -4289,6 +4289,10 @@ DO NOT TRANSLATE --> <string name="notification_inbox_ellipsis">\u2026</string> <!-- Tempalate for Notification.MessagingStyle to join a conversation name with the name of the sender of a message, to make a notification title [CHAR LIMIT=NONE] --> <string name="notification_messaging_title_template"><xliff:g id="conversation_title" example="Tasty Treat Team">%1$s</xliff:g>: <xliff:g id="sender_name" example="Adrian Baker">%2$s</xliff:g></string> <!-- Label describing the number of selected items [CHAR LIMIT=48] --> <plurals name="selected_count"> <item quantity="one"><xliff:g id="count" example="1">%1$d</xliff:g> selected</item> Loading
core/res/res/values/symbols.xml +1 −0 Original line number Diff line number Diff line Loading @@ -2601,6 +2601,7 @@ <!-- TV Remote Service package --> <java-symbol type="string" name="config_tvRemoteServicePackage" /> <java-symbol type="string" name="notification_messaging_title_template" /> <java-symbol type="bool" name="config_supportPreRebootSecurityLogs" /> Loading