From 1418fb8ce04866f14e596d6fac28d8175a2b89a1 Mon Sep 17 00:00:00 2001 From: Daniel Zheng Date: Mon, 13 Mar 2023 18:13:08 +0000 Subject: [PATCH] Correcting Reboot Task Functionality Modifying fastboot-info.txt to directly call reboot fastboot instead of reboot userspace -> so no longer need "userspace" in reboot task. Also moving skip_reboot check to task since in old code we can have skip_reboot be true and still reboot to bootloader, fastboot, or recovery Test: tested reboot commands on Raven Change-Id: I98ba51747bf7229a88ba737540c81d20b42e5981 --- fastboot/fastboot.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/fastboot/fastboot.cpp b/fastboot/fastboot.cpp index b977e31b1..4e4f431b6 100644 --- a/fastboot/fastboot.cpp +++ b/fastboot/fastboot.cpp @@ -2247,7 +2247,7 @@ int FastBootTool::Main(int argc, char* argv[]) { if (args.size() == 1) { std::string reboot_target = next_arg(&args); reboot_task = std::make_unique(fp.get(), reboot_target); - } else { + } else if (!fp->skip_reboot) { reboot_task = std::make_unique(fp.get()); } if (!args.empty()) syntax_error("junk after reboot command"); @@ -2302,7 +2302,9 @@ int FastBootTool::Main(int argc, char* argv[]) { } else { do_flashall(fp.get()); } - reboot_task = std::make_unique(fp.get()); + if (!fp->skip_reboot) { + reboot_task = std::make_unique(fp.get()); + } } else if (command == "update") { bool slot_all = (slot_override == "all"); if (slot_all) { @@ -2314,7 +2316,9 @@ int FastBootTool::Main(int argc, char* argv[]) { filename = next_arg(&args); } do_update(filename.c_str(), fp.get()); - reboot_task = std::make_unique(fp.get()); + if (!fp->skip_reboot) { + reboot_task = std::make_unique(fp.get()); + } } else if (command == FB_CMD_SET_ACTIVE) { std::string slot = verify_slot(next_arg(&args), false); fb->SetActive(slot); @@ -2403,7 +2407,7 @@ int FastBootTool::Main(int argc, char* argv[]) { if (fp->wants_set_active) { fb->SetActive(next_active); } - if (reboot_task && !fp->skip_reboot) { + if (reboot_task) { reboot_task->Run(); } fprintf(stderr, "Finished. Total time: %.3fs\n", (now() - start));