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

Commit 95ab5221 authored by Ariel Gertzenstein's avatar Ariel Gertzenstein
Browse files

Add api to WearableExtender for setting and getting the bridge tag.

Make a change in the comment of setDismissalId.

Bug:31181351
Change-Id: I2fa080cd171c24d753529304ca16e4023cfb2c15
parent 652fd9cf
Loading
Loading
Loading
Loading
+2 −0
Original line number Original line Diff line number Diff line
@@ -5259,6 +5259,7 @@ package android.app {
    method public android.app.Notification.Builder extend(android.app.Notification.Builder);
    method public android.app.Notification.Builder extend(android.app.Notification.Builder);
    method public java.util.List<android.app.Notification.Action> getActions();
    method public java.util.List<android.app.Notification.Action> getActions();
    method public android.graphics.Bitmap getBackground();
    method public android.graphics.Bitmap getBackground();
    method public java.lang.String getBridgeTag();
    method public int getContentAction();
    method public int getContentAction();
    method public int getContentIcon();
    method public int getContentIcon();
    method public int getContentIconGravity();
    method public int getContentIconGravity();
@@ -5277,6 +5278,7 @@ package android.app {
    method public java.util.List<android.app.Notification> getPages();
    method public java.util.List<android.app.Notification> getPages();
    method public boolean getStartScrollBottom();
    method public boolean getStartScrollBottom();
    method public android.app.Notification.WearableExtender setBackground(android.graphics.Bitmap);
    method public android.app.Notification.WearableExtender setBackground(android.graphics.Bitmap);
    method public android.app.Notification.WearableExtender setBridgeTag(java.lang.String);
    method public android.app.Notification.WearableExtender setContentAction(int);
    method public android.app.Notification.WearableExtender setContentAction(int);
    method public android.app.Notification.WearableExtender setContentIcon(int);
    method public android.app.Notification.WearableExtender setContentIcon(int);
    method public android.app.Notification.WearableExtender setContentIconGravity(int);
    method public android.app.Notification.WearableExtender setContentIconGravity(int);
+2 −0
Original line number Original line Diff line number Diff line
@@ -5406,6 +5406,7 @@ package android.app {
    method public android.app.Notification.Builder extend(android.app.Notification.Builder);
    method public android.app.Notification.Builder extend(android.app.Notification.Builder);
    method public java.util.List<android.app.Notification.Action> getActions();
    method public java.util.List<android.app.Notification.Action> getActions();
    method public android.graphics.Bitmap getBackground();
    method public android.graphics.Bitmap getBackground();
    method public java.lang.String getBridgeTag();
    method public int getContentAction();
    method public int getContentAction();
    method public int getContentIcon();
    method public int getContentIcon();
    method public int getContentIconGravity();
    method public int getContentIconGravity();
@@ -5424,6 +5425,7 @@ package android.app {
    method public java.util.List<android.app.Notification> getPages();
    method public java.util.List<android.app.Notification> getPages();
    method public boolean getStartScrollBottom();
    method public boolean getStartScrollBottom();
    method public android.app.Notification.WearableExtender setBackground(android.graphics.Bitmap);
    method public android.app.Notification.WearableExtender setBackground(android.graphics.Bitmap);
    method public android.app.Notification.WearableExtender setBridgeTag(java.lang.String);
    method public android.app.Notification.WearableExtender setContentAction(int);
    method public android.app.Notification.WearableExtender setContentAction(int);
    method public android.app.Notification.WearableExtender setContentIcon(int);
    method public android.app.Notification.WearableExtender setContentIcon(int);
    method public android.app.Notification.WearableExtender setContentIconGravity(int);
    method public android.app.Notification.WearableExtender setContentIconGravity(int);
+2 −0
Original line number Original line Diff line number Diff line
@@ -5262,6 +5262,7 @@ package android.app {
    method public android.app.Notification.Builder extend(android.app.Notification.Builder);
    method public android.app.Notification.Builder extend(android.app.Notification.Builder);
    method public java.util.List<android.app.Notification.Action> getActions();
    method public java.util.List<android.app.Notification.Action> getActions();
    method public android.graphics.Bitmap getBackground();
    method public android.graphics.Bitmap getBackground();
    method public java.lang.String getBridgeTag();
    method public int getContentAction();
    method public int getContentAction();
    method public int getContentIcon();
    method public int getContentIcon();
    method public int getContentIconGravity();
    method public int getContentIconGravity();
@@ -5280,6 +5281,7 @@ package android.app {
    method public java.util.List<android.app.Notification> getPages();
    method public java.util.List<android.app.Notification> getPages();
    method public boolean getStartScrollBottom();
    method public boolean getStartScrollBottom();
    method public android.app.Notification.WearableExtender setBackground(android.graphics.Bitmap);
    method public android.app.Notification.WearableExtender setBackground(android.graphics.Bitmap);
    method public android.app.Notification.WearableExtender setBridgeTag(java.lang.String);
    method public android.app.Notification.WearableExtender setContentAction(int);
    method public android.app.Notification.WearableExtender setContentAction(int);
    method public android.app.Notification.WearableExtender setContentIcon(int);
    method public android.app.Notification.WearableExtender setContentIcon(int);
    method public android.app.Notification.WearableExtender setContentIconGravity(int);
    method public android.app.Notification.WearableExtender setContentIconGravity(int);
+32 −5
Original line number Original line Diff line number Diff line
@@ -5834,6 +5834,7 @@ public class Notification implements Parcelable
        private static final String KEY_GRAVITY = "gravity";
        private static final String KEY_GRAVITY = "gravity";
        private static final String KEY_HINT_SCREEN_TIMEOUT = "hintScreenTimeout";
        private static final String KEY_HINT_SCREEN_TIMEOUT = "hintScreenTimeout";
        private static final String KEY_DISMISSAL_ID = "dismissalId";
        private static final String KEY_DISMISSAL_ID = "dismissalId";
        private static final String KEY_BRIDGE_TAG = "bridgeTag";


        // Flags bitwise-ored to mFlags
        // Flags bitwise-ored to mFlags
        private static final int FLAG_CONTENT_INTENT_AVAILABLE_OFFLINE = 0x1;
        private static final int FLAG_CONTENT_INTENT_AVAILABLE_OFFLINE = 0x1;
@@ -5863,6 +5864,7 @@ public class Notification implements Parcelable
        private int mGravity = DEFAULT_GRAVITY;
        private int mGravity = DEFAULT_GRAVITY;
        private int mHintScreenTimeout;
        private int mHintScreenTimeout;
        private String mDismissalId;
        private String mDismissalId;
        private String mBridgeTag;


        /**
        /**
         * Create a {@link android.app.Notification.WearableExtender} with default
         * Create a {@link android.app.Notification.WearableExtender} with default
@@ -5900,6 +5902,7 @@ public class Notification implements Parcelable
                mGravity = wearableBundle.getInt(KEY_GRAVITY, DEFAULT_GRAVITY);
                mGravity = wearableBundle.getInt(KEY_GRAVITY, DEFAULT_GRAVITY);
                mHintScreenTimeout = wearableBundle.getInt(KEY_HINT_SCREEN_TIMEOUT);
                mHintScreenTimeout = wearableBundle.getInt(KEY_HINT_SCREEN_TIMEOUT);
                mDismissalId = wearableBundle.getString(KEY_DISMISSAL_ID);
                mDismissalId = wearableBundle.getString(KEY_DISMISSAL_ID);
                mBridgeTag = wearableBundle.getString(KEY_BRIDGE_TAG);
            }
            }
        }
        }


@@ -5953,6 +5956,9 @@ public class Notification implements Parcelable
            if (mDismissalId != null) {
            if (mDismissalId != null) {
                wearableBundle.putString(KEY_DISMISSAL_ID, mDismissalId);
                wearableBundle.putString(KEY_DISMISSAL_ID, mDismissalId);
            }
            }
            if (mBridgeTag != null) {
                wearableBundle.putString(KEY_BRIDGE_TAG, mBridgeTag);
            }


            builder.getExtras().putBundle(EXTRA_WEARABLE_EXTENSIONS, wearableBundle);
            builder.getExtras().putBundle(EXTRA_WEARABLE_EXTENSIONS, wearableBundle);
            return builder;
            return builder;
@@ -5974,6 +5980,7 @@ public class Notification implements Parcelable
            that.mGravity = this.mGravity;
            that.mGravity = this.mGravity;
            that.mHintScreenTimeout = this.mHintScreenTimeout;
            that.mHintScreenTimeout = this.mHintScreenTimeout;
            that.mDismissalId = this.mDismissalId;
            that.mDismissalId = this.mDismissalId;
            that.mBridgeTag = this.mBridgeTag;
            return that;
            return that;
        }
        }


@@ -6462,12 +6469,11 @@ public class Notification implements Parcelable
        }
        }


        /**
        /**
         * When you post a notification, if you set the dismissal id field, then when that
         * Sets the dismissal id for this notification. If a notification is posted with a
         * notification is canceled, notifications on other wearables and the paired Android phone
         * dismissal id, then when that notification is canceled, notifications on other wearables
         * having that same dismissal id will also be canceled.  Note that this only works if you
         * and the paired Android phone having that same dismissal id will also be canceled. See
         * have notification bridge mode set to NO_BRIDGING in your Wear app manifest.  See
         * <a href="{@docRoot}wear/notifications/index.html">Adding Wearable Features to
         * <a href="{@docRoot}wear/notifications/index.html">Adding Wearable Features to
         * Notifications</a> for more information on how to use the bridge mode feature.
         * Notifications</a> for more information.
         * @param dismissalId the dismissal id of the notification.
         * @param dismissalId the dismissal id of the notification.
         * @return this object for method chaining
         * @return this object for method chaining
         */
         */
@@ -6484,6 +6490,27 @@ public class Notification implements Parcelable
            return mDismissalId;
            return mDismissalId;
        }
        }


        /**
         * Sets a bridge tag for this notification. A bridge tag can be set for notifications
         * posted from a phone to provide finer-grained control on what notifications are bridged
         * to wearables. See <a href="{@docRoot}wear/notifications/index.html">Adding Wearable
         * Features to Notifications</a> for more information.
         * @param bridgeTag the bridge tag of the notification.
         * @return this object for method chaining
         */
        public WearableExtender setBridgeTag(String bridgeTag) {
            mBridgeTag = bridgeTag;
            return this;
        }

        /**
         * Returns the bridge tag of the notification.
         * @return the bridge tag or null if not present.
         */
        public String getBridgeTag() {
            return mBridgeTag;
        }

        private void setFlag(int mask, boolean value) {
        private void setFlag(int mask, boolean value) {
            if (value) {
            if (value) {
                mFlags |= mask;
                mFlags |= mask;