I am developing an automated test script to turn off my android device and turn it on back again and then run a few adb commands after the boot is complete.
My problem is that when I turn the device off and turn it on back again, the
sys.boot_completed flag is true , showing that the device is on, but any command such as
adb -s <device_id> shell returns a device not found error.
I tried inserting delays between commands and sleep for boot completion but this error sometimes shows up after a few reboot cycles.
Is there a way to automize reboot with some post-reboot sanity check ?