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

Commit fdc9fe8d authored by Artur Satayev's avatar Artur Satayev
Browse files

Swap default for disableTestApiChecks.

There are more runners than those updated in tradefed/testtype/, which donot/cannot push --no-test-api-checks arg to `am instrument`. Instead reverse the default, so that by default `am instrument` disables test api enforcement policy.

Test: atest CtsHiddenApiBlacklistApi27TestCases \
        CtsHiddenApiBlacklistApi28TestCases \
        CtsHiddenApiBlacklistCurrentApiTestCases \
        CtsHiddenApiBlacklistDebugClassTestCases \
        CtsHiddenApiBlacklistTestApiTestCases \
        CtsAppSecurityHostTestCases:android.appsecurity.cts.ExternalStorageHostTest#testMediaEscalation \
        CtsAppSecurityHostTestCases:android.appsecurity.cts.StorageHostTest#testVerify \
        CtsAppSecurityHostTestCases:android.appsecurity.cts.DirectBootHostTest#testDirectBootNative
Exempt-From-Owner-Approval: small fix
Bug: 133832325
Change-Id: Id1870cdd4bb0a51bddede24afd7f87d6e5ec766c
parent 168c6090
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -175,7 +175,11 @@ public class Am extends BaseCommand {
            } else if (opt.equals("--no-hidden-api-checks")) {
                instrument.disableHiddenApiChecks = true;
            } else if (opt.equals("--no-test-api-checks")) {
                instrument.disableTestApiChecks = true;
                // TODO(satayev): remove this option, only kept for backwards compatibility with
                // cached tradefed instance
                instrument.disableTestApiChecks = false;
            } else if (opt.equals("--no-test-api-access")) {
                instrument.disableTestApiChecks = false;
            } else if (opt.equals("--no-isolated-storage")) {
                instrument.disableIsolatedStorage = true;
            } else if (opt.equals("--user")) {
+1 −1
Original line number Diff line number Diff line
@@ -86,7 +86,7 @@ public class Instrument {
    String logPath = null;
    public boolean noWindowAnimation = false;
    public boolean disableHiddenApiChecks = false;
    public boolean disableTestApiChecks = false;
    public boolean disableTestApiChecks = true;
    public boolean disableIsolatedStorage = false;
    public String abi = null;
    public int userId = UserHandle.USER_CURRENT;
+2 −2
Original line number Diff line number Diff line
@@ -3029,7 +3029,7 @@ final class ActivityManagerShellCommand extends ShellCommand {
            pw.println("      --receiver-permission <PERMISSION>: Require receiver to hold permission.");
            pw.println("  instrument [-r] [-e <NAME> <VALUE>] [-p <FILE>] [-w]");
            pw.println("          [--user <USER_ID> | current]");
            pw.println("          [--no-hidden-api-checks [--no-test-api-checks]]");
            pw.println("          [--no-hidden-api-checks [--no-test-api-access]]");
            pw.println("          [--no-isolated-storage]");
            pw.println("          [--no-window-animation] [--abi <ABI>] <COMPONENT>");
            pw.println("      Start an Instrumentation.  Typically this target <COMPONENT> is in the");
@@ -3049,7 +3049,7 @@ final class ActivityManagerShellCommand extends ShellCommand {
            pw.println("      --user <USER_ID> | current: Specify user instrumentation runs in;");
            pw.println("          current user if not specified.");
            pw.println("      --no-hidden-api-checks: disable restrictions on use of hidden API.");
            pw.println("      --no-test-api-checks: disable restrictions to test APIs, if hidden");
            pw.println("      --no-test-api-access: do not allow access to test APIs, if hidden");
            pw.println("          API checks are enabled.");
            pw.println("      --no-isolated-storage: don't use isolated storage sandbox and ");
            pw.println("          mount full external storage");