Merge "MessagingStyle: Generate EXTRA_TITLE and EXTRA_TEXT" into nyc-dev am: ff39d3ec2f
am: 72bc1299f2
* commit '72bc1299f2020c4acd51defed6da430d61edc5fa':
MessagingStyle: Generate EXTRA_TITLE and EXTRA_TEXT
Change-Id: Ifcba6fe03700c39b9777c3c08ffa1c4bf4873dd7
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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" />
|
||||
|
||||
|
||||
Reference in New Issue
Block a user