Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b487ffee authored by Julia Reynolds's avatar Julia Reynolds Committed by Android (Google) Code Review
Browse files

Merge "Allow signature apps to modify notification policies."

parents 7642d568 39a8c353
Loading
Loading
Loading
Loading
+6 −0
Original line number Original line Diff line number Diff line
@@ -2530,6 +2530,12 @@
        android:label="@string/permlab_access_notification_policy"
        android:label="@string/permlab_access_notification_policy"
        android:protectionLevel="normal" />
        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.
    <!-- Allows access to keyguard secure storage.  Only allowed for system processes.
        @hide -->
        @hide -->
    <permission android:name="android.permission.ACCESS_KEYGUARD_SECURE_STORAGE"
    <permission android:name="android.permission.ACCESS_KEYGUARD_SECURE_STORAGE"
+4 −0
Original line number Original line Diff line number Diff line
@@ -1642,6 +1642,10 @@ public class NotificationManagerService extends SystemService {
        }
        }


        private void enforcePolicyAccess(String pkg, String method) {
        private void enforcePolicyAccess(String pkg, String method) {
            if (PackageManager.PERMISSION_GRANTED == getContext().checkCallingPermission(
                    android.Manifest.permission.MANAGE_NOTIFICATION_RULES)) {
                return;
            }
            if (!checkPolicyAccess(pkg)) {
            if (!checkPolicyAccess(pkg)) {
                Slog.w(TAG, "Notification policy access denied calling " + method);
                Slog.w(TAG, "Notification policy access denied calling " + method);
                throw new SecurityException("Notification policy access denied");
                throw new SecurityException("Notification policy access denied");
+3 −2
Original line number Original line Diff line number Diff line
@@ -248,8 +248,9 @@ public class ZenModeHelper {
        }
        }
        pw.printf("allow(calls=%s,callsFrom=%s,repeatCallers=%s,messages=%s,messagesFrom=%s,"
        pw.printf("allow(calls=%s,callsFrom=%s,repeatCallers=%s,messages=%s,messagesFrom=%s,"
                + "events=%s,reminders=%s)\n",
                + "events=%s,reminders=%s)\n",
                config.allowCalls, config.allowCallsFrom, config.allowRepeatCallers,
                config.allowCalls, ZenModeConfig.sourceToString(config.allowCallsFrom),
                config.allowMessages, config.allowMessagesFrom,
                config.allowRepeatCallers, config.allowMessages,
                ZenModeConfig.sourceToString(config.allowMessagesFrom),
                config.allowEvents, config.allowReminders);
                config.allowEvents, config.allowReminders);
        pw.print(prefix); pw.print("  manualRule="); pw.println(config.manualRule);
        pw.print(prefix); pw.print("  manualRule="); pw.println(config.manualRule);
        if (config.automaticRules.isEmpty()) return;
        if (config.automaticRules.isEmpty()) return;