diff options
author | Daniel Sandler <dsandler@android.com> | 2013-04-23 00:53:31 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2013-04-23 00:53:31 +0000 |
commit | f78ff07f6e688d11881658f743ef63076fcc550c (patch) | |
tree | 25c8879879a1707215db8fdd57b0a6a633c48e2a /services/java/com/android/server/NotificationManagerService.java | |
parent | d52f2b14852c057fd8d94cebb7ddf8900ba1d232 (diff) | |
parent | 1a497d3a2b1496c12949e47e55f8e46d8f585be5 (diff) |
Merge "Fix concurrency issues when parceling StatusBarNotifications." into jb-mr2-dev
Diffstat (limited to 'services/java/com/android/server/NotificationManagerService.java')
-rw-r--r-- | services/java/com/android/server/NotificationManagerService.java | 23 |
1 files changed, 10 insertions, 13 deletions
diff --git a/services/java/com/android/server/NotificationManagerService.java b/services/java/com/android/server/NotificationManagerService.java index 9a93f637e072..f0257ffe276d 100644 --- a/services/java/com/android/server/NotificationManagerService.java +++ b/services/java/com/android/server/NotificationManagerService.java @@ -237,7 +237,7 @@ public class NotificationManagerService extends INotificationManager.Stub try { listener.onNotificationPosted(sbn); } catch (RemoteException ex) { - // not there? + Log.e(TAG, "unable to notify listener (posted): " + listener, ex); } } @@ -246,7 +246,7 @@ public class NotificationManagerService extends INotificationManager.Stub try { listener.onNotificationRemoved(sbn); } catch (RemoteException ex) { - // not there? + Log.e(TAG, "unable to notify listener (removed): " + listener, ex); } } @@ -285,14 +285,7 @@ public class NotificationManagerService extends INotificationManager.Stub public void record(StatusBarNotification nr) { // Nuke heavy parts of notification before storing in archive - nr.notification.tickerView = null; - nr.notification.contentView = null; - nr.notification.bigContentView = null; - nr.notification.largeIcon = null; - final Bundle extras = nr.notification.extras; - extras.remove(Notification.EXTRA_LARGE_ICON); - extras.remove(Notification.EXTRA_LARGE_ICON_BIG); - extras.remove(Notification.EXTRA_PICTURE); + nr.notification.lightenPayload(); if (mBuffer.size() == BUFFER_SIZE) { mBuffer.removeFirst(); @@ -746,7 +739,8 @@ public class NotificationManagerService extends INotificationManager.Stub * asynchronously notify all listeners about a new notification */ private void notifyPostedLocked(NotificationRecord n) { - final StatusBarNotification sbn = n.sbn; + // make a copy in case changes are made to the underlying Notification object + final StatusBarNotification sbn = n.sbn.clone(); for (final NotificationListenerInfo info : mListeners) { mHandler.post(new Runnable() { @Override @@ -760,12 +754,15 @@ public class NotificationManagerService extends INotificationManager.Stub * asynchronously notify all listeners about a removed notification */ private void notifyRemovedLocked(NotificationRecord n) { - final StatusBarNotification sbn = n.sbn; + // make a copy in case changes are made to the underlying Notification object + // NOTE: this copy is lightweight: it doesn't include heavyweight parts of the notification + final StatusBarNotification sbn_light = n.sbn.cloneLight(); + for (final NotificationListenerInfo info : mListeners) { mHandler.post(new Runnable() { @Override public void run() { - info.notifyRemovedIfUserMatch(sbn); + info.notifyRemovedIfUserMatch(sbn_light); }}); } } |