Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f7a5ceca authored by Abhijeet Kaur's avatar Abhijeet Kaur Committed by Automerger Merge Worker
Browse files

Merge "Copy Screenshot to fd if and only if user consent approved" into...

Merge "Copy Screenshot to fd if and only if user consent approved" into rvc-dev am: 5653ee25 am: 8db3369c am: 1053c110

Change-Id: Iac818855e7452741129ab139500ac9e0a7d73c18
parents 8bc22d0c 1053c110
Loading
Loading
Loading
Loading
+10 −9
Original line number Diff line number Diff line
@@ -2677,15 +2677,6 @@ Dumpstate::RunStatus Dumpstate::RunInternal(int32_t calling_uid,
            MYLOGI("User denied consent. Returning\n");
            return status;
        }
        if (options_->do_screenshot &&
            options_->screenshot_fd.get() != -1 &&
            !options_->is_screenshot_copied) {
            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."
@@ -2815,6 +2806,16 @@ Dumpstate::RunStatus Dumpstate::CopyBugreportIfUserConsented(int32_t calling_uid
        bool copy_succeeded = android::os::CopyFileToFd(path_, options_->bugreport_fd.get());
        if (copy_succeeded) {
            android::os::UnlinkAndLogOnError(path_);
            if (options_->do_screenshot &&
                options_->screenshot_fd.get() != -1 &&
                !options_->is_screenshot_copied) {
                copy_succeeded = android::os::CopyFileToFd(screenshot_path_,
                                                           options_->screenshot_fd.get());
                options_->is_screenshot_copied = copy_succeeded;
                if (copy_succeeded) {
                    android::os::UnlinkAndLogOnError(screenshot_path_);
                }
            }
        }
        return copy_succeeded ? Dumpstate::RunStatus::OK : Dumpstate::RunStatus::ERROR;
    } else if (consent_result == UserConsentResult::UNAVAILABLE) {