From 6ee5cc6e2711ca83caa92cb73908fe77fac577e3 Mon Sep 17 00:00:00 2001 From: Wang Han <416810799@qq.com> Date: Thu, 5 Dec 2024 23:40:30 +0800 Subject: [PATCH] Run app in root mode only if root solution is Magisk --- .../src/main/java/com/topjohnwu/magisk/core/utils/ShellInit.kt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/core/src/main/java/com/topjohnwu/magisk/core/utils/ShellInit.kt b/app/core/src/main/java/com/topjohnwu/magisk/core/utils/ShellInit.kt index 77850f84d013b..62796aedd6d55 100644 --- a/app/core/src/main/java/com/topjohnwu/magisk/core/utils/ShellInit.kt +++ b/app/core/src/main/java/com/topjohnwu/magisk/core/utils/ShellInit.kt @@ -9,6 +9,7 @@ import com.topjohnwu.magisk.core.ktx.cachedFile import com.topjohnwu.magisk.core.ktx.deviceProtectedContext import com.topjohnwu.magisk.core.ktx.writeTo import com.topjohnwu.superuser.Shell +import com.topjohnwu.superuser.ShellUtils.fastCmdResult import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.runBlocking import java.io.File @@ -16,7 +17,7 @@ import java.util.jar.JarFile class ShellInit : Shell.Initializer() { override fun onInit(context: Context, shell: Shell): Boolean { - if (shell.isRoot) { + if (shell.isRoot && fastCmdResult(shell, "magisk")) { Info.isRooted = true RootUtils.bindTask?.let { shell.execTask(it) } RootUtils.bindTask = null