Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ff39d3ec authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "MessagingStyle: Generate EXTRA_TITLE and EXTRA_TEXT" into nyc-dev

parents 0d7dbb0f 33fbd2c9
Loading
Loading
Loading
Loading
+33 −0
Original line number Diff line number Diff line
@@ -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;
        }

+4 −0
Original line number Diff line number Diff line
@@ -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>
+1 −0
Original line number Diff line number Diff line
@@ -2598,6 +2598,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" />