diff options
author | Steven Laver <lavers@google.com> | 2020-02-05 04:53:02 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2020-02-05 04:53:02 +0000 |
commit | 6a30c5f691c96d3d75cd8ac85dd76696ba345b7b (patch) | |
tree | fa618ed3d605e46d9786cc80fd46a01c3010f3f4 /init/builtins.cpp | |
parent | 4c613f7acaecddbe73747ff5d7ed31b4bf038a19 (diff) | |
parent | b60e31a87f1ca66a3e7bb59bafd53194069ce132 (diff) |
Merge "Merge RP1A.200123.001" into r-keystone-qcom-dev
Diffstat (limited to 'init/builtins.cpp')
-rw-r--r-- | init/builtins.cpp | 27 |
1 files changed, 18 insertions, 9 deletions
diff --git a/init/builtins.cpp b/init/builtins.cpp index afa27c5df..53e10895d 100644 --- a/init/builtins.cpp +++ b/init/builtins.cpp @@ -1141,19 +1141,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); } }; @@ -1289,7 +1298,7 @@ static Result<void> create_apex_data_dirs() { if (strchr(name, '@') != nullptr) continue; auto path = "/data/misc/apexdata/" + std::string(name); - auto options = MkdirOptions{path, 0770, AID_ROOT, AID_SYSTEM, FscryptAction::kNone, "ref"}; + auto options = MkdirOptions{path, 0771, AID_ROOT, AID_SYSTEM, FscryptAction::kNone, "ref"}; make_dir_with_options(options); } return {}; |