Reboot after env_fix

This commit is contained in:
topjohnwu 2019-04-06 01:56:47 -04:00
parent ebe1ab982e
commit da3937ff4e
2 changed files with 5 additions and 12 deletions

View File

@ -13,6 +13,7 @@ import com.topjohnwu.magisk.SplashActivity;
import com.topjohnwu.magisk.tasks.MagiskInstaller;
import com.topjohnwu.magisk.utils.Utils;
import com.topjohnwu.superuser.Shell;
import com.topjohnwu.superuser.internal.UiThreadHandler;
import com.topjohnwu.superuser.io.SuFile;
import java.io.IOException;
@ -39,18 +40,9 @@ public class EnvFixDialog extends CustomAlertDialog {
@Override
protected void onResult(boolean success) {
pd.dismiss();
Utils.toast(success ? R.string.setup_done : R.string.setup_fail, Toast.LENGTH_LONG);
if (success) {
// Relaunch the app
try {
Shell.getShell().close();
} catch (IOException ignored) {}
Intent intent = new Intent(activity, ClassMap.get(SplashActivity.class));
intent.addFlags(Intent.FLAG_ACTIVITY_TASK_ON_HOME | Intent.FLAG_ACTIVITY_NEW_TASK);
activity.startActivity(intent);
activity.finish();
}
Utils.toast(success ? R.string.reboot_delay_toast : R.string.setup_fail, Toast.LENGTH_LONG);
if (success)
UiThreadHandler.handler.postDelayed(Utils::reboot, 5000);
}
}.exec();
});

View File

@ -84,6 +84,7 @@
<string name="setup_title">Additional Setup</string>
<string name="select_patch_file">Select and Patch a File</string>
<string name="patch_file_msg">Select a raw image (*.img) or an ODIN tarfile (*.tar)</string>
<string name="reboot_delay_toast">Rebooting in 5 seconds…</string>
<!--Toasts, Dialogs-->
<string name="close">Close</string>