summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Julia Reynolds <juliacr@google.com> 2015-09-28 11:34:48 -0400
committer Julia Reynolds <juliacr@google.com> 2015-09-28 14:48:42 -0400
commit39a8c353a8f723e5e67bc846f8fa96d580c4abbb (patch)
tree8bc991fb4e98a39c47cc50f4406b8af3e986ee98
parentaeaa12c34e0b47df7f3079516177e791b5f2a0d7 (diff)
Allow signature apps to modify notification policies.
Bug: 22977552 Change-Id: I7bfd2fe7bcb2e14b9eb7281acbb8a35dbc2ec93e
-rw-r--r--core/res/AndroidManifest.xml6
-rw-r--r--services/core/java/com/android/server/notification/NotificationManagerService.java4
-rw-r--r--services/core/java/com/android/server/notification/ZenModeHelper.java5
3 files changed, 13 insertions, 2 deletions
diff --git a/core/res/AndroidManifest.xml b/core/res/AndroidManifest.xml
index c7134548a1e1..cf4e4f690dce 100644
--- a/core/res/AndroidManifest.xml
+++ b/core/res/AndroidManifest.xml
@@ -2530,6 +2530,12 @@
android:label="@string/permlab_access_notification_policy"
android:protectionLevel="normal" />
+ <!-- Allows modification of do not disturb rules and policies. Only allowed for system
+ processes.
+ @hide -->
+ <permission android:name="android.permission.MANAGE_NOTIFICATIONS"
+ android:protectionLevel="signature" />
+
<!-- Allows access to keyguard secure storage. Only allowed for system processes.
@hide -->
<permission android:name="android.permission.ACCESS_KEYGUARD_SECURE_STORAGE"
diff --git a/services/core/java/com/android/server/notification/NotificationManagerService.java b/services/core/java/com/android/server/notification/NotificationManagerService.java
index 0c884f1558fa..908dddab8ccf 100644
--- a/services/core/java/com/android/server/notification/NotificationManagerService.java
+++ b/services/core/java/com/android/server/notification/NotificationManagerService.java
@@ -1642,6 +1642,10 @@ public class NotificationManagerService extends SystemService {
}
private void enforcePolicyAccess(String pkg, String method) {
+ if (PackageManager.PERMISSION_GRANTED == getContext().checkCallingPermission(
+ android.Manifest.permission.MANAGE_NOTIFICATION_RULES)) {
+ return;
+ }
if (!checkPolicyAccess(pkg)) {
Slog.w(TAG, "Notification policy access denied calling " + method);
throw new SecurityException("Notification policy access denied");
diff --git a/services/core/java/com/android/server/notification/ZenModeHelper.java b/services/core/java/com/android/server/notification/ZenModeHelper.java
index cbe61c3da5af..9131e5eecbf5 100644
--- a/services/core/java/com/android/server/notification/ZenModeHelper.java
+++ b/services/core/java/com/android/server/notification/ZenModeHelper.java
@@ -248,8 +248,9 @@ public class ZenModeHelper {
}
pw.printf("allow(calls=%s,callsFrom=%s,repeatCallers=%s,messages=%s,messagesFrom=%s,"
+ "events=%s,reminders=%s)\n",
- config.allowCalls, config.allowCallsFrom, config.allowRepeatCallers,
- config.allowMessages, config.allowMessagesFrom,
+ config.allowCalls, ZenModeConfig.sourceToString(config.allowCallsFrom),
+ config.allowRepeatCallers, config.allowMessages,
+ ZenModeConfig.sourceToString(config.allowMessagesFrom),
config.allowEvents, config.allowReminders);
pw.print(prefix); pw.print(" manualRule="); pw.println(config.manualRule);
if (config.automaticRules.isEmpty()) return;