判断设备是否 root @return true yes, false no
()
| 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 权限 |
no outgoing calls
no test coverage detected