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/dumpsys/dumpsys.h b/cmds/dumpsys/dumpsys.h
index c48a1e9..929c55c 100644
--- a/cmds/dumpsys/dumpsys.h
+++ b/cmds/dumpsys/dumpsys.h
@@ -51,6 +51,11 @@
      */
     static void setServiceArgs(Vector<String16>& args, bool asProto, int priorityFlags);
 
+    enum class Type {
+        DUMP,  // dump using `dump` function
+        PID,   // dump pid of server only
+    };
+
     /**
      * Starts a thread to connect to a service and get its dump output. The thread redirects
      * the output to a pipe. Thread must be stopped by a subsequent callto {@code
@@ -61,7 +66,8 @@
      *         {@code NAME_NOT_FOUND} service could not be found.
      *         {@code != OK} error
      */
-    status_t startDumpThread(const String16& serviceName, const Vector<String16>& args);
+    status_t startDumpThread(Type type, const String16& serviceName,
+                             const Vector<String16>& args);
 
     /**
      * Writes a section header to a file descriptor.