2016-04-12 26 views
1

這個問題可能是重複的,但我已經通過所有的答案了,發現他們不會再被工作入住蘇存在即設備是植根與否

private static boolean checkRootMethod1() { 
    String buildTags = android.os.Build.TAGS; 
    return buildTags != null && buildTags.contains("test-keys"); 
} 

方法-1失敗

private static boolean checkRootMethod2() { 
    String[] paths = { "/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" }; 
    for (String path : paths) { 
     if (new File(path).exists()) return true; 
    } 
    return false; 
} 

方法2也失敗了,因爲「SuperSu」不再是系統應用程序,它可以卸載並且su文件現在存在於合資文件夾SU/bin/su上

private static boolean checkRootMethod3() { 
    Process process = null; 
    try { 
     process = Runtime.getRuntime().exec(new String[] { "/system/xbin/which", "su" }); 
     BufferedReader in = new BufferedReader(new InputStreamReader(process.getInputStream())); 
     if (in.readLine() != null) return true; 
     return false; 
    } catch (Throwable t) { 
     return false; 
    } finally { 
     if (process != null) process.destroy(); 
    } 
} 

方法3也失敗了,因爲沒有一個天「的」文件在Android設備現在

RootTools.isavailable(); 

也未能

我的問題是可以檢測通過檢查肅是否蘇內文件爲基礎設備/ bin/su文件夾是否是檢測固定設備的正確方法?

回答

1
  1. 添加 「/ SU /斌/蘇」 到checkRootMethod2()
  2. 路徑變量作爲方法3,也應該調用通過使用 「其」 「/系統/斌/其中」
+0

感謝您的答案山姆魯,但你有點遲到;) – Dayvon

+0

「其中」文件不存在現在甚至不存在「/ system/bin/which」路徑 – Dayvon