package de.tudarmstadt.informatik.hostage.system; import java.io.IOException; public class Device { private static boolean initialized = false; private static boolean root = false; private static boolean pp = false; private Device() { new Thread(new Runnable() { @Override public void run() { try { String test = "[ -e /data/local/pp ]"; Process su = new ProcessBuilder("su", "-c", test).start(); switch (su.waitFor()) { case 0: root = true; pp = true; break; case 1: root = true; pp = false; break; case 127: root = false; pp = false; break; } } catch (InterruptedException e) { } catch (IOException e) { } finally { initialized = true; } } }).start(); } public static boolean isRooted() { while (!initialized) ; return root; } public static boolean isPPInstalled() { while (!initialized) ; return pp; } }