Root checker
public static boolean hasRootPermission() {
Process process = null;
DataOutputStream os = null;
boolean rooted = true;
try {
process = Runtime.getRuntime().exec("su");
os = new DataOutputStream(process.getOutputStream());
os.writeBytes("exit\n");
os.flush();
process.waitFor();
if (process.exitValue() != 0) rooted = false;
} catch (Exception e) {
rooted = false;
} finally {
if (os != null) {
try {
os.close();
process.destroy();
} catch (Exception e) {
}
}
}
return rooted;
}