Android (and, in addition, Android Things) should not have any problems with a sudden loss of power. The main operating system is located in read-only partitions in the file system, so there is no risk of damaging the OS due to unsuccessful recording in flight.
, reboot -p , . , Gpio InputDriver, KEYCODE_POWER, , , .