diff options
author | Daniel Sandler <dsandler@android.com> | 2013-04-15 21:55:15 -0700 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2013-04-15 21:55:15 -0700 |
commit | 1a0f755971b92c6c2322eeb03841dee062b7e01a (patch) | |
tree | 08fb0ba2f160697693436ac08bf5e35e89d6959f /services/java | |
parent | 7c3d3f8b627d20503301c4216bdbbf70f07c530b (diff) | |
parent | 0a8ed3f214ad9d4cd173cbffe6e712c395a108f6 (diff) | |
download | frameworks_base-1a0f755971b92c6c2322eeb03841dee062b7e01a.zip frameworks_base-1a0f755971b92c6c2322eeb03841dee062b7e01a.tar.gz frameworks_base-1a0f755971b92c6c2322eeb03841dee062b7e01a.tar.bz2 |
am 0a8ed3f2: am 4b6d23d7: Merge "Further reduce memory usage of notification archive." into jb-mr2-dev
* commit '0a8ed3f214ad9d4cd173cbffe6e712c395a108f6':
Further reduce memory usage of notification archive.
Diffstat (limited to 'services/java')
-rw-r--r-- | services/java/com/android/server/NotificationManagerService.java | 29 |
1 files changed, 28 insertions, 1 deletions
diff --git a/services/java/com/android/server/NotificationManagerService.java b/services/java/com/android/server/NotificationManagerService.java index 97120bf..fa18e76 100644 --- a/services/java/com/android/server/NotificationManagerService.java +++ b/services/java/com/android/server/NotificationManagerService.java @@ -49,6 +49,7 @@ import android.media.IAudioService; import android.media.IRingtonePlayer; import android.net.Uri; import android.os.Binder; +import android.os.Bundle; import android.os.Handler; import android.os.IBinder; import android.os.Message; @@ -266,18 +267,32 @@ public class NotificationManagerService extends INotificationManager.Stub } private static class Archive { - static final int BUFFER_SIZE = 1000; + static final int BUFFER_SIZE = 250; ArrayDeque<StatusBarNotification> mBuffer = new ArrayDeque<StatusBarNotification>(BUFFER_SIZE); public Archive() { } + public String toString() { + final StringBuilder sb = new StringBuilder(); + final int N = mBuffer.size(); + sb.append("Archive ("); + sb.append(N); + sb.append(" notification"); + sb.append((N==1)?")":"s)"); + return sb.toString(); + } + 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); if (mBuffer.size() == BUFFER_SIZE) { mBuffer.removeFirst(); @@ -285,6 +300,7 @@ public class NotificationManagerService extends INotificationManager.Stub mBuffer.addLast(nr); } + public void clear() { mBuffer.clear(); } @@ -2131,6 +2147,17 @@ public class NotificationManagerService extends INotificationManager.Stub pw.println(" mVibrateNotification=" + mVibrateNotification); pw.println(" mDisabledNotifications=0x" + Integer.toHexString(mDisabledNotifications)); pw.println(" mSystemReady=" + mSystemReady); + pw.println(" mArchive=" + mArchive.toString()); + Iterator<StatusBarNotification> iter = mArchive.descendingIterator(); + int i=0; + while (iter.hasNext()) { + pw.println(" " + iter.next()); + if (++i >= 5) { + if (iter.hasNext()) pw.println(" ..."); + break; + } + } + } } } |