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

Commit a3187048 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "[RESTRICT AUTOMERGE]: Add cross user permission check -...

Merge "[RESTRICT AUTOMERGE]: Add cross user permission check - areNotificationsEnabledForPackage" into nyc-dev
parents 9061fcc4 a2b2e377
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -1413,6 +1413,12 @@ public class NotificationManagerService extends SystemService {
        @Override
        public boolean areNotificationsEnabledForPackage(String pkg, int uid) {
            checkCallerIsSystemOrSameApp(pkg);
            if (UserHandle.getCallingUserId() != UserHandle.getUserId(uid)) {
                getContext().enforceCallingPermission(
                        android.Manifest.permission.INTERACT_ACROSS_USERS,
                        "canNotifyAsPackage for uid " + uid);
            }

            return (mAppOps.checkOpNoThrow(AppOpsManager.OP_POST_NOTIFICATION, uid, pkg)
                    == AppOpsManager.MODE_ALLOWED) && !isPackageSuspendedForUser(pkg, uid);
        }