\ v1.0.2 - Play Protect \uc720\ud574\uc571 \ucc28\ub2e8 \uc624\uc9c4 \uc6d0\uc778 \uc644\ubcbd \uc81c\uac70 \ubc0f \uc804\uccb4\ud654\uba74 \uc54c\ub9bc \uc124\uc815 \ud6c4 \uc571 \ubcf5\uadc0 uac1cuc120\

This commit is contained in:
sanjeok77
2026-08-14 09:25:52 +09:00
parent 2aa3ff15b2
commit 80eb086a59
9 changed files with 32 additions and 79 deletions
@@ -1,46 +1,5 @@
package com.example.shiftalarm
import java.io.File
object RootUtil {
fun isDeviceRooted(): Boolean {
return checkRootMethod1() || checkRootMethod2() || checkRootMethod3()
}
private fun checkRootMethod1(): Boolean {
val buildTags = android.os.Build.TAGS
return buildTags != null && buildTags.contains("test-keys")
}
private fun checkRootMethod2(): Boolean {
val paths = arrayOf(
"/system/app/Superuser.apk",
"/sbin/su",
"/system/bin/su",
"/system/xbin/su",
"/data/local/xbin/su",
"/data/local/bin/su",
"/system/sd/xbin/su",
"/system/bin/failsafe/su",
"/data/local/su",
"/su/bin/su"
)
for (path in paths) {
if (File(path).exists()) return true
}
return false
}
private fun checkRootMethod3(): Boolean {
var process: Process? = null
return try {
process = Runtime.getRuntime().exec(arrayOf("/system/xbin/which", "su"))
val reader = process.inputStream.bufferedReader()
reader.readLine() != null
} catch (t: Throwable) {
false
} finally {
process?.destroy()
}
}
fun isDeviceRooted(): Boolean = false
}