From c68ef58c94a8040f395497bf93a727453aea518a Mon Sep 17 00:00:00 2001 From: Julia Reynolds Date: Wed, 29 Jun 2016 08:43:00 -0400 Subject: [PATCH] Check uid for notification policy access. Bug: 29421441 Change-Id: Ia0a7b06112dde1c925ec3232f50bf4d90b17b5e5 (cherry picked from commit 0cd1b789567b60b963fc7b8935e898ea0e61a617) --- .../server/notification/NotificationManagerService.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/services/core/java/com/android/server/notification/NotificationManagerService.java b/services/core/java/com/android/server/notification/NotificationManagerService.java index 11c65250f94c6..ee09e163988e8 100644 --- a/services/core/java/com/android/server/notification/NotificationManagerService.java +++ b/services/core/java/com/android/server/notification/NotificationManagerService.java @@ -1983,6 +1983,7 @@ public class NotificationManagerService extends SystemService { android.Manifest.permission.MANAGE_NOTIFICATIONS)) { return; } + checkCallerIsSameApp(pkg); if (!checkPolicyAccess(pkg)) { Slog.w(TAG, "Notification policy access denied calling " + method); throw new SecurityException("Notification policy access denied"); @@ -3643,6 +3644,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(