diff options
| author | 2024-01-29 14:02:49 +0000 | |
|---|---|---|
| committer | 2024-01-29 14:02:49 +0000 | |
| commit | f84ad307e6bfca369418cf331eae69075b683dcf (patch) | |
| tree | 76270630e9827def1c9954a2610084638f67a8bd | |
| parent | 8505785fa3119baea2e9d91dc5824f92714d4b3e (diff) | |
| parent | 61b8f80e3630353593b7d79648792438e987f4f0 (diff) | |
Merge "Flag getSdkSandboxApplicationInfoForInstrumentation" into main
| -rw-r--r-- | services/core/java/com/android/server/am/ActivityManagerService.java | 23 |
1 files changed, 18 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 74902f76b617..374a17a3a23f 100644 --- a/services/core/java/com/android/server/am/ActivityManagerService.java +++ b/services/core/java/com/android/server/am/ActivityManagerService.java @@ -135,6 +135,7 @@ import static android.view.Display.INVALID_DISPLAY; import static com.android.internal.protolog.ProtoLogGroup.WM_DEBUG_CONFIGURATION; import static com.android.internal.util.FrameworkStatsLog.UNSAFE_INTENT_EVENT_REPORTED__EVENT_TYPE__INTERNAL_NON_EXPORTED_COMPONENT_MATCH; import static com.android.internal.util.FrameworkStatsLog.UNSAFE_INTENT_EVENT_REPORTED__EVENT_TYPE__NEW_MUTABLE_IMPLICIT_PENDING_INTENT_RETRIEVED; +import static com.android.sdksandbox.flags.Flags.sdkSandboxInstrumentationInfo; import static com.android.server.am.ActivityManagerDebugConfig.DEBUG_ALL; import static com.android.server.am.ActivityManagerDebugConfig.DEBUG_ALLOWLISTS; import static com.android.server.am.ActivityManagerDebugConfig.DEBUG_BACKGROUND_CHECK; @@ -16141,10 +16142,22 @@ public class ActivityManagerService extends IActivityManager.Stub } final ApplicationInfo sdkSandboxInfo; + final String processName; try { - sdkSandboxInfo = - sandboxManagerLocal.getSdkSandboxApplicationInfoForInstrumentation( - sdkSandboxClientAppInfo, isSdkInSandbox); + if (sdkSandboxInstrumentationInfo()) { + sdkSandboxInfo = + sandboxManagerLocal.getSdkSandboxApplicationInfoForInstrumentation( + sdkSandboxClientAppInfo, isSdkInSandbox); + processName = sdkSandboxInfo.processName; + } else { + final PackageManager pm = mContext.getPackageManager(); + sdkSandboxInfo = + pm.getApplicationInfoAsUser(pm.getSdkSandboxPackageName(), 0, userId); + processName = + sandboxManagerLocal.getSdkSandboxProcessNameForInstrumentation( + sdkSandboxClientAppInfo); + sdkSandboxInfo.uid = Process.toSdkSandboxUid(sdkSandboxClientAppInfo.uid); + } } catch (NameNotFoundException e) { reportStartInstrumentationFailureLocked( watcher, className, "Can't find SdkSandbox package"); @@ -16153,7 +16166,7 @@ public class ActivityManagerService extends IActivityManager.Stub ActiveInstrumentation activeInstr = new ActiveInstrumentation(this); activeInstr.mClass = className; - activeInstr.mTargetProcesses = new String[]{sdkSandboxInfo.processName}; + activeInstr.mTargetProcesses = new String[]{processName}; activeInstr.mTargetInfo = sdkSandboxInfo; activeInstr.mIsSdkInSandbox = isSdkInSandbox; activeInstr.mProfileFile = profileFile; @@ -16196,7 +16209,7 @@ public class ActivityManagerService extends IActivityManager.Stub ProcessRecord app = addAppLocked( sdkSandboxInfo, - sdkSandboxInfo.processName, + processName, /* isolated= */ false, /* isSdkSandbox= */ true, sdkSandboxInfo.uid, |