Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b021b2c8 authored by Sandro Montanari's avatar Sandro Montanari Committed by Android (Google) Code Review
Browse files

Merge "Add parameter to instrument tests for running sdk-in-sandbox"

parents ea785cc0 8a8aaa59
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -193,6 +193,9 @@ public class Am extends BaseCommand {
                instrument.alwaysCheckSignature = true;
            } else if (opt.equals("--instrument-sdk-sandbox")) {
                instrument.instrumentSdkSandbox = true;
            } else if (opt.equals("--instrument-sdk-in-sandbox")) {
                instrument.instrumentSdkSandbox = true;
                instrument.instrumentSdkInSandbox = true;
            } else {
                System.err.println("Error: Unknown option: " + opt);
                return;
+5 −0
Original line number Diff line number Diff line
@@ -20,6 +20,7 @@ import static android.app.ActivityManager.INSTR_FLAG_ALWAYS_CHECK_SIGNATURE;
import static android.app.ActivityManager.INSTR_FLAG_DISABLE_HIDDEN_API_CHECKS;
import static android.app.ActivityManager.INSTR_FLAG_DISABLE_ISOLATED_STORAGE;
import static android.app.ActivityManager.INSTR_FLAG_DISABLE_TEST_API_CHECKS;
import static android.app.ActivityManager.INSTR_FLAG_INSTRUMENT_SDK_IN_SANDBOX;
import static android.app.ActivityManager.INSTR_FLAG_INSTRUMENT_SDK_SANDBOX;
import static android.app.ActivityManager.INSTR_FLAG_NO_RESTART;

@@ -99,6 +100,7 @@ public class Instrument {
    public String componentNameArg;
    public boolean alwaysCheckSignature = false;
    public boolean instrumentSdkSandbox = false;
    public boolean instrumentSdkInSandbox = false;

    /**
     * Construct the instrument command runner.
@@ -530,6 +532,9 @@ public class Instrument {
            if (instrumentSdkSandbox) {
                flags |= INSTR_FLAG_INSTRUMENT_SDK_SANDBOX;
            }
            if (instrumentSdkInSandbox) {
                flags |= INSTR_FLAG_INSTRUMENT_SDK_IN_SANDBOX;
            }
            if (!mAm.startInstrumentation(cn, profileFile, flags, args, watcher, connection, userId,
                        abi)) {
                throw new AndroidException("INSTRUMENTATION_FAILED: " + cn.flattenToString());
+5 −0
Original line number Diff line number Diff line
@@ -192,6 +192,11 @@ public class ActivityManager {
     * @hide
     */
    public static final int INSTR_FLAG_INSTRUMENT_SDK_SANDBOX = 1 << 5;
    /**
     * Instrument an Sdk Sandbox process corresponding to an Sdk running inside the sandbox.
     * @hide
     */
    public static final int INSTR_FLAG_INSTRUMENT_SDK_IN_SANDBOX = 1 << 6;

    static final class UidObserver extends IUidObserver.Stub {
        final OnUidImportanceListener mListener;
+5 −3
Original line number Diff line number Diff line
@@ -15446,7 +15446,8 @@ public class ActivityManagerService extends IActivityManager.Stub
                        ai,
                        noRestart,
                        disableHiddenApiChecks,
                        disableTestApiChecks);
                        disableTestApiChecks,
                        (flags & ActivityManager.INSTR_FLAG_INSTRUMENT_SDK_IN_SANDBOX) != 0);
            }
            ActiveInstrumentation activeInstr = new ActiveInstrumentation(this);
@@ -15543,7 +15544,8 @@ public class ActivityManagerService extends IActivityManager.Stub
            ApplicationInfo sdkSandboxClientAppInfo,
            boolean noRestart,
            boolean disableHiddenApiChecks,
            boolean disableTestApiChecks) {
            boolean disableTestApiChecks,
            boolean isSdkInSandbox) {
        if (noRestart) {
            reportStartInstrumentationFailureLocked(
@@ -15565,7 +15567,7 @@ public class ActivityManagerService extends IActivityManager.Stub
        try {
            sdkSandboxInfo =
                    sandboxManagerLocal.getSdkSandboxApplicationInfoForInstrumentation(
                            sdkSandboxClientAppInfo, userId);
                            sdkSandboxClientAppInfo, userId, isSdkInSandbox);
        } catch (NameNotFoundException e) {
            reportStartInstrumentationFailureLocked(
                    watcher, className, "Can't find SdkSandbox package");