In the end I managed to accomplish what I wanted to, but I had to do it in a very fiddly way. Posting it here for future reference for anyone else who might have similar troubles.
: I had to edit some init.*.rc files found on the ramdisk. The problem with editing these files directly is that as the name implies, any changes made to the ramdisk during runtime aren't persisted. So what I had to do was to extract the boot partition of the device as an ".img" file onto my development computer, modify a few init.*.rc files, repack the changes as a .img file, and flash it back onto the phone.
Extracting the boot partition
To extract the boot partition, I first found where it is:
> ls -l /dev/block/platform/13540000.dwmmc0/by-name
lrwxrwxrwx 1 root root 21 2018-08-06 11:00 BOOT -> /dev/block/mmcblk0p10
lrwxrwxrwx 1 root root 20 2018-08-06 11:00 BOTA0 -> /dev/block/mmcblk0p1
lrwxrwxrwx 1 root root 20 2018-08-06 11:00 BOTA1 -> /dev/block/mmcblk0p2
lrwxrwxrwx 1 root root 21 2018-08-06 11:00 CACHE -> /dev/block/mmcblk0p21
lrwxrwxrwx 1 root root 20 2018-08-06 11:00 CARRIER -> /dev/block/mmcblk0p8
lrwxrwxrwx 1 root root 21 2018-08-06 11:00 CDMA-RADIO -> /dev/block/mmcblk0p13
As we see, the boot partition lies in /dev/block/mmcblk0p10. So the next step was to
cat /dev/block/mmcblk0p10 > /sdcard/boot.img
which resulted in a boot.img in the /sdcard/ directory, which I then copied onto my development PC.
To unpack boot.img, I used a program called Android Image Kitchen. I still cannot post links, so just search for it. After unpacking boot.img, I got a folder called "ramdisk" which contained, among other things, a bunch of init.*.rc files.
Editing the init.*.rc files
I had to make changes to two files, init.rc
I made the following changes:
- Removed the lpm service. Example:
#service lpm /system/bin/lpm
# class charger
- Removed the "on charger" trigger.
- Added the following trigger:
and for init.samsungexynos7570.rc
I made these changes:
Repacking the edited ramdisk
- Removed the lpm service.
- Removed the "on property:ro bootmode=charger" triggers.
To repack the edited ramdisk I once again used Android Image Kitchen.
Flashing the modified ramdisk
To flash the modified ramdisk I used ODIN version 3.12.5. In order for it to be flashable through ODIN the .img file needs to be turned into a .tar file. I used 7zip for this. It is also very important that .img file is called "boot.img" before being tar-ed. Not sure if the .tar file has such stringent naming requirements as well.
The phone now boots automatically when connecting power (if powered off). Caveat: The touch screen does not work when booting via connecting power, but for my own specific scenario this is not a problem as I am going to use the phone as a kiosk device without touch functionality. To enable the touch screen I suspect I just need to preserve some of the stuff in the init.samsungexynos7570.rc file that I initially removed.