diff options
author | Jean-Baptiste Queru <jbq@google.com> | 2010-04-16 12:52:47 -0700 |
---|---|---|
committer | Jean-Baptiste Queru <jbq@google.com> | 2010-04-16 12:55:48 -0700 |
commit | 69acb6b746c82f88607b3365795ebb3279188eed (patch) | |
tree | cd36e73daeba0b2f24ba77fde8643e98c866eeca /cmds/am | |
parent | d4dd85d532dcd383a2f6b421e747b5ab07246d19 (diff) | |
download | frameworks_base-69acb6b746c82f88607b3365795ebb3279188eed.zip frameworks_base-69acb6b746c82f88607b3365795ebb3279188eed.tar.gz frameworks_base-69acb6b746c82f88607b3365795ebb3279188eed.tar.bz2 |
Unify am startservice commands.
This replaces the implementation with an equivalent one.
Change-Id: I1343ddee9414a67906cd426b8381ddbace873894
Diffstat (limited to 'cmds/am')
-rw-r--r-- | cmds/am/src/com/android/commands/am/Am.java | 26 |
1 files changed, 12 insertions, 14 deletions
diff --git a/cmds/am/src/com/android/commands/am/Am.java b/cmds/am/src/com/android/commands/am/Am.java index 3566caf..13e6d5c 100644 --- a/cmds/am/src/com/android/commands/am/Am.java +++ b/cmds/am/src/com/android/commands/am/Am.java @@ -88,7 +88,7 @@ public class Am { if (op.equals("start")) { runStart(); - } else if (op.equals("start-service")) { + } else if (op.equals("startservice")) { runStartService(); } else if (op.equals("instrument")) { runInstrument(); @@ -181,6 +181,15 @@ public class Am { return intent; } + private void runStartService() throws Exception { + Intent intent = makeIntent(); + System.out.println("Starting service: " + intent); + ComponentName cn = mAm.startService(null, intent, intent.getType()); + if (cn == null) { + System.err.println("Error: Not found; no service started."); + } + } + private void runStart() throws Exception { Intent intent = makeIntent(); System.out.println("Starting: " + intent); @@ -240,19 +249,6 @@ public class Am { } } - private void runStartService() throws Exception { - Intent intent = makeIntent(); - - if (intent != null) { - System.out.println("Starting: " + intent); - try { - mAm.startService(null, intent, intent.getType()); - } catch (Exception e) { - System.err.println("Error: " + e); - } - } - } - private void sendBroadcast() throws Exception { Intent intent = makeIntent(); IntentReceiver receiver = new IntentReceiver(); @@ -507,6 +503,8 @@ public class Am { " start an Activity: am start [-D] <INTENT>\n" + " -D: enable debugging\n" + "\n" + + " start a Service: am startservice <INTENT>\n" + + "\n" + " send a broadcast Intent: am broadcast <INTENT>\n" + "\n" + " start an Instrumentation: am instrument [flags] <COMPONENT>\n" + |