<!-- The system directory -->
<string name="system_dir">/system</string>
+ <!-- The su binary -->
+ <string name="su_binary">/system/xbin/su</string>
+
<!-- The size of the buffers use by the console (in bytes). Default: 4k -->
<integer name="buffer_size">4096</integer>
import com.cyanogenmod.explorer.util.FileHelper;
import com.cyanogenmod.explorer.util.MimeTypeHelper;
+import java.io.File;
+
/**
* A class that wraps the information of the application (constants,
* identifiers, statics variables, ...).
private static ConsoleHolder sBackgroundConsole;
private static boolean sDebuggable = false;
+ private static boolean sRootedDevice = false;
private final BroadcastReceiver mOnSettingChangeReceiver = new BroadcastReceiver() {
@Override
// Check if the application is debuggable
sDebuggable = (0 != (getApplicationInfo().flags &= ApplicationInfo.FLAG_DEBUGGABLE));
+
+ // Check if the device is rooted
+ sRootedDevice = new File(getString(R.string.su_binary)).exists();
// Register the broadcast receiver
IntentFilter filter = new IntentFilter();
}
/**
+ * Method that returns if the device is rooted
+ *
+ * @return boolean If the device is rooted
+ */
+ public static boolean isRooted() {
+ return sRootedDevice;
+ }
+
+ /**
* Method that returns the application background console.
*
* @return Console The background console