Created
December 5, 2016 10:22
-
-
Save KravaDanil/f001919de2f1d2c6e59721afa3908ae0 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| private static boolean isRooted() { | |
| return findBinary("su"); | |
| } | |
| public static boolean findBinary(String binaryName) { | |
| boolean found = false; | |
| if (!found) { | |
| String[] places = {"/sbin/", "/system/bin/", | |
| "/system/xbin/", "/data/local/xbin/", | |
| "/data/local/bin/", "/system/sd/xbin/", | |
| "/system/bin/failsafe/", "/data/local/"}; | |
| for (String where : places) { | |
| if (new File(where + binaryName).exists()) { | |
| found = true; | |
| break; | |
| } | |
| } | |
| } | |
| return found; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Many devices have the su binary in /su/bin now. It would be better to just loop over PATH