Disabling power button restart How can I disable android from rebooting when the power button is pressed for few seconds? Is this done in software?

Context: my power button is broken. I tried to remap it by changing the relevant file (/system/usr/keylayout/Generic.kl), I uncommented lines that dealt with POWER and changed VOLUME_UP key to power. Right now, pressing the power button doesn't lead to anything, and volume up button would actually power off the screen. But the old problem seems to happen once in a while.

I suspect if this feature was implemented in hardware because, after all the phone has to be turned on when the OS is not running. Still, is someone aware if a key in Generic.kl corresponds to the reboot feature?
Disabling the power button and changing the volume_up button to power did end up working (i.e., prevents faulty restarts at random times.) I also verified that long pressing the actual power button does end up restarting the device, which means that restart is somehow programmed at the hardware level.