From 23d7c700324d6ae9a20ddc89617ccc1846f80fc8 Mon Sep 17 00:00:00 2001 From: Daniel Sandler Date: Thu, 7 Mar 2013 16:32:06 -0500 Subject: [PATCH] Accumulate updates to notifications before archiving. By only adding notifications to the archive when they are removed we batch up multiple updates and only store the final version. Some data is lost in this process, but we save tons of memory storing otherwise redundant / uninteresting data (e.g. each step of a download). Change-Id: I008afefc1242bb7c433d45da2c36fcc626dd3706 --- .../java/com/android/server/NotificationManagerService.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/services/java/com/android/server/NotificationManagerService.java b/services/java/com/android/server/NotificationManagerService.java index 1e394d6f9e4c6..9e036d1124ec3 100644 --- a/services/java/com/android/server/NotificationManagerService.java +++ b/services/java/com/android/server/NotificationManagerService.java @@ -1255,9 +1255,6 @@ public class NotificationManagerService extends INotificationManager.Stub sendAccessibilityEvent(notification, pkg); } - // finally, keep some of this information around for later use - mArchive.record(n); - notifyPostedLocked(r); } else { Slog.e(TAG, "Ignoring notification with icon==0: " + notification); @@ -1472,6 +1469,9 @@ public class NotificationManagerService extends INotificationManager.Stub if (mLedNotification == r) { mLedNotification = null; } + + // Save it for users of getHistoricalNotifications() + mArchive.record(r.sbn); } /**