summaryrefslogtreecommitdiff
path: root/init/builtins.cpp
diff options
context:
space:
mode:
authorNikita Ioffe <ioffe@google.com>2020-01-15 14:43:55 +0000
committerNikita Ioffe <ioffe@google.com>2020-01-15 16:27:39 +0000
commit05506f05b6014e81f3531fae8a9226e66093a305 (patch)
treec5d9c5138fc4cd937775dffb0ce564a9577c8321 /init/builtins.cpp
parent60ddf3a29a08621b1fadc9fa7e1ef46f5f07117c (diff)
Don't reboot into recovery during userspace reboot
In case one of the cryptfs calls to vdc fails, first try a normal reboot. Test: manual Bug: 135984674 Bug: 143970043 Change-Id: I5706d9cd6c3a08fa06329ffb7d141de632620e3d
Diffstat (limited to 'init/builtins.cpp')
-rw-r--r--init/builtins.cpp25
1 files changed, 17 insertions, 8 deletions
diff --git a/init/builtins.cpp b/init/builtins.cpp
index 2a6df84f1..adcba3a02 100644
--- a/init/builtins.cpp
+++ b/init/builtins.cpp
@@ -1119,19 +1119,28 @@ static Result<void> ExecWithFunctionOnFailure(const std::vector<std::string>& ar
}
static Result<void> 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;
+ }
- auto reboot = [reboot_reason](const std::string& message) {
+ auto reboot = [reboot_reason, should_reboot_into_recovery](const std::string& message) {
// TODO (b/122850122): support this in gsi
- if (fscrypt_is_native() && !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) {
- LOG(FATAL) << "Could not reboot into recovery: " << result.error();
+ if (should_reboot_into_recovery) {
+ if (fscrypt_is_native() && !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) {
+ LOG(FATAL) << "Could not reboot into recovery: " << result.error();
+ }
+ } else {
+ LOG(ERROR) << "Failure (reboot suppressed): " << reboot_reason;
}
} else {
- LOG(ERROR) << "Failure (reboot suppressed): " << reboot_reason;
+ LOG(ERROR) << message << ": rebooting, reason: " << reboot_reason;
+ trigger_shutdown("reboot," + reboot_reason);
}
};