summaryrefslogtreecommitdiff
path: root/cmds/dumpstate/utils.cpp
diff options
context:
space:
mode:
author Nandana Dutt <nandana@google.com> 2019-03-12 10:52:56 +0000
committer Nandana Dutt <nandana@google.com> 2019-03-14 10:42:08 +0000
commitbbdb5b459579b53edcd2667d9dfdf45fcdbecf18 (patch)
tree97476d37e9471c9c02966d5f3039428e941fe8c2 /cmds/dumpstate/utils.cpp
parentb0f2b48c0a2cecbcf971a526025ca763950b3ef1 (diff)
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 in internal 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 Merged-In: Icbed7c510ff9c9a882a7b49eac1a92fa17727635
Diffstat (limited to 'cmds/dumpstate/utils.cpp')
-rw-r--r--cmds/dumpstate/utils.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/cmds/dumpstate/utils.cpp b/cmds/dumpstate/utils.cpp
index 8b9298820d..fe1e4b4b14 100644
--- a/cmds/dumpstate/utils.cpp
+++ b/cmds/dumpstate/utils.cpp
@@ -278,6 +278,12 @@ static void __for_each_pid(void (*helper)(int, const char *, void *), const char
if (header) printf("\n------ %s ------\n", header);
while ((de = readdir(d))) {
+ if (ds.IsUserConsentDenied()) {
+ MYLOGE(
+ "Returning early because user denied consent to share bugreport with calling app.");
+ closedir(d);
+ return;
+ }
int pid;
int fd;
char cmdpath[255];
@@ -350,6 +356,12 @@ static void for_each_tid_helper(int pid, const char *cmdline, void *arg) {
func(pid, pid, cmdline);
while ((de = readdir(d))) {
+ if (ds.IsUserConsentDenied()) {
+ MYLOGE(
+ "Returning early because user denied consent to share bugreport with calling app.");
+ closedir(d);
+ return;
+ }
int tid;
int fd;
char commpath[255];