private static ExplorerApplication sApp;
private static ConsoleHolder sBackgroundConsole;
- private static boolean sDebuggable = false;
- private static boolean sRootedDevice = false;
+ private static boolean sIsDebuggable = false;
+ private static boolean sIsDeviceRooted = false;
private final BroadcastReceiver mOnSettingChangeReceiver = new BroadcastReceiver() {
@Override
sApp = this;
// Check if the application is debuggable
- sDebuggable = (0 != (getApplicationInfo().flags &= ApplicationInfo.FLAG_DEBUGGABLE));
+ sIsDebuggable = (0 != (getApplicationInfo().flags &= ApplicationInfo.FLAG_DEBUGGABLE));
// Check if the device is rooted
- sRootedDevice = new File(getString(R.string.su_binary)).exists();
+ sIsDeviceRooted = new File(getString(R.string.su_binary)).exists();
// Register the broadcast receiver
IntentFilter filter = new IntentFilter();
* @return boolean If the application is debuggable
*/
public static boolean isDebuggable() {
- return sDebuggable;
+ return sIsDebuggable;
}
/**
*
* @return boolean If the device is rooted
*/
- public static boolean isRooted() {
- return sRootedDevice;
+ public static boolean isDeviceRooted() {
+ return sIsDeviceRooted;
}
/**
* @return boolean If the application is running in advanced mode
*/
public static boolean isAdvancedMode() {
+ // If device is not rooted, don't allow advanced mode
+ if (isDeviceRooted()) return false;
+
boolean defaultValue =
((Boolean)ExplorerSettings.
SETTINGS_ADVANCE_MODE.
getDefaultValue()).booleanValue();
String id = ExplorerSettings.SETTINGS_ADVANCE_MODE.getId();
- return Preferences.getSharedPreferences().getBoolean(id, defaultValue);
+ return Preferences.getSharedPreferences().getBoolean(id, defaultValue);
}
}
import android.widget.TextView;
import android.widget.Toast;
+import com.cyanogenmod.explorer.ExplorerApplication;
import com.cyanogenmod.explorer.R;
import com.cyanogenmod.explorer.preferences.ExplorerSettings;
import com.cyanogenmod.explorer.preferences.ObjectStringIdentifier;
private ListPreference mDefaultLongClickAction;
private ListPreference mFreeDiskSpaceWarningLevel;
private CheckBoxPreference mComputeFolderStatistics;
- private CheckBoxPreference mAllowConsoleSelection;
+ private CheckBoxPreference mAdvancedSettings;
/**
* @hide
ExplorerSettings.SETTINGS_COMPUTE_FOLDER_STATISTICS.getId());
this.mComputeFolderStatistics.setOnPreferenceChangeListener(this.mOnChangeListener);
- // Allow console selection
- this.mAllowConsoleSelection =
+ // Advanced settings
+ this.mAdvancedSettings =
(CheckBoxPreference)findPreference(
ExplorerSettings.SETTINGS_ADVANCE_MODE.getId());
- this.mAllowConsoleSelection.setOnPreferenceChangeListener(this.mOnChangeListener);
+ if (ExplorerApplication.isDeviceRooted()) {
+ this.mAdvancedSettings.setOnPreferenceChangeListener(this.mOnChangeListener);
+ } else {
+ // Disable the advanced mode
+ this.mAdvancedSettings.setEnabled(false);
+ }
// Loaded
this.mLoaded = true;