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

Commit 4fcd78e4 authored by Guojing Yuan's avatar Guojing Yuan Committed by Android (Google) Code Review
Browse files

Merge "Fix setNotificationPolicyAccessGranted caller checks" into main

parents e6d8f6f9 3584b563
Loading
Loading
Loading
Loading
+10 −1
Original line number Diff line number Diff line
@@ -6992,7 +6992,16 @@ public class NotificationManagerService extends SystemService {
        @Override
        public void setNotificationPolicyAccessGrantedForUser(
                String pkg, int userId, boolean granted) {
            checkCallerIsSystemOrShell();
            if (UserHandle.getCallingUserId() != userId) {
                getContext().enforceCallingOrSelfPermission(
                        android.Manifest.permission.INTERACT_ACROSS_USERS,
                        "setNotificationPolicyAccessGrantedForUser for user " + userId);
            }
            if (!isCallerSystemOrSystemUiOrShell()) {
                getContext().enforceCallingPermission(
                        android.Manifest.permission.MANAGE_NOTIFICATIONS,
                        "setNotificationPolicyAccessGrantedForUser");
            }
            final long identity = Binder.clearCallingIdentity();
            try {
                if (mAllowedManagedServicePackages.test(