summaryrefslogtreecommitdiffstats
path: root/cmds
diff options
context:
space:
mode:
authorFelipe Leme <felipeal@google.com>2015-06-10 20:53:23 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2015-06-10 20:53:24 +0000
commita6dd714a5ab620cf5b84c2d1f680ddacf763559d (patch)
treebd39933a1f822ef91b10f5d9b9fa2062424b9fbf /cmds
parent7cbe9f03a968ef42840d234ea325b69f4b1f1417 (diff)
parentf36a0f5d178786d07ab2d674003cf865c9e7a35f (diff)
downloadframeworks_base-a6dd714a5ab620cf5b84c2d1f680ddacf763559d.zip
frameworks_base-a6dd714a5ab620cf5b84c2d1f680ddacf763559d.tar.gz
frameworks_base-a6dd714a5ab620cf5b84c2d1f680ddacf763559d.tar.bz2
Merge "Added new options (--eial, --elal, --efal, and --esal) to pass multiple extras as ArrayList instead of Array. BUG: 21757911 Change-Id: I7e2a9c81ad4606a8aba90ea4820ba0732a1c8749 modified: src/com/android/commands/am/Am.java On branch handles_array_list Changes to be committed: modified: src/com/android/commands/am/Am.java" into mnc-dev
Diffstat (limited to 'cmds')
-rw-r--r--cmds/am/src/com/android/commands/am/Am.java58
1 files changed, 56 insertions, 2 deletions
diff --git a/cmds/am/src/com/android/commands/am/Am.java b/cmds/am/src/com/android/commands/am/Am.java
index b0a7dc7..bf3b455 100644
--- a/cmds/am/src/com/android/commands/am/Am.java
+++ b/cmds/am/src/com/android/commands/am/Am.java
@@ -305,11 +305,23 @@ public class Am extends BaseCommand {
" [--eu <EXTRA_KEY> <EXTRA_URI_VALUE> ...]\n" +
" [--ecn <EXTRA_KEY> <EXTRA_COMPONENT_NAME_VALUE>]\n" +
" [--eia <EXTRA_KEY> <EXTRA_INT_VALUE>[,<EXTRA_INT_VALUE...]]\n" +
+ " (mutiple extras passed as Integer[])\n" +
+ " [--eial <EXTRA_KEY> <EXTRA_INT_VALUE>[,<EXTRA_INT_VALUE...]]\n" +
+ " (mutiple extras passed as List<Integer>)\n" +
" [--ela <EXTRA_KEY> <EXTRA_LONG_VALUE>[,<EXTRA_LONG_VALUE...]]\n" +
+ " (mutiple extras passed as Long[])\n" +
+ " [--elal <EXTRA_KEY> <EXTRA_LONG_VALUE>[,<EXTRA_LONG_VALUE...]]\n" +
+ " (mutiple extras passed as List<Long>)\n" +
" [--efa <EXTRA_KEY> <EXTRA_FLOAT_VALUE>[,<EXTRA_FLOAT_VALUE...]]\n" +
+ " (mutiple extras passed as Float[])\n" +
+ " [--efal <EXTRA_KEY> <EXTRA_FLOAT_VALUE>[,<EXTRA_FLOAT_VALUE...]]\n" +
+ " (mutiple extras passed as List<Float>)\n" +
" [--esa <EXTRA_KEY> <EXTRA_STRING_VALUE>[,<EXTRA_STRING_VALUE...]]\n" +
- " (to embed a comma into a string escape it using \"\\,\")\n" +
- " [-n <COMPONENT>] [-p <PACKAGE>] [-f <FLAGS>]\n" +
+ " (mutiple extras passed as String[]; to embed a comma into a string,\n" +
+ " escape it using \"\\,\")\n" +
+ " [--esal <EXTRA_KEY> <EXTRA_STRING_VALUE>[,<EXTRA_STRING_VALUE...]]\n" +
+ " (mutiple extras passed as List<String>; to embed a comma into a string,\n" +
+ " escape it using \"\\,\")\n" +
" [--grant-read-uri-permission] [--grant-write-uri-permission]\n" +
" [--grant-persistable-uri-permission] [--grant-prefix-uri-permission]\n" +
" [--debug-log-resolution] [--exclude-stopped-packages]\n" +
@@ -490,6 +502,15 @@ public class Am extends BaseCommand {
list[i] = Integer.decode(strings[i]);
}
intent.putExtra(key, list);
+ } else if (opt.equals("--eial")) {
+ String key = nextArgRequired();
+ String value = nextArgRequired();
+ String[] strings = value.split(",");
+ ArrayList<Integer> list = new ArrayList<>(strings.length);
+ for (int i = 0; i < strings.length; i++) {
+ list.add(Integer.decode(strings[i]));
+ }
+ intent.putExtra(key, list);
} else if (opt.equals("--el")) {
String key = nextArgRequired();
String value = nextArgRequired();
@@ -504,6 +525,16 @@ public class Am extends BaseCommand {
}
intent.putExtra(key, list);
hasIntentInfo = true;
+ } else if (opt.equals("--elal")) {
+ String key = nextArgRequired();
+ String value = nextArgRequired();
+ String[] strings = value.split(",");
+ ArrayList<Long> list = new ArrayList<>(strings.length);
+ for (int i = 0; i < strings.length; i++) {
+ list.add(Long.valueOf(strings[i]));
+ }
+ intent.putExtra(key, list);
+ hasIntentInfo = true;
} else if (opt.equals("--ef")) {
String key = nextArgRequired();
String value = nextArgRequired();
@@ -519,6 +550,16 @@ public class Am extends BaseCommand {
}
intent.putExtra(key, list);
hasIntentInfo = true;
+ } else if (opt.equals("--efal")) {
+ String key = nextArgRequired();
+ String value = nextArgRequired();
+ String[] strings = value.split(",");
+ ArrayList<Float> list = new ArrayList<>(strings.length);
+ for (int i = 0; i < strings.length; i++) {
+ list.add(Float.valueOf(strings[i]));
+ }
+ intent.putExtra(key, list);
+ hasIntentInfo = true;
} else if (opt.equals("--esa")) {
String key = nextArgRequired();
String value = nextArgRequired();
@@ -528,6 +569,19 @@ public class Am extends BaseCommand {
String[] strings = value.split("(?<!\\\\),");
intent.putExtra(key, strings);
hasIntentInfo = true;
+ } else if (opt.equals("--esal")) {
+ String key = nextArgRequired();
+ String value = nextArgRequired();
+ // Split on commas unless they are preceeded by an escape.
+ // The escape character must be escaped for the string and
+ // again for the regex, thus four escape characters become one.
+ String[] strings = value.split("(?<!\\\\),");
+ ArrayList<String> list = new ArrayList<>(strings.length);
+ for (int i = 0; i < strings.length; i++) {
+ list.add(strings[i]);
+ }
+ intent.putExtra(key, list);
+ hasIntentInfo = true;
} else if (opt.equals("--ez")) {
String key = nextArgRequired();
String value = nextArgRequired().toLowerCase();