Add a flag that makes dumpstate wait for options
There are 2 ways of running bugreports. Running dumpstate binary
directly with command line options (existing flow), or running the
binary to start the binder service, which waits for a caller to supply
arguments like file descriptors to write output to (new flow to support
the bugreport triggering API).
Support the second flow with a new commandline flag.
Also add a new service that uses the flag, to be used in the API.
BUG:111441001
Test: adb shell setprop "ctl.start" "bugreportd" -> starts service &
waits.
Test: interactive bugreport still works
Change-Id: I64cd03d15f45a896692d7462998d4faa6e413ef1
diff --git a/cmds/dumpstate/dumpstate.rc b/cmds/dumpstate/dumpstate.rc
index 2e72574..14937b8 100644
--- a/cmds/dumpstate/dumpstate.rc
+++ b/cmds/dumpstate/dumpstate.rc
@@ -17,3 +17,9 @@
class main
disabled
oneshot
+
+# bugreportd starts dumpstate binder service and makes it wait for a listener to connect.
+service bugreportd /system/bin/dumpstate -w
+ class main
+ disabled
+ oneshot