resolved conflicts for merge of 579ace03 to master

Change-Id: I461879359824036ec861ad9b5b8804ae814179a9
This commit is contained in:
Kenny Root
2014-06-11 14:31:56 -07:00
4 changed files with 21 additions and 9 deletions

View File

@@ -36,4 +36,8 @@
<!-- Maximum velocity to initiate a fling, as measured in dips per second. -->
<dimen name="config_viewMaxFlingVelocity">8000dp</dimen>
<!-- Number of notifications to keep in the notification service historical archive.
Reduced intentionally for watches to retain minimal memory footprint -->
<integer name="config_notificationServiceArchiveSize">1</integer>
</resources>

View File

@@ -627,6 +627,9 @@
<!-- Default value for LED off time when the battery is low on charge in miliseconds -->
<integer name="config_notificationsBatteryLedOff">2875</integer>
<!-- Number of notifications to keep in the notification service historical archive -->
<integer name="config_notificationServiceArchiveSize">250</integer>
<!-- Allow the menu hard key to be disabled in LockScreen on some devices -->
<bool name="config_disableMenuKeyInLockScreen">false</bool>

View File

@@ -1518,6 +1518,7 @@
<java-symbol type="integer" name="config_notificationsBatteryLedOn" />
<java-symbol type="integer" name="config_notificationsBatteryLowARGB" />
<java-symbol type="integer" name="config_notificationsBatteryMediumARGB" />
<java-symbol type="integer" name="config_notificationServiceArchiveSize" />
<java-symbol type="integer" name="config_radioScanningTimeout" />
<java-symbol type="integer" name="config_screenBrightnessSettingMinimum" />
<java-symbol type="integer" name="config_screenBrightnessSettingMaximum" />

View File

@@ -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<String> mBlockedPackages = new HashSet<String>();
@@ -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<StatusBarNotification> mBuffer = new ArrayDeque<StatusBarNotification>(BUFFER_SIZE);
final int mBufferSize;
final ArrayDeque<StatusBarNotification> mBuffer;
public Archive() {
public Archive(int size) {
mBufferSize = size;
mBuffer = new ArrayDeque<StatusBarNotification>(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<StatusBarNotification> 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<StatusBarNotification> 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);
}