Check for user consent denial when dumping traces.
VM traces is one of the longer running operations. Check consent
periodically and return early if necessary.
BUG:128270426
Test: manual; by canceling when traces was running.
Test: verified "VM TRACES JUST NOW" shows up as expected
after refactoring in the normal flow as well.
Change-Id: Ic5282b948929857850730d6b06ec0cae8c39a99f
diff --git a/cmds/dumpstate/dumpstate.h b/cmds/dumpstate/dumpstate.h
index 1463b8b..d02ec75 100644
--- a/cmds/dumpstate/dumpstate.h
+++ b/cmds/dumpstate/dumpstate.h
@@ -291,8 +291,11 @@
// TODO: temporary method until Dumpstate object is properly set
void SetProgress(std::unique_ptr<Progress> progress);
- // Dumps Dalvik and native stack traces, return the trace file location (nullptr if none).
- const char* DumpTraces();
+ // Dumps Dalvik and native stack traces, sets the trace file location to path
+ // if it succeeded.
+ // Note that it returns early if user consent is denied with status USER_CONSENT_DENIED.
+ // Returns OK in all other cases.
+ RunStatus DumpTraces(const char** path);
void DumpstateBoard();