Handle user consent denial sooner

Currently dumpstate prompts the user for consent rightaway when called
via the API, but does not check for the result until the entire
bugreport is generated. This can make for a poor user experience - for
e.g. the client will continue to show a progress bar for a long time
after user denied consent.

Fix by checking for user consent intermittently.

BUG: 128270426
Test: Tested canceling during each long running operation
Test: bugreport from power menu (ie non-api flow) still works as
expected
Test: adb shell
/data/nativetest64/dumpstate_smoke_test/dumpstate_smoke_test &&
adb shell /data/nativetest64/dumpstate_test/dumpstate_test

Change-Id: Icbed7c510ff9c9a882a7b49eac1a92fa17727635
(cherry picked from commit e49b94c97201214705ec72b50167e544a96e226c)
diff --git a/cmds/dumpstate/dumpstate.h b/cmds/dumpstate/dumpstate.h
index 603af71..1463b8b 100644
--- a/cmds/dumpstate/dumpstate.h
+++ b/cmds/dumpstate/dumpstate.h
@@ -331,6 +331,13 @@
     void SetOptions(std::unique_ptr<DumpOptions> options);
 
     /*
+     * Returns true if user consent is necessary and has been denied.
+     * Consent is only necessary if the caller has asked to copy over the bugreport to a file they
+     * provided.
+     */
+    bool IsUserConsentDenied() const;
+
+    /*
      * Structure to hold options that determine the behavior of dumpstate.
      */
     struct DumpOptions {