Floatingpoint,
How does your code example help the device get past the bootloader / battery charging screen when power is applied again? Or, are you just making the device last long w/o power?
From what I have found, cold boot is possible by modifying the bootloader on some devices such as Galaxy or Nexus, but I have not found a solution for my Tab4 Kiosk.