diff options
author | David Anderson <dvander@google.com> | 2019-01-17 18:42:58 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2019-01-17 18:42:58 +0000 |
commit | b43440ba79955a42b1786c1eda02318b2518e9eb (patch) | |
tree | 39e09b01bd646cd1a1c305dbe334d9446a9833e8 /init/builtins.cpp | |
parent | e181bf51163a57c4625cf92f2a05469f7fe8d326 (diff) | |
parent | 0e330f12bc7f693933b96ad729d296a92ffd80b7 (diff) |
Merge "init: Add support for GSI installations in first-stage mount."
Diffstat (limited to 'init/builtins.cpp')
-rw-r--r-- | init/builtins.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/init/builtins.cpp b/init/builtins.cpp index 43a520fb9..e1a86e4f9 100644 --- a/init/builtins.cpp +++ b/init/builtins.cpp @@ -54,6 +54,7 @@ #include <fs_mgr.h> #include <fscrypt/fscrypt.h> #include <fscrypt/fscrypt_init_extensions.h> +#include <libgsi/libgsi.h> #include <selinux/android.h> #include <selinux/label.h> #include <selinux/selinux.h> @@ -520,6 +521,9 @@ static Result<Success> queue_fs_event(int code) { return Success(); } else if (code == FS_MGR_MNTALL_DEV_NEEDS_RECOVERY) { /* Setup a wipe via recovery, and reboot into recovery */ + if (android::gsi::IsGsiRunning()) { + return Error() << "cannot wipe within GSI"; + } PLOG(ERROR) << "fs_mgr_mount_all suggested recovery, so wiping data via recovery."; const std::vector<std::string> options = {"--wipe_data", "--reason=fs_mgr_mount_all" }; return reboot_into_recovery(options); @@ -1022,7 +1026,8 @@ static Result<Success> ExecWithRebootOnFailure(const std::string& reboot_reason, } service->AddReapCallback([reboot_reason](const siginfo_t& siginfo) { if (siginfo.si_code != CLD_EXITED || siginfo.si_status != 0) { - if (fscrypt_is_native()) { + // TODO (b/122850122): support this in gsi + if (fscrypt_is_native() && !android::gsi::IsGsiRunning()) { LOG(ERROR) << "Rebooting into recovery, reason: " << reboot_reason; if (auto result = reboot_into_recovery( {"--prompt_and_wipe_data", "--reason="s + reboot_reason}); |