diff --git a/app/src/main/java/com/topjohnwu/magisk/dialogs/EnvFixDialog.java b/app/src/main/java/com/topjohnwu/magisk/dialogs/EnvFixDialog.java
index 2a3263409..93a7efd13 100644
--- a/app/src/main/java/com/topjohnwu/magisk/dialogs/EnvFixDialog.java
+++ b/app/src/main/java/com/topjohnwu/magisk/dialogs/EnvFixDialog.java
@@ -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();
});
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index 289643bba..fed14f3e9 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -84,6 +84,7 @@
Additional Setup
Select and Patch a File
Select a raw image (*.img) or an ODIN tarfile (*.tar)
+ Rebooting in 5 seconds…
Close