From 2dbd36fc7f9341ecef51c2ed96a0f21b046f5a8d Mon Sep 17 00:00:00 2001 From: Justin Koh Date: Wed, 4 Jun 2014 13:57:49 -0700 Subject: [PATCH] Add check to allow notification listener packages to post >50 notifications Bug: 13433398 Change-Id: I77abf19982add240e1bbe8196fbe148d32884f68 --- .../server/notification/NotificationManagerService.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/services/core/java/com/android/server/notification/NotificationManagerService.java b/services/core/java/com/android/server/notification/NotificationManagerService.java index b708c16edb70e..d163a617fa9d4 100644 --- a/services/core/java/com/android/server/notification/NotificationManagerService.java +++ b/services/core/java/com/android/server/notification/NotificationManagerService.java @@ -1729,14 +1729,15 @@ public class NotificationManagerService extends SystemService { } checkCallerIsSystemOrSameApp(pkg); final boolean isSystemNotification = isUidSystem(callingUid) || ("android".equals(pkg)); + final boolean isNotificationFromListener = mEnabledListenerPackageNames.contains(pkg); final int userId = ActivityManager.handleIncomingUser(callingPid, callingUid, incomingUserId, true, false, "enqueueNotification", pkg); final UserHandle user = new UserHandle(userId); // Limit the number of notifications that any given package except the android - // package can enqueue. Prevents DOS attacks and deals with leaks. - if (!isSystemNotification) { + // package or a registered listener can enqueue. Prevents DOS attacks and deals with leaks. + if (!isSystemNotification && !isNotificationFromListener) { synchronized (mNotificationList) { int count = 0; final int N = mNotificationList.size();