summaryrefslogtreecommitdiff
path: root/init/builtins.cpp
diff options
context:
space:
mode:
authorScott Lobdell <slobdell@google.com>2019-01-22 18:03:18 -0800
committerScott Lobdell <slobdell@google.com>2019-02-05 16:49:57 -0800
commit31b75440456409a2c691f31887261f23fd36c35a (patch)
tree61d76caccd4ef9105446707a053ecd197ed22858 /init/builtins.cpp
parent841094c16dd79ffb007050d605ee6b45018f1370 (diff)
parent1564341169ca211e7c1f5deda02e6e4aa3db3fea (diff)
Merge QP1A.190122.001
Conflicts: fs_mgr/fs_mgr.cpp fs_mgr/fs_mgr_fstab.cpp fs_mgr/fs_mgr_priv.h init/reboot.cpp Change-Id: I88c99bfd0f4bd80fb3d2c974978cf9cb483e68c3
Diffstat (limited to 'init/builtins.cpp')
-rw-r--r--init/builtins.cpp15
1 files changed, 13 insertions, 2 deletions
diff --git a/init/builtins.cpp b/init/builtins.cpp
index ea2035b02..882666253 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>
@@ -100,6 +101,9 @@ static void ForEachServiceInClass(const std::string& classname, F function) {
}
static Result<Success> do_class_start(const BuiltinArguments& args) {
+ // Do not start a class if it has a property persist.dont_start_class.CLASS set to 1.
+ if (android::base::GetBoolProperty("persist.init.dont_start_class." + args[1], false))
+ return Success();
// Starting a class does not start services which are explicitly disabled.
// They must be started individually.
for (const auto& service : ServiceList::GetInstance()) {
@@ -124,6 +128,9 @@ static Result<Success> do_class_reset(const BuiltinArguments& args) {
}
static Result<Success> do_class_restart(const BuiltinArguments& args) {
+ // Do not restart a class if it has a property persist.dont_start_class.CLASS set to 1.
+ if (android::base::GetBoolProperty("persist.init.dont_start_class." + args[1], false))
+ return Success();
ForEachServiceInClass(args[1], &Service::Restart);
return Success();
}
@@ -514,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);
@@ -973,7 +983,7 @@ static Result<Success> do_load_persist_props(const BuiltinArguments& args) {
}
static Result<Success> do_load_system_props(const BuiltinArguments& args) {
- load_system_props();
+ LOG(INFO) << "deprecated action `load_system_props` called.";
return Success();
}
@@ -1023,7 +1033,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});