summaryrefslogtreecommitdiff
path: root/cmds/am/src
diff options
context:
space:
mode:
authorSudheer Shanka <sudheersai@google.com>2018-10-21 16:19:53 -0700
committerSudheer Shanka <sudheersai@google.com>2018-10-21 16:30:52 -0700
commit8f99bff2e417b7cf0ba9de331cb72c2c28693fa1 (patch)
treecf276c88b1b60b01b4e81b2c1fd1aea7f86d0d98 /cmds/am/src
parent5b3a6a81871925ff9a6fdcee2f90aa8a09b87670 (diff)
Add instrumentation flag to get access to full exteranl storage.
When starting a process under instrumentation using this new "--no-isolated-storage" flag, the process would be able to see the full external storage. Bug: 117229024 Test: adb shell am instrument --no-isolated-storage \ -e class android.media.cts.EncodeDecodeTest#testEncodeDecodeVideoFromBufferToBuffer720p \ -w android.media.cts/android.test.InstrumentationTestRunner Change-Id: I7973b123cf4fc08e8ce2b05bd4c23fa41b1cdcdf
Diffstat (limited to 'cmds/am/src')
-rw-r--r--cmds/am/src/com/android/commands/am/Am.java2
-rw-r--r--cmds/am/src/com/android/commands/am/Instrument.java16
2 files changed, 13 insertions, 5 deletions
diff --git a/cmds/am/src/com/android/commands/am/Am.java b/cmds/am/src/com/android/commands/am/Am.java
index c04e61b77274..41d546f6d603 100644
--- a/cmds/am/src/com/android/commands/am/Am.java
+++ b/cmds/am/src/com/android/commands/am/Am.java
@@ -174,6 +174,8 @@ public class Am extends BaseCommand {
instrument.noWindowAnimation = true;
} else if (opt.equals("--no-hidden-api-checks")) {
instrument.disableHiddenApiChecks = true;
+ } else if (opt.equals("--no-isolated-storage")) {
+ instrument.disableIsolatedStorage = true;
} else if (opt.equals("--user")) {
instrument.userId = parseUserArg(nextArgRequired());
} else if (opt.equals("--abi")) {
diff --git a/cmds/am/src/com/android/commands/am/Instrument.java b/cmds/am/src/com/android/commands/am/Instrument.java
index 0dade0b2ba81..70baa8702ba9 100644
--- a/cmds/am/src/com/android/commands/am/Instrument.java
+++ b/cmds/am/src/com/android/commands/am/Instrument.java
@@ -16,6 +16,9 @@
package com.android.commands.am;
+import static android.app.ActivityManager.INSTR_FLAG_DISABLE_HIDDEN_API_CHECKS;
+import static android.app.ActivityManager.INSTR_FLAG_MOUNT_EXTERNAL_STORAGE_FULL;
+
import android.app.IActivityManager;
import android.app.IInstrumentationWatcher;
import android.app.Instrumentation;
@@ -74,16 +77,13 @@ public class Instrument {
String logPath = null;
public boolean noWindowAnimation = false;
public boolean disableHiddenApiChecks = false;
+ public boolean disableIsolatedStorage = false;
public String abi = null;
public int userId = UserHandle.USER_CURRENT;
public Bundle args = new Bundle();
// Required
public String componentNameArg;
- // Disable hidden API checks for the newly started instrumentation.
- // Must be kept in sync with ActivityManagerService.
- private static final int INSTRUMENTATION_FLAG_DISABLE_HIDDEN_API_CHECKS = 1 << 0;
-
/**
* Construct the instrument command runner.
*/
@@ -480,7 +480,13 @@ public class Instrument {
}
// Start the instrumentation
- int flags = disableHiddenApiChecks ? INSTRUMENTATION_FLAG_DISABLE_HIDDEN_API_CHECKS : 0;
+ int flags = 0;
+ if (disableHiddenApiChecks) {
+ flags |= INSTR_FLAG_DISABLE_HIDDEN_API_CHECKS;
+ }
+ if (disableIsolatedStorage) {
+ flags |= INSTR_FLAG_MOUNT_EXTERNAL_STORAGE_FULL;
+ }
if (!mAm.startInstrumentation(cn, profileFile, flags, args, watcher, connection, userId,
abi)) {
throw new AndroidException("INSTRUMENTATION_FAILED: " + cn.flattenToString());