summaryrefslogtreecommitdiffstats
path: root/cmds/am/src
diff options
context:
space:
mode:
authorDoug Zongker <dougz@android.com>2010-02-24 11:13:26 -0800
committerDoug Zongker <dougz@android.com>2010-02-24 11:37:35 -0800
commit6fb35fe1accfbdcbf0252e55cf7ef823c12f4c05 (patch)
tree9665f7db74016860efaf894244562c8f39d3f297 /cmds/am/src
parent9ff1f96fdf1c88c55c45e0876b10a3a9686dc28a (diff)
downloadframeworks_base-6fb35fe1accfbdcbf0252e55cf7ef823c12f4c05.zip
frameworks_base-6fb35fe1accfbdcbf0252e55cf7ef823c12f4c05.tar.gz
frameworks_base-6fb35fe1accfbdcbf0252e55cf7ef823c12f4c05.tar.bz2
add "startservice" option to am command-line utility
Allows starting Services in addition to Activities. Change-Id: Ib078115f6200faa8907b35909af2f64b0c563b38
Diffstat (limited to 'cmds/am/src')
-rw-r--r--cmds/am/src/com/android/commands/am/Am.java13
1 files changed, 13 insertions, 0 deletions
diff --git a/cmds/am/src/com/android/commands/am/Am.java b/cmds/am/src/com/android/commands/am/Am.java
index d640de1..b6c9de4 100644
--- a/cmds/am/src/com/android/commands/am/Am.java
+++ b/cmds/am/src/com/android/commands/am/Am.java
@@ -88,6 +88,8 @@ public class Am {
if (op.equals("start")) {
runStart();
+ } else if (op.equals("startservice")) {
+ runStartService();
} else if (op.equals("instrument")) {
runInstrument();
} else if (op.equals("broadcast")) {
@@ -183,6 +185,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);
@@ -496,6 +507,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" +