Loading core/java/android/app/ActivityThread.java +36 −13 Original line number Diff line number Diff line Loading @@ -888,6 +888,7 @@ public final class ActivityThread extends ClientTransactionHandler ApplicationInfo appInfo; String sdkSandboxClientAppVolumeUuid; String sdkSandboxClientAppPackage; boolean isSdkInSandbox; @UnsupportedAppUsage List<ProviderInfo> providers; ComponentName instrumentationName; Loading Loading @@ -1169,19 +1170,34 @@ public final class ActivityThread extends ClientTransactionHandler } @Override public final void bindApplication(String processName, ApplicationInfo appInfo, String sdkSandboxClientAppVolumeUuid, String sdkSandboxClientAppPackage, ProviderInfoList providerList, ComponentName instrumentationName, ProfilerInfo profilerInfo, Bundle instrumentationArgs, public final void bindApplication( String processName, ApplicationInfo appInfo, String sdkSandboxClientAppVolumeUuid, String sdkSandboxClientAppPackage, boolean isSdkInSandbox, ProviderInfoList providerList, ComponentName instrumentationName, ProfilerInfo profilerInfo, Bundle instrumentationArgs, IInstrumentationWatcher instrumentationWatcher, IUiAutomationConnection instrumentationUiConnection, int debugMode, boolean enableBinderTracking, boolean trackAllocation, boolean isRestrictedBackupMode, boolean persistent, Configuration config, CompatibilityInfo compatInfo, Map services, Bundle coreSettings, String buildSerial, AutofillOptions autofillOptions, ContentCaptureOptions contentCaptureOptions, long[] disabledCompatChanges, IUiAutomationConnection instrumentationUiConnection, int debugMode, boolean enableBinderTracking, boolean trackAllocation, boolean isRestrictedBackupMode, boolean persistent, Configuration config, CompatibilityInfo compatInfo, Map services, Bundle coreSettings, String buildSerial, AutofillOptions autofillOptions, ContentCaptureOptions contentCaptureOptions, long[] disabledCompatChanges, SharedMemory serializedSystemFontMap, long startRequestedElapsedTime, long startRequestedUptime) { long startRequestedElapsedTime, long startRequestedUptime) { if (services != null) { if (false) { // Test code to make sure the app could see the passed-in services. Loading Loading @@ -1215,6 +1231,7 @@ public final class ActivityThread extends ClientTransactionHandler data.appInfo = appInfo; data.sdkSandboxClientAppVolumeUuid = sdkSandboxClientAppVolumeUuid; data.sdkSandboxClientAppPackage = sdkSandboxClientAppPackage; data.isSdkInSandbox = isSdkInSandbox; data.providers = providerList.getList(); data.instrumentationName = instrumentationName; data.instrumentationArgs = instrumentationArgs; Loading Loading @@ -7213,8 +7230,14 @@ public final class ActivityThread extends ClientTransactionHandler // The test context's op package name == the target app's op package name, because // the app ops manager checks the op package name against the real calling UID, // which is what the target package name is associated with. final ContextImpl instrContext = ContextImpl.createAppContext(this, pi, appContext.getOpPackageName()); // In the case of instrumenting an sdk running in the sdk sandbox, appContext refers // to the context of the sdk running in the sandbox. Since the sandbox does not have // access to data outside the sandbox, we require the instrContext to point to the // sdk in the sandbox as well, and not to the test context. final ContextImpl instrContext = (data.isSdkInSandbox) ? appContext : ContextImpl.createAppContext(this, pi, appContext.getOpPackageName()); try { final ClassLoader cl = instrContext.getClassLoader(); Loading core/java/android/app/IApplicationThread.aidl +1 −0 Original line number Diff line number Diff line Loading @@ -78,6 +78,7 @@ oneway interface IApplicationThread { void scheduleStopService(IBinder token); void bindApplication(in String packageName, in ApplicationInfo info, in String sdkSandboxClientAppVolumeUuid, in String sdkSandboxClientAppPackage, in boolean isSdkInSandbox, in ProviderInfoList providerList, in ComponentName testName, in ProfilerInfo profilerInfo, in Bundle testArguments, IInstrumentationWatcher testWatcher, IUiAutomationConnection uiAutomationConnection, Loading services/core/java/com/android/server/am/ActiveInstrumentation.java +3 −0 Original line number Diff line number Diff line Loading @@ -40,6 +40,9 @@ class ActiveInstrumentation { // The application being instrumented ApplicationInfo mTargetInfo; // Whether the application is instrumented as an sdk running in the sdk_sandbox. boolean mIsSdkInSandbox; // Where to save profiling String mProfileFile; Loading services/core/java/com/android/server/am/ActivityManagerService.java +4 −2 Original line number Diff line number Diff line Loading @@ -4655,6 +4655,7 @@ public class ActivityManagerService extends IActivityManager.Stub } else if (instr2 != null) { thread.bindApplication(processName, appInfo, app.sdkSandboxClientAppVolumeUuid, app.sdkSandboxClientAppPackage, instr2.mIsSdkInSandbox, providerList, instr2.mClass, profilerInfo, instr2.mArguments, Loading @@ -4671,6 +4672,7 @@ public class ActivityManagerService extends IActivityManager.Stub } else { thread.bindApplication(processName, appInfo, app.sdkSandboxClientAppVolumeUuid, app.sdkSandboxClientAppPackage, /* isSdkInSandbox= */ false, providerList, null, profilerInfo, null, null, null, testMode, mBinderTransactionTrackingEnabled, enableTrackAllocation, isRestrictedBackupMode || !normalMode, app.isPersistent(), Loading Loading @@ -15436,6 +15438,7 @@ public class ActivityManagerService extends IActivityManager.Stub activeInstr.mClass = className; activeInstr.mTargetProcesses = new String[]{sdkSandboxInfo.processName}; activeInstr.mTargetInfo = sdkSandboxInfo; activeInstr.mIsSdkInSandbox = isSdkInSandbox; activeInstr.mProfileFile = profileFile; activeInstr.mArguments = arguments; activeInstr.mWatcher = watcher; Loading @@ -15452,7 +15455,6 @@ public class ActivityManagerService extends IActivityManager.Stub sandboxManagerLocal.notifyInstrumentationStarted( sdkSandboxClientAppInfo.packageName, sdkSandboxClientAppInfo.uid); synchronized (mProcLock) { int sdkSandboxUid = Process.toSdkSandboxUid(sdkSandboxClientAppInfo.uid); // Kill the package sdk sandbox process belong to. At this point sdk sandbox is // already killed. forceStopPackageLocked( Loading @@ -15471,7 +15473,7 @@ public class ActivityManagerService extends IActivityManager.Stub sdkSandboxInfo.processName, /* isolated= */ false, /* isSdkSandbox= */ true, sdkSandboxUid, sdkSandboxInfo.uid, sdkSandboxClientAppInfo.packageName, disableHiddenApiChecks, disableTestApiChecks, services/tests/mockingservicestests/src/com/android/server/am/AsyncProcessStartTest.java +2 −2 Original line number Diff line number Diff line Loading @@ -200,7 +200,7 @@ public class AsyncProcessStartTest { return null; }).when(thread).bindApplication( any(), any(), any(), any(), any(), any(), anyBoolean(), any(), any(), any(), any(), any(), Loading Loading @@ -260,7 +260,7 @@ public class AsyncProcessStartTest { /* expectedStartSeq */ 0, /* procAttached */ false); app.getThread().bindApplication(PACKAGE, appInfo, null, null, null, null, false, null, null, null, null, Loading Loading
core/java/android/app/ActivityThread.java +36 −13 Original line number Diff line number Diff line Loading @@ -888,6 +888,7 @@ public final class ActivityThread extends ClientTransactionHandler ApplicationInfo appInfo; String sdkSandboxClientAppVolumeUuid; String sdkSandboxClientAppPackage; boolean isSdkInSandbox; @UnsupportedAppUsage List<ProviderInfo> providers; ComponentName instrumentationName; Loading Loading @@ -1169,19 +1170,34 @@ public final class ActivityThread extends ClientTransactionHandler } @Override public final void bindApplication(String processName, ApplicationInfo appInfo, String sdkSandboxClientAppVolumeUuid, String sdkSandboxClientAppPackage, ProviderInfoList providerList, ComponentName instrumentationName, ProfilerInfo profilerInfo, Bundle instrumentationArgs, public final void bindApplication( String processName, ApplicationInfo appInfo, String sdkSandboxClientAppVolumeUuid, String sdkSandboxClientAppPackage, boolean isSdkInSandbox, ProviderInfoList providerList, ComponentName instrumentationName, ProfilerInfo profilerInfo, Bundle instrumentationArgs, IInstrumentationWatcher instrumentationWatcher, IUiAutomationConnection instrumentationUiConnection, int debugMode, boolean enableBinderTracking, boolean trackAllocation, boolean isRestrictedBackupMode, boolean persistent, Configuration config, CompatibilityInfo compatInfo, Map services, Bundle coreSettings, String buildSerial, AutofillOptions autofillOptions, ContentCaptureOptions contentCaptureOptions, long[] disabledCompatChanges, IUiAutomationConnection instrumentationUiConnection, int debugMode, boolean enableBinderTracking, boolean trackAllocation, boolean isRestrictedBackupMode, boolean persistent, Configuration config, CompatibilityInfo compatInfo, Map services, Bundle coreSettings, String buildSerial, AutofillOptions autofillOptions, ContentCaptureOptions contentCaptureOptions, long[] disabledCompatChanges, SharedMemory serializedSystemFontMap, long startRequestedElapsedTime, long startRequestedUptime) { long startRequestedElapsedTime, long startRequestedUptime) { if (services != null) { if (false) { // Test code to make sure the app could see the passed-in services. Loading Loading @@ -1215,6 +1231,7 @@ public final class ActivityThread extends ClientTransactionHandler data.appInfo = appInfo; data.sdkSandboxClientAppVolumeUuid = sdkSandboxClientAppVolumeUuid; data.sdkSandboxClientAppPackage = sdkSandboxClientAppPackage; data.isSdkInSandbox = isSdkInSandbox; data.providers = providerList.getList(); data.instrumentationName = instrumentationName; data.instrumentationArgs = instrumentationArgs; Loading Loading @@ -7213,8 +7230,14 @@ public final class ActivityThread extends ClientTransactionHandler // The test context's op package name == the target app's op package name, because // the app ops manager checks the op package name against the real calling UID, // which is what the target package name is associated with. final ContextImpl instrContext = ContextImpl.createAppContext(this, pi, appContext.getOpPackageName()); // In the case of instrumenting an sdk running in the sdk sandbox, appContext refers // to the context of the sdk running in the sandbox. Since the sandbox does not have // access to data outside the sandbox, we require the instrContext to point to the // sdk in the sandbox as well, and not to the test context. final ContextImpl instrContext = (data.isSdkInSandbox) ? appContext : ContextImpl.createAppContext(this, pi, appContext.getOpPackageName()); try { final ClassLoader cl = instrContext.getClassLoader(); Loading
core/java/android/app/IApplicationThread.aidl +1 −0 Original line number Diff line number Diff line Loading @@ -78,6 +78,7 @@ oneway interface IApplicationThread { void scheduleStopService(IBinder token); void bindApplication(in String packageName, in ApplicationInfo info, in String sdkSandboxClientAppVolumeUuid, in String sdkSandboxClientAppPackage, in boolean isSdkInSandbox, in ProviderInfoList providerList, in ComponentName testName, in ProfilerInfo profilerInfo, in Bundle testArguments, IInstrumentationWatcher testWatcher, IUiAutomationConnection uiAutomationConnection, Loading
services/core/java/com/android/server/am/ActiveInstrumentation.java +3 −0 Original line number Diff line number Diff line Loading @@ -40,6 +40,9 @@ class ActiveInstrumentation { // The application being instrumented ApplicationInfo mTargetInfo; // Whether the application is instrumented as an sdk running in the sdk_sandbox. boolean mIsSdkInSandbox; // Where to save profiling String mProfileFile; Loading
services/core/java/com/android/server/am/ActivityManagerService.java +4 −2 Original line number Diff line number Diff line Loading @@ -4655,6 +4655,7 @@ public class ActivityManagerService extends IActivityManager.Stub } else if (instr2 != null) { thread.bindApplication(processName, appInfo, app.sdkSandboxClientAppVolumeUuid, app.sdkSandboxClientAppPackage, instr2.mIsSdkInSandbox, providerList, instr2.mClass, profilerInfo, instr2.mArguments, Loading @@ -4671,6 +4672,7 @@ public class ActivityManagerService extends IActivityManager.Stub } else { thread.bindApplication(processName, appInfo, app.sdkSandboxClientAppVolumeUuid, app.sdkSandboxClientAppPackage, /* isSdkInSandbox= */ false, providerList, null, profilerInfo, null, null, null, testMode, mBinderTransactionTrackingEnabled, enableTrackAllocation, isRestrictedBackupMode || !normalMode, app.isPersistent(), Loading Loading @@ -15436,6 +15438,7 @@ public class ActivityManagerService extends IActivityManager.Stub activeInstr.mClass = className; activeInstr.mTargetProcesses = new String[]{sdkSandboxInfo.processName}; activeInstr.mTargetInfo = sdkSandboxInfo; activeInstr.mIsSdkInSandbox = isSdkInSandbox; activeInstr.mProfileFile = profileFile; activeInstr.mArguments = arguments; activeInstr.mWatcher = watcher; Loading @@ -15452,7 +15455,6 @@ public class ActivityManagerService extends IActivityManager.Stub sandboxManagerLocal.notifyInstrumentationStarted( sdkSandboxClientAppInfo.packageName, sdkSandboxClientAppInfo.uid); synchronized (mProcLock) { int sdkSandboxUid = Process.toSdkSandboxUid(sdkSandboxClientAppInfo.uid); // Kill the package sdk sandbox process belong to. At this point sdk sandbox is // already killed. forceStopPackageLocked( Loading @@ -15471,7 +15473,7 @@ public class ActivityManagerService extends IActivityManager.Stub sdkSandboxInfo.processName, /* isolated= */ false, /* isSdkSandbox= */ true, sdkSandboxUid, sdkSandboxInfo.uid, sdkSandboxClientAppInfo.packageName, disableHiddenApiChecks, disableTestApiChecks,
services/tests/mockingservicestests/src/com/android/server/am/AsyncProcessStartTest.java +2 −2 Original line number Diff line number Diff line Loading @@ -200,7 +200,7 @@ public class AsyncProcessStartTest { return null; }).when(thread).bindApplication( any(), any(), any(), any(), any(), any(), anyBoolean(), any(), any(), any(), any(), any(), Loading Loading @@ -260,7 +260,7 @@ public class AsyncProcessStartTest { /* expectedStartSeq */ 0, /* procAttached */ false); app.getThread().bindApplication(PACKAGE, appInfo, null, null, null, null, false, null, null, null, null, Loading