diff options
| author | 2022-02-23 11:25:10 -0800 | |
|---|---|---|
| committer | 2022-02-23 11:25:10 -0800 | |
| commit | cb5d61b44c5b720cb10e87aa5424a6e1fd1e5470 (patch) | |
| tree | be82859f0ee63cee253edf83145612570dad348f | |
| parent | 4b5f06df788dbacfddc08ad83a28e406408c65c3 (diff) | |
Only allow ROOT'ed ADB to run unit tests ignoring certificates.
Bug: 220198493
Test: Treehugger
Change-Id: Iebbe1c8749ef43ac310179698a048a93be47e24b
| -rw-r--r-- | services/core/java/com/android/server/am/ActivityManagerService.java | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/services/core/java/com/android/server/am/ActivityManagerService.java b/services/core/java/com/android/server/am/ActivityManagerService.java index bdb3e808b6f1..7ddfc870d4c9 100644 --- a/services/core/java/com/android/server/am/ActivityManagerService.java +++ b/services/core/java/com/android/server/am/ActivityManagerService.java @@ -14330,7 +14330,8 @@ public class ActivityManagerService extends IActivityManager.Stub int match = mContext.getPackageManager().checkSignatures( ii.targetPackage, ii.packageName); if (match < 0 && match != PackageManager.SIGNATURE_FIRST_NOT_SIGNED) { - if (Build.IS_DEBUGGABLE && (flags & INSTR_FLAG_ALWAYS_CHECK_SIGNATURE) == 0) { + if (Build.IS_DEBUGGABLE && (callingUid == Process.ROOT_UID) + && (flags & INSTR_FLAG_ALWAYS_CHECK_SIGNATURE) == 0) { Slog.w(TAG, "Instrumentation test " + ii.packageName + " doesn't have a signature matching the target " + ii.targetPackage + ", which would not be allowed on the production Android builds"); |