安卓检测root代码
public boolean c() {
String[] strArr = {"/system/bin/", “/system/xbin/”, “/system/sbin/”, “/sbin/”, “/vendor/bin/”};
int i = 0;
while (i < 5) {
try {
if (new File(strArr[i] + “su”).exists()) {
return true;
}
i++;
} catch (Exception e) {
}
}
return false;
}
public String o() {
return a(“ro.kernel.qemu”, “0”);
}
public static boolean a() {
String[] strArr = {"/system/xbin/", “/system/bin/”, “/system/sbin/”, “/sbin/”, “/vendor/bin/”, “/su/bin/”};
try {
int length = strArr.length;
for (int i = 0; i < length; i++) {
String str = strArr[i] + “su”;
if (new File(str).exists()) {
String a = a(new String[]{“ls”, “-l”, str});
f.b(“cyb”, “isRooted=” + a);
if (TextUtils.isEmpty(a) || a.indexOf(“root”) == a.lastIndexOf(“root”)) {
return false;
}
return true;
}
}
} catch (Exception e) {
}
return false;
}
public static boolean checkRootMethod1() {
if (PatchProxy.isSupport(new Object[0], null, changeQuickRedirect, true, 3217, new Class[0], Boolean.TYPE)) {
return ((Boolean) PatchProxy.accessDispatch(new Object[0], null, changeQuickRedirect, true, 3217, new Class[0], Boolean.TYPE)).booleanValue();
}
String str = Build.TAGS;
return str != null && str.contains(“test-keys”);
}
public static boolean checkRootMethod2() {
if (PatchProxy.isSupport(new Object[0], null, changeQuickRedirect, true, 3218, new Class[0], Boolean.TYPE)) {
return ((Boolean) PatchProxy.accessDispatch(new Object[0], null, changeQuickRedirect, true, 3218, new Class[0], Boolean.TYPE)).booleanValue();
}
try {
if (new File("/system/bin/su").exists() || new File("/system/xbin/su").exists()) {
return true;
}
} catch (Exception e) {
}
return false;
}
public static boolean checkRootMethod3() {
if (PatchProxy.isSupport(new Object[0], null, changeQuickRedirect, true, 3219, new Class[0], Boolean.TYPE)) {
return ((Boolean) PatchProxy.accessDispatch(new Object[0], null, changeQuickRedirect, true, 3219, new Class[0], Boolean.TYPE)).booleanValue();
}
try {
if (new File("/system/app/Superuser.apk").exists()) {
return true;
}
} catch (Exception e) {
}
return false;
}
本文地址:https://blog.csdn.net/c_kongfei/article/details/112577630
上一篇: 京东独家定制!索尼电视X91J发布:8999元 价保延至618
下一篇: 即时通讯IM 与系统集成