diff options
Diffstat (limited to 'services/java/com/android')
-rw-r--r-- | services/java/com/android/server/NotificationManagerService.java | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/services/java/com/android/server/NotificationManagerService.java b/services/java/com/android/server/NotificationManagerService.java index 4928a86..4bbf452 100644 --- a/services/java/com/android/server/NotificationManagerService.java +++ b/services/java/com/android/server/NotificationManagerService.java @@ -1554,7 +1554,7 @@ public class NotificationManagerService extends INotificationManager.Stub } public void cancelNotificationWithTag(String pkg, String tag, int id, int userId) { - checkCallerIsSystemOrSameApp(pkg); + checkCallerCanCancelNotification(pkg); userId = ActivityManager.handleIncomingUser(Binder.getCallingPid(), Binder.getCallingUid(), userId, true, false, "cancelNotificationWithTag", pkg); // Don't allow client applications to cancel foreground service notis. @@ -1564,7 +1564,7 @@ public class NotificationManagerService extends INotificationManager.Stub } public void cancelAllNotifications(String pkg, int userId) { - checkCallerIsSystemOrSameApp(pkg); + checkCallerCanCancelNotification(pkg); userId = ActivityManager.handleIncomingUser(Binder.getCallingPid(), Binder.getCallingUid(), userId, true, false, "cancelAllNotifications", pkg); @@ -1582,11 +1582,15 @@ public class NotificationManagerService extends INotificationManager.Stub throw new SecurityException("Disallowed call for uid " + uid); } - void checkCallerIsSystemOrSameApp(String pkg) { + void checkCallerCanCancelNotification(String pkg) { if (mContext.checkCallingOrSelfPermission(android.Manifest.permission.CANCEL_NOTIFICATIONS) == PackageManager.PERMISSION_GRANTED) { return; } + checkCallerIsSystemOrSameApp(pkg); + } + + void checkCallerIsSystemOrSameApp(String pkg) { int uid = Binder.getCallingUid(); if (UserHandle.getAppId(uid) == Process.SYSTEM_UID || uid == 0) { return; |