diff options
author | Joe Onorato <joeo@android.com> | 2010-05-29 17:22:51 -0400 |
---|---|---|
committer | Joe Onorato <joeo@android.com> | 2010-06-02 14:48:46 -0700 |
commit | 75199e3ddcf7886c8ee5fbf8b486a8c21335bf14 (patch) | |
tree | 42164398a816e20fd0659c32cbbcdc972a4c30a0 /services/java/com/android/server | |
parent | b77f53b21c2185ae3ff7c219c384a6db73f8f4e4 (diff) | |
download | frameworks_base-75199e3ddcf7886c8ee5fbf8b486a8c21335bf14.zip frameworks_base-75199e3ddcf7886c8ee5fbf8b486a8c21335bf14.tar.gz frameworks_base-75199e3ddcf7886c8ee5fbf8b486a8c21335bf14.tar.bz2 |
Populate the notifications at startup of SystemUI.apk.
Change-Id: Ie0b3fd9ed4bc9a012791372e6276f0b5908370a5
Diffstat (limited to 'services/java/com/android/server')
-rw-r--r-- | services/java/com/android/server/status/StatusBarManagerService.java | 39 |
1 files changed, 31 insertions, 8 deletions
diff --git a/services/java/com/android/server/status/StatusBarManagerService.java b/services/java/com/android/server/status/StatusBarManagerService.java index 26a41f3..fe26697 100644 --- a/services/java/com/android/server/status/StatusBarManagerService.java +++ b/services/java/com/android/server/status/StatusBarManagerService.java @@ -37,12 +37,13 @@ import com.android.internal.statusbar.IStatusBarService; import com.android.internal.statusbar.StatusBarIcon; import com.android.internal.statusbar.StatusBarIconList; import com.android.internal.statusbar.StatusBarNotification; -import com.android.internal.statusbar.StatusBarNotificationList; import java.io.FileDescriptor; import java.io.PrintWriter; import java.util.ArrayList; import java.util.HashMap; +import java.util.List; +import java.util.Map; /** @@ -62,7 +63,8 @@ public class StatusBarManagerService extends IStatusBarService.Stub NotificationCallbacks mNotificationCallbacks; volatile IStatusBar mBar; StatusBarIconList mIcons = new StatusBarIconList(); - StatusBarNotificationList mNotifications = new StatusBarNotificationList(); + HashMap<IBinder,StatusBarNotification> mNotifications + = new HashMap<IBinder,StatusBarNotification>(); // for disabling the status bar ArrayList<DisableRecord> mDisableRecords = new ArrayList<DisableRecord>(); @@ -250,10 +252,19 @@ public class StatusBarManagerService extends IStatusBarService.Stub // ================================================================================ // Callbacks from the status bar service. // ================================================================================ - public void registerStatusBar(IStatusBar bar, StatusBarIconList iconList) { + public void registerStatusBar(IStatusBar bar, StatusBarIconList iconList, + List<IBinder> notificationKeys, List<StatusBarNotification> notifications) { Slog.i(TAG, "registerStatusBar bar=" + bar); mBar = bar; - iconList.copyFrom(mIcons); + synchronized (mIcons) { + iconList.copyFrom(mIcons); + } + synchronized (mNotifications) { + for (Map.Entry<IBinder,StatusBarNotification> e: mNotifications.entrySet()) { + notificationKeys.add(e.getKey()); + notifications.add(e.getValue()); + } + } } /** @@ -277,8 +288,9 @@ public class StatusBarManagerService extends IStatusBarService.Stub // ================================================================================ public IBinder addNotification(StatusBarNotification notification) { synchronized (mNotifications) { + Slog.d(TAG, "addNotification notification=" + notification); IBinder key = new Binder(); - mNotifications.add(key, notification); + mNotifications.put(key, notification); if (mBar != null) { try { mBar.addNotification(key, notification); @@ -291,7 +303,10 @@ public class StatusBarManagerService extends IStatusBarService.Stub public void updateNotification(IBinder key, StatusBarNotification notification) { synchronized (mNotifications) { - mNotifications.update(key, notification); + if (!mNotifications.containsKey(key)) { + throw new IllegalArgumentException("updateNotification key not found: " + key); + } + mNotifications.put(key, notification); if (mBar != null) { try { mBar.updateNotification(key, notification); @@ -303,7 +318,10 @@ public class StatusBarManagerService extends IStatusBarService.Stub public void removeNotification(IBinder key) { synchronized (mNotifications) { - mNotifications.remove(key); + final StatusBarNotification n = mNotifications.remove(key); + if (n == null) { + throw new IllegalArgumentException("removeNotification key not found: " + key); + } if (mBar != null) { try { mBar.removeNotification(key); @@ -386,7 +404,12 @@ public class StatusBarManagerService extends IStatusBarService.Stub } synchronized (mNotifications) { - mNotifications.dump(pw); + int i=0; + pw.println("Notification list:"); + for (Map.Entry<IBinder,StatusBarNotification> e: mNotifications.entrySet()) { + pw.printf(" %2d: %s\n", i, e.getValue().toString()); + i++; + } } synchronized (mDisableRecords) { |