Merge "Correcting Reboot Task Functionality"

This commit is contained in:
Daniel Zheng 2023-04-10 17:46:03 +00:00 committed by Gerrit Code Review
commit dddb5fa80b

View file

@ -2255,7 +2255,7 @@ int FastBootTool::Main(int argc, char* argv[]) {
if (args.size() == 1) { if (args.size() == 1) {
std::string reboot_target = next_arg(&args); std::string reboot_target = next_arg(&args);
reboot_task = std::make_unique<RebootTask>(fp.get(), reboot_target); reboot_task = std::make_unique<RebootTask>(fp.get(), reboot_target);
} else { } else if (!fp->skip_reboot) {
reboot_task = std::make_unique<RebootTask>(fp.get()); reboot_task = std::make_unique<RebootTask>(fp.get());
} }
if (!args.empty()) syntax_error("junk after reboot command"); if (!args.empty()) syntax_error("junk after reboot command");
@ -2310,7 +2310,9 @@ int FastBootTool::Main(int argc, char* argv[]) {
} else { } else {
do_flashall(fp.get()); do_flashall(fp.get());
} }
reboot_task = std::make_unique<RebootTask>(fp.get()); if (!fp->skip_reboot) {
reboot_task = std::make_unique<RebootTask>(fp.get());
}
} else if (command == "update") { } else if (command == "update") {
bool slot_all = (slot_override == "all"); bool slot_all = (slot_override == "all");
if (slot_all) { if (slot_all) {
@ -2322,7 +2324,9 @@ int FastBootTool::Main(int argc, char* argv[]) {
filename = next_arg(&args); filename = next_arg(&args);
} }
do_update(filename.c_str(), fp.get()); do_update(filename.c_str(), fp.get());
reboot_task = std::make_unique<RebootTask>(fp.get()); if (!fp->skip_reboot) {
reboot_task = std::make_unique<RebootTask>(fp.get());
}
} else if (command == FB_CMD_SET_ACTIVE) { } else if (command == FB_CMD_SET_ACTIVE) {
std::string slot = verify_slot(next_arg(&args), false); std::string slot = verify_slot(next_arg(&args), false);
fb->SetActive(slot); fb->SetActive(slot);
@ -2411,7 +2415,7 @@ int FastBootTool::Main(int argc, char* argv[]) {
if (fp->wants_set_active) { if (fp->wants_set_active) {
fb->SetActive(next_active); fb->SetActive(next_active);
} }
if (reboot_task && !fp->skip_reboot) { if (reboot_task) {
reboot_task->Run(); reboot_task->Run();
} }
fprintf(stderr, "Finished. Total time: %.3fs\n", (now() - start)); fprintf(stderr, "Finished. Total time: %.3fs\n", (now() - start));