Fix root detection for KernelSU
Use libsu's Shell API instead of Runtime.exec("su -c ...") for root
detection. The previous approach assumed su is in PATH, which works
for Magisk but not for KernelSU where su has a different path.
This commit is contained in:
@@ -18,16 +18,6 @@ import kotlin.coroutines.resumeWithException
|
||||
|
||||
object RootInstaller {
|
||||
|
||||
suspend fun checkAccess(): Boolean = withContext(Dispatchers.IO) {
|
||||
try {
|
||||
val process = Runtime.getRuntime().exec("su -c echo test")
|
||||
val exitCode = process.waitFor()
|
||||
exitCode == 0
|
||||
} catch (e: Exception) {
|
||||
false
|
||||
}
|
||||
}
|
||||
|
||||
suspend fun install(apkFile: File) {
|
||||
withContext(Dispatchers.IO) {
|
||||
bindRootService().use { handle ->
|
||||
|
||||
Reference in New Issue
Block a user