diff options
| author | 2014-05-09 16:35:20 +0000 | |
|---|---|---|
| committer | 2014-05-09 16:35:21 +0000 | |
| commit | 2509be2bb7f00d615e7e8770c713a36fcf8b9ee1 (patch) | |
| tree | 1f15c9f51af4858f3b6c139c4158101e6dcaa689 | |
| parent | 3b2f548b67abc16f0d0042f7c693b084e4a7c395 (diff) | |
| parent | 061dee22df6af640db6f236d0929d6ccf9b455af (diff) | |
Merge "Preserve notification stats on update"
| -rw-r--r-- | services/core/java/com/android/server/notification/NotificationManagerService.java | 4 | ||||
| -rw-r--r-- | services/core/java/com/android/server/notification/NotificationUsageStats.java | 4 |
2 files changed, 5 insertions, 3 deletions
diff --git a/services/core/java/com/android/server/notification/NotificationManagerService.java b/services/core/java/com/android/server/notification/NotificationManagerService.java index fce86e88e3f5..46985874045d 100644 --- a/services/core/java/com/android/server/notification/NotificationManagerService.java +++ b/services/core/java/com/android/server/notification/NotificationManagerService.java @@ -444,7 +444,7 @@ public class NotificationManagerService extends SystemService { public static final class NotificationRecord { final StatusBarNotification sbn; - final SingleNotificationStats stats = new SingleNotificationStats(); + SingleNotificationStats stats; IBinder statusBarKey; NotificationRecord(StatusBarNotification sbn) @@ -1639,7 +1639,7 @@ public class NotificationManagerService extends SystemService { } else { old = mNotificationList.get(index); mNotificationList.set(index, r); - mUsageStats.registerUpdatedByApp(r); + mUsageStats.registerUpdatedByApp(r, old); // Make sure we don't lose the foreground service state. if (old != null) { notification.flags |= diff --git a/services/core/java/com/android/server/notification/NotificationUsageStats.java b/services/core/java/com/android/server/notification/NotificationUsageStats.java index 45ab3d3bd2e5..a60e95b12ac8 100644 --- a/services/core/java/com/android/server/notification/NotificationUsageStats.java +++ b/services/core/java/com/android/server/notification/NotificationUsageStats.java @@ -58,6 +58,7 @@ public class NotificationUsageStats { * Called when a notification has been posted. */ public synchronized void registerPostedByApp(NotificationRecord notification) { + notification.stats = new SingleNotificationStats(); notification.stats.posttimeElapsedMs = SystemClock.elapsedRealtime(); for (AggregatedStats stats : getAggregatedStatsLocked(notification)) { stats.numPostedByApp++; @@ -68,7 +69,8 @@ public class NotificationUsageStats { /** * Called when a notification has been updated. */ - public void registerUpdatedByApp(NotificationRecord notification) { + public void registerUpdatedByApp(NotificationRecord notification, NotificationRecord old) { + notification.stats = old.stats; for (AggregatedStats stats : getAggregatedStatsLocked(notification)) { stats.numUpdatedByApp++; } |