From 9323df6e469de5002cae168d24d776e79d7f6f4c Mon Sep 17 00:00:00 2001 From: Jeff Sharkey Date: Mon, 11 Apr 2016 16:20:25 -0600 Subject: [PATCH] Use callerPackage instead of callerApp. When AlarmManager sends a broadcast, it only knows the packageName that requested the broadcast, and the callerApp may not even be running anymore. Since we only need the package name for enforcement, use that instead of the possibly null callerApp. Bug: 27397019 Change-Id: I8a52d73b4a83eebf85aa1adbfe06bd8886814d4b --- .../com/android/server/am/ActivityManagerService.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/services/core/java/com/android/server/am/ActivityManagerService.java b/services/core/java/com/android/server/am/ActivityManagerService.java index b11dc1182f339..3ec51e3dfa42f 100644 --- a/services/core/java/com/android/server/am/ActivityManagerService.java +++ b/services/core/java/com/android/server/am/ActivityManagerService.java @@ -17144,7 +17144,7 @@ public final class ActivityManagerService extends ActivityManagerNative // but historically it has not been protected and apps may be using it // to poke their own app widget. So, instead of making it protected, // just limit it to the caller. - if (callerApp == null) { + if (callerPackage == null) { String msg = "Permission Denial: not allowed to send broadcast " + action + " from unknown caller."; Slog.w(TAG, msg); @@ -17153,17 +17153,17 @@ public final class ActivityManagerService extends ActivityManagerNative // They are good enough to send to an explicit component... verify // it is being sent to the calling app. if (!intent.getComponent().getPackageName().equals( - callerApp.info.packageName)) { + callerPackage)) { String msg = "Permission Denial: not allowed to send broadcast " + action + " to " + intent.getComponent().getPackageName() + " from " - + callerApp.info.packageName; + + callerPackage; Slog.w(TAG, msg); throw new SecurityException(msg); } } else { // Limit broadcast to their own package. - intent.setPackage(callerApp.info.packageName); + intent.setPackage(callerPackage); } } }