diff options
author | 2021-02-18 16:18:33 +0000 | |
---|---|---|
committer | 2021-02-18 16:18:33 +0000 | |
commit | 9bbaf16b1be711d5c856a2be8d32a2962a1a5f27 (patch) | |
tree | d7a456eee187102cbc87768aee9e99eb3b3a41d0 /services | |
parent | 9498b3f782a3bb98a5d9e29a3b44ee874cb3bf08 (diff) | |
parent | 750732504f3e5a6ef7e05e9279c514fea0a5869d (diff) |
Merge "Log when enforceActor fails" into sc-dev am: 750732504f
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/13606036
MUST ONLY BE SUBMITTED BY AUTOMERGER
Change-Id: Ifd440deae6f427c1692eceea825340697c9342fb
Diffstat (limited to 'services')
-rw-r--r-- | services/core/java/com/android/server/om/OverlayActorEnforcer.java | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/services/core/java/com/android/server/om/OverlayActorEnforcer.java b/services/core/java/com/android/server/om/OverlayActorEnforcer.java index 2d540de69660..c4b6485d2a2f 100644 --- a/services/core/java/com/android/server/om/OverlayActorEnforcer.java +++ b/services/core/java/com/android/server/om/OverlayActorEnforcer.java @@ -23,6 +23,7 @@ import android.net.Uri; import android.os.Process; import android.text.TextUtils; import android.util.Pair; +import android.util.Slog; import com.android.internal.annotations.VisibleForTesting; import com.android.internal.util.ArrayUtils; @@ -42,9 +43,6 @@ import java.util.Map; */ public class OverlayActorEnforcer { - // By default, the reason is not logged to prevent leaks of why it failed - private static final boolean DEBUG_REASON = false; - private final PackageManagerHelper mPackageManager; /** @@ -85,17 +83,18 @@ public class OverlayActorEnforcer { void enforceActor(@NonNull OverlayInfo overlayInfo, @NonNull String methodName, int callingUid, int userId) throws SecurityException { - ActorState actorState = isAllowedActor(methodName, overlayInfo, callingUid, userId); + final ActorState actorState = isAllowedActor(methodName, overlayInfo, callingUid, userId); if (actorState == ActorState.ALLOWED) { return; } - String targetOverlayableName = overlayInfo.targetOverlayableName; - throw new SecurityException("UID" + callingUid + " is not allowed to call " - + methodName + " for " + final String targetOverlayableName = overlayInfo.targetOverlayableName; + final String errorMessage = "UID" + callingUid + " is not allowed to call " + methodName + + " for " + (TextUtils.isEmpty(targetOverlayableName) ? "" : (targetOverlayableName + " in ")) - + overlayInfo.targetPackageName + (DEBUG_REASON ? (" because " + actorState) : "") - ); + + overlayInfo.targetPackageName + " for user " + userId; + Slog.w(OverlayManagerService.TAG, errorMessage + " because " + actorState); + throw new SecurityException(errorMessage); } /** |