root123 "My goal is to prevent my phone from being powered off while it's locked."
Impossible, sorry. Hardware wise I can hold the power button, more so I could remove the battery (or wait for it to die) if I really want to.
No security benefit from this either, you should want people to turn off your device.
Once the device power cycles, the devices memory is cleared and it enters BFU.
If someone steals your phone, assuming you don't know them, a GPS locator isn't going to help really. I could easily kill the phones battery, recharge it, enter recovery, and wipe it clean.
Your data is more at risk if the power can't be cycled, this is why auto reboot exists