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 9716f0c5f2b03..0bd12d6652954 100644
--- a/core/res/res/values/config.xml
+++ b/core/res/res/values/config.xml
@@ -627,6 +627,9 @@
2875
+
+ 250
+
false
diff --git a/core/res/res/values/symbols.xml b/core/res/res/values/symbols.xml
index 2ea742183d201..088717056f7bc 100644
--- a/core/res/res/values/symbols.xml
+++ b/core/res/res/values/symbols.xml
@@ -1518,6 +1518,7 @@
+
diff --git a/services/core/java/com/android/server/notification/NotificationManagerService.java b/services/core/java/com/android/server/notification/NotificationManagerService.java
index 386402b83ed98..06732caef530c 100644
--- a/services/core/java/com/android/server/notification/NotificationManagerService.java
+++ b/services/core/java/com/android/server/notification/NotificationManagerService.java
@@ -188,6 +188,8 @@ public class NotificationManagerService extends SystemService {
private AppOpsManager mAppOps;
+ private Archive mArchive;
+
// Notification control database. For now just contains disabled packages.
private AtomicFile mPolicyFile;
private HashSet mBlockedPackages = new HashSet();
@@ -223,10 +225,12 @@ public class NotificationManagerService extends SystemService {
private static final int REASON_LISTENER_CANCEL_ALL = 11;
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() {
@@ -240,7 +244,7 @@ public class NotificationManagerService extends SystemService {
}
public void record(StatusBarNotification nr) {
- if (mBuffer.size() == BUFFER_SIZE) {
+ if (mBuffer.size() == mBufferSize) {
mBuffer.removeFirst();
}
@@ -250,7 +254,6 @@ public class NotificationManagerService extends SystemService {
mBuffer.addLast(nr.cloneLight());
}
-
public void clear() {
mBuffer.clear();
}
@@ -300,7 +303,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();
@@ -312,7 +315,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);
@@ -325,8 +328,6 @@ public class NotificationManagerService extends SystemService {
}
- Archive mArchive = new Archive();
-
private void loadPolicyFile() {
synchronized(mPolicyFile) {
mBlockedPackages.clear();
@@ -854,6 +855,9 @@ public class NotificationManagerService extends SystemService {
}
}
+ mArchive = new Archive(resources.getInteger(
+ R.integer.config_notificationServiceArchiveSize));
+
publishBinderService(Context.NOTIFICATION_SERVICE, mService);
publishLocalService(NotificationManagerInternal.class, mInternalService);
}