Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 28600e26 authored by Dale Hawkins's avatar Dale Hawkins
Browse files

Adds support for array string extra.

Adds support for setting an array string extra on an intent when
launching an activity/service.  Allows inclusion of commas using
an escape character.

Change-Id: I8857f7d28d60b75ddc65dc47f345a77230d00467
parent adcd253a
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -232,6 +232,8 @@ public class Am extends BaseCommand {
                "    [--eia <EXTRA_KEY> <EXTRA_INT_VALUE>[,<EXTRA_INT_VALUE...]]\n" +
                "    [--ela <EXTRA_KEY> <EXTRA_LONG_VALUE>[,<EXTRA_LONG_VALUE...]]\n" +
                "    [--efa <EXTRA_KEY> <EXTRA_FLOAT_VALUE>[,<EXTRA_FLOAT_VALUE...]]\n" +
                "    [--esa <EXTRA_KEY> <EXTRA_STRING_VALUE>[,<EXTRA_STRING_VALUE...]]\n" +
                "        (to embed a comma into a string escape it using \"\\,\")\n" +
                "    [-n <COMPONENT>] [-f <FLAGS>]\n" +
                "    [--grant-read-uri-permission] [--grant-write-uri-permission]\n" +
                "    [--debug-log-resolution] [--exclude-stopped-packages]\n" +
@@ -419,6 +421,15 @@ public class Am extends BaseCommand {
                }
                intent.putExtra(key, list);
                hasIntentInfo = true;
            } else if (opt.equals("--esa")) {
                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("(?<!\\\\),");
                intent.putExtra(key, strings);
                hasIntentInfo = true;
            } else if (opt.equals("--ez")) {
                String key = nextArgRequired();
                String value = nextArgRequired();