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-09 15:07:18 -0800
commit72cfcd02b89838264b018e9b9417d2829c87b7e2 (patch)
tree60ac079f1443ce0d63643649b51b4071e6e33f18 /core/java/android/os/ShellCommand.java
parent0afcfdca963f4cefcb90ac7061aafe3985875145 (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: I5680f57208d377daadb69b2cc09c233c02fe5016
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.