diff --git a/core/res/res/values-watch/config.xml b/core/res/res/values-watch/config.xml index 8d82a176383d6..6052fb0f33ffc 100644 --- a/core/res/res/values-watch/config.xml +++ b/core/res/res/values-watch/config.xml @@ -36,4 +36,8 @@ 8000dp + + 1 + diff --git a/core/res/res/values/config.xml b/core/res/res/values/config.xml index bbc58f5d3da7d..f239cc5997c2f 100644 --- a/core/res/res/values/config.xml +++ b/core/res/res/values/config.xml @@ -605,6 +605,9 @@ 2875 + + 250 + false diff --git a/core/res/res/values/symbols.xml b/core/res/res/values/symbols.xml index 412ae9dd64117..c5b8a5a82054c 100644 --- a/core/res/res/values/symbols.xml +++ b/core/res/res/values/symbols.xml @@ -1511,6 +1511,7 @@ + diff --git a/services/core/java/com/android/server/notification/NotificationManagerService.java b/services/core/java/com/android/server/notification/NotificationManagerService.java index d163a617fa9d4..f8ff038f4c234 100644 --- a/services/core/java/com/android/server/notification/NotificationManagerService.java +++ b/services/core/java/com/android/server/notification/NotificationManagerService.java @@ -177,6 +177,8 @@ public class NotificationManagerService extends SystemService { private AppOpsManager mAppOps; + private Archive mArchive; + // contains connections to all connected listeners, including app services // and system listeners private ArrayList mListeners @@ -277,10 +279,12 @@ public class NotificationManagerService extends SystemService { } private static class Archive { - static final int BUFFER_SIZE = 250; - ArrayDeque mBuffer = new ArrayDeque(BUFFER_SIZE); + final int mBufferSize; + final ArrayDeque mBuffer; - public Archive() { + public Archive(int size) { + mBufferSize = size; + mBuffer = new ArrayDeque(mBufferSize); } public String toString() { @@ -294,7 +298,7 @@ public class NotificationManagerService extends SystemService { } public void record(StatusBarNotification nr) { - if (mBuffer.size() == BUFFER_SIZE) { + if (mBuffer.size() == mBufferSize) { mBuffer.removeFirst(); } @@ -304,7 +308,6 @@ public class NotificationManagerService extends SystemService { mBuffer.addLast(nr.cloneLight()); } - public void clear() { mBuffer.clear(); } @@ -354,7 +357,7 @@ public class NotificationManagerService extends SystemService { } public StatusBarNotification[] getArray(int count) { - if (count == 0) count = Archive.BUFFER_SIZE; + if (count == 0) count = mBufferSize; final StatusBarNotification[] a = new StatusBarNotification[Math.min(count, mBuffer.size())]; Iterator iter = descendingIterator(); @@ -366,7 +369,7 @@ public class NotificationManagerService extends SystemService { } public StatusBarNotification[] getArray(int count, String pkg, int userId) { - if (count == 0) count = Archive.BUFFER_SIZE; + if (count == 0) count = mBufferSize; final StatusBarNotification[] a = new StatusBarNotification[Math.min(count, mBuffer.size())]; Iterator iter = filter(descendingIterator(), pkg, userId); @@ -379,8 +382,6 @@ public class NotificationManagerService extends SystemService { } - Archive mArchive = new Archive(); - private void loadBlockDb() { synchronized(mBlockedPackages) { if (mPolicyFile == null) { @@ -1231,6 +1232,9 @@ public class NotificationManagerService extends SystemService { } } + mArchive = new Archive(resources.getInteger( + R.integer.config_notificationServiceArchiveSize)); + publishBinderService(Context.NOTIFICATION_SERVICE, mService); publishLocalService(NotificationManagerInternal.class, mInternalService); }