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

Commit 3ddc3fa3 authored by Greg Kaiser's avatar Greg Kaiser
Browse files

dumpstate: Only attempt screencap with do_fb

When 'do_fb' is false, then our 'screenshot_path_' is empty,
so our call to TakeScreenshot() results in two Errors into
the logcat.  We want to avoid that, especially during the
bugreport process.

So we follow the logic which 'do_early_screenshot_' uses, by
only calling TakeScreenshot() when 'do_fb' is true.  We also
modify this other call to TakeScreenshot() to remove its
additional check, since we know if we get into this unexpected
state, we'll get non-fatal Errors in the logcat indicating it.

Bug: 133448994
Test: dumpstate_test
Change-Id: Ibb30bb908e12a498a341e2c5c1d9b59a7a16c2a5
parent 62e5a6fb
Loading
Loading
Loading
Loading
+3 −8
Original line number Diff line number Diff line
@@ -1246,7 +1246,7 @@ static Dumpstate::RunStatus dumpstate() {
    /* Dump Bluetooth HCI logs */
    ds.AddDir("/data/misc/bluetooth/logs", true);

    if (!ds.do_early_screenshot_) {
    if (ds.options_->do_fb && !ds.do_early_screenshot_) {
        MYLOGI("taking late screenshot\n");
        ds.TakeScreenshot();
    }
@@ -2482,14 +2482,9 @@ Dumpstate::RunStatus Dumpstate::RunInternal(int32_t calling_uid,
    }

    if (options_->do_fb && do_early_screenshot_) {
        if (screenshot_path_.empty()) {
            // should not have happened
            MYLOGE("INTERNAL ERROR: skipping early screenshot because path was not set\n");
        } else {
        MYLOGI("taking early screenshot\n");
        TakeScreenshot();
    }
    }

    if (options_->do_zip_file && zip_file != nullptr) {
        if (chown(path_.c_str(), AID_SHELL, AID_SHELL)) {