From fed3373b5b671613c615b63800eb3977bb1911ea Mon Sep 17 00:00:00 2001 From: Tom Cherry Date: Fri, 18 Aug 2017 10:47:46 -0700 Subject: [PATCH] init: only set ro.boottime. properties once. Currently, init attempts to set ro.boottime. properties whenever a service starts, however since these properties are ro. this means that an error is printed whenever a service is restarted. Since these properties are intended for reporting boottime, these subsequent writes during restarts are erroneous and therefore this change stops attempting to write them, thus silencing the error. Test: boot bullhead, restart processes, observe no error print Change-Id: I372f8d5c26590fc0661b92f632410e23e6418841 --- init/service.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/init/service.cpp b/init/service.cpp index 1b5cc19e4..86e650faf 100644 --- a/init/service.cpp +++ b/init/service.cpp @@ -201,7 +201,10 @@ void Service::NotifyStateChange(const std::string& new_state) const { if (new_state == "running") { uint64_t start_ns = time_started_.time_since_epoch().count(); - property_set("ro.boottime." + name_, std::to_string(start_ns)); + std::string boottime_property = "ro.boottime." + name_; + if (GetProperty(boottime_property, "").empty()) { + property_set(boottime_property, std::to_string(start_ns)); + } } }