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

Commit 3f0c58eb authored by Daniel Sandler's avatar Daniel Sandler Committed by Android (Google) Code Review
Browse files

Merge "New notification priority and related APIs."

parents 525ece40 2561b0b1
Loading
Loading
Loading
Loading
+15 −1
Original line number Diff line number Diff line
@@ -3631,12 +3631,22 @@ package android.app {
    field public static final int DEFAULT_VIBRATE = 2; // 0x2
    field public static final int FLAG_AUTO_CANCEL = 16; // 0x10
    field public static final int FLAG_FOREGROUND_SERVICE = 64; // 0x40
    field public static final int FLAG_HIGH_PRIORITY = 128; // 0x80
    field public static final deprecated int FLAG_HIGH_PRIORITY = 128; // 0x80
    field public static final int FLAG_INSISTENT = 4; // 0x4
    field public static final int FLAG_NO_CLEAR = 32; // 0x20
    field public static final int FLAG_ONGOING_EVENT = 2; // 0x2
    field public static final int FLAG_ONLY_ALERT_ONCE = 8; // 0x8
    field public static final int FLAG_SHOW_LIGHTS = 1; // 0x1
    field public static final java.lang.String KIND_CALL = "android.call";
    field public static final java.lang.String KIND_EMAIL = "android.email";
    field public static final java.lang.String KIND_EVENT = "android.event";
    field public static final java.lang.String KIND_MESSAGE = "android.message";
    field public static final java.lang.String KIND_PROMO = "android.promo";
    field public static final int PRIORITY_DEFAULT = 0; // 0x0
    field public static final int PRIORITY_HIGH = 1; // 0x1
    field public static final int PRIORITY_LOW = -1; // 0xffffffff
    field public static final int PRIORITY_MAX = 2; // 0x2
    field public static final int PRIORITY_MIN = -2; // 0xfffffffe
    field public static final int STREAM_DEFAULT = -1; // 0xffffffff
    field public int audioStreamType;
    field public android.app.PendingIntent contentIntent;
@@ -3647,11 +3657,13 @@ package android.app {
    field public android.app.PendingIntent fullScreenIntent;
    field public int icon;
    field public int iconLevel;
    field public java.lang.String[] kind;
    field public android.graphics.Bitmap largeIcon;
    field public int ledARGB;
    field public int ledOffMS;
    field public int ledOnMS;
    field public int number;
    field public int priority;
    field public android.net.Uri sound;
    field public java.lang.CharSequence tickerText;
    field public android.widget.RemoteViews tickerView;
@@ -3661,6 +3673,7 @@ package android.app {
  public static class Notification.Builder {
    ctor public Notification.Builder(android.content.Context);
    method public android.app.Notification.Builder addKind(java.lang.String);
    method public android.app.Notification getNotification();
    method public android.app.Notification.Builder setAutoCancel(boolean);
    method public android.app.Notification.Builder setContent(android.widget.RemoteViews);
@@ -3676,6 +3689,7 @@ package android.app {
    method public android.app.Notification.Builder setNumber(int);
    method public android.app.Notification.Builder setOngoing(boolean);
    method public android.app.Notification.Builder setOnlyAlertOnce(boolean);
    method public android.app.Notification.Builder setPriority(int);
    method public android.app.Notification.Builder setProgress(int, int, boolean);
    method public android.app.Notification.Builder setSmallIcon(int);
    method public android.app.Notification.Builder setSmallIcon(int, int);
+0 −1
Original line number Diff line number Diff line
@@ -33,7 +33,6 @@ interface INotificationManager
    void enqueueToast(String pkg, ITransientNotification callback, int duration);
    void cancelToast(String pkg, ITransientNotification callback);
    void enqueueNotificationWithTag(String pkg, String tag, int id, in Notification notification, inout int[] idReceived);
    void enqueueNotificationWithTagPriority(String pkg, String tag, int id, int priority, in Notification notification, inout int[] idReceived);
    void cancelNotificationWithTag(String pkg, String tag, int id);
}
+387 −106

File changed.

Preview size limit exceeded, changes collapsed.

+12 −15
Original line number Diff line number Diff line
@@ -34,25 +34,23 @@ if (truncatedTicker != null && truncatedTicker.length() > maxTickerLen) {
}
*/

/**
 * Class encapsulating a Notification. Sent by the NotificationManagerService to the IStatusBar (in System UI).
 */
public class StatusBarNotification implements Parcelable {
    public static int PRIORITY_JIFFY_EXPRESS = -100;
    public static int PRIORITY_NORMAL        = 0;
    public static int PRIORITY_ONGOING       = 100;
    public static int PRIORITY_SYSTEM        = 200;

    public String pkg;
    public int id;
    public String tag;
    public int uid;
    public int initialPid;
    public Notification notification;
    public int priority = PRIORITY_NORMAL;
    public int score;
    
    public StatusBarNotification() {
    }

    public StatusBarNotification(String pkg, int id, String tag,
            int uid, int initialPid, Notification notification) {
            int uid, int initialPid, int score, Notification notification) {
        if (pkg == null) throw new NullPointerException();
        if (notification == null) throw new NullPointerException();

@@ -61,9 +59,8 @@ public class StatusBarNotification implements Parcelable {
        this.tag = tag;
        this.uid = uid;
        this.initialPid = initialPid;
        this.score = score;
        this.notification = notification;

        this.priority = PRIORITY_NORMAL;
    }

    public StatusBarNotification(Parcel in) {
@@ -80,7 +77,7 @@ public class StatusBarNotification implements Parcelable {
        }
        this.uid = in.readInt();
        this.initialPid = in.readInt();
        this.priority = in.readInt();
        this.score = in.readInt();
        this.notification = new Notification(in);
    }

@@ -95,7 +92,7 @@ public class StatusBarNotification implements Parcelable {
        }
        out.writeInt(this.uid);
        out.writeInt(this.initialPid);
        out.writeInt(this.priority);
        out.writeInt(this.score);
        this.notification.writeToParcel(out, flags);
    }

@@ -119,12 +116,12 @@ public class StatusBarNotification implements Parcelable {

    public StatusBarNotification clone() {
        return new StatusBarNotification(this.pkg, this.id, this.tag,
                this.uid, this.initialPid, this.notification.clone());
                this.uid, this.initialPid, this.score, this.notification.clone());
    }

    public String toString() {
        return "StatusBarNotification(package=" + pkg + " id=" + id + " tag=" + tag
                + " notification=" + notification + " priority=" + priority + ")";
        return "StatusBarNotification(pkg=" + pkg + " id=" + id + " tag=" + tag
                + " score=" + score + " notn=" + notification + ")";
    }

    public boolean isOngoing() {
+4 −3
Original line number Diff line number Diff line
@@ -47,12 +47,13 @@ public class NotificationData {
    }
    private final ArrayList<Entry> mEntries = new ArrayList<Entry>();
    private final Comparator<Entry> mEntryCmp = new Comparator<Entry>() {
        // sort first by score, then by when
        public int compare(Entry a, Entry b) {
            final StatusBarNotification na = a.notification;
            final StatusBarNotification nb = b.notification;
            int priDiff = na.priority - nb.priority;
            return (priDiff != 0)
                ? priDiff
            int d = na.score - nb.score;
            return (d != 0)
                ? d
                : (int)(na.notification.when - nb.notification.when);
        }
    };
Loading