I'm using following code for root detection in Android device. But still my security expert saying it can be installed and run in rooted device. Could someone detect what the issue with my code
public static boolean isDeviceRooted() {
// get from build info
String buildTags = android.os.Build.TAGS;
if (buildTags != null && buildTags.contains("test-keys")) {
return true;
}
return checkFiles() || checkLocations();
}
private static boolean checkFiles(){
String[] files = {
"/system/app/Superuser.apk",
"/system/etc/init.d/99SuperSUDaemon",
"/dev/com.koushikdutta.superuser.daemon/",
"/system/xbin/daemonsu"
};
for (String fileData : files) {
try {
File file = new File(fileData);
if (file.exists()) {
return true;
}
} catch (Exception e1) {
// ignore
}
}
return false;
}
private static boolean checkLocations(){
String su = "su";
String[] locations = {
"/system/bin/",
"/system/xbin/",
"/sbin/",
"/system/sd/xbin/",
"/system/bin/failsafe/",
"/data/local/xbin/",
"/data/local/bin/",
"/data/local/",
"/system/sbin/",
"/usr/bin/",
"/vendor/bin/"
};
for (String location : locations) {
if (new File(location + su).exists()) {
return true;
}
}
return false;
}