Project Code 0

The file to modify can be seen forked here

Explanation

LineageOS starts a healthd script to begin the “Charging Animation” when plugged in (among other things). To make the device power on, all we need to do is add these lines to the beginning /system/core/healthd

on charger
    setprop sys.powerctl reboot,leaving-off-mode-charging

This can be added to an existing installation or to your own build of Lineage. FYI, on a live install any OTA update from LineageOS will reset the changes.

It’s important to leave the rest of the script as is, healthd does more than start an animation so it’s critical that the component is initialized. I only figured this out a dozen boot loops later…

This has worked on my Samsung Tab S2 (gts28vewifi), using LineageOS 16. I suspect it will work for many other devices on this version as well.