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

Commit b7604ea2 authored by Julia Reynolds's avatar Julia Reynolds Committed by Jessica Wagantall
Browse files

Check caller's uid before allowing notification policy access.

CYNGNOS-3235
Bug: 29421441
Change-Id: I7460268595e932d54660b02007bcd68b95fe8aec
(cherry picked from commit f4811159)
(cherry picked from commit e1f33a7f)
parent 830213cf
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -1991,6 +1991,7 @@ public class NotificationManagerService extends SystemService {
        }

        private void enforcePolicyAccess(String pkg, String method) {
            checkCallerIsSameApp(pkg);
            if (!checkPolicyAccess(pkg)) {
                Slog.w(TAG, "Notification policy access denied calling " + method);
                throw new SecurityException("Notification policy access denied");
@@ -3629,6 +3630,10 @@ public class NotificationManagerService extends SystemService {
        if (isCallerSystem()) {
            return;
        }
        checkCallerIsSameApp(pkg);
    }

    private static void checkCallerIsSameApp(String pkg) {
        final int uid = Binder.getCallingUid();
        try {
            ApplicationInfo ai = AppGlobals.getPackageManager().getApplicationInfo(