xmlns:filemanager="http://schemas.android.com/apk/res/com.cyanogenmod.filemanager"
android:layout_width="match_parent"
android:layout_height="match_parent"
+ android:background="@color/default_background"
android:orientation="vertical">
<!-- Breadcrumb -->
<item>100</item>
</string-array>
+ <!-- General. Access modes -->
+ <string-array name="access_mode_labels">
+ <item>@string/pref_access_mode_safe</item>
+ <item>@string/pref_access_mode_prompt</item>
+ <item>@string/pref_access_mode_root</item>
+ </string-array>
+ <string-array name="access_mode_summaries">
+ <item>@string/pref_access_mode_safe_summary</item>
+ <item>@string/pref_access_mode_prompt_summary</item>
+ <item>@string/pref_access_mode_root_summary</item>
+ </string-array>
+ <string-array name="access_mode_values" translable="false">
+ <item>0</item>
+ <item>1</item>
+ <item>2</item>
+ </string-array>
+
<!-- Search. Sort search results mode -->
<string-array name="sort_search_results_mode_labels" translable="false">
<item>@string/pref_sort_search_results_mode_none</item>
</string-array>
<!-- Compression modes -->
- <!-- Note: Archive modes must be before that compression modes -->
+ <!-- Note: Archive modes must be set prior to compression modes -->
<string-array name="compression_modes_labels" translable="false">
<item>@string/compression_mode_tar</item>
<item>@string/compression_mode_tar_gzip</item>
system resources</string>
<!-- Preferences * General * Advanced settings category -->
<string name="pref_general_advanced_settings_category">Advanced</string>
- <!-- Preferences * General * Advanced mode -->
- <string name="pref_advanced_mode">Privileged mode</string>
- <!-- Preferences * General * Advanced mode summary on -->
- <string name="pref_advanced_mode_on">Warning! Privileged mode allows operations that could break
- your device. It\'s your responsibility to ensure that an operation is safe</string>
+ <!-- Preferences * General * Access mode -->
+ <string name="pref_access_mode">Access mode</string>
+ <!-- Preferences * General * Safe mode -->
+ <string name="pref_access_mode_safe">Safe mode</string>
+ <!-- Preferences * General * Safe mode summary -->
+ <string name="pref_access_mode_safe_summary">Safe mode. The app is running without
+ privileges and the only accessible file systems are the storage volumes (sdcards and USB).</string>
+ <!-- Preferences * General * Prompt user mode -->
+ <string name="pref_access_mode_prompt">Prompt user mode</string>
+ <!-- Preferences * General * Prompt user mode summary -->
+ <string name="pref_access_mode_prompt_summary">Prompt user mode. The app is running
+ without privileges, with full access to the file system, but the user is asked prior to execute
+ any privileged action.</string>
+ <!-- Preferences * General * Root access mode -->
+ <string name="pref_access_mode_root">Root mode</string>
+ <!-- Preferences * General * Root access mode summary -->
+ <string name="pref_access_mode_root_summary">Root mode. The app is running will all
+ the privileges.\n\nWarning! Privileged mode allows operations that could break
+ your device. It\'s your responsibility to ensure that an operation is safe.</string>
<!-- Preferences * Search * Results category -->
<string name="pref_search_results_category">Results</string>
<!-- Preferences * Search * Show relevance widget -->
android:key="general_advanced_settings"
android:title="@string/pref_general_advanced_settings_category">
- <!-- Advanced mode -->
- <CheckBoxPreference
- android:key="cm_filemanager_advanced_mode"
- android:title="@string/pref_advanced_mode"
- android:summaryOn="@string/pref_advanced_mode_on"
- android:persistent="true"
- android:defaultValue="false" />
+ <!-- Access Mode -->
+ <ListPreference
+ android:key="cm_filemanager_access_mode"
+ android:title="@string/pref_access_mode"
+ android:entries="@array/access_mode_labels"
+ android:entryValues="@array/access_mode_values"
+ android:defaultValue="0"
+ android:persistent="true" />
<!-- Capture debug traces -->
<CheckBoxPreference
import com.cyanogenmod.filemanager.console.ConsoleBuilder;
import com.cyanogenmod.filemanager.console.ConsoleHolder;
import com.cyanogenmod.filemanager.console.shell.PrivilegedConsole;
+import com.cyanogenmod.filemanager.preferences.AccessMode;
import com.cyanogenmod.filemanager.preferences.FileManagerSettings;
+import com.cyanogenmod.filemanager.preferences.ObjectStringIdentifier;
import com.cyanogenmod.filemanager.preferences.Preferences;
import com.cyanogenmod.filemanager.util.ExceptionUtil;
import com.cyanogenmod.filemanager.util.FileHelper;
c.reloadTrace();
}
} catch (Throwable _throw) {/**NON BLOCK**/}
- } else if (key != null && key.compareTo(
- FileManagerSettings.SETTINGS_ADVANCE_MODE.getId()) == 0) {
- // Force to change to a privileged console.
- boolean advancedMode = isAdvancedMode();
- if (!advancedMode) {
- // First change to non-privileged console
- if (!ConsoleBuilder.changeToNonPrivilegedConsole(context)) {
- // Try with a privileged console
- ConsoleBuilder.changeToPrivilegedConsole(context);
- try {
- Preferences.savePreference(
- FileManagerSettings.SETTINGS_SUPERUSER_MODE,
- Boolean.TRUE, true);
- } catch (Throwable ex) {
- Log.w(TAG, "can't save console preference", ex); //$NON-NLS-1$
- }
- } else {
- try {
- Preferences.savePreference(
- FileManagerSettings.SETTINGS_SUPERUSER_MODE,
- Boolean.FALSE, true);
- } catch (Throwable ex) {
- Log.w(TAG, "can't save console preference", ex); //$NON-NLS-1$
- }
- }
-
- }
}
}
}
}
}
-
-
/**
* Method that check if the app is signed with the platform signature
*
}
/**
- * Method that returns if the application is running in superuser mode
- *
- * @return boolean If the application is running in superuser mode
- */
- public static boolean isSuperuserMode() {
- boolean defaultValue =
- ((Boolean)FileManagerSettings.
- SETTINGS_SUPERUSER_MODE.
- getDefaultValue()).booleanValue();
- String id = FileManagerSettings.SETTINGS_SUPERUSER_MODE.getId();
- return Preferences.getSharedPreferences().getBoolean(id, defaultValue);
- }
-
- /**
- * Method that returns if the application is running in advanced mode
+ * Method that returns the access mode of the application
*
- * @return boolean If the application is running in advanced mode
+ * @return boolean If the access mode of the application
*/
- public static boolean isAdvancedMode() {
- // If device is not rooted, don't allow advanced mode
- if (!isDeviceRooted()) return false;
-
- boolean defaultValue =
- ((Boolean)FileManagerSettings.
- SETTINGS_ADVANCE_MODE.
- getDefaultValue()).booleanValue();
- String id = FileManagerSettings.SETTINGS_ADVANCE_MODE.getId();
- return Preferences.getSharedPreferences().getBoolean(id, defaultValue);
+ public static AccessMode getAccessMode() {
+ String defaultValue =
+ ((ObjectStringIdentifier)FileManagerSettings.
+ SETTINGS_ACCESS_MODE.getDefaultValue()).getId();
+ String id = FileManagerSettings.SETTINGS_ACCESS_MODE.getId();
+ AccessMode mode =
+ AccessMode.fromId(Preferences.getSharedPreferences().getString(id, defaultValue));
+ return mode;
}
/**
import com.cyanogenmod.filemanager.model.Bookmark;
import com.cyanogenmod.filemanager.model.Bookmark.BOOKMARK_TYPE;
import com.cyanogenmod.filemanager.model.FileSystemObject;
+import com.cyanogenmod.filemanager.preferences.AccessMode;
import com.cyanogenmod.filemanager.preferences.Bookmarks;
import com.cyanogenmod.filemanager.preferences.FileManagerSettings;
import com.cyanogenmod.filemanager.preferences.Preferences;
}
// Is ChRooted?
- this.mChRooted = !FileManagerApplication.isAdvancedMode();
+ this.mChRooted = FileManagerApplication.getAccessMode().compareTo(AccessMode.SAFE) == 0;
//Request features
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
// Is there a console allocate
if (!ConsoleBuilder.isAlloc()) {
// Create a console
- ConsoleBuilder.getConsole(this, true);
+ ConsoleBuilder.getConsole(this);
}
// There is a console allocated. Use it.
return true;
import com.cyanogenmod.filemanager.parcelables.HistoryNavigable;
import com.cyanogenmod.filemanager.parcelables.NavigationViewInfoParcelable;
import com.cyanogenmod.filemanager.parcelables.SearchInfoParcelable;
+import com.cyanogenmod.filemanager.preferences.AccessMode;
import com.cyanogenmod.filemanager.preferences.FileManagerSettings;
import com.cyanogenmod.filemanager.preferences.NavigationLayoutMode;
import com.cyanogenmod.filemanager.preferences.ObjectIdentifier;
// Advanced mode
if (key.compareTo(FileManagerSettings.
- SETTINGS_ADVANCE_MODE.getId()) == 0) {
+ SETTINGS_ACCESS_MODE.getId()) == 0) {
// Is it necessary to create or exit of the ChRooted?
- boolean chRooted = !FileManagerApplication.isAdvancedMode();
+ boolean chRooted =
+ FileManagerApplication.
+ getAccessMode().compareTo(AccessMode.SAFE) == 0;
if (chRooted != NavigationActivity.this.mChRooted) {
if (chRooted) {
createChRooted();
*/
private void init() {
this.mHistory = new ArrayList<History>();
- this.mChRooted = !FileManagerApplication.isAdvancedMode();
+ this.mChRooted = FileManagerApplication.getAccessMode().compareTo(AccessMode.SAFE) == 0;
}
/**
String initialDir =
Preferences.getSharedPreferences().getString(
FileManagerSettings.SETTINGS_INITIAL_DIR.getId(),
- (String)FileManagerSettings.SETTINGS_INITIAL_DIR.getDefaultValue());
+ (String)FileManagerSettings.
+ SETTINGS_INITIAL_DIR.getDefaultValue());
if (NavigationActivity.this.mChRooted) {
// Initial directory is the first external sdcard (sdcard, emmc, usb, ...)
StorageVolume[] volumes =
//######################
case R.id.ab_sort_mode:
showSettingsPopUp(view,
- Arrays.asList(new FileManagerSettings[]{FileManagerSettings.SETTINGS_SORT_MODE}));
+ Arrays.asList(
+ new FileManagerSettings[]{
+ FileManagerSettings.SETTINGS_SORT_MODE}));
break;
case R.id.ab_layout_mode:
showSettingsPopUp(view,
Arrays.asList(
- new FileManagerSettings[]{FileManagerSettings.SETTINGS_LAYOUT_MODE}));
+ new FileManagerSettings[]{
+ FileManagerSettings.SETTINGS_LAYOUT_MODE}));
break;
case R.id.ab_view_options:
// If we are in ChRooted mode, then don't show non-secure items
return;
}
- // Ok. Now try to change to advanced selection console. Any crash
+ // Ok. Now try to change to prompt mode. Any crash
// here is a fatal error. We won't have any console to operate.
try {
// Change console
// Save preferences
Preferences.savePreference(
- FileManagerSettings.SETTINGS_ADVANCE_MODE,
- Boolean.TRUE, true);
- Preferences.savePreference(
- FileManagerSettings.SETTINGS_SUPERUSER_MODE,
- Boolean.FALSE, true);
+ FileManagerSettings.SETTINGS_ACCESS_MODE,
+ AccessMode.PROMPT, true);
} catch (Exception e) {
- //Show exception and exists
+ // Displays an exception and exit
Log.e(TAG, getString(R.string.msgs_cant_create_console), e);
DialogHelper.showToast(
NavigationActivity.this,
this.mDialog.show();
// Set content description of storage volume button
- ButtonItem fs = (ButtonItem)findViewById(R.id.ab_filesystem_info);
+ ButtonItem fs = (ButtonItem)rootView.findViewById(R.id.ab_filesystem_info);
fs.setContentDescription(getString(R.string.actionbar_button_storage_cd));
this.mHandler = new Handler();
import com.cyanogenmod.filemanager.model.SearchResult;
import com.cyanogenmod.filemanager.model.Symlink;
import com.cyanogenmod.filemanager.parcelables.SearchInfoParcelable;
+import com.cyanogenmod.filemanager.preferences.AccessMode;
import com.cyanogenmod.filemanager.preferences.FileManagerSettings;
import com.cyanogenmod.filemanager.preferences.Preferences;
import com.cyanogenmod.filemanager.providers.RecentSearchesContentProvider;
}
// Check if app is running in chrooted mode
- this.mChRooted = !FileManagerApplication.isAdvancedMode();
+ this.mChRooted = FileManagerApplication.getAccessMode().compareTo(AccessMode.SAFE) == 0;
// Register the broadcast receiver
IntentFilter filter = new IntentFilter();
// Is there a console allocate
if (!ConsoleBuilder.isAlloc()) {
// Create a console
- ConsoleBuilder.getConsole(this, true);
+ ConsoleBuilder.getConsole(this);
}
// There is a console allocated. Use it.
return true;
package com.cyanogenmod.filemanager.activities.preferences;
import android.app.ActionBar;
+import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.preference.CheckBoxPreference;
import com.cyanogenmod.filemanager.FileManagerApplication;
import com.cyanogenmod.filemanager.R;
+import com.cyanogenmod.filemanager.console.ConsoleBuilder;
+import com.cyanogenmod.filemanager.preferences.AccessMode;
import com.cyanogenmod.filemanager.preferences.FileManagerSettings;
import com.cyanogenmod.filemanager.preferences.ObjectStringIdentifier;
import com.cyanogenmod.filemanager.preferences.Preferences;
private CheckBoxPreference mCaseSensitiveSort;
private ListPreference mFreeDiskSpaceWarningLevel;
private CheckBoxPreference mComputeFolderStatistics;
- private CheckBoxPreference mAdvancedSettings;
+ private ListPreference mAccessMode;
private CheckBoxPreference mDebugTraces;
/**
private final OnPreferenceChangeListener mOnChangeListener =
new OnPreferenceChangeListener() {
@Override
- public boolean onPreferenceChange(Preference preference, Object newValue) {
+ public boolean onPreferenceChange(final Preference preference, Object newValue) {
+ boolean ret = true;
+
String key = preference.getKey();
- if (DEBUG) Log.d(LOG_TAG,
+ if (DEBUG) {
+ Log.d(LOG_TAG,
String.format("New value for %s: %s", //$NON-NLS-1$
key,
String.valueOf(newValue)));
+ }
// Disk usage warning level
- else if (FileManagerSettings.SETTINGS_DISK_USAGE_WARNING_LEVEL.
+ if (FileManagerSettings.SETTINGS_DISK_USAGE_WARNING_LEVEL.
getId().compareTo(key) == 0) {
String value = (String)newValue;
preference.setSummary(
R.string.pref_disk_usage_warning_level_summary, value));
}
+ // Access mode
+ else if (FileManagerSettings.SETTINGS_ACCESS_MODE.getId().compareTo(key) == 0) {
+ Activity activity = GeneralPreferenceFragment.this.getActivity();
+
+ String value = (String)newValue;
+ AccessMode oldMode = FileManagerApplication.getAccessMode();
+ AccessMode newMode = AccessMode.fromId(value);
+ if (oldMode.compareTo(newMode) != 0) {
+ // The mode was changes. Change the console
+ if (newMode.compareTo(AccessMode.ROOT) == 0) {
+ if (!ConsoleBuilder.changeToPrivilegedConsole(
+ activity.getApplicationContext())) {
+ value = String.valueOf(oldMode.ordinal());
+ ret = false;
+ }
+ } else {
+ if (!ConsoleBuilder.changeToNonPrivilegedConsole(
+ activity.getApplicationContext())) {
+ value = String.valueOf(oldMode.ordinal());
+ ret = false;
+ }
+ }
+ }
+
+ int valueId = Integer.valueOf(value).intValue();
+ String[] summary = getResources().getStringArray(
+ R.array.access_mode_summaries);
+ preference.setSummary(summary[valueId]);
+ }
+
// Notify the change (only if fragment is loaded. Default values are loaded
// while not in loaded mode)
- if (GeneralPreferenceFragment.this.mLoaded) {
+ if (GeneralPreferenceFragment.this.mLoaded && ret) {
Intent intent = new Intent(FileManagerSettings.INTENT_SETTING_CHANGED);
intent.putExtra(
FileManagerSettings.EXTRA_SETTING_CHANGED_KEY, preference.getKey());
getActivity().sendBroadcast(intent);
}
- return true;
+ return ret;
}
};
FileManagerSettings.SETTINGS_COMPUTE_FOLDER_STATISTICS.getId());
this.mComputeFolderStatistics.setOnPreferenceChangeListener(this.mOnChangeListener);
- // Advanced settings
- this.mAdvancedSettings =
- (CheckBoxPreference)findPreference(
- FileManagerSettings.SETTINGS_ADVANCE_MODE.getId());
- if (FileManagerApplication.isDeviceRooted()) {
- this.mAdvancedSettings.setOnPreferenceChangeListener(this.mOnChangeListener);
- } else {
- // Disable the advanced mode
- this.mAdvancedSettings.setEnabled(false);
- }
+ // Access mode
+ this.mAccessMode =
+ (ListPreference)findPreference(
+ FileManagerSettings.SETTINGS_ACCESS_MODE.getId());
+ this.mAccessMode.setOnPreferenceChangeListener(this.mOnChangeListener);
+ defaultValue = ((ObjectStringIdentifier)FileManagerSettings.
+ SETTINGS_ACCESS_MODE.getDefaultValue()).getId();
+ value = Preferences.getSharedPreferences().getString(
+ FileManagerSettings.SETTINGS_ACCESS_MODE.getId(),
+ defaultValue);
+ this.mOnChangeListener.onPreferenceChange(this.mAccessMode, value);
// Capture Debug traces
this.mDebugTraces =
@Override
public boolean onPreferenceChange(Preference preference, Object newValue) {
String key = preference.getKey();
- if (DEBUG) Log.d(LOG_TAG,
+ if (DEBUG) {
+ Log.d(LOG_TAG,
String.format("New value for %s: %s", //$NON-NLS-1$
key,
String.valueOf(newValue)));
+ }
// Saved search terms
if (preference.getKey().compareTo(
import com.cyanogenmod.filemanager.console.java.JavaConsole;
import com.cyanogenmod.filemanager.console.shell.NonPriviledgeConsole;
import com.cyanogenmod.filemanager.console.shell.PrivilegedConsole;
+import com.cyanogenmod.filemanager.preferences.AccessMode;
import com.cyanogenmod.filemanager.preferences.FileManagerSettings;
import com.cyanogenmod.filemanager.preferences.Preferences;
import com.cyanogenmod.filemanager.util.DialogHelper;
return null;
}
createDefaultConsole(context);
+ } else {
+ // Need to change the console? Is the appropriate console for the current mode?
+ if (FileManagerApplication.getAccessMode().
+ compareTo(AccessMode.ROOT) == 0 && !isPrivileged()) {
+ // Force to change the console
+ createDefaultConsole(context);
+ }
}
return sHolder.getConsole();
}
throws FileNotFoundException, IOException, InvalidCommandDefinitionException,
ConsoleAllocException, InsufficientPermissionsException {
//Gets superuser mode settings
- boolean superuserMode = FileManagerApplication.isSuperuserMode();
- boolean advancedMode = FileManagerApplication.isAdvancedMode();
+ boolean superuserMode =
+ FileManagerApplication.getAccessMode().compareTo(AccessMode.ROOT) == 0;
+ boolean advancedMode =
+ FileManagerApplication.getAccessMode().compareTo(AccessMode.SAFE) != 0;
if (superuserMode && !advancedMode) {
try {
Preferences.savePreference(
- FileManagerSettings.SETTINGS_SUPERUSER_MODE, Boolean.FALSE, true);
+ FileManagerSettings.SETTINGS_ACCESS_MODE, AccessMode.PROMPT, true);
} catch (Throwable ex) {
Log.w(TAG, "can't save console preference", ex); //$NON-NLS-1$
}
}
}
- boolean advancedMode = FileManagerApplication.isAdvancedMode();
+ boolean advancedMode =
+ FileManagerApplication.getAccessMode().compareTo(AccessMode.SAFE) != 0;
if (advancedMode) {
//Save settings
try {
Preferences.savePreference(
- FileManagerSettings.SETTINGS_SUPERUSER_MODE, Boolean.FALSE, true);
+ FileManagerSettings.SETTINGS_ACCESS_MODE, AccessMode.PROMPT, true);
} catch (Exception ex) {
Log.e(TAG,
String.format("Failed to save %s property", //$NON-NLS-1$
- FileManagerSettings.SETTINGS_SUPERUSER_MODE.getId()), ex);
+ FileManagerSettings.SETTINGS_ACCESS_MODE.getId()), ex);
}
//Create the non-privileged console
--- /dev/null
+/*
+ * Copyright (C) 2012 The CyanogenMod Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.cyanogenmod.filemanager.preferences;
+
+/**
+ * An enumeration of the access modes.
+ */
+public enum AccessMode implements ObjectStringIdentifier {
+
+ /**
+ * The safe mode. The app runs without privileges and the only accessible filesystem
+ * are the storage volumes (sdcards and USB).
+ */
+ SAFE("0"), //$NON-NLS-1$
+ /**
+ * The prompt user mode. The app runs without privileges, with access to all the filesystem,
+ * but the user is asked prior to execute a privileged action. If the user accepts then the
+ * system change to a {@link AccessMode#ROOT} mode, and continues in it after execute the
+ * action.
+ */
+ PROMPT("1"), //$NON-NLS-1$
+ /**
+ * the root mode. The app runs with all privileges.
+ */
+ ROOT("2"); //$NON-NLS-1$
+
+ private String mId;
+
+ /**
+ * Constructor of <code>AccessMode</code>.
+ *
+ * @param id The unique identifier of the enumeration
+ */
+ private AccessMode(String id) {
+ this.mId = id;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public String getId() {
+ return this.mId;
+ }
+
+ /**
+ * Method that returns an instance of {@link AccessMode} from its
+ * unique identifier.
+ *
+ * @param id The unique identifier
+ * @return AccessMode The access mode
+ */
+ public static AccessMode fromId(String id) {
+ AccessMode[] values = values();
+ int cc = values.length;
+ for (int i = 0; i < cc; i++) {
+ if (values[i].mId.compareTo(id) == 0) {
+ return values[i];
+ }
+ }
+ return null;
+ }
+
+}
SETTINGS_FIRST_USE("cm_filemanager_first_use", Boolean.TRUE), //$NON-NLS-1$
/**
- * Whether use SUPERUSER mode.
+ * The access mode to use
* @hide
*/
- SETTINGS_SUPERUSER_MODE("cm_filemanager_superuser_mode", Boolean.FALSE), //$NON-NLS-1$
+ SETTINGS_ACCESS_MODE("cm_filemanager_access_mode", AccessMode.SAFE), //$NON-NLS-1$
+
/**
* The initial directory to be used.
* @hide
*/
SETTINGS_COMPUTE_FOLDER_STATISTICS(
"cm_filemanager_compute_folder_statistics", Boolean.FALSE), //$NON-NLS-1$
- /**
- * When to run in advanced mode
- * @hide
- */
- SETTINGS_ADVANCE_MODE(
- "cm_filemanager_advanced_mode", Boolean.FALSE), //$NON-NLS-1$
/**
* When to highlight the terms of the search in the search results
import com.cyanogenmod.filemanager.model.FileSystemObject;
import com.cyanogenmod.filemanager.model.Query;
import com.cyanogenmod.filemanager.model.SearchResult;
+import com.cyanogenmod.filemanager.preferences.AccessMode;
import com.cyanogenmod.filemanager.preferences.FileManagerSettings;
import com.cyanogenmod.filemanager.preferences.NavigationSortMode;
import com.cyanogenmod.filemanager.preferences.ObjectStringIdentifier;
SearchSortResultMode mode = SearchSortResultMode.fromId(value);
// Are we in ChRooted environment?
- boolean chRooted = !FileManagerApplication.isAdvancedMode();
+ boolean chRooted =
+ FileManagerApplication.getAccessMode().compareTo(AccessMode.SAFE) == 0;
//Process all the data
final List<SearchResult> result =
import com.cyanogenmod.filemanager.listeners.OnSelectionListener;
import com.cyanogenmod.filemanager.model.FileSystemObject;
import com.cyanogenmod.filemanager.model.SystemFile;
+import com.cyanogenmod.filemanager.preferences.AccessMode;
import com.cyanogenmod.filemanager.ui.policy.BookmarksActionPolicy;
import com.cyanogenmod.filemanager.ui.policy.CompressActionPolicy;
import com.cyanogenmod.filemanager.ui.policy.CopyMoveActionPolicy;
this.mContext = context;
this.mGlobal = global;
this.mSearch = search;
- this.mChRooted = !FileManagerApplication.isAdvancedMode();
+ this.mChRooted = FileManagerApplication.getAccessMode().compareTo(AccessMode.SAFE) == 0;
//Initialize dialog
init(context, global ? R.id.mnu_actions_global : R.id.mnu_actions_fso);
import com.cyanogenmod.filemanager.console.ConsoleBuilder;
import com.cyanogenmod.filemanager.model.DiskUsage;
import com.cyanogenmod.filemanager.model.MountPoint;
+import com.cyanogenmod.filemanager.preferences.AccessMode;
import com.cyanogenmod.filemanager.preferences.FileManagerSettings;
import com.cyanogenmod.filemanager.preferences.Preferences;
import com.cyanogenmod.filemanager.ui.widgets.DiskUsageGraph;
this.mMountPoint = mountPoint;
this.mDiskUsage = diskUsage;
this.mIsMountAllowed = false;
- this.mIsAdvancedMode = FileManagerApplication.isAdvancedMode();
+ this.mIsAdvancedMode =
+ FileManagerApplication.getAccessMode().compareTo(AccessMode.SAFE) != 0;
//Inflate the content
LayoutInflater li =
import com.cyanogenmod.filemanager.model.Symlink;
import com.cyanogenmod.filemanager.model.User;
import com.cyanogenmod.filemanager.model.UserPermission;
+import com.cyanogenmod.filemanager.preferences.AccessMode;
import com.cyanogenmod.filemanager.preferences.FileManagerSettings;
import com.cyanogenmod.filemanager.preferences.Preferences;
import com.cyanogenmod.filemanager.util.AIDHelper;
this.mHasChanged = false;
this.mIgnoreCheckEvents = true;
this.mHasPrivileged = false;
- this.mIsAdvancedMode = FileManagerApplication.isAdvancedMode();
+ this.mIsAdvancedMode =
+ FileManagerApplication.getAccessMode().compareTo(AccessMode.SAFE) != 0;
//Inflate the content
LayoutInflater li =
import com.cyanogenmod.filemanager.model.Symlink;
import com.cyanogenmod.filemanager.parcelables.NavigationViewInfoParcelable;
import com.cyanogenmod.filemanager.parcelables.SearchInfoParcelable;
+import com.cyanogenmod.filemanager.preferences.AccessMode;
import com.cyanogenmod.filemanager.preferences.FileManagerSettings;
import com.cyanogenmod.filemanager.preferences.NavigationLayoutMode;
import com.cyanogenmod.filemanager.preferences.ObjectIdentifier;
// Pick mode is always ChRooted
this.mChRooted = true;
} else {
- this.mChRooted = !FileManagerApplication.isAdvancedMode();
+ this.mChRooted =
+ FileManagerApplication.getAccessMode().compareTo(AccessMode.SAFE) == 0;
}
//Retrieve the default configuration
import com.cyanogenmod.filemanager.console.OperationTimeoutException;
import com.cyanogenmod.filemanager.console.ReadOnlyFilesystemException;
import com.cyanogenmod.filemanager.console.RelaunchableException;
+import com.cyanogenmod.filemanager.preferences.AccessMode;
import java.io.FileNotFoundException;
import java.io.IOException;
// If console is privileged there is not need to change
// If we are in a ChRooted environment, resolve the error without do anymore
if (relaunchable instanceof InsufficientPermissionsException &&
- (isPrivileged || !FileManagerApplication.isAdvancedMode())) {
+ (isPrivileged ||
+ FileManagerApplication.getAccessMode().compareTo(AccessMode.SAFE) == 0)) {
translateException(
context, relaunchable, quiet, false, null);