MCPcopy Create free account
hub / github.com/afkT/DevUtils / isDeviceRooted

Method isDeviceRooted

lib/DevApp/src/main/java/dev/utils/app/ADBUtils.java:42–55  ·  view source on GitHub ↗

判断设备是否 root @return true yes, false no

()

Source from the content-addressed store, hash-verified

40 * @return {@code true} yes, {@code false} no
41 */
42 public static boolean isDeviceRooted() {
43 String su = "su";
44 String[] locations = {
45 "/system/bin/", "/system/xbin/", "/sbin/",
46 "/system/sd/xbin/", "/system/bin/failsafe/",
47 "/data/local/xbin/", "/data/local/bin/", "/data/local/"
48 };
49 for (String location : locations) {
50 if (new File(location + su).exists()) {
51 return true;
52 }
53 }
54 return false;
55 }
56
57 /**
58 * 请求 Root 权限

Callers 4

installAppMethod · 0.95
installAppSilentMethod · 0.95
uninstallAppMethod · 0.95
uninstallAppSilentMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected