From f91503bd18de89c38be495b14ca045be31fd54d7 Mon Sep 17 00:00:00 2001 From: Jooyung Han Date: Fri, 9 Aug 2024 16:17:20 +0900 Subject: [PATCH] Clean up userspace-reboot (#2) Bug: 292469129 Test: CtsInitTestCases Test: system/core/bootstat/boot_reason_test.sh Change-Id: I00deb50c5634ade6b69d5b6bf4d08c5101e0beb8 --- init/builtins.cpp | 26 ++++++++------------------ 1 file changed, 8 insertions(+), 18 deletions(-) diff --git a/init/builtins.cpp b/init/builtins.cpp index 2b965b66c..122adb7f6 100644 --- a/init/builtins.cpp +++ b/init/builtins.cpp @@ -1137,29 +1137,19 @@ static Result ExecWithFunctionOnFailure(const std::vector& ar } static Result ExecVdcRebootOnFailure(const std::string& vdc_arg) { - bool should_reboot_into_recovery = true; auto reboot_reason = vdc_arg + "_failed"; - if (android::sysprop::InitProperties::userspace_reboot_in_progress().value_or(false)) { - should_reboot_into_recovery = false; - reboot_reason = "userspace_failed," + vdc_arg; - } - auto reboot = [reboot_reason, should_reboot_into_recovery](const std::string& message) { + auto reboot = [reboot_reason](const std::string& message) { // TODO (b/122850122): support this in gsi - if (should_reboot_into_recovery) { - if (IsFbeEnabled() && !android::gsi::IsGsiRunning()) { - LOG(ERROR) << message << ": Rebooting into recovery, reason: " << reboot_reason; - if (auto result = reboot_into_recovery( - {"--prompt_and_wipe_data", "--reason="s + reboot_reason}); - !result.ok()) { - LOG(FATAL) << "Could not reboot into recovery: " << result.error(); - } - } else { - LOG(ERROR) << "Failure (reboot suppressed): " << reboot_reason; + if (IsFbeEnabled() && !android::gsi::IsGsiRunning()) { + LOG(ERROR) << message << ": Rebooting into recovery, reason: " << reboot_reason; + if (auto result = reboot_into_recovery( + {"--prompt_and_wipe_data", "--reason="s + reboot_reason}); + !result.ok()) { + LOG(FATAL) << "Could not reboot into recovery: " << result.error(); } } else { - LOG(ERROR) << message << ": rebooting, reason: " << reboot_reason; - trigger_shutdown("reboot," + reboot_reason); + LOG(ERROR) << "Failure (reboot suppressed): " << reboot_reason; } };