Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Powering off Android Things

Usually, to power down an Android device, you do this via the power button of course.

You can also do adb shell and reboot -p.

But in Android Things, I don't see a way to shut down the device. If it is no problem, I'd love to just cut the power of my Raspberry Pi for this, but is that acceptable? Could it corrupt the SD-card?

like image 542
Boy Avatar asked Jan 06 '17 10:01

Boy


2 Answers

Android (and by extension, Android Things) should have no problem with a sudden loss of power. The core operating system is housed in read-only partitions on the file system, so there is no risk of corrupting the OS from a failed in-flight write.

Also, reboot -p should still work if you wanted to use that in testing or development. Going even farther with it, you could connect a Gpio with an InputDriver that emits KEYCODE_POWER to add your own power button back to the system if you felt you needed it.

like image 94
devunwired Avatar answered Sep 17 '22 19:09

devunwired


I like Dave's Answer, just wanted to add two things:

You could shut down the Android Things device programatically a number of ways but each has a caveat attached to it, discussed here: Turn off device programmatically

To power off an AndroidThings device like you said you can do it via ADB:

 adb shell reboot -p 

(-p is short for --poweroff)

like image 28
Blundell Avatar answered Sep 18 '22 19:09

Blundell