summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSandro Montanari <sandrom@google.com>2024-01-25 16:49:41 +0000
committerAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2024-01-30 20:32:25 +0000
commit878990ca2e5e990859beb0ba2fcc0e1365378711 (patch)
tree274ca19b5ce35fd6245880f2a1d4c97fa24e24df
parent25157fd96ffd9e6e10ff81da3a72914849ec404d (diff)
downloadbase-878990ca2e5e990859beb0ba2fcc0e1365378711.tar.gz
Flag getSdkSandboxApplicationInfoForInstrumentation
The API is not present in the mainline prebuilts on U. Because of the missing API, we are getting runtime failures on next targets. Bug: 315018061 Test: m & flashall (cherry picked from https://googleplex-android-review.googlesource.com/q/commit:72edc443924ed2e68bd265e9aaea5ef20027fdd1) Merged-In: I3cbfb164ab88ba0285434e9b82d7994a91d3d019 Change-Id: I3cbfb164ab88ba0285434e9b82d7994a91d3d019
-rw-r--r--services/core/java/com/android/server/am/ActivityManagerService.java23
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 2ee39c577977..89b53aab1539 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;
@@ -16099,10 +16100,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");
@@ -16111,7 +16124,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;
@@ -16154,7 +16167,7 @@ public class ActivityManagerService extends IActivityManager.Stub
ProcessRecord app = addAppLocked(
sdkSandboxInfo,
- sdkSandboxInfo.processName,
+ processName,
/* isolated= */ false,
/* isSdkSandbox= */ true,
sdkSandboxInfo.uid,