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/reboot.cpp b/init/reboot.cpp
index 5bae4bc..1f83582 100644
--- a/init/reboot.cpp
+++ b/init/reboot.cpp
@@ -378,10 +378,17 @@
if (kill_after_apps.count(s->name())) {
s->SetShutdownCritical();
} else if (to_starts.count(s->name())) {
- s->Start();
+ if (auto result = s->Start(); !result) {
+ LOG(ERROR) << "Could not start shutdown 'to_start' service '" << s->name()
+ << "': " << result.error();
+ }
s->SetShutdownCritical();
} else if (s->IsShutdownCritical()) {
- s->Start(); // start shutdown critical service if not started
+ // Start shutdown critical service if not started.
+ if (auto result = s->Start(); !result) {
+ LOG(ERROR) << "Could not start shutdown critical service '" << s->name()
+ << "': " << result.error();
+ }
}
}