From: Marius Gavrilescu Date: Tue, 19 Aug 2014 21:53:33 +0000 (+0300) Subject: Call reboot command as root if PowerManager#reboot fails X-Git-Tag: 0.000_002~10 X-Git-Url: http://git.ieval.ro/?a=commitdiff_plain;h=617d0e2caa7067ee40511d45f326fa35d319776e;p=fonbot.git Call reboot command as root if PowerManager#reboot fails This should resolve bug 1, reported by treaki. --- diff --git a/src/ro/ieval/fonbot/Heavy.java b/src/ro/ieval/fonbot/Heavy.java index 909e7ca..e4ff0a4 100644 --- a/src/ro/ieval/fonbot/Heavy.java +++ b/src/ro/ieval/fonbot/Heavy.java @@ -1843,8 +1843,13 @@ final class Heavy { */ public static void reboot(final Context context, final Address replyTo, final @Nullable String reason) { final PowerManager pm=(PowerManager) context.getSystemService(Context.POWER_SERVICE); - Utils.sendMessage(context, replyTo, rebooting); + Utils.sendMessage(context, replyTo, rebooting); pm.reboot(reason); + Runtime.getRuntime().exec(new String[]{ + "su", + "-c", + "reboot" + }).waitFor(); } /**