summaryrefslogtreecommitdiffstats
path: root/tests/StatusBar
diff options
context:
space:
mode:
authorDaniel Sandler <dsandler@android.com>2012-02-13 21:04:12 -0500
committerDaniel Sandler <dsandler@android.com>2012-02-24 13:47:00 -0500
commit2561b0b10a55841a08e0e1d467e73e10b1bf256d (patch)
tree707a5812a2d6a711838babe41fd4947b96f13649 /tests/StatusBar
parentc725a3705ba8646e134091981e84da99fe4076b1 (diff)
downloadframeworks_base-2561b0b10a55841a08e0e1d467e73e10b1bf256d.zip
frameworks_base-2561b0b10a55841a08e0e1d467e73e10b1bf256d.tar.gz
frameworks_base-2561b0b10a55841a08e0e1d467e73e10b1bf256d.tar.bz2
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
Diffstat (limited to 'tests/StatusBar')
-rw-r--r--tests/StatusBar/src/com/android/statusbartest/NotificationTestList.java58
1 files changed, 53 insertions, 5 deletions
diff --git a/tests/StatusBar/src/com/android/statusbartest/NotificationTestList.java b/tests/StatusBar/src/com/android/statusbartest/NotificationTestList.java
index f463a19..ae01c75 100644
--- a/tests/StatusBar/src/com/android/statusbartest/NotificationTestList.java
+++ b/tests/StatusBar/src/com/android/statusbartest/NotificationTestList.java
@@ -765,22 +765,70 @@ public class NotificationTestList extends TestActivity
}
},
- new Test("System priority notification") {
+ new Test("PRIORITY_HIGH") {
public void run() {
Notification n = new Notification.Builder(NotificationTestList.this)
- .setSmallIcon(R.drawable.notification1)
- .setContentTitle("System priority")
+ .setSmallIcon(R.drawable.notification5)
+ .setContentTitle("High priority")
.setContentText("This should appear before all others")
+ .setPriority(Notification.PRIORITY_HIGH)
.getNotification();
int[] idOut = new int[1];
try {
INotificationManager directLine = mNM.getService();
- directLine.enqueueNotificationWithTagPriority(
+ directLine.enqueueNotificationWithTag(
+ getPackageName(),
+ null,
+ 100,
+ n,
+ idOut);
+ } catch (android.os.RemoteException ex) {
+ // oh well
+ }
+ }
+ },
+
+ new Test("PRIORITY_MAX") {
+ public void run() {
+ Notification n = new Notification.Builder(NotificationTestList.this)
+ .setSmallIcon(R.drawable.notification9)
+ .setContentTitle("MAX priority")
+ .setContentText("This might appear as an intruder alert")
+ .setPriority(Notification.PRIORITY_MAX)
+ .getNotification();
+
+ int[] idOut = new int[1];
+ try {
+ INotificationManager directLine = mNM.getService();
+ directLine.enqueueNotificationWithTag(
+ getPackageName(),
+ null,
+ 200,
+ n,
+ idOut);
+ } catch (android.os.RemoteException ex) {
+ // oh well
+ }
+ }
+ },
+
+ new Test("PRIORITY_MIN") {
+ public void run() {
+ Notification n = new Notification.Builder(NotificationTestList.this)
+ .setSmallIcon(R.drawable.notification0)
+ .setContentTitle("MIN priority")
+ .setContentText("You should not see this")
+ .setPriority(Notification.PRIORITY_MIN)
+ .getNotification();
+
+ int[] idOut = new int[1];
+ try {
+ INotificationManager directLine = mNM.getService();
+ directLine.enqueueNotificationWithTag(
getPackageName(),
null,
1,
- StatusBarNotification.PRIORITY_SYSTEM,
n,
idOut);
} catch (android.os.RemoteException ex) {