Closed GoogleCodeExporter closed 9 years ago
Yes.
There should be better checking of su. Also caching result looks not so right.
Sorry for that. It will be improved. Any sugesstions? Looking for file
/system/xbin/su
Now it is:
/**
* Checks if the phone is rooted.
*
* @return <code>true</code> if the phone is rooted, <code>false</code>
* otherwise.
*/
public static boolean isPhoneRooted() {
if (phoneRooted || (lastRootCheck != null && lastRootCheck.getTime() > System.currentTimeMillis() - 5000))
{
return phoneRooted;
}
// get from build info
String buildTags = android.os.Build.TAGS;
if (buildTags != null && buildTags.contains("test-keys")) {
phoneRooted = true;
lastRootCheck = new Date(System.currentTimeMillis());
return true;
}
// check if /system/app/Superuser.apk is present
try {
File file = new File("/system/app/Superuser.apk");
if (file.exists()) {
phoneRooted = true;
lastRootCheck = new Date(System.currentTimeMillis());
return true;
}
} catch (Throwable e1) {
// ignore
}
phoneRooted = false;
lastRootCheck = new Date(System.currentTimeMillis());
return false;
}
Original comment by supp.san...@gmail.com
on 11 Jul 2012 at 5:47
Probably something like this code.
// public static boolean findBinary(String binaryName) { //
http://code.google.com/p/roottools/source/browse/trunk/Stable/RootTools-sdk3-gen
eric/src/com/stericson/RootTools/RootTools.java#578
Original comment by supp.san...@gmail.com
on 11 Jul 2012 at 5:58
Original comment by supp.san...@gmail.com
on 11 Jul 2012 at 5:58
Original comment by supp.san...@gmail.com
on 12 Jul 2012 at 8:44
Original comment by supp.san...@gmail.com
on 13 Jul 2012 at 5:02
Original issue reported on code.google.com by
bate...@bat.fr.eu.org
on 11 Jul 2012 at 1:10