Disabling Android Things

Usually, to turn off your Android device, you do this with the power button, of course.

You can also do adb shelland reboot -p.

But in Android Things, I see no way to turn off the device. If this is not a problem, I would just like to cut off the power of my raspberry pi for this, but is that acceptable? Could this ruin the SD card?

+27
source share
3 answers

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, , , .

+19

Dave Answer, :

Android Things , , , :

AndroidThings, , ADB:

 adb shell reboot -p

(-p --poweroff)

+15

...

to disconnect

Runtime.getRuntime().exec("reboot -p");

and reboot

Runtime.getRuntime().exec("reboot");

Explanation: The binary is rebootsent in the Android Things image with permission for the whole world, i.e. rwxr-xr-xthat makes it possible to execute from any . In other words, the application does not need to receive su, unlike most Android Android phones / tablets, therefore, additional permission is not required AndroidManifest.xml.

+9
source

Source: https://habr.com/ru/post/1676728/