Merge "Add check to allow notification listener packages to post >50 notifications" into klp-modular-dev
This commit is contained in:
@@ -1729,14 +1729,15 @@ public class NotificationManagerService extends SystemService {
|
|||||||
}
|
}
|
||||||
checkCallerIsSystemOrSameApp(pkg);
|
checkCallerIsSystemOrSameApp(pkg);
|
||||||
final boolean isSystemNotification = isUidSystem(callingUid) || ("android".equals(pkg));
|
final boolean isSystemNotification = isUidSystem(callingUid) || ("android".equals(pkg));
|
||||||
|
final boolean isNotificationFromListener = mEnabledListenerPackageNames.contains(pkg);
|
||||||
|
|
||||||
final int userId = ActivityManager.handleIncomingUser(callingPid,
|
final int userId = ActivityManager.handleIncomingUser(callingPid,
|
||||||
callingUid, incomingUserId, true, false, "enqueueNotification", pkg);
|
callingUid, incomingUserId, true, false, "enqueueNotification", pkg);
|
||||||
final UserHandle user = new UserHandle(userId);
|
final UserHandle user = new UserHandle(userId);
|
||||||
|
|
||||||
// Limit the number of notifications that any given package except the android
|
// Limit the number of notifications that any given package except the android
|
||||||
// package can enqueue. Prevents DOS attacks and deals with leaks.
|
// package or a registered listener can enqueue. Prevents DOS attacks and deals with leaks.
|
||||||
if (!isSystemNotification) {
|
if (!isSystemNotification && !isNotificationFromListener) {
|
||||||
synchronized (mNotificationList) {
|
synchronized (mNotificationList) {
|
||||||
int count = 0;
|
int count = 0;
|
||||||
final int N = mNotificationList.size();
|
final int N = mNotificationList.size();
|
||||||
|
|||||||
Reference in New Issue
Block a user