OSDN Git Service

NoManService: More efficient notification update
authorChristoph Studer <chstuder@google.com>
Wed, 2 Apr 2014 22:02:39 +0000 (00:02 +0200)
committerChristoph Studer <chstuder@google.com>
Mon, 7 Apr 2014 18:49:05 +0000 (14:49 -0400)
Instead of removing the old notification and inserting the
updated notification afterwards, replace the old notification
in-place.

Change-Id: I88962fd2452de191c1d63c142719194282568dcc

services/core/java/com/android/server/notification/NotificationManagerService.java

index 3b6d288..663501d 100644 (file)
@@ -1915,8 +1915,8 @@ public class NotificationManagerService extends SystemService {
                         mNotificationList.add(r);
                         mUsageStats.registerPostedByApp(r);
                     } else {
-                        old = mNotificationList.remove(index);
-                        mNotificationList.add(index, r);
+                        old = mNotificationList.get(index);
+                        mNotificationList.set(index, r);
                         mUsageStats.registerUpdatedByApp(r);
                         // Make sure we don't lose the foreground service state.
                         if (old != null) {