summaryrefslogtreecommitdiff
path: root/core/java/android/os/ShellCommand.java
diff options
context:
space:
mode:
authorDianne Hackborn <hackbod@google.com>2016-10-07 17:57:00 -0700
committerDianne Hackborn <hackbod@google.com>2016-10-10 16:58:12 -0700
commit331084dca66ec2dc0b32f689c7a5c5252e0c7d3f (patch)
tree0e8a5b71f2d683c9effe7f3f80a72170d6458765 /core/java/android/os/ShellCommand.java
parent9cf75061b143196c97c31726655c7e5c4ada8814 (diff)
Move the remaining am commands to ActivityManagerShellCommand.
The only thing not removed is the "instrument" command, which really needs to run Java code in the shell. We'll deal with that later. Test: manual Change-Id: I9df0cdf831ac280cb0eb85c857d27166bc00604d
Diffstat (limited to 'core/java/android/os/ShellCommand.java')
-rw-r--r--core/java/android/os/ShellCommand.java19
1 files changed, 19 insertions, 0 deletions
diff --git a/core/java/android/os/ShellCommand.java b/core/java/android/os/ShellCommand.java
index 831c9b27ac45..dbb9650a7cb9 100644
--- a/core/java/android/os/ShellCommand.java
+++ b/core/java/android/os/ShellCommand.java
@@ -188,6 +188,25 @@ public abstract class ShellCommand {
}
/**
+ * Helper for just system services to ask the shell to open an output file.
+ * @hide
+ */
+ public ParcelFileDescriptor openOutputFileForSystem(String path) {
+ try {
+ ParcelFileDescriptor pfd = getShellCallback().openOutputFile(path,
+ "u:r:system_server:s0");
+ if (pfd != null) {
+ return pfd;
+ }
+ } catch (RuntimeException e) {
+ getErrPrintWriter().println("Failure opening file: " + e.getMessage());
+ }
+ getErrPrintWriter().println("Error: Unable to open file: " + path);
+ getErrPrintWriter().println("Consider using a file under /data/local/tmp/");
+ return null;
+ }
+
+ /**
* Return the next option on the command line -- that is an argument that
* starts with '-'. If the next argument is not an option, null is returned.
*/