diff options
author | Koushik Dutta <koushd@gmail.com> | 2013-07-07 09:28:42 -0700 |
---|---|---|
committer | Koushik Dutta <koushd@gmail.com> | 2013-07-07 09:52:57 -0700 |
commit | aafc56bcf3ce3deb979c263944287f0b971689af (patch) | |
tree | 2d6ee1c9f5c138e3864c7248ae164a643b173621 /services/java/com/android | |
parent | fc94a474d309ab31ac67215815bef5ea6521e24a (diff) | |
download | frameworks_base-aafc56bcf3ce3deb979c263944287f0b971689af.zip frameworks_base-aafc56bcf3ce3deb979c263944287f0b971689af.tar.gz frameworks_base-aafc56bcf3ce3deb979c263944287f0b971689af.tar.bz2 |
Notification cancellation fixes:
Permission should only allow cancellation of other app notifications, not enqueueing.
Fix checkapi breakage.
Change-Id: Idbcfd4617057984250dc4d4fa32ff55bfbb155e2
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; |