diff options
Diffstat (limited to 'core/java/android/app/Notification.java')
| -rw-r--r-- | core/java/android/app/Notification.java | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/core/java/android/app/Notification.java b/core/java/android/app/Notification.java index 82917d27d0d6..4172ed7e57ea 100644 --- a/core/java/android/app/Notification.java +++ b/core/java/android/app/Notification.java @@ -1022,6 +1022,7 @@ public class Notification implements Parcelable private Icon mLargeIcon; private String mChannelId; + private long mTimeout; /** * Structure to encapsulate a named action that can be shown as part of this notification. @@ -1766,6 +1767,7 @@ public class Notification implements Parcelable if (parcel.readInt() != 0) { mChannelId = parcel.readString(); } + mTimeout = parcel.readLong(); } @Override @@ -1872,6 +1874,7 @@ public class Notification implements Parcelable that.color = this.color; that.mChannelId = this.mChannelId; + that.mTimeout = this.mTimeout; if (!heavy) { that.lightenPayload(); // will clean out extras @@ -2128,6 +2131,7 @@ public class Notification implements Parcelable } else { parcel.writeInt(0); } + parcel.writeLong(mTimeout); } /** @@ -2325,6 +2329,13 @@ public class Notification implements Parcelable } /** + * Returns the time at which this notification should be canceled, if it's not canceled already. + */ + public long getTimeout() { + return mTimeout; + } + + /** * The small icon representing this notification in the status bar and content view. * * @return the small icon representing this notification. @@ -2532,6 +2543,15 @@ public class Notification implements Parcelable } /** + * Specifies the time at which this notification should be canceled, if it is not already + * canceled. + */ + public Builder setTimeout(long when) { + mN.mTimeout = when; + return this; + } + + /** * Add a timestamp pertaining to the notification (usually the time the event occurred). * * For apps targeting {@link android.os.Build.VERSION_CODES#N} and above, this time is not |
