diff options
author | Abhijeet Kaur <abkaur@google.com> | 2020-06-25 19:13:28 +0000 |
---|---|---|
committer | Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> | 2020-06-25 19:13:28 +0000 |
commit | d1a1d6486c5b79bf8f87ad2c540ddf6ba03bdfef (patch) | |
tree | f487d5592d2c655c70482a3252cc5ca1c2f8a65b | |
parent | f5d934e7ba225f3def682811e9cdc0a13062cd2f (diff) | |
parent | 90f8249030e02080e937eeed12fc8c8c692bbc64 (diff) | |
download | native-d1a1d6486c5b79bf8f87ad2c540ddf6ba03bdfef.tar.gz |
Copy Screenshot to fd if and only if user consent approved am: 90f8249030
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/native/+/11950659
Change-Id: I7e9e6f0ee94857d1846bf4dec63ecc211a068af3
-rw-r--r-- | cmds/dumpstate/dumpstate.cpp | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/cmds/dumpstate/dumpstate.cpp b/cmds/dumpstate/dumpstate.cpp index 5de40776b9..39f3f051ee 100644 --- a/cmds/dumpstate/dumpstate.cpp +++ b/cmds/dumpstate/dumpstate.cpp @@ -2718,13 +2718,6 @@ Dumpstate::RunStatus Dumpstate::RunInternal(int32_t calling_uid, MYLOGI("User denied consent. Returning\n"); return status; } - if (options_->do_fb && options_->screenshot_fd.get() != -1) { - bool copy_succeeded = android::os::CopyFileToFd(screenshot_path_, - options_->screenshot_fd.get()); - if (copy_succeeded) { - android::os::UnlinkAndLogOnError(screenshot_path_); - } - } if (status == Dumpstate::RunStatus::USER_CONSENT_TIMED_OUT) { MYLOGI( "Did not receive user consent yet." @@ -2832,6 +2825,13 @@ Dumpstate::RunStatus Dumpstate::CopyBugreportIfUserConsented() { bool copy_succeeded = android::os::CopyFileToFd(path_, options_->bugreport_fd.get()); if (copy_succeeded) { android::os::UnlinkAndLogOnError(path_); + if (options_->do_fb && options_->screenshot_fd.get() != -1) { + copy_succeeded = android::os::CopyFileToFd(screenshot_path_, + options_->screenshot_fd.get()); + if (copy_succeeded) { + android::os::UnlinkAndLogOnError(screenshot_path_); + } + } } return copy_succeeded ? Dumpstate::RunStatus::OK : Dumpstate::RunStatus::ERROR; } else if (consent_result == UserConsentResult::UNAVAILABLE) { |