Merge "Add 'am start-foreground-service' shell command" into oc-dev am: 1157116b0c
am: 86ca9f3826 Change-Id: I2eda3f0d4e4e841b0a391c6734069df1f45ee1c7
This commit is contained in:
commit
798ba732eb
@ -145,7 +145,12 @@ final class ActivityManagerShellCommand extends ShellCommand {
|
||||
return runStartActivity(pw);
|
||||
case "startservice":
|
||||
case "start-service":
|
||||
return runStartService(pw);
|
||||
return runStartService(pw, false);
|
||||
case "startforegroundservice":
|
||||
case "startfgservice":
|
||||
case "start-foreground-service":
|
||||
case "start-fg-service":
|
||||
return runStartService(pw, true);
|
||||
case "stopservice":
|
||||
case "stop-service":
|
||||
return runStopService(pw);
|
||||
@ -504,7 +509,7 @@ final class ActivityManagerShellCommand extends ShellCommand {
|
||||
return 0;
|
||||
}
|
||||
|
||||
int runStartService(PrintWriter pw) throws RemoteException {
|
||||
int runStartService(PrintWriter pw, boolean asForeground) throws RemoteException {
|
||||
final PrintWriter err = getErrPrintWriter();
|
||||
Intent intent;
|
||||
try {
|
||||
@ -519,7 +524,7 @@ final class ActivityManagerShellCommand extends ShellCommand {
|
||||
pw.println("Starting service: " + intent);
|
||||
pw.flush();
|
||||
ComponentName cn = mInterface.startService(null, intent, intent.getType(),
|
||||
-1, null, false, SHELL_PACKAGE_NAME, mUserId);
|
||||
-1, null, asForeground, SHELL_PACKAGE_NAME, mUserId);
|
||||
if (cn == null) {
|
||||
err.println("Error: Not found; no service started.");
|
||||
return -1;
|
||||
|
Loading…
x
Reference in New Issue
Block a user