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

Commit 2561b0b1 authored by Daniel Sandler's avatar Daniel Sandler
Browse files

New notification priority and related APIs.

This change introduces a few new bits of data on
Notification that will help the Notification Manager and
System UI route and display them more intelligently:

 -> priority: an integer in a predefined range that
    indicates the app's best guess as to the relative
    importance (to the user, right now) of that information

 -> kind: a tag (really, set of tags) indicating the general
    type of notification (realtime, asynchronous, etc)

 -> extras: a Bundle of additional key/value pairs
    associated with this notification (currently @hidden)

The notification manager takes these data into account when
assigning to each notification a score which is passed with
the notification on to the system UI, where it can be used to
affect presentation. For example:

  - Spammy apps (identified explicitly by the user or by
    some other means) will have their notifications scored
    very negatively by the notification manager, allowing
    the UI to suppress them
  - Notifications of higher score might be shown larger
    or in a different way
  - Very important notifications (indicated by a very high
    score) might interrupt the user during an otherwise
    important task (videochat, game, etc)

Implementation note: This replaces/extends the old internal
notion of "priority", which was mostly used to organize
ongoings and system notifications at the top of the panel.

Change-Id: Ie063dc75f198a68e2b5734a3aa0cacb5aba1ac39
parent c725a370
Loading
Loading
Loading
Loading
+15 −1
Original line number Diff line number Diff line
@@ -3626,12 +3626,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;
@@ -3642,11 +3652,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;
@@ -3656,6 +3668,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);
@@ -3671,6 +3684,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);
}
Loading