Reboot device if apexd crashes
With apexd becoming a lazy aidl, it can't be marked as critical anymore,
hence it can't benefit from init's recovery mechanism for critical
services (if critical service is crash looping, init will reboot into
bootloader).
Instead, we now have a poor-man recovery mechanism:
* If bootstrap apexd crashes, reboot into bootloader
* If regular apexd crashes, then issue a normal reboot, hoping that
fs-checkpointing will save the day.
Note, that additionally apexd now needs to manually handle SIGTERM
signal:
By default, when SIGTERM is received a process will exit with non-zero
exit code, which will trigger reboot_on_failure handler in init. This
doesn't work well with userspace reboot, that will send SIGTERM to apexd
if apexd was running when userspace reboot was requested. To workaround
this, apexd now simply calls _exit(0) when SIGTERM signal is received.
Test: device boots
Test: adb shell svc power reboot userspace
Bug: 155275196
Change-Id: I75094599f4784d5eb8cd1f8b2f5acaeb867023e3
2 files changed