</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>
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);
}
/**