summaryrefslogtreecommitdiff
path: root/core/java
diff options
context:
space:
mode:
authorMike Ma <yanmin@google.com>2017-10-31 12:30:42 -0700
committerMike Ma <yanmin@google.com>2017-11-01 14:20:31 -0700
commitd2239828d608a936e8a92319ce9c2b415998acb8 (patch)
tree853e1ee7885b54411e32bdefb933655c2c16c661 /core/java
parentf8a9169949c589755d300530f7b2390e687a9f8b (diff)
Record proto to file in am instrument
Add an option -f to record instrumentdata proto produced by am instrument to a file in addition to printing to stdout. Default path is /sdcard/instrument-logs/log-yyyyMMdd-hhmmss-SSS.instrumentation_data_proto. If the file exits, it will be deleted before writing. Path can be changed via optional <FILE> argument after -f. If -f and -m are both present, proto will be written to a file and print to stdout. Test: build, flash and run: bit -bi FrameworksCoreTests adb shell am instrument -w -r -f tmp/tmp.log \ -e class com.android.internal.os.BatteryStatsNoteTest \ com.android.frameworks.coretests/android.support.test.runner.AndroidJUnitRunner Change-Id: Iabc320c066d5995eee842c26416623eeb3d403f4
Diffstat (limited to 'core/java')
-rw-r--r--core/java/com/android/internal/os/BaseCommand.java8
1 files changed, 8 insertions, 0 deletions
diff --git a/core/java/com/android/internal/os/BaseCommand.java b/core/java/com/android/internal/os/BaseCommand.java
index 3baccee049b0..05ec9e90513e 100644
--- a/core/java/com/android/internal/os/BaseCommand.java
+++ b/core/java/com/android/internal/os/BaseCommand.java
@@ -106,6 +106,14 @@ public abstract class BaseCommand {
}
/**
+ * Peek the next argument on the command line, whatever it is; if there are
+ * no arguments left, return null.
+ */
+ public String peekNextArg() {
+ return mArgs.peekNextArg();
+ }
+
+ /**
* Return the next argument on the command line, whatever it is; if there are
* no arguments left, throws an IllegalArgumentException to report this to the user.
*/