summaryrefslogtreecommitdiff
path: root/init/builtins.cpp
diff options
context:
space:
mode:
authorSteven Laver <lavers@google.com>2020-01-23 17:03:34 -0800
committerSteven Laver <lavers@google.com>2020-01-23 17:03:34 -0800
commitb60e31a87f1ca66a3e7bb59bafd53194069ce132 (patch)
treefa618ed3d605e46d9786cc80fd46a01c3010f3f4 /init/builtins.cpp
parent39fca9e854e544cfa8164acbf6ea18c9d6ed1262 (diff)
parent4b6d4901703230445a2bcf960e3610e891901cc1 (diff)
Merge RP1A.200123.001
Change-Id: I9a5261600a4bbae9e68b1e7ee554be2fd1c7525c
Diffstat (limited to 'init/builtins.cpp')
-rw-r--r--init/builtins.cpp27
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 {};