diff options
author | Felipe Leme <felipeal@google.com> | 2015-06-10 12:10:57 -0700 |
---|---|---|
committer | Felipe Leme <felipeal@google.com> | 2015-06-10 13:44:04 -0700 |
commit | f36a0f5d178786d07ab2d674003cf865c9e7a35f (patch) | |
tree | 4848277545058f4a3b51484844e4055c6b97b7ab /cmds/am | |
parent | f22030d1c59aca4f9ad2af7d4c4d646b0b619f27 (diff) | |
download | frameworks_base-f36a0f5d178786d07ab2d674003cf865c9e7a35f.zip frameworks_base-f36a0f5d178786d07ab2d674003cf865c9e7a35f.tar.gz frameworks_base-f36a0f5d178786d07ab2d674003cf865c9e7a35f.tar.bz2 |
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
Diffstat (limited to 'cmds/am')
-rw-r--r-- | cmds/am/src/com/android/commands/am/Am.java | 58 |
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(); |