Implement startBugreport binder function
The bugreport runs in a background thread.
Simplified the interface a bit by restricting to just the mode for now.
BUG: 117177665
Test: Builds
Change-Id: I5c9755086521b94224c248dcb72be61eeea0ecab
diff --git a/cmds/dumpstate/dumpstate.cpp b/cmds/dumpstate/dumpstate.cpp
index 7e42002..94e8877 100644
--- a/cmds/dumpstate/dumpstate.cpp
+++ b/cmds/dumpstate/dumpstate.cpp
@@ -2138,13 +2138,16 @@
return true;
}
-Dumpstate::RunStatus Dumpstate::RunWithOptions(std::unique_ptr<DumpOptions> options) {
- if (!options->ValidateOptions()) {
+void Dumpstate::SetOptions(std::unique_ptr<DumpOptions> options) {
+ options_ = std::move(options);
+}
+
+Dumpstate::RunStatus Dumpstate::Run() {
+ if (!options_->ValidateOptions()) {
MYLOGE("Invalid options specified\n");
- LogDumpOptions(*options);
+ LogDumpOptions(*options_);
return RunStatus::INVALID_INPUT;
}
- options_ = std::move(options);
/* set as high priority, and protect from OOM killer */
setpriority(PRIO_PROCESS, 0, -20);
@@ -2366,7 +2369,8 @@
std::unique_ptr<Dumpstate::DumpOptions> options = std::make_unique<Dumpstate::DumpOptions>();
Dumpstate::RunStatus status = options->Initialize(argc, argv);
if (status == Dumpstate::RunStatus::OK) {
- status = ds.RunWithOptions(std::move(options));
+ ds.SetOptions(std::move(options));
+ status = ds.Run();
}
switch (status) {