I want to use this code in order to reboot my RPI3 running Android Things:
public static void Reboot()
{
try {
Process proc = R
/system/bin/reboot
binary in DP 4, so as in all the previous dev previews, has world-executable permission, i.e. the following yields
adb shell ls -l /system/bin | grep reboot
-rwxr-xr-x 1 root shell ... reboot
That said, it is yet possible to execute the binary for any user (a.k.a app process in Android) without a need to grab su
. Just execute in Java for
rebooting
Runtime.getRuntime().exec("reboot");
or for powering off
Runtime.getRuntime().exec("reboot -p");
No permission's needed in AndroidManifest.xml
to run the binary successfully.
Caution: in case of security model changes in newer OS versions this approach may not work.