summaryrefslogtreecommitdiff
path: root/core/java/android/os/ShellCommand.java
diff options
context:
space:
mode:
authorTodd Kennedy <toddke@google.com>2015-11-03 17:08:55 -0800
committerTodd Kennedy <toddke@google.com>2015-11-06 09:27:22 -0800
commitec059d839de6d061085dcfd85ce6565dcf4d5b69 (patch)
tree4c308cdb1e40506262faa5146c806968a3911b08 /core/java/android/os/ShellCommand.java
parent8382f98f6246c514106ca2bd88ab9f3c8d2ff5c8 (diff)
Move 'un/install' to cmd
Move the implementation of the install variants and uninstall to the cmd command. Additionally, make two other important changes: 1) replace calls to the legacy PackageManager#installPackageAsUser with the PackageInstaller 2) allow streaming package bits for 'pm install' Change-Id: Ia49dac0ccd6470f9d1c1964bdeb3c0b22b856075
Diffstat (limited to 'core/java/android/os/ShellCommand.java')
-rw-r--r--core/java/android/os/ShellCommand.java11
1 files changed, 11 insertions, 0 deletions
diff --git a/core/java/android/os/ShellCommand.java b/core/java/android/os/ShellCommand.java
index 73c2c804bdf1..cad482b6bab9 100644
--- a/core/java/android/os/ShellCommand.java
+++ b/core/java/android/os/ShellCommand.java
@@ -19,8 +19,11 @@ package android.os;
import android.util.Slog;
import com.android.internal.util.FastPrintWriter;
+import java.io.BufferedInputStream;
import java.io.FileDescriptor;
+import java.io.FileInputStream;
import java.io.FileOutputStream;
+import java.io.InputStream;
import java.io.PrintWriter;
/**
@@ -43,6 +46,7 @@ public abstract class ShellCommand {
private FastPrintWriter mOutPrintWriter;
private FastPrintWriter mErrPrintWriter;
+ private InputStream mInputStream;
public int exec(Binder target, FileDescriptor in, FileDescriptor out, FileDescriptor err,
String[] args, ResultReceiver resultReceiver) {
@@ -111,6 +115,13 @@ public abstract class ShellCommand {
return mErrPrintWriter;
}
+ public InputStream getInputStream() {
+ if (mInputStream == null) {
+ mInputStream = new BufferedInputStream(new FileInputStream(mIn));
+ }
+ return mInputStream;
+ }
+
/**
* 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.