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
diff --git a/cmds/dumpstate/dumpstate.cpp b/cmds/dumpstate/dumpstate.cpp
index 1eb2efd..32f7e6d 100644
--- a/cmds/dumpstate/dumpstate.cpp
+++ b/cmds/dumpstate/dumpstate.cpp
@@ -1246,7 +1246,7 @@
     /* 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,13 +2482,8 @@
     }
 
     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();
-        }
+        MYLOGI("taking early screenshot\n");
+        TakeScreenshot();
     }
 
     if (options_->do_zip_file && zip_file != nullptr) {