Loading init/README.md +1 −11 Original line number Diff line number Diff line Loading @@ -487,11 +487,6 @@ Commands not already running. See the start entry for more information on starting services. `class_start_post_data <serviceclass>` > Like `class_start`, but only considers services that were started after /data was mounted, and that were running at the time `class_reset_post_data` was called. Only used for FDE devices. `class_stop <serviceclass>` > Stop and disable all services of the specified class if they are currently running. Loading @@ -501,10 +496,6 @@ Commands currently running, without disabling them. They can be restarted later using `class_start`. `class_reset_post_data <serviceclass>` > Like `class_reset`, but only considers services that were started after /data was mounted. Only used for FDE devices. `class_restart <serviceclass>` > Restarts all services of the specified class. Loading Loading @@ -607,8 +598,7 @@ provides the `aidl_lazy_test_1` interface. Properties are expanded within _level_. `mark_post_data` > Used to mark the point right after /data is mounted. Used to implement the `class_reset_post_data` and `class_start_post_data` commands. > Used to mark the point right after /data is mounted. `mkdir <path> [<mode>] [<owner>] [<group>] [encryption=<action>] [key=<key>]` > Create a directory at _path_, optionally with the given mode, owner, and Loading init/builtins.cpp +0 −38 Original line number Diff line number Diff line Loading @@ -46,7 +46,6 @@ #include <map> #include <memory> #include <ApexProperties.sysprop.h> #include <InitProperties.sysprop.h> #include <android-base/chrono_utils.h> #include <android-base/file.h> Loading Loading @@ -177,28 +176,6 @@ static Result<void> do_class_start(const BuiltinArguments& args) { return {}; } static Result<void> do_class_start_post_data(const BuiltinArguments& args) { if (args.context != kInitContext) { return Error() << "command 'class_start_post_data' only available in init context"; } static bool is_apex_updatable = android::sysprop::ApexProperties::updatable().value_or(false); if (!is_apex_updatable) { // No need to start these on devices that don't support APEX, since they're not // stopped either. return {}; } for (const auto& service : ServiceList::GetInstance()) { if (service->classnames().count(args[1])) { if (auto result = service->StartIfPostData(); !result.ok()) { LOG(ERROR) << "Could not start service '" << service->name() << "' as part of class '" << args[1] << "': " << result.error(); } } } return {}; } static Result<void> do_class_stop(const BuiltinArguments& args) { ForEachServiceInClass(args[1], &Service::Stop); return {}; Loading @@ -209,19 +186,6 @@ static Result<void> do_class_reset(const BuiltinArguments& args) { return {}; } static Result<void> do_class_reset_post_data(const BuiltinArguments& args) { if (args.context != kInitContext) { return Error() << "command 'class_reset_post_data' only available in init context"; } static bool is_apex_updatable = android::sysprop::ApexProperties::updatable().value_or(false); if (!is_apex_updatable) { // No need to stop these on devices that don't support APEX. return {}; } ForEachServiceInClass(args[1], &Service::ResetIfPostData); return {}; } static Result<void> 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)) Loading Loading @@ -1428,10 +1392,8 @@ const BuiltinFunctionMap& GetBuiltinFunctionMap() { {"chmod", {2, 2, {true, do_chmod}}}, {"chown", {2, 3, {true, do_chown}}}, {"class_reset", {1, 1, {false, do_class_reset}}}, {"class_reset_post_data", {1, 1, {false, do_class_reset_post_data}}}, {"class_restart", {1, 1, {false, do_class_restart}}}, {"class_start", {1, 1, {false, do_class_start}}}, {"class_start_post_data", {1, 1, {false, do_class_start_post_data}}}, {"class_stop", {1, 1, {false, do_class_stop}}}, {"copy", {2, 2, {true, do_copy}}}, {"copy_per_line", {2, 2, {true, do_copy_per_line}}}, Loading init/service.cpp +0 −19 Original line number Diff line number Diff line Loading @@ -661,25 +661,6 @@ void Service::Reset() { StopOrReset(SVC_RESET); } void Service::ResetIfPostData() { if (post_data_) { if (flags_ & SVC_RUNNING) { running_at_post_data_reset_ = true; } StopOrReset(SVC_RESET); } } Result<void> Service::StartIfPostData() { // Start the service, but only if it was started after /data was mounted, // and it was still running when we reset the post-data services. if (running_at_post_data_reset_) { return Start(); } return {}; } void Service::Stop() { StopOrReset(SVC_DISABLED); } Loading init/service.h +0 −4 Original line number Diff line number Diff line Loading @@ -80,10 +80,8 @@ class Service { Result<void> ExecStart(); Result<void> Start(); Result<void> StartIfNotDisabled(); Result<void> StartIfPostData(); Result<void> Enable(); void Reset(); void ResetIfPostData(); void Stop(); void Terminate(); void Timeout(); Loading Loading @@ -214,8 +212,6 @@ class Service { bool post_data_ = false; bool running_at_post_data_reset_ = false; std::optional<std::string> on_failure_reboot_target_; bool from_apex_ = false; Loading Loading
init/README.md +1 −11 Original line number Diff line number Diff line Loading @@ -487,11 +487,6 @@ Commands not already running. See the start entry for more information on starting services. `class_start_post_data <serviceclass>` > Like `class_start`, but only considers services that were started after /data was mounted, and that were running at the time `class_reset_post_data` was called. Only used for FDE devices. `class_stop <serviceclass>` > Stop and disable all services of the specified class if they are currently running. Loading @@ -501,10 +496,6 @@ Commands currently running, without disabling them. They can be restarted later using `class_start`. `class_reset_post_data <serviceclass>` > Like `class_reset`, but only considers services that were started after /data was mounted. Only used for FDE devices. `class_restart <serviceclass>` > Restarts all services of the specified class. Loading Loading @@ -607,8 +598,7 @@ provides the `aidl_lazy_test_1` interface. Properties are expanded within _level_. `mark_post_data` > Used to mark the point right after /data is mounted. Used to implement the `class_reset_post_data` and `class_start_post_data` commands. > Used to mark the point right after /data is mounted. `mkdir <path> [<mode>] [<owner>] [<group>] [encryption=<action>] [key=<key>]` > Create a directory at _path_, optionally with the given mode, owner, and Loading
init/builtins.cpp +0 −38 Original line number Diff line number Diff line Loading @@ -46,7 +46,6 @@ #include <map> #include <memory> #include <ApexProperties.sysprop.h> #include <InitProperties.sysprop.h> #include <android-base/chrono_utils.h> #include <android-base/file.h> Loading Loading @@ -177,28 +176,6 @@ static Result<void> do_class_start(const BuiltinArguments& args) { return {}; } static Result<void> do_class_start_post_data(const BuiltinArguments& args) { if (args.context != kInitContext) { return Error() << "command 'class_start_post_data' only available in init context"; } static bool is_apex_updatable = android::sysprop::ApexProperties::updatable().value_or(false); if (!is_apex_updatable) { // No need to start these on devices that don't support APEX, since they're not // stopped either. return {}; } for (const auto& service : ServiceList::GetInstance()) { if (service->classnames().count(args[1])) { if (auto result = service->StartIfPostData(); !result.ok()) { LOG(ERROR) << "Could not start service '" << service->name() << "' as part of class '" << args[1] << "': " << result.error(); } } } return {}; } static Result<void> do_class_stop(const BuiltinArguments& args) { ForEachServiceInClass(args[1], &Service::Stop); return {}; Loading @@ -209,19 +186,6 @@ static Result<void> do_class_reset(const BuiltinArguments& args) { return {}; } static Result<void> do_class_reset_post_data(const BuiltinArguments& args) { if (args.context != kInitContext) { return Error() << "command 'class_reset_post_data' only available in init context"; } static bool is_apex_updatable = android::sysprop::ApexProperties::updatable().value_or(false); if (!is_apex_updatable) { // No need to stop these on devices that don't support APEX. return {}; } ForEachServiceInClass(args[1], &Service::ResetIfPostData); return {}; } static Result<void> 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)) Loading Loading @@ -1428,10 +1392,8 @@ const BuiltinFunctionMap& GetBuiltinFunctionMap() { {"chmod", {2, 2, {true, do_chmod}}}, {"chown", {2, 3, {true, do_chown}}}, {"class_reset", {1, 1, {false, do_class_reset}}}, {"class_reset_post_data", {1, 1, {false, do_class_reset_post_data}}}, {"class_restart", {1, 1, {false, do_class_restart}}}, {"class_start", {1, 1, {false, do_class_start}}}, {"class_start_post_data", {1, 1, {false, do_class_start_post_data}}}, {"class_stop", {1, 1, {false, do_class_stop}}}, {"copy", {2, 2, {true, do_copy}}}, {"copy_per_line", {2, 2, {true, do_copy_per_line}}}, Loading
init/service.cpp +0 −19 Original line number Diff line number Diff line Loading @@ -661,25 +661,6 @@ void Service::Reset() { StopOrReset(SVC_RESET); } void Service::ResetIfPostData() { if (post_data_) { if (flags_ & SVC_RUNNING) { running_at_post_data_reset_ = true; } StopOrReset(SVC_RESET); } } Result<void> Service::StartIfPostData() { // Start the service, but only if it was started after /data was mounted, // and it was still running when we reset the post-data services. if (running_at_post_data_reset_) { return Start(); } return {}; } void Service::Stop() { StopOrReset(SVC_DISABLED); } Loading
init/service.h +0 −4 Original line number Diff line number Diff line Loading @@ -80,10 +80,8 @@ class Service { Result<void> ExecStart(); Result<void> Start(); Result<void> StartIfNotDisabled(); Result<void> StartIfPostData(); Result<void> Enable(); void Reset(); void ResetIfPostData(); void Stop(); void Terminate(); void Timeout(); Loading Loading @@ -214,8 +212,6 @@ class Service { bool post_data_ = false; bool running_at_post_data_reset_ = false; std::optional<std::string> on_failure_reboot_target_; bool from_apex_ = false; Loading