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

Commit 2a128746 authored by Julia Reynolds's avatar Julia Reynolds
Browse files

Allow notifications to be autocanceled at a time.

Test: cts
Change-Id: I24ebcab2c0fa2028ec5d2984dc3b7ec19391b590
parent 573c6537
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -5016,6 +5016,7 @@ package android.app {
    method public android.graphics.drawable.Icon getLargeIcon();
    method public android.graphics.drawable.Icon getSmallIcon();
    method public java.lang.String getSortKey();
    method public long getTimeout();
    method public void writeToParcel(android.os.Parcel, int);
    field public static final android.media.AudioAttributes AUDIO_ATTRIBUTES_DEFAULT;
    field public static final java.lang.String CATEGORY_ALARM = "alarm";
@@ -5244,6 +5245,7 @@ package android.app {
    method public android.app.Notification.Builder setSubText(java.lang.CharSequence);
    method public android.app.Notification.Builder setTicker(java.lang.CharSequence);
    method public deprecated android.app.Notification.Builder setTicker(java.lang.CharSequence, android.widget.RemoteViews);
    method public android.app.Notification.Builder setTimeout(long);
    method public android.app.Notification.Builder setUsesChronometer(boolean);
    method public android.app.Notification.Builder setVibrate(long[]);
    method public android.app.Notification.Builder setVisibility(int);
@@ -35873,9 +35875,9 @@ package android.service.notification {
    field public static final int REASON_PACKAGE_SUSPENDED = 14; // 0xe
    field public static final int REASON_PROFILE_TURNED_OFF = 15; // 0xf
    field public static final int REASON_SNOOZED = 18; // 0x12
    field public static final int REASON_TIMEOUT = 19; // 0x13
    field public static final int REASON_UNAUTOBUNDLED = 16; // 0x10
    field public static final int REASON_USER_STOPPED = 6; // 0x6
    field public static final int REASON_USER_SWITCH = 19; // 0x13
    field public static final java.lang.String SERVICE_INTERFACE = "android.service.notification.NotificationListenerService";
    field public static final int SUPPRESSED_EFFECT_SCREEN_OFF = 1; // 0x1
    field public static final int SUPPRESSED_EFFECT_SCREEN_ON = 2; // 0x2
+3 −1
Original line number Diff line number Diff line
@@ -5174,6 +5174,7 @@ package android.app {
    method public static java.lang.Class<? extends android.app.Notification.Style> getNotificationStyleClass(java.lang.String);
    method public android.graphics.drawable.Icon getSmallIcon();
    method public java.lang.String getSortKey();
    method public long getTimeout();
    method public void writeToParcel(android.os.Parcel, int);
    field public static final android.media.AudioAttributes AUDIO_ATTRIBUTES_DEFAULT;
    field public static final java.lang.String CATEGORY_ALARM = "alarm";
@@ -5404,6 +5405,7 @@ package android.app {
    method public android.app.Notification.Builder setSubText(java.lang.CharSequence);
    method public android.app.Notification.Builder setTicker(java.lang.CharSequence);
    method public deprecated android.app.Notification.Builder setTicker(java.lang.CharSequence, android.widget.RemoteViews);
    method public android.app.Notification.Builder setTimeout(long);
    method public android.app.Notification.Builder setUsesChronometer(boolean);
    method public android.app.Notification.Builder setVibrate(long[]);
    method public android.app.Notification.Builder setVisibility(int);
@@ -38861,9 +38863,9 @@ package android.service.notification {
    field public static final int REASON_PACKAGE_SUSPENDED = 14; // 0xe
    field public static final int REASON_PROFILE_TURNED_OFF = 15; // 0xf
    field public static final int REASON_SNOOZED = 18; // 0x12
    field public static final int REASON_TIMEOUT = 19; // 0x13
    field public static final int REASON_UNAUTOBUNDLED = 16; // 0x10
    field public static final int REASON_USER_STOPPED = 6; // 0x6
    field public static final int REASON_USER_SWITCH = 19; // 0x13
    field public static final java.lang.String SERVICE_INTERFACE = "android.service.notification.NotificationListenerService";
    field public static final int SUPPRESSED_EFFECT_SCREEN_OFF = 1; // 0x1
    field public static final int SUPPRESSED_EFFECT_SCREEN_ON = 2; // 0x2
+3 −1
Original line number Diff line number Diff line
@@ -5026,6 +5026,7 @@ package android.app {
    method public android.graphics.drawable.Icon getLargeIcon();
    method public android.graphics.drawable.Icon getSmallIcon();
    method public java.lang.String getSortKey();
    method public long getTimeout();
    method public void writeToParcel(android.os.Parcel, int);
    field public static final android.media.AudioAttributes AUDIO_ATTRIBUTES_DEFAULT;
    field public static final java.lang.String CATEGORY_ALARM = "alarm";
@@ -5254,6 +5255,7 @@ package android.app {
    method public android.app.Notification.Builder setSubText(java.lang.CharSequence);
    method public android.app.Notification.Builder setTicker(java.lang.CharSequence);
    method public deprecated android.app.Notification.Builder setTicker(java.lang.CharSequence, android.widget.RemoteViews);
    method public android.app.Notification.Builder setTimeout(long);
    method public android.app.Notification.Builder setUsesChronometer(boolean);
    method public android.app.Notification.Builder setVibrate(long[]);
    method public android.app.Notification.Builder setVisibility(int);
@@ -35994,9 +35996,9 @@ package android.service.notification {
    field public static final int REASON_PACKAGE_SUSPENDED = 14; // 0xe
    field public static final int REASON_PROFILE_TURNED_OFF = 15; // 0xf
    field public static final int REASON_SNOOZED = 18; // 0x12
    field public static final int REASON_TIMEOUT = 19; // 0x13
    field public static final int REASON_UNAUTOBUNDLED = 16; // 0x10
    field public static final int REASON_USER_STOPPED = 6; // 0x6
    field public static final int REASON_USER_SWITCH = 19; // 0x13
    field public static final java.lang.String SERVICE_INTERFACE = "android.service.notification.NotificationListenerService";
    field public static final int SUPPRESSED_EFFECT_SCREEN_OFF = 1; // 0x1
    field public static final int SUPPRESSED_EFFECT_SCREEN_ON = 2; // 0x2
+20 −0
Original line number Diff line number Diff line
@@ -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);
    }

    /**
@@ -2324,6 +2328,13 @@ public class Notification implements Parcelable
        return mChannelId;
    }

    /**
     * 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.
     *
@@ -2531,6 +2542,15 @@ public class Notification implements Parcelable
            return this;
        }

        /**
         * 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).
         *
+2 −2
Original line number Diff line number Diff line
@@ -183,8 +183,8 @@ public abstract class NotificationListenerService extends Service {
    public static final int REASON_CHANNEL_BANNED = 17;
    /** Notification was snoozed. */
    public static final int REASON_SNOOZED = 18;
    /** Notification no longer visible because of user switch */
    public static final int REASON_USER_SWITCH = 19;
    /** Notification was canceled due to timeout */
    public static final int REASON_TIMEOUT = 19;

    /**
     * The full trim of the StatusBarNotification including all its features.
Loading