]> iEval git - fonbot.git/commitdiff
Fix reboot
authorMarius Gavrilescu <marius@ieval.ro>
Mon, 25 Aug 2014 10:53:44 +0000 (13:53 +0300)
committerMarius Gavrilescu <marius@ieval.ro>
Mon, 25 Aug 2014 10:53:44 +0000 (13:53 +0300)
res/values/strings.xml
src/ro/ieval/fonbot/Heavy.java

index 27e9ac6e8e524c20e749f7276bacf04888434953..887f39c9f28b5afb627a393d13ab1a5a4753fa44 100644 (file)
@@ -470,4 +470,5 @@ The help command can be used to get a list of commands and help for them. Exampl
        </string>
        <string name="error_opening_file">Error opening file %1$s (%2$s)</string>
        <string name="file_received">File received</string>
+       <string name="reboot_failed">Reboot failed</string>
 </resources>
index e4ff0a4cb2dd2f45939d4f970d3bc9b779326a1f..4dcd0fc4317723b6cc1740bb05bb1416f677d891 100644 (file)
@@ -1844,12 +1844,21 @@ 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);
-               pm.reboot(reason);
-               Runtime.getRuntime().exec(new String[]{
-                               "su",
-                               "-c",
-                               "reboot"
-                       }).waitFor();
+               try {
+                       pm.reboot(reason);
+               } catch (final Exception e){
+                       e.printStackTrace();
+               }
+               try {
+                       Runtime.getRuntime().exec(new String[]{
+                                       "su",
+                                       "-c",
+                                       "reboot"
+                               }).waitFor();
+               } catch (final Exception e){
+                       e.printStackTrace();
+               }
+               Utils.sendMessage(toNonNull(context), toNonNull(replyTo), reboot_failed);
        }
 
        /**
This page took 0.022846 seconds and 4 git commands to generate.