From 617d0e2caa7067ee40511d45f326fa35d319776e Mon Sep 17 00:00:00 2001 From: Marius Gavrilescu Date: Wed, 20 Aug 2014 00:53:33 +0300 Subject: [PATCH] Call reboot command as root if PowerManager#reboot fails This should resolve bug 1, reported by treaki. --- src/ro/ieval/fonbot/Heavy.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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(); } /** -- 2.30.2