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

Commit 5a871867 authored by Shane Brennan's avatar Shane Brennan
Browse files

Adding an extras Bundle to MessagingStyle messages.

This allows extending each message with standard extenders.

Test: Will be adding CTS test in a separate CL.

Change-Id: I2ce35cc28e0f374af02e0ad1228f473a63ff7740
parent 8f491d16
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -5412,6 +5412,7 @@ package android.app {
    ctor public Notification.MessagingStyle.Message(java.lang.CharSequence, long, java.lang.CharSequence);
    method public java.lang.String getDataMimeType();
    method public android.net.Uri getDataUri();
    method public android.os.Bundle getExtras();
    method public java.lang.CharSequence getSender();
    method public java.lang.CharSequence getText();
    method public long getTimestamp();
+1 −0
Original line number Diff line number Diff line
@@ -5586,6 +5586,7 @@ package android.app {
    ctor public Notification.MessagingStyle.Message(java.lang.CharSequence, long, java.lang.CharSequence);
    method public java.lang.String getDataMimeType();
    method public android.net.Uri getDataUri();
    method public android.os.Bundle getExtras();
    method public java.lang.CharSequence getSender();
    method public java.lang.CharSequence getText();
    method public long getTimestamp();
+1 −0
Original line number Diff line number Diff line
@@ -5422,6 +5422,7 @@ package android.app {
    ctor public Notification.MessagingStyle.Message(java.lang.CharSequence, long, java.lang.CharSequence);
    method public java.lang.String getDataMimeType();
    method public android.net.Uri getDataUri();
    method public android.os.Bundle getExtras();
    method public java.lang.CharSequence getSender();
    method public java.lang.CharSequence getText();
    method public long getTimestamp();
+15 −1
Original line number Diff line number Diff line
@@ -5651,11 +5651,13 @@ public class Notification implements Parcelable
            static final String KEY_SENDER = "sender";
            static final String KEY_DATA_MIME_TYPE = "type";
            static final String KEY_DATA_URI= "uri";
            static final String KEY_EXTRAS_BUNDLE = "extras";

            private final CharSequence mText;
            private final long mTimestamp;
            private final CharSequence mSender;

            private Bundle mExtras = new Bundle();
            private String mDataMimeType;
            private Uri mDataUri;

@@ -5723,6 +5725,13 @@ public class Notification implements Parcelable
                return mTimestamp;
            }

            /**
             * Get the extras Bundle for this message.
             */
            public Bundle getExtras() {
                return mExtras;
            }

            /**
             * Get the text used to display the contact's name in the messaging experience
             */
@@ -5760,6 +5769,9 @@ public class Notification implements Parcelable
                if (mDataUri != null) {
                    bundle.putParcelable(KEY_DATA_URI, mDataUri);
                }
                if (mExtras != null) {
                    bundle.putBundle(KEY_EXTRAS_BUNDLE, mExtras);
                }
                return bundle;
            }

@@ -5794,10 +5806,12 @@ public class Notification implements Parcelable
                                bundle.getLong(KEY_TIMESTAMP), bundle.getCharSequence(KEY_SENDER));
                        if (bundle.containsKey(KEY_DATA_MIME_TYPE) &&
                                bundle.containsKey(KEY_DATA_URI)) {

                            message.setData(bundle.getString(KEY_DATA_MIME_TYPE),
                                    (Uri) bundle.getParcelable(KEY_DATA_URI));
                        }
                        if (bundle.containsKey(KEY_EXTRAS_BUNDLE)) {
                            message.getExtras().putAll(bundle.getBundle(KEY_EXTRAS_BUNDLE));
                        }
                        return message;
                    }
                } catch (ClassCastException e) {