diff --git a/app-core/src/main/java/com/topjohnwu/magisk/database/RepoDatabaseHelper.java b/app-core/src/main/java/com/topjohnwu/magisk/database/RepoDatabaseHelper.java index a77eb5a70..194374f6a 100644 --- a/app-core/src/main/java/com/topjohnwu/magisk/database/RepoDatabaseHelper.java +++ b/app-core/src/main/java/com/topjohnwu/magisk/database/RepoDatabaseHelper.java @@ -8,7 +8,6 @@ import android.database.sqlite.SQLiteOpenHelper; import com.topjohnwu.magisk.Config; import com.topjohnwu.magisk.Const; import com.topjohnwu.magisk.container.Repo; -import com.topjohnwu.superuser.internal.UiThreadHandler; import java.util.HashSet; import java.util.Set; diff --git a/app-core/src/main/java/com/topjohnwu/magisk/tasks/FlashZip.java b/app-core/src/main/java/com/topjohnwu/magisk/tasks/FlashZip.java index 265a9d761..50803ec27 100644 --- a/app-core/src/main/java/com/topjohnwu/magisk/tasks/FlashZip.java +++ b/app-core/src/main/java/com/topjohnwu/magisk/tasks/FlashZip.java @@ -35,7 +35,8 @@ public abstract class FlashZip { private boolean unzipAndCheck() throws IOException { ZipUtils.unzip(tmpFile, tmpFile.getParentFile(), "META-INF/com/google/android", true); - return ShellUtils.fastCmdResult("grep -q '#MAGISK' " + new File(tmpFile.getParentFile(), "updater-script")); + return Shell.su("grep -q '#MAGISK' " + new File(tmpFile.getParentFile(), "updater-script")) + .exec().isSuccess(); } private boolean flash() throws IOException { diff --git a/app/src/full/java/com/topjohnwu/magisk/fragments/MagiskFragment.java b/app/src/full/java/com/topjohnwu/magisk/fragments/MagiskFragment.java index b853f1f8c..c810cc70f 100644 --- a/app/src/full/java/com/topjohnwu/magisk/fragments/MagiskFragment.java +++ b/app/src/full/java/com/topjohnwu/magisk/fragments/MagiskFragment.java @@ -30,7 +30,6 @@ import com.topjohnwu.magisk.utils.AppUtils; import com.topjohnwu.magisk.utils.Topic; import com.topjohnwu.net.Networking; import com.topjohnwu.superuser.Shell; -import com.topjohnwu.superuser.ShellUtils; import java.util.Locale; @@ -254,7 +253,7 @@ public class MagiskFragment extends BaseFragment private void updateCheckUI() { int image, color; - String status; + String status, button = ""; if (Config.remoteMagiskVersionCode < 0) { color = colorNeutral; @@ -268,12 +267,12 @@ public class MagiskFragment extends BaseFragment color = colorInfo; image = R.drawable.ic_update; status = getString(R.string.magisk_update_title); - magisk.install.setText(R.string.update); + button = getString(R.string.update); } else { color = colorOK; image = R.drawable.ic_check_circle; status = getString(R.string.magisk_up_to_date); - magisk.install.setText(R.string.install); + button = getString(R.string.install); } } if (Config.magiskVersionCode > 0) { @@ -281,6 +280,7 @@ public class MagiskFragment extends BaseFragment magisk.statusIcon.setImageResource(image); magisk.statusIcon.setColorFilter(color); magisk.status.setText(status); + magisk.install.setText(button); } if (Config.remoteManagerVersionCode < 0) { @@ -322,7 +322,8 @@ public class MagiskFragment extends BaseFragment uninstallButton.setVisibility(Shell.rootAccess() ? View.VISIBLE : View.GONE); } - if (!shownDialog && !ShellUtils.fastCmdResult("env_check")) { + if (!shownDialog && Config.magiskVersionCode > 0 && + !Shell.su("env_check").exec().isSuccess()) { shownDialog = true; new EnvFixDialog(requireActivity()).show(); } diff --git a/app/src/full/java/com/topjohnwu/magisk/utils/DownloadApp.java b/app/src/full/java/com/topjohnwu/magisk/utils/DownloadApp.java index 4c418b4da..5490c33f2 100644 --- a/app/src/full/java/com/topjohnwu/magisk/utils/DownloadApp.java +++ b/app/src/full/java/com/topjohnwu/magisk/utils/DownloadApp.java @@ -7,7 +7,7 @@ import com.topjohnwu.magisk.R; import com.topjohnwu.magisk.uicomponents.ProgressNotification; import com.topjohnwu.net.Networking; import com.topjohnwu.net.ResponseListener; -import com.topjohnwu.superuser.ShellUtils; +import com.topjohnwu.superuser.Shell; import java.io.File; @@ -84,7 +84,7 @@ public class DownloadApp { Config.export(); // Make it world readable apk.setReadable(true, false); - if (ShellUtils.fastCmdResult("pm install " + apk)) + if (Shell.su("pm install " + apk).exec().isSuccess()) RootUtils.rmAndLaunch(app.getPackageName(), BuildConfig.APPLICATION_ID); progress.dismiss(); } diff --git a/app/src/full/java/com/topjohnwu/magisk/utils/PatchAPK.java b/app/src/full/java/com/topjohnwu/magisk/utils/PatchAPK.java index f3863643e..d8989d03d 100644 --- a/app/src/full/java/com/topjohnwu/magisk/utils/PatchAPK.java +++ b/app/src/full/java/com/topjohnwu/magisk/utils/PatchAPK.java @@ -10,7 +10,7 @@ import com.topjohnwu.magisk.R; import com.topjohnwu.magisk.uicomponents.Notifications; import com.topjohnwu.signing.JarMap; import com.topjohnwu.signing.SignAPK; -import com.topjohnwu.superuser.ShellUtils; +import com.topjohnwu.superuser.Shell; import java.io.BufferedOutputStream; import java.io.File; @@ -104,7 +104,7 @@ public class PatchAPK { // Install the application repack.setReadable(true, false); - if (!ShellUtils.fastCmdResult("pm install " + repack)) + if (!Shell.su("pm install " + repack).exec().isSuccess()) return false; Config.set(Config.Key.SU_MANAGER, pkg); diff --git a/app/src/full/res/layout/fragment_magisk.xml b/app/src/full/res/layout/fragment_magisk.xml index 06202066b..a40534473 100644 --- a/app/src/full/res/layout/fragment_magisk.xml +++ b/app/src/full/res/layout/fragment_magisk.xml @@ -79,6 +79,7 @@ android:layout_marginTop="4dp" android:layout_marginRight="5dp" android:layout_marginBottom="4dp" + android:visibility="gone" app:cardCornerRadius="@dimen/card_corner_radius" app:cardElevation="@dimen/card_elevation">