summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Nadia Benbernou <nbenbernou@google.com> 2016-05-02 14:15:45 +0000
committer Android (Google) Code Review <android-gerrit@google.com> 2016-05-02 14:15:46 +0000
commitf4810f5506203ac03439d1ed6e33e021540568f8 (patch)
tree69a50ebd7f56aa5a41e391079ecf8f06bd25a740
parent4a992cbde834fdf3770e34b21361b47f4786f65f (diff)
parent948627eeaaa9ab4147b87bda9565ad16c510cfb7 (diff)
Merge "Add api to WearableExtender for setting and getting the dismissal id. Bug:27696581" into nyc-dev
-rw-r--r--api/current.txt2
-rw-r--r--api/system-current.txt2
-rw-r--r--api/test-current.txt2
-rw-r--r--core/java/android/app/Notification.java30
4 files changed, 36 insertions, 0 deletions
diff --git a/api/current.txt b/api/current.txt
index 5e4b2d4eb958..b7b65f1402c7 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -5241,6 +5241,7 @@ package android.app {
method public boolean getContentIntentAvailableOffline();
method public int getCustomContentHeight();
method public int getCustomSizePreset();
+ method public java.lang.String getDismissalId();
method public android.app.PendingIntent getDisplayIntent();
method public int getGravity();
method public boolean getHintAmbientBigPicture();
@@ -5258,6 +5259,7 @@ package android.app {
method public android.app.Notification.WearableExtender setContentIntentAvailableOffline(boolean);
method public android.app.Notification.WearableExtender setCustomContentHeight(int);
method public android.app.Notification.WearableExtender setCustomSizePreset(int);
+ method public android.app.Notification.WearableExtender setDismissalId(java.lang.String);
method public android.app.Notification.WearableExtender setDisplayIntent(android.app.PendingIntent);
method public android.app.Notification.WearableExtender setGravity(int);
method public android.app.Notification.WearableExtender setHintAmbientBigPicture(boolean);
diff --git a/api/system-current.txt b/api/system-current.txt
index bde3a8cd7bb1..6b5f1e992d3d 100644
--- a/api/system-current.txt
+++ b/api/system-current.txt
@@ -5386,6 +5386,7 @@ package android.app {
method public boolean getContentIntentAvailableOffline();
method public int getCustomContentHeight();
method public int getCustomSizePreset();
+ method public java.lang.String getDismissalId();
method public android.app.PendingIntent getDisplayIntent();
method public int getGravity();
method public boolean getHintAmbientBigPicture();
@@ -5403,6 +5404,7 @@ package android.app {
method public android.app.Notification.WearableExtender setContentIntentAvailableOffline(boolean);
method public android.app.Notification.WearableExtender setCustomContentHeight(int);
method public android.app.Notification.WearableExtender setCustomSizePreset(int);
+ method public android.app.Notification.WearableExtender setDismissalId(java.lang.String);
method public android.app.Notification.WearableExtender setDisplayIntent(android.app.PendingIntent);
method public android.app.Notification.WearableExtender setGravity(int);
method public android.app.Notification.WearableExtender setHintAmbientBigPicture(boolean);
diff --git a/api/test-current.txt b/api/test-current.txt
index 91415066a3df..ae58f3685f16 100644
--- a/api/test-current.txt
+++ b/api/test-current.txt
@@ -5241,6 +5241,7 @@ package android.app {
method public boolean getContentIntentAvailableOffline();
method public int getCustomContentHeight();
method public int getCustomSizePreset();
+ method public java.lang.String getDismissalId();
method public android.app.PendingIntent getDisplayIntent();
method public int getGravity();
method public boolean getHintAmbientBigPicture();
@@ -5258,6 +5259,7 @@ package android.app {
method public android.app.Notification.WearableExtender setContentIntentAvailableOffline(boolean);
method public android.app.Notification.WearableExtender setCustomContentHeight(int);
method public android.app.Notification.WearableExtender setCustomSizePreset(int);
+ method public android.app.Notification.WearableExtender setDismissalId(java.lang.String);
method public android.app.Notification.WearableExtender setDisplayIntent(android.app.PendingIntent);
method public android.app.Notification.WearableExtender setGravity(int);
method public android.app.Notification.WearableExtender setHintAmbientBigPicture(boolean);
diff --git a/core/java/android/app/Notification.java b/core/java/android/app/Notification.java
index 20037ce30cdb..0c2e3c189aae 100644
--- a/core/java/android/app/Notification.java
+++ b/core/java/android/app/Notification.java
@@ -5486,6 +5486,7 @@ public class Notification implements Parcelable
private static final String KEY_CUSTOM_CONTENT_HEIGHT = "customContentHeight";
private static final String KEY_GRAVITY = "gravity";
private static final String KEY_HINT_SCREEN_TIMEOUT = "hintScreenTimeout";
+ private static final String KEY_DISMISSAL_ID = "dismissalId";
// Flags bitwise-ored to mFlags
private static final int FLAG_CONTENT_INTENT_AVAILABLE_OFFLINE = 0x1;
@@ -5514,6 +5515,7 @@ public class Notification implements Parcelable
private int mCustomContentHeight;
private int mGravity = DEFAULT_GRAVITY;
private int mHintScreenTimeout;
+ private String mDismissalId;
/**
* Create a {@link android.app.Notification.WearableExtender} with default
@@ -5550,6 +5552,7 @@ public class Notification implements Parcelable
mCustomContentHeight = wearableBundle.getInt(KEY_CUSTOM_CONTENT_HEIGHT);
mGravity = wearableBundle.getInt(KEY_GRAVITY, DEFAULT_GRAVITY);
mHintScreenTimeout = wearableBundle.getInt(KEY_HINT_SCREEN_TIMEOUT);
+ mDismissalId = wearableBundle.getString(KEY_DISMISSAL_ID);
}
}
@@ -5600,6 +5603,9 @@ public class Notification implements Parcelable
if (mHintScreenTimeout != 0) {
wearableBundle.putInt(KEY_HINT_SCREEN_TIMEOUT, mHintScreenTimeout);
}
+ if (mDismissalId != null) {
+ wearableBundle.putString(KEY_DISMISSAL_ID, mDismissalId);
+ }
builder.getExtras().putBundle(EXTRA_WEARABLE_EXTENSIONS, wearableBundle);
return builder;
@@ -5620,6 +5626,7 @@ public class Notification implements Parcelable
that.mCustomContentHeight = this.mCustomContentHeight;
that.mGravity = this.mGravity;
that.mHintScreenTimeout = this.mHintScreenTimeout;
+ that.mDismissalId = this.mDismissalId;
return that;
}
@@ -6107,6 +6114,29 @@ public class Notification implements Parcelable
return (mFlags & FLAG_HINT_CONTENT_INTENT_LAUNCHES_ACTIVITY) != 0;
}
+ /**
+ * When you post a notification, if you set the dismissal id field, then when that
+ * notification is canceled, notifications on other wearables and the paired Android phone
+ * having that same dismissal id will also be canceled. Note that this only works if you
+ * 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
+ * Notifications</a> for more information on how to use the bridge mode feature.
+ * @param dismissalId the dismissal id of the notification.
+ * @return this object for method chaining
+ */
+ public WearableExtender setDismissalId(String dismissalId) {
+ mDismissalId = dismissalId;
+ return this;
+ }
+
+ /**
+ * Returns the dismissal id of the notification.
+ * @return the dismissal id of the notification or null if it has not been set.
+ */
+ public String getDismissalId() {
+ return mDismissalId;
+ }
+
private void setFlag(int mask, boolean value) {
if (value) {
mFlags |= mask;