summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKoushik Dutta <koushd@gmail.com>2013-07-06 16:48:44 -0700
committerKoushik Dutta <koushd@gmail.com>2013-07-06 16:51:09 -0700
commit41bec7bf371b73d622af403ac80a8e113ca042ce (patch)
tree1490e91cc9b326cf884fd04c41c99835979381d5
parent2ce68c452863feda4cf3465263122c74f5801377 (diff)
downloadframeworks_base-41bec7bf371b73d622af403ac80a8e113ca042ce.zip
frameworks_base-41bec7bf371b73d622af403ac80a8e113ca042ce.tar.gz
frameworks_base-41bec7bf371b73d622af403ac80a8e113ca042ce.tar.bz2
Add permission that allows cancelling notifications from other apps.
Change-Id: I055b17873e174f71174898a7649b1e221fd8c436
-rw-r--r--core/res/AndroidManifest.xml8
-rw-r--r--core/res/res/values/cm_strings.xml5
-rw-r--r--services/java/com/android/server/NotificationManagerService.java4
3 files changed, 17 insertions, 0 deletions
diff --git a/core/res/AndroidManifest.xml b/core/res/AndroidManifest.xml
index ce9b3a8..1b4adc5 100644
--- a/core/res/AndroidManifest.xml
+++ b/core/res/AndroidManifest.xml
@@ -1942,6 +1942,14 @@
android:description="@string/permdesc_broadcastPackageRemoved"
android:protectionLevel="signature" />
+ <!-- Allows an application to cancel notifications from other apps
+ -->
+ <permission android:name="android.permission.CANCEL_NOTIFICATIONS"
+ android:permissionGroup="android.permission-group.SYSTEM_TOOLS"
+ android:protectionLevel="signature|system"
+ android:label="@string/permlab_cancelNotifications"
+ android:description="@string/permdesc_cancelNotifications" />
+
<!-- Allows an application to intercept and rewrite outgoing SMS
@hide -->
<permission android:name="android.permission.INTERCEPT_SMS"
diff --git a/core/res/res/values/cm_strings.xml b/core/res/res/values/cm_strings.xml
index 6357521..33f07f0 100644
--- a/core/res/res/values/cm_strings.xml
+++ b/core/res/res/values/cm_strings.xml
@@ -170,6 +170,11 @@
<string name="profile_none">None</string>
<!-- Title of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
+ <string name="permlab_cancelNotifications">cancel application notifications</string>
+ <!-- Description of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
+ <string name="permdesc_cancelNotifications">Allows the app to cancel notifications created by other apps.</string>
+
+ <!-- Title of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
<string name="permlab_interceptSmsSent">intercept outgoing SMS</string>
<!-- Description of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
<string name="permdesc_interceptSmsSent">Allows the app to
diff --git a/services/java/com/android/server/NotificationManagerService.java b/services/java/com/android/server/NotificationManagerService.java
index 41377d2..4928a86 100644
--- a/services/java/com/android/server/NotificationManagerService.java
+++ b/services/java/com/android/server/NotificationManagerService.java
@@ -1583,6 +1583,10 @@ public class NotificationManagerService extends INotificationManager.Stub
}
void checkCallerIsSystemOrSameApp(String pkg) {
+ if (mContext.checkCallingOrSelfPermission(android.Manifest.permission.CANCEL_NOTIFICATIONS)
+ == PackageManager.PERMISSION_GRANTED) {
+ return;
+ }
int uid = Binder.getCallingUid();
if (UserHandle.getAppId(uid) == Process.SYSTEM_UID || uid == 0) {
return;