init: log all failures of Service::Start()
The move to returning Result from Service::Start() for better context
when starting process through init's builtins stops Service::Start()
failures from being logged from other contexts. This change adds
those logs along with their context.
Test: boot bullhead, fail to start services via `setprop ctl.start`,
see the expected error in dmesg
Change-Id: I45294f6abf00852f3d4c549a32eaf4920a51e6f0
diff --git a/init/keychords.cpp b/init/keychords.cpp
index 2ef0ce7..e686ce1 100644
--- a/init/keychords.cpp
+++ b/init/keychords.cpp
@@ -81,8 +81,11 @@
if (adb_enabled == "running") {
Service* svc = ServiceList::GetInstance().FindService(id, &Service::keychord_id);
if (svc) {
- LOG(INFO) << "Starting service " << svc->name() << " from keychord " << id;
- svc->Start();
+ LOG(INFO) << "Starting service '" << svc->name() << "' from keychord " << id;
+ if (auto result = svc->Start(); !result) {
+ LOG(ERROR) << "Could not start service '" << svc->name() << "' from keychord " << id
+ << ": " << result.error();
+ }
} else {
LOG(ERROR) << "Service for keychord " << id << " not found";
}