summaryrefslogtreecommitdiff
path: root/init/builtins.cpp
diff options
context:
space:
mode:
authorScott Lobdell <slobdell@google.com>2019-05-23 10:20:08 -0700
committerScott Lobdell <slobdell@google.com>2019-05-23 10:20:08 -0700
commit522637944dc2d1bad01e781c351f30a2445a5cd6 (patch)
treede4e0269110c7f2f7298781d9348b122d1b9833c /init/builtins.cpp
parent55b830ffc808d623ae94aaeeb8dd89d95993affd (diff)
parent41634220dc1eb94f576e404b1bd8051d937f12be (diff)
Merge QP1A.190523.001
Change-Id: I9a00cf883d9f1905f771c33b7ef3d5b57ada6e07
Diffstat (limited to 'init/builtins.cpp')
-rw-r--r--init/builtins.cpp25
1 files changed, 13 insertions, 12 deletions
diff --git a/init/builtins.cpp b/init/builtins.cpp
index efcb5402c..030a99692 100644
--- a/init/builtins.cpp
+++ b/init/builtins.cpp
@@ -104,35 +104,36 @@ static void ForEachServiceInClass(const std::string& classname, F function) {
}
}
-static Result<Success> class_start(const std::string& class_name, bool post_data_only) {
+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." + class_name, false))
+ 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()) {
- if (service->classnames().count(class_name)) {
- if (post_data_only && !service->is_post_data()) {
- continue;
- }
+ if (service->classnames().count(args[1])) {
if (auto result = service->StartIfNotDisabled(); !result) {
LOG(ERROR) << "Could not start service '" << service->name()
- << "' as part of class '" << class_name << "': " << result.error();
+ << "' as part of class '" << args[1] << "': " << result.error();
}
}
}
return Success();
}
-static Result<Success> do_class_start(const BuiltinArguments& args) {
- return class_start(args[1], false /* post_data_only */);
-}
-
static Result<Success> do_class_start_post_data(const BuiltinArguments& args) {
if (args.context != kInitContext) {
return Error() << "command 'class_start_post_data' only available in init context";
}
- return class_start(args[1], true /* post_data_only */);
+ for (const auto& service : ServiceList::GetInstance()) {
+ if (service->classnames().count(args[1])) {
+ if (auto result = service->StartIfPostData(); !result) {
+ LOG(ERROR) << "Could not start service '" << service->name()
+ << "' as part of class '" << args[1] << "': " << result.error();
+ }
+ }
+ }
+ return Success();
}
static Result<Success> do_class_stop(const BuiltinArguments& args) {