diff --git a/manager/app/src/main/java/me/weishu/kernelsu/ui/util/KsuCli.kt b/manager/app/src/main/java/me/weishu/kernelsu/ui/util/KsuCli.kt index c76b646dcf07..821d96d46a31 100644 --- a/manager/app/src/main/java/me/weishu/kernelsu/ui/util/KsuCli.kt +++ b/manager/app/src/main/java/me/weishu/kernelsu/ui/util/KsuCli.kt @@ -8,6 +8,7 @@ import android.util.Log import com.topjohnwu.superuser.CallbackList import com.topjohnwu.superuser.Shell import com.topjohnwu.superuser.ShellUtils +import com.topjohnwu.superuser.io.SuFile import me.weishu.kernelsu.BuildConfig import me.weishu.kernelsu.Natives import me.weishu.kernelsu.ksuApp @@ -240,6 +241,14 @@ fun isAbDevice(): Boolean { fun isInitBoot(): Boolean { val shell = getRootShell() + if (shell.isRoot) { + // if we have root, use /dev/block/by-name/init_boot to check + val abDevice = isAbDevice() + val initBootBlock = "/dev/block/by-name/init_boot${if (abDevice) "_a" else ""}" + val file = SuFile(initBootBlock) + file.shell = shell + return file.exists() + } // https://source.android.com/docs/core/architecture/partitions/generic-boot return ShellUtils.fastCmd(shell, "getprop ro.product.first_api_level").trim().toInt() >= Build.VERSION_CODES.TIRAMISU }