diff options
author | Tom Cherry <tomcherry@google.com> | 2019-08-19 15:21:25 -0700 |
---|---|---|
committer | Tom Cherry <tomcherry@google.com> | 2019-12-04 15:43:21 -0800 |
commit | c88d8f93cfaa8cbf368a0fa94e8bc84bc55c3ece (patch) | |
tree | 3caaa75251230d98f2b21dadd9b8892c2442c976 /init/service.cpp | |
parent | f7a6c4587f06bc7e79748acd97dc4dd5b741f328 (diff) |
init: Replace property_set() with android::base::SetProperty()
Init is no longer a special case and talks to property service just
like every other client, therefore move it away from property_set()
and to android::base::SetProperty().
In doing so, this change moves the initial property set up from the
kernel command line and property files directly into PropertyInit().
This makes the responsibilities between init and property services
more clear.
Test: boot, unit test cases
Change-Id: I36b8c83e845d887f1b203355c2391ec123c3d05f
Diffstat (limited to 'init/service.cpp')
-rw-r--r-- | init/service.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/init/service.cpp b/init/service.cpp index ad42df7d9..cc97d949d 100644 --- a/init/service.cpp +++ b/init/service.cpp @@ -45,7 +45,6 @@ #include <android/api-level.h> #include "mount_namespace.h" -#include "property_service.h" #include "selinux.h" #else #include "host_init_stubs.h" @@ -55,6 +54,7 @@ using android::base::boot_clock; using android::base::GetProperty; using android::base::Join; using android::base::make_scope_guard; +using android::base::SetProperty; using android::base::StartsWith; using android::base::StringPrintf; using android::base::WriteStringToFile; @@ -164,13 +164,13 @@ void Service::NotifyStateChange(const std::string& new_state) const { } std::string prop_name = "init.svc." + name_; - property_set(prop_name, new_state); + SetProperty(prop_name, new_state); if (new_state == "running") { uint64_t start_ns = time_started_.time_since_epoch().count(); std::string boottime_property = "ro.boottime." + name_; if (GetProperty(boottime_property, "").empty()) { - property_set(boottime_property, std::to_string(start_ns)); + SetProperty(boottime_property, std::to_string(start_ns)); } } @@ -178,9 +178,9 @@ void Service::NotifyStateChange(const std::string& new_state) const { // on device for security checks. std::string pid_property = "init.svc_debug_pid." + name_; if (new_state == "running") { - property_set(pid_property, std::to_string(pid_)); + SetProperty(pid_property, std::to_string(pid_)); } else if (new_state == "stopped") { - property_set(pid_property, ""); + SetProperty(pid_property, ""); } } @@ -324,7 +324,7 @@ void Service::Reap(const siginfo_t& siginfo) { LOG(ERROR) << "updatable process '" << name_ << "' exited 4 times " << (boot_completed ? "in 4 minutes" : "before boot completed"); // Notifies update_verifier and apexd - property_set("sys.init.updatable_crashing", "1"); + SetProperty("sys.init.updatable_crashing", "1"); } } } else { |