diff options
author | Joe Onorato <joeo@android.com> | 2010-06-04 16:08:02 -0400 |
---|---|---|
committer | Joe Onorato <joeo@android.com> | 2010-06-09 09:15:25 -0700 |
commit | 005847b03b2ebe3eb1a974a8a04ad51bca6636cd (patch) | |
tree | 1664f30f2320bddcf44b0af581b492589a38fcda /tests | |
parent | d956ae8b813da893ab6a9357acfe287c529d6ac2 (diff) | |
download | frameworks_base-005847b03b2ebe3eb1a974a8a04ad51bca6636cd.zip frameworks_base-005847b03b2ebe3eb1a974a8a04ad51bca6636cd.tar.gz frameworks_base-005847b03b2ebe3eb1a974a8a04ad51bca6636cd.tar.bz2 |
Handle errors inflating notifications (and their icons).
On an inflation error, the StatusBarService cleans up, removes / doesn't add
the views, and calls into the StatusBarManagerService, which tells the
NotificationManagerService to remove the notification.
That then calls all the way back into the StatusBarService, but I think being
extra careful is okay. Throughout the status bar, it's all keyed off of the
IBinder key, so if the app comes in with a good notification while we're
cleaning up, we won't lose the new notification or anything like that.
Change-Id: Iea78a637495a8b67810c214b951d5ddb93becacb
Diffstat (limited to 'tests')
-rw-r--r-- | tests/StatusBar/src/com/android/statusbartest/NotificationTestList.java | 50 |
1 files changed, 35 insertions, 15 deletions
diff --git a/tests/StatusBar/src/com/android/statusbartest/NotificationTestList.java b/tests/StatusBar/src/com/android/statusbartest/NotificationTestList.java index f96a079..4d071e3 100644 --- a/tests/StatusBar/src/com/android/statusbartest/NotificationTestList.java +++ b/tests/StatusBar/src/com/android/statusbartest/NotificationTestList.java @@ -123,29 +123,49 @@ public class NotificationTestList extends TestActivity } }, - new Test("Bad Icon") { + new Test("Bad Icon #1 (when=create)") { public void run() { - mNM.notify(1, new Notification(NotificationTestList.this, - R.layout.chrono_notification, /* not a drawable! */ - null, System.currentTimeMillis()-(1000*60*60*24), - "(453) 123-2328", - "", null)); + Notification n = new Notification(R.layout.chrono_notification /* not an icon */, + null, mActivityCreateTime); + n.setLatestEventInfo(NotificationTestList.this, "Persistent #1", + "This is the same notification!!!", makeIntent()); + mNM.notify(1, n); } }, - new Test("Bad resource #2") { - public void run() - { - Notification n = new Notification(NotificationTestList.this, - R.drawable.ic_statusbar_missedcall, - null, System.currentTimeMillis()-(1000*60*60*24), - "(453) 123-2328", - "", null); + new Test("Bad Icon #1 (when=now)") { + public void run() { + Notification n = new Notification(R.layout.chrono_notification /* not an icon */, + 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, + null, mActivityCreateTime); + n.setLatestEventInfo(NotificationTestList.this, "Persistent #1", + "This is the same notification!!!", makeIntent()); n.contentView.setInt(1 /*bogus*/, "bogus method", 666); - mNM.notify(2, n); + mNM.notify(1, n); } }, + new Test("Bad resource #1 (when=now)") { + public void run() { + Notification n = new Notification(R.drawable.icon2, + null, System.currentTimeMillis()); + n.setLatestEventInfo(NotificationTestList.this, "Persistent #1", + "This is the same notification!!!", makeIntent()); + n.contentView.setInt(1 /*bogus*/, "bogus method", 666); + mNM.notify(1, n); + } + }, + + new Test("Bad resource #3") { public void run() { |