From 4e6a314e7398a28ed5cbda0ad13202ee119e7685 Mon Sep 17 00:00:00 2001 From: Orion Hodson Date: Mon, 8 Apr 2019 10:12:02 +0100 Subject: [PATCH] ActivityManager: process stop needs a process to stop Make process a required argument for am process stop to avoid silent failure. Minor usage clean-up for am process commands. Bug: 129892812 Test: manual Change-Id: Ib5f3c225c79af65f66c22b24abbef210bb383c8e --- .../am/ActivityManagerShellCommand.java | 21 ++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/services/core/java/com/android/server/am/ActivityManagerShellCommand.java b/services/core/java/com/android/server/am/ActivityManagerShellCommand.java index b03628930dd6d..3399a76f358f5 100644 --- a/services/core/java/com/android/server/am/ActivityManagerShellCommand.java +++ b/services/core/java/com/android/server/am/ActivityManagerShellCommand.java @@ -787,7 +787,7 @@ final class ActivityManagerShellCommand extends ShellCommand { return -1; } } - process = getNextArg(); + process = getNextArgRequired(); } else { // Compatibility with old syntax: process is specified first. process = cmd; @@ -2919,15 +2919,22 @@ final class ActivityManagerShellCommand extends ShellCommand { pw.println(" start: start tracing IPC transactions."); pw.println(" stop: stop tracing IPC transactions and dump the results to file."); pw.println(" --dump-file : Specify the file the trace should be dumped to."); - pw.println(" profile [start|stop] [--user current] [--sampling INTERVAL]"); - pw.println(" [--streaming] "); - pw.println(" Start and stop profiler on a process. The given argument"); + pw.println(" profile start [--user current]"); + pw.println(" [--sampling INTERVAL | --streaming] "); + pw.println(" Start profiler on a process. The given argument"); pw.println(" may be either a process name or pid. Options are:"); pw.println(" --user | current: When supplying a process name,"); - pw.println(" specify user of process to profile; uses current user if not specified."); + pw.println(" specify user of process to profile; uses current user if not"); + pw.println(" specified."); pw.println(" --sampling INTERVAL: use sample profiling with INTERVAL microseconds"); - pw.println(" between samples"); - pw.println(" --streaming: stream the profiling output to the specified file"); + pw.println(" between samples."); + pw.println(" --streaming: stream the profiling output to the specified file."); + pw.println(" profile stop [--user current] "); + pw.println(" Stop profiler on a process. The given argument"); + pw.println(" may be either a process name or pid. Options are:"); + pw.println(" --user | current: When supplying a process name,"); + pw.println(" specify user of process to profile; uses current user if not"); + pw.println(" specified."); pw.println(" dumpheap [--user current] [-n] [-g] "); pw.println(" Dump the heap of a process. The given argument may"); pw.println(" be either a process name or pid. Options are:");