dumpsys: add --pid option
We can't change the output format of dumpsys since too many places rely
on it, so introducing a separate option to dump the PID of a service.
Fixes: 141187318
Test: dumpsys_test, bugreport, also:
$ adb shell dumpsys --pid
...
-------------------------------------------------------------------------------
DUMP OF SERVICE package_native:
1165
--------- 0.001s was the duration of dumpsys package_native, ending at: 2019-10-08 20:35:32
...
(dumps pids of all services)
or with specific service name only:
$ dumpsys --pid package_native
1165
Change-Id: Iaa2478568245ca7d10d2e3f8ebafe43d2d26df2c
diff --git a/cmds/dumpstate/dumpstate.cpp b/cmds/dumpstate/dumpstate.cpp
index 739f9ca..67f12e8 100644
--- a/cmds/dumpstate/dumpstate.cpp
+++ b/cmds/dumpstate/dumpstate.cpp
@@ -1082,7 +1082,7 @@
std::string path(title);
path.append(" - ").append(String8(service).c_str());
size_t bytes_written = 0;
- status_t status = dumpsys.startDumpThread(service, args);
+ status_t status = dumpsys.startDumpThread(Dumpsys::Type::DUMP, service, args);
if (status == OK) {
dumpsys.writeDumpHeader(STDOUT_FILENO, service, priority);
std::chrono::duration<double> elapsed_seconds;
@@ -1154,7 +1154,7 @@
path.append("_HIGH");
}
path.append(kProtoExt);
- status_t status = dumpsys.startDumpThread(service, args);
+ status_t status = dumpsys.startDumpThread(Dumpsys::Type::DUMP, service, args);
if (status == OK) {
status = ds.AddZipEntryFromFd(path, dumpsys.getDumpFd(), service_timeout);
bool dumpTerminated = (status == OK);