diff options
| author | 2022-02-23 22:05:01 +0000 | |
|---|---|---|
| committer | 2022-02-23 22:05:01 +0000 | |
| commit | 81a4e811765fe593e38f2706c6f0f8d33f948e08 (patch) | |
| tree | 97e44670307f7a29880005df8ab23880f9939782 | |
| parent | 10e148d78a39dba218d9015630790224a592b966 (diff) | |
| parent | 983caeddb4090e078801497e8118c0447f04d0e6 (diff) | |
[automerge] Show a warning about mismatching test / APK certs 2p: 983caeddb4
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/16988388
Bug: 220198493
Change-Id: I6712d7ef5ab90c50574a5198495cab93c7ef3a97
Merged-In: Iebbe1c8749ef43ac310179698a048a93be47e24b
| -rw-r--r-- | services/core/java/com/android/server/am/ActivityManagerService.java | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/services/core/java/com/android/server/am/ActivityManagerService.java b/services/core/java/com/android/server/am/ActivityManagerService.java index 9f59a5fc7253..3e0f26132d7e 100644 --- a/services/core/java/com/android/server/am/ActivityManagerService.java +++ b/services/core/java/com/android/server/am/ActivityManagerService.java @@ -13813,14 +13813,26 @@ public class ActivityManagerService extends IActivityManager.Stub return false; } - if (!Build.IS_DEBUGGABLE) { - int match = mContext.getPackageManager().checkSignatures( - ii.targetPackage, ii.packageName); - if (match < 0 && match != PackageManager.SIGNATURE_FIRST_NOT_SIGNED) { + int match = mContext.getPackageManager().checkSignatures( + ii.targetPackage, ii.packageName); + if (match < 0 && match != PackageManager.SIGNATURE_FIRST_NOT_SIGNED) { + if (Build.IS_DEBUGGABLE) { + String message = "Instrumentation test " + ii.packageName + + " doesn't have a signature matching the target " + + ii.targetPackage + + ", which would not be allowed on the production Android builds"; + if (callingUid != Process.ROOT_UID) { + Slog.e(TAG, message + + ". THIS WILL BE DISALLOWED ON FUTURE ANDROID VERSIONS" + + " unless from a rooted ADB shell."); + } else { + Slog.w(TAG, message); + } + } else { String msg = "Permission Denial: starting instrumentation " + className + " from pid=" + Binder.getCallingPid() - + ", uid=" + Binder.getCallingPid() + + ", uid=" + Binder.getCallingUid() + " not allowed because package " + ii.packageName + " does not have a signature matching the target " + ii.targetPackage; |