summaryrefslogtreecommitdiffstats
path: root/tests/StatusBar
diff options
context:
space:
mode:
authorDaniel Sandler <dsandler@google.com>2011-02-03 14:51:35 -0500
committerDaniel Sandler <dsandler@google.com>2011-02-03 21:11:46 -0500
commite40451a89dc91dfd636af7cb32a23b4a4cc93fdc (patch)
tree875a847a9a638ce36310887dc7818e02e8cb96dc /tests/StatusBar
parent8275c6087897e8fd614681d1cd12db62e6b9fcd5 (diff)
downloadframeworks_base-e40451a89dc91dfd636af7cb32a23b4a4cc93fdc.zip
frameworks_base-e40451a89dc91dfd636af7cb32a23b4a4cc93fdc.tar.gz
frameworks_base-e40451a89dc91dfd636af7cb32a23b4a4cc93fdc.tar.bz2
Ongoing notification for GPS use.
This change improves upon the notification priority API introduced in change I9e738cc4, allowing privileged clients to set the priority of a notification when posting it directly to INotificationManager. StatusBarTest is updated to test this new feature. The new LocationController in SystemUI uses this facility to post a high-priority ongoing notification whenever GPS is in use (replacing the functionality of the legacy GPS status bar icon). Also happens to fix http://b/3325472 (adding a log message when notifications are dropped because of a missing icon). Bug: 3412807 Change-Id: I523016ffa53bf979be98ddc4a2deb55a6270c68a
Diffstat (limited to 'tests/StatusBar')
-rw-r--r--tests/StatusBar/src/com/android/statusbartest/NotificationTestList.java37
1 files changed, 37 insertions, 0 deletions
diff --git a/tests/StatusBar/src/com/android/statusbartest/NotificationTestList.java b/tests/StatusBar/src/com/android/statusbartest/NotificationTestList.java
index 90c2a1a..f463a19 100644
--- a/tests/StatusBar/src/com/android/statusbartest/NotificationTestList.java
+++ b/tests/StatusBar/src/com/android/statusbartest/NotificationTestList.java
@@ -35,6 +35,10 @@ import android.widget.TextView;
import android.widget.ProgressBar;
import android.os.PowerManager;
+// private NM API
+import android.app.INotificationManager;
+import com.android.internal.statusbar.StatusBarNotification;
+
public class NotificationTestList extends TestActivity
{
private final static String TAG = "NotificationTestList";
@@ -205,6 +209,15 @@ public class NotificationTestList extends TestActivity
}
},
+ new Test("Null Icon #1 (when=now)") {
+ public void run() {
+ Notification n = new Notification(0, null, System.currentTimeMillis());
+ n.setLatestEventInfo(NotificationTestList.this, "Persistent #1",
+ "This is the same notification!!!", makeIntent());
+ mNM.notify(1, n);
+ }
+ },
+
new Test("Bad resource #1 (when=create)") {
public void run() {
Notification n = new Notification(R.drawable.icon2,
@@ -752,6 +765,30 @@ public class NotificationTestList extends TestActivity
}
},
+ new Test("System priority notification") {
+ public void run() {
+ Notification n = new Notification.Builder(NotificationTestList.this)
+ .setSmallIcon(R.drawable.notification1)
+ .setContentTitle("System priority")
+ .setContentText("This should appear before all others")
+ .getNotification();
+
+ int[] idOut = new int[1];
+ try {
+ INotificationManager directLine = mNM.getService();
+ directLine.enqueueNotificationWithTagPriority(
+ getPackageName(),
+ null,
+ 1,
+ StatusBarNotification.PRIORITY_SYSTEM,
+ n,
+ idOut);
+ } catch (android.os.RemoteException ex) {
+ // oh well
+ }
+ }
+ },
+
new Test("Crash") {
public void run()
{