Merge "Add api to WearableExtender for setting and getting the dismissal id. Bug:27696581" into nyc-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
f4810f5506
@@ -5241,6 +5241,7 @@ package android.app {
|
|||||||
method public boolean getContentIntentAvailableOffline();
|
method public boolean getContentIntentAvailableOffline();
|
||||||
method public int getCustomContentHeight();
|
method public int getCustomContentHeight();
|
||||||
method public int getCustomSizePreset();
|
method public int getCustomSizePreset();
|
||||||
|
method public java.lang.String getDismissalId();
|
||||||
method public android.app.PendingIntent getDisplayIntent();
|
method public android.app.PendingIntent getDisplayIntent();
|
||||||
method public int getGravity();
|
method public int getGravity();
|
||||||
method public boolean getHintAmbientBigPicture();
|
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 setContentIntentAvailableOffline(boolean);
|
||||||
method public android.app.Notification.WearableExtender setCustomContentHeight(int);
|
method public android.app.Notification.WearableExtender setCustomContentHeight(int);
|
||||||
method public android.app.Notification.WearableExtender setCustomSizePreset(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 setDisplayIntent(android.app.PendingIntent);
|
||||||
method public android.app.Notification.WearableExtender setGravity(int);
|
method public android.app.Notification.WearableExtender setGravity(int);
|
||||||
method public android.app.Notification.WearableExtender setHintAmbientBigPicture(boolean);
|
method public android.app.Notification.WearableExtender setHintAmbientBigPicture(boolean);
|
||||||
|
|||||||
@@ -5386,6 +5386,7 @@ package android.app {
|
|||||||
method public boolean getContentIntentAvailableOffline();
|
method public boolean getContentIntentAvailableOffline();
|
||||||
method public int getCustomContentHeight();
|
method public int getCustomContentHeight();
|
||||||
method public int getCustomSizePreset();
|
method public int getCustomSizePreset();
|
||||||
|
method public java.lang.String getDismissalId();
|
||||||
method public android.app.PendingIntent getDisplayIntent();
|
method public android.app.PendingIntent getDisplayIntent();
|
||||||
method public int getGravity();
|
method public int getGravity();
|
||||||
method public boolean getHintAmbientBigPicture();
|
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 setContentIntentAvailableOffline(boolean);
|
||||||
method public android.app.Notification.WearableExtender setCustomContentHeight(int);
|
method public android.app.Notification.WearableExtender setCustomContentHeight(int);
|
||||||
method public android.app.Notification.WearableExtender setCustomSizePreset(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 setDisplayIntent(android.app.PendingIntent);
|
||||||
method public android.app.Notification.WearableExtender setGravity(int);
|
method public android.app.Notification.WearableExtender setGravity(int);
|
||||||
method public android.app.Notification.WearableExtender setHintAmbientBigPicture(boolean);
|
method public android.app.Notification.WearableExtender setHintAmbientBigPicture(boolean);
|
||||||
|
|||||||
@@ -5241,6 +5241,7 @@ package android.app {
|
|||||||
method public boolean getContentIntentAvailableOffline();
|
method public boolean getContentIntentAvailableOffline();
|
||||||
method public int getCustomContentHeight();
|
method public int getCustomContentHeight();
|
||||||
method public int getCustomSizePreset();
|
method public int getCustomSizePreset();
|
||||||
|
method public java.lang.String getDismissalId();
|
||||||
method public android.app.PendingIntent getDisplayIntent();
|
method public android.app.PendingIntent getDisplayIntent();
|
||||||
method public int getGravity();
|
method public int getGravity();
|
||||||
method public boolean getHintAmbientBigPicture();
|
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 setContentIntentAvailableOffline(boolean);
|
||||||
method public android.app.Notification.WearableExtender setCustomContentHeight(int);
|
method public android.app.Notification.WearableExtender setCustomContentHeight(int);
|
||||||
method public android.app.Notification.WearableExtender setCustomSizePreset(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 setDisplayIntent(android.app.PendingIntent);
|
||||||
method public android.app.Notification.WearableExtender setGravity(int);
|
method public android.app.Notification.WearableExtender setGravity(int);
|
||||||
method public android.app.Notification.WearableExtender setHintAmbientBigPicture(boolean);
|
method public android.app.Notification.WearableExtender setHintAmbientBigPicture(boolean);
|
||||||
|
|||||||
@@ -5486,6 +5486,7 @@ public class Notification implements Parcelable
|
|||||||
private static final String KEY_CUSTOM_CONTENT_HEIGHT = "customContentHeight";
|
private static final String KEY_CUSTOM_CONTENT_HEIGHT = "customContentHeight";
|
||||||
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";
|
||||||
|
|
||||||
// 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;
|
||||||
@@ -5514,6 +5515,7 @@ public class Notification implements Parcelable
|
|||||||
private int mCustomContentHeight;
|
private int mCustomContentHeight;
|
||||||
private int mGravity = DEFAULT_GRAVITY;
|
private int mGravity = DEFAULT_GRAVITY;
|
||||||
private int mHintScreenTimeout;
|
private int mHintScreenTimeout;
|
||||||
|
private String mDismissalId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a {@link android.app.Notification.WearableExtender} with default
|
* 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);
|
mCustomContentHeight = wearableBundle.getInt(KEY_CUSTOM_CONTENT_HEIGHT);
|
||||||
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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -5600,6 +5603,9 @@ public class Notification implements Parcelable
|
|||||||
if (mHintScreenTimeout != 0) {
|
if (mHintScreenTimeout != 0) {
|
||||||
wearableBundle.putInt(KEY_HINT_SCREEN_TIMEOUT, mHintScreenTimeout);
|
wearableBundle.putInt(KEY_HINT_SCREEN_TIMEOUT, mHintScreenTimeout);
|
||||||
}
|
}
|
||||||
|
if (mDismissalId != null) {
|
||||||
|
wearableBundle.putString(KEY_DISMISSAL_ID, mDismissalId);
|
||||||
|
}
|
||||||
|
|
||||||
builder.getExtras().putBundle(EXTRA_WEARABLE_EXTENSIONS, wearableBundle);
|
builder.getExtras().putBundle(EXTRA_WEARABLE_EXTENSIONS, wearableBundle);
|
||||||
return builder;
|
return builder;
|
||||||
@@ -5620,6 +5626,7 @@ public class Notification implements Parcelable
|
|||||||
that.mCustomContentHeight = this.mCustomContentHeight;
|
that.mCustomContentHeight = this.mCustomContentHeight;
|
||||||
that.mGravity = this.mGravity;
|
that.mGravity = this.mGravity;
|
||||||
that.mHintScreenTimeout = this.mHintScreenTimeout;
|
that.mHintScreenTimeout = this.mHintScreenTimeout;
|
||||||
|
that.mDismissalId = this.mDismissalId;
|
||||||
return that;
|
return that;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -6107,6 +6114,29 @@ public class Notification implements Parcelable
|
|||||||
return (mFlags & FLAG_HINT_CONTENT_INTENT_LAUNCHES_ACTIVITY) != 0;
|
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) {
|
private void setFlag(int mask, boolean value) {
|
||||||
if (value) {
|
if (value) {
|
||||||
mFlags |= mask;
|
mFlags |= mask;
|
||||||
|
|||||||
Reference in New Issue
Block a user