OSDN Git Service

Rename jail room terms for a more convenient chrooted
authorjruesga <jorge@ruesga.com>
Sun, 21 Oct 2012 14:05:48 +0000 (16:05 +0200)
committerjruesga <jorge@ruesga.com>
Sun, 21 Oct 2012 14:05:48 +0000 (16:05 +0200)
src/com/cyanogenmod/explorer/activities/BookmarksActivity.java
src/com/cyanogenmod/explorer/activities/NavigationActivity.java
src/com/cyanogenmod/explorer/activities/PickerActivity.java
src/com/cyanogenmod/explorer/parcelables/NavigationViewInfoParcelable.java
src/com/cyanogenmod/explorer/tasks/SearchResultDrawingAsyncTask.java
src/com/cyanogenmod/explorer/ui/dialogs/ActionsDialog.java
src/com/cyanogenmod/explorer/ui/widgets/Breadcrumb.java
src/com/cyanogenmod/explorer/ui/widgets/BreadcrumbView.java
src/com/cyanogenmod/explorer/ui/widgets/NavigationView.java
src/com/cyanogenmod/explorer/util/ExceptionUtil.java
src/com/cyanogenmod/explorer/util/FileHelper.java

index 556199b..18ab7e9 100644 (file)
@@ -71,7 +71,7 @@ public class BookmarksActivity extends Activity implements OnItemClickListener,
 
     private ListView mBookmarksListView;
 
-    private boolean mJailRoom;
+    private boolean mChRooted;
 
     /**
      * {@inheritDoc}
@@ -82,8 +82,8 @@ public class BookmarksActivity extends Activity implements OnItemClickListener,
             Log.d(TAG, "NavigationActivity.onCreate"); //$NON-NLS-1$
         }
 
-        // Is in jail room?
-        this.mJailRoom = !ExplorerApplication.isAdvancedMode();
+        // Is ChRooted?
+        this.mChRooted = !ExplorerApplication.isAdvancedMode();
 
         //Request features
         setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
@@ -274,9 +274,9 @@ public class BookmarksActivity extends Activity implements OnItemClickListener,
      */
     private List<Bookmark> loadBookmarks() {
         // Bookmarks = HOME + FILESYSTEM + SD STORAGES + USER DEFINED
-        // In jail room mode = SD STORAGES + USER DEFINED (from SD STORAGES)
+        // In ChRooted mode = SD STORAGES + USER DEFINED (from SD STORAGES)
         List<Bookmark> bookmarks = new ArrayList<Bookmark>();
-        if (!this.mJailRoom) {
+        if (!this.mChRooted) {
             bookmarks.add(loadHomeBookmarks());
             bookmarks.addAll(loadFilesystemBookmarks());
         }
@@ -415,7 +415,7 @@ public class BookmarksActivity extends Activity implements OnItemClickListener,
         if (cursor != null && cursor.moveToFirst()) {
             do {
                 Bookmark bm = new Bookmark(cursor);
-                if (this.mJailRoom && StorageHelper.isPathInStorageVolume(bm.mPath)) {
+                if (this.mChRooted && StorageHelper.isPathInStorageVolume(bm.mPath)) {
                     continue;
                 }
                 bookmarks.add(bm);
index e106baa..975847d 100644 (file)
@@ -207,13 +207,13 @@ public class NavigationActivity extends Activity
                     // Advanced mode
                     if (key.compareTo(ExplorerSettings.
                             SETTINGS_ADVANCE_MODE.getId()) == 0) {
-                        // Is it necessary to create or exit of the jail room?
-                        boolean jailRoom = !ExplorerApplication.isAdvancedMode();
-                        if (jailRoom != NavigationActivity.this.mJailRoom) {
-                            if (jailRoom) {
-                                createJailRoom();
+                        // Is it necessary to create or exit of the ChRooted?
+                        boolean chRooted = !ExplorerApplication.isAdvancedMode();
+                        if (chRooted != NavigationActivity.this.mChRooted) {
+                            if (chRooted) {
+                                createChRooted();
                             } else {
-                                exitJailRoom();
+                                exitChRooted();
                             }
                         }
                     }
@@ -239,7 +239,7 @@ public class NavigationActivity extends Activity
     /**
      * @hide
      */
-    boolean mJailRoom;
+    boolean mChRooted;
 
     /**
      * @hide
@@ -355,7 +355,7 @@ public class NavigationActivity extends Activity
      */
     private void init() {
         this.mHistory = new ArrayList<History>();
-        this.mJailRoom = !ExplorerApplication.isAdvancedMode();
+        this.mChRooted = !ExplorerApplication.isAdvancedMode();
     }
 
     /**
@@ -484,7 +484,7 @@ public class NavigationActivity extends Activity
                         throw new ConsoleAllocException("console == null"); //$NON-NLS-1$
                     }
                 } catch (Throwable ex) {
-                    if (!NavigationActivity.this.mJailRoom) {
+                    if (!NavigationActivity.this.mChRooted) {
                         //Show exception and exists
                         Log.e(TAG, getString(R.string.msgs_cant_create_console), ex);
                         // We don't have any console
@@ -510,7 +510,7 @@ public class NavigationActivity extends Activity
                             Preferences.getSharedPreferences().getString(
                                 ExplorerSettings.SETTINGS_INITIAL_DIR.getId(),
                                 (String)ExplorerSettings.SETTINGS_INITIAL_DIR.getDefaultValue());
-                    if (NavigationActivity.this.mJailRoom) {
+                    if (NavigationActivity.this.mChRooted) {
                         // Initial directory is the first external sdcard (sdcard, emmc, usb, ...)
                         StorageVolume[] volumes =
                                 StorageHelper.getStorageVolumes(NavigationActivity.this);
@@ -658,8 +658,8 @@ public class NavigationActivity extends Activity
                                 new ExplorerSettings[]{ExplorerSettings.SETTINGS_LAYOUT_MODE}));
                 break;
             case R.id.ab_view_options:
-                // If we are in jail room, then don't show non-secure items
-                if (this.mJailRoom) {
+                // If we are in ChRooted mode, then don't show non-secure items
+                if (this.mChRooted) {
                     showSettingsPopUp(view,
                             Arrays.asList(new ExplorerSettings[]{
                                     ExplorerSettings.SETTINGS_SHOW_DIRS_FIRST}));
@@ -948,7 +948,7 @@ public class NavigationActivity extends Activity
         }
 
         // Check if console selection is allowed
-        if (this.mJailRoom) {
+        if (this.mChRooted) {
             menu.removeItem(R.id.mnu_console);
         }
 
@@ -1354,17 +1354,18 @@ public class NavigationActivity extends Activity
     }
 
     /**
-     * Method that creates a jail room, protecting the user to break anything in the device
+     * Method that creates a ChRooted environment, protecting the user to break anything in
+     * the device
      * @hide
      */
-    void createJailRoom() {
-        // If we are in a jail room, then do nothing
-        if (this.mJailRoom) return;
-        this.mJailRoom = true;
+    void createChRooted() {
+        // If we are in a ChRooted mode, then do nothing
+        if (this.mChRooted) return;
+        this.mChRooted = true;
 
         int cc = this.mNavigationViews.length;
         for (int i = 0; i < cc; i++) {
-            this.mNavigationViews[i].createJailRoom();
+            this.mNavigationViews[i].createChRooted();
         }
 
         // Remove the selection
@@ -1378,17 +1379,17 @@ public class NavigationActivity extends Activity
     }
 
     /**
-     * Method that exits from a jail room
+     * Method that exits from a ChRooted
      * @hide
      */
-    void exitJailRoom() {
-        // If we aren't in a jail room, then do nothing
-        if (!this.mJailRoom) return;
-        this.mJailRoom = false;
+    void exitChRooted() {
+        // If we aren't in a ChRooted mode, then do nothing
+        if (!this.mChRooted) return;
+        this.mChRooted = false;
 
         int cc = this.mNavigationViews.length;
         for (int i = 0; i < cc; i++) {
-            this.mNavigationViews[i].exitJailRoom();
+            this.mNavigationViews[i].exitChRooted();
         }
     }
 
index 2c523ac..ca323f7 100644 (file)
@@ -181,7 +181,7 @@ public class PickerActivity extends Activity
         try {
             // Is there a console allocate
             if (!ConsoleBuilder.isAlloc()) {
-                // Create a jail room console
+                // Create a ChRooted console
                 ConsoleBuilder.createDefaultConsole(this, false, false);
             }
             // There is a console allocated. Use it.
index 9fd8f62..1e7bd18 100644 (file)
@@ -37,7 +37,7 @@ public class NavigationViewInfoParcelable extends HistoryNavigable {
 
     private int mId;
     private String mCurrentDir;
-    private boolean mJailRoom;
+    private boolean mChRooted;
     private List<FileSystemObject> mFiles;
     private List<FileSystemObject> mSelectedFiles;
 
@@ -114,21 +114,21 @@ public class NavigationViewInfoParcelable extends HistoryNavigable {
     }
 
     /**
-     * Method that returns if the view is in a jail room.
+     * Method that returns if the view is in a ChRooted environment.
      *
-     * @return boolean If the view is in a jail room
+     * @return boolean If the view is in a ChRooted environment
      */
-    public boolean getJailRoom() {
-        return this.mJailRoom;
+    public boolean getChRooted() {
+        return this.mChRooted;
     }
 
     /**
-     * Method that sets if the view is in a jail room.
+     * Method that sets if the view is in a ChRooted environment.
      *
-     * @param jailRoom If the view is in a jail room
+     * @param chRooted If the view is in a ChRooted environment
      */
-    public void setJailRoom(boolean jailRoom) {
-        this.mJailRoom = jailRoom;
+    public void setChRooted(boolean chRooted) {
+        this.mChRooted = chRooted;
     }
 
     /**
@@ -188,7 +188,7 @@ public class NavigationViewInfoParcelable extends HistoryNavigable {
             dest.writeString(this.mCurrentDir);
         }
         //- 2
-        dest.writeInt(this.mJailRoom ? 1 : 0);
+        dest.writeInt(this.mChRooted ? 1 : 0);
         //- 3
         dest.writeInt(this.mSelectedFiles == null ? 0 : 1);
         if (this.mSelectedFiles != null) {
@@ -215,7 +215,7 @@ public class NavigationViewInfoParcelable extends HistoryNavigable {
             this.mCurrentDir = in.readString();
         }
         //- 2
-        this.mJailRoom = (in.readInt() == 1);
+        this.mChRooted = (in.readInt() == 1);
         //- 3
         int hasSelectedFiles = in.readInt();
         if (hasSelectedFiles == 1) {
index 36e99f7..e41a85d 100644 (file)
@@ -115,14 +115,14 @@ public class SearchResultDrawingAsyncTask extends AsyncTask<Object, Integer, Boo
                                 defaultValue);
             SearchSortResultMode mode = SearchSortResultMode.fromId(value);
 
-            // Is in jail room?
-            boolean jailRoom = !ExplorerApplication.isAdvancedMode();
+            // Are we in ChRooted environment?
+            boolean chRooted = !ExplorerApplication.isAdvancedMode();
 
             //Process all the data
             final List<SearchResult> result =
                     SearchHelper.convertToResults(
                             FileHelper.applyUserPreferences(
-                                    this.mFiles, MimeTypeHelper.ALL_MIME_TYPES, true, jailRoom),
+                                    this.mFiles, MimeTypeHelper.ALL_MIME_TYPES, true, chRooted),
                             this.mQueries);
             if (mode.compareTo(SearchSortResultMode.NAME) == 0) {
                 Collections.sort(result, new Comparator<SearchResult>() {
index dfbb2f6..df8fcd1 100644 (file)
@@ -72,7 +72,7 @@ public class ActionsDialog implements OnItemClickListener, OnItemLongClickListen
     final Context mContext;
     private final boolean mGlobal;
     private final boolean mSearch;
-    private final boolean mJailRoom;
+    private final boolean mChRooted;
 
     /**
      * @hide
@@ -109,7 +109,7 @@ public class ActionsDialog implements OnItemClickListener, OnItemLongClickListen
         this.mContext = context;
         this.mGlobal = global;
         this.mSearch = search;
-        this.mJailRoom = !ExplorerApplication.isAdvancedMode();
+        this.mChRooted = !ExplorerApplication.isAdvancedMode();
 
         //Initialize dialog
         init(context, global ? R.id.mnu_actions_global : R.id.mnu_actions_fso);
@@ -636,9 +636,9 @@ public class ActionsDialog implements OnItemClickListener, OnItemLongClickListen
             menu.removeItem(R.id.mnu_actions_open_parent_folder);
         }
 
-        // Remove jail room actions (actions that can't be present when running in
+        // Remove not-ChRooted actions (actions that can't be present when running in
         // unprivileged mode)
-        if (this.mJailRoom) {
+        if (this.mChRooted) {
             menu.removeItem(R.id.mnu_actions_create_link);
             menu.removeItem(R.id.mnu_actions_create_link_global);
             menu.removeItem(R.id.mnu_actions_execute);
index 02854bd..4c41a83 100644 (file)
@@ -38,9 +38,9 @@ public interface Breadcrumb {
      * Method that changes the path of the breadcrumb.
      *
      * @param newPath The new path
-     * @param jailRoom If the breadcrumb should be in a jail room
+     * @param chRooted If the breadcrumb should be in a ChRooted environment
      */
-    void changeBreadcrumbPath(final String newPath, boolean jailRoom);
+    void changeBreadcrumbPath(final String newPath, boolean chRooted);
 
     /**
      * Method that adds a new breadcrumb listener.
index 1fb939d..471e2f1 100644 (file)
@@ -185,7 +185,7 @@ public class BreadcrumbView extends RelativeLayout implements Breadcrumb, OnClic
      * {@inheritDoc}
      */
     @Override
-    public void changeBreadcrumbPath(final String newPath, final boolean jailRoom) {
+    public void changeBreadcrumbPath(final String newPath, final boolean chRooted) {
         //Sets the current path
         this.mCurrentPath = newPath;
 
@@ -195,15 +195,15 @@ public class BreadcrumbView extends RelativeLayout implements Breadcrumb, OnClic
         //Remove all views
         this.mBreadcrumbBar.removeAllViews();
 
-        //The first is always the root (if not in a jail room)
-        if (!jailRoom) {
+        // The first is always the root (except if we are in a ChRooted environment)
+        if (!chRooted) {
             this.mBreadcrumbBar.addView(createBreadcrumbItem(new File(FileHelper.ROOT_DIRECTORY)));
         }
 
         //Add the rest of the path
         String[] dirs = newPath.split(File.separator);
         int cc = dirs.length;
-        if (jailRoom) {
+        if (chRooted) {
             boolean first = true;
             for (int i = 1; i < cc; i++) {
                 File f = createFile(dirs, i);
index 0df6d05..65bc4e9 100644 (file)
@@ -147,7 +147,7 @@ public class NavigationView extends RelativeLayout implements
     private OnNavigationRequestMenuListener mOnNavigationRequestMenuListener;
     private OnFilePickedListener mOnFilePickedListener;
 
-    private boolean mJailRoom;
+    private boolean mChRooted;
 
     private NAVIGATION_MODE mNavigationMode;
 
@@ -226,7 +226,7 @@ public class NavigationView extends RelativeLayout implements
         NavigationViewInfoParcelable parcel = new NavigationViewInfoParcelable();
         parcel.setId(this.mId);
         parcel.setCurrentDir(this.mCurrentDir);
-        parcel.setJailRoom(this.mJailRoom);
+        parcel.setChRooted(this.mChRooted);
         parcel.setSelectedFiles(this.mAdapter.getSelectedItems());
         parcel.setFiles(this.mFiles);
         return parcel;
@@ -241,7 +241,7 @@ public class NavigationView extends RelativeLayout implements
         //Restore the data
         this.mId = info.getId();
         this.mCurrentDir = info.getCurrentDir();
-        this.mJailRoom = info.getJailRoom();
+        this.mChRooted = info.getChRooted();
         this.mFiles = info.getFiles();
         this.mAdapter.setSelectedItems(info.getSelectedFiles());
 
@@ -268,12 +268,12 @@ public class NavigationView extends RelativeLayout implements
         //Initialize variables
         this.mFiles = new ArrayList<FileSystemObject>();
 
-        // Is in jail room?
+        // Is ChRooted environment?
         if (this.mNavigationMode.compareTo(NAVIGATION_MODE.PICKABLE) == 0) {
-            // Pick mode is jail room always
-            this.mJailRoom = true;
+            // Pick mode is always ChRooted
+            this.mChRooted = true;
         } else {
-            this.mJailRoom = !ExplorerApplication.isAdvancedMode();
+            this.mChRooted = !ExplorerApplication.isAdvancedMode();
         }
 
         // Default long-click action
@@ -648,9 +648,9 @@ public class NavigationView extends RelativeLayout implements
             final boolean reload, final boolean useCurrent,
             final SearchInfoParcelable searchInfo, final FileSystemObject scrollTo) {
 
-        // Check navigation security (don't allow to go outside the jail room if one
+        // Check navigation security (don't allow to go outside the ChRooted environment if one
         // is created)
-        final String fNewDir = checkJailRoomNavigation(newDir);
+        final String fNewDir = checkChRootedNavigation(newDir);
 
         synchronized (this.mSync) {
             //Check that it is really necessary change the directory
@@ -795,7 +795,7 @@ public class NavigationView extends RelativeLayout implements
 
             //Apply user preferences
             List<FileSystemObject> sortedFiles =
-                    FileHelper.applyUserPreferences(files, this.mMimeType, this.mJailRoom);
+                    FileHelper.applyUserPreferences(files, this.mMimeType, this.mChRooted);
 
             //Load the data
             loadData(sortedFiles);
@@ -814,7 +814,7 @@ public class NavigationView extends RelativeLayout implements
 
             //Change the breadcrumb
             if (NavigationView.this.mBreadcrumb != null) {
-                NavigationView.this.mBreadcrumb.changeBreadcrumbPath(newDir, this.mJailRoom);
+                NavigationView.this.mBreadcrumb.changeBreadcrumbPath(newDir, this.mChRooted);
             }
 
             //Scroll to object?
@@ -1085,13 +1085,14 @@ public class NavigationView extends RelativeLayout implements
     }
 
     /**
-     * Method that creates a jail room, protecting the user to break anything in the device
+     * Method that creates a ChRooted environment, protecting the user to break anything
+     * in the device
      * @hide
      */
-    public void createJailRoom() {
-        // If we are in a jail room, then do nothing
-        if (this.mJailRoom) return;
-        this.mJailRoom = true;
+    public void createChRooted() {
+        // If we are in a ChRooted environment, then do nothing
+        if (this.mChRooted) return;
+        this.mChRooted = true;
 
         //Change to first storage volume
         StorageVolume[] volumes =
@@ -1102,27 +1103,27 @@ public class NavigationView extends RelativeLayout implements
     }
 
     /**
-     * Method that exits from a jail room
+     * Method that exits from a ChRooted environment
      * @hide
      */
-    public void exitJailRoom() {
-        // If we aren't in a jail room, then do nothing
-        if (!this.mJailRoom) return;
-        this.mJailRoom = false;
+    public void exitChRooted() {
+        // If we aren't in a ChRooted environment, then do nothing
+        if (!this.mChRooted) return;
+        this.mChRooted = false;
 
         // Refresh
         refresh();
     }
 
     /**
-     * Method that ensures that the user don't go outside the jail room
+     * Method that ensures that the user don't go outside the ChRooted environment
      *
      * @param newDir The new directory to navigate to
      * @return String
      */
-    private String checkJailRoomNavigation(String newDir) {
-        // If we aren't in jail room, then there is nothing to check
-        if (!this.mJailRoom) return newDir;
+    private String checkChRootedNavigation(String newDir) {
+        // If we aren't in ChRooted environment, then there is nothing to check
+        if (!this.mChRooted) return newDir;
 
         // Check if the path is owned by one of the storage volumes
         if (!StorageHelper.isPathInStorageVolume(newDir)) {
index d26268e..fba4f8b 100644 (file)
@@ -251,7 +251,7 @@ public final class ExceptionUtil {
         }
 
         // If console is privileged there is not need to change
-        // If we are in a jail room, resolve the error without do anymore
+        // If we are in a ChRooted environment, resolve the error without do anymore
         if (relaunchable instanceof InsufficientPermissionsException &&
                 (isPrivileged || !ExplorerApplication.isAdvancedMode())) {
             translateException(
index 4169b0a..2b8526c 100644 (file)
@@ -445,12 +445,12 @@ public final class FileHelper {
      *
      * @param files The listed files
      * @param mimeType The mime-type to apply. if null returns all.
-     * @param jailRoom If app run with no privileges
+     * @param chRooted If app run with no privileges
      * @return List<FileSystemObject> The applied mode listed files
      */
     public static List<FileSystemObject> applyUserPreferences(
-                    List<FileSystemObject> files, String mimeType, boolean jailRoom) {
-        return applyUserPreferences(files, mimeType, false, jailRoom);
+                    List<FileSystemObject> files, String mimeType, boolean chRooted) {
+        return applyUserPreferences(files, mimeType, false, chRooted);
     }
 
     /**
@@ -460,11 +460,11 @@ public final class FileHelper {
      * @param files The listed files
      * @param mimeType The mime-type to apply. if null returns all.
      * @param noSort If sort must be applied
-     * @param jailRoom If app run with no privileges
+     * @param chRooted If app run with no privileges
      * @return List<FileSystemObject> The applied mode listed files
      */
     public static List<FileSystemObject> applyUserPreferences(
-            List<FileSystemObject> files, String mimeType, boolean noSort, boolean jailRoom) {
+            List<FileSystemObject> files, String mimeType, boolean noSort, boolean chRooted) {
         //Retrieve user preferences
         SharedPreferences prefs = Preferences.getSharedPreferences();
         ExplorerSettings sortModePref = ExplorerSettings.SETTINGS_SORT_MODE;
@@ -481,7 +481,7 @@ public final class FileHelper {
             //Hidden files
             if (!prefs.getBoolean(
                     showHiddenPref.getId(),
-                    ((Boolean)showHiddenPref.getDefaultValue()).booleanValue()) || jailRoom) {
+                    ((Boolean)showHiddenPref.getDefaultValue()).booleanValue()) || chRooted) {
                 if (file.isHidden()) {
                     files.remove(i);
                     continue;
@@ -491,7 +491,7 @@ public final class FileHelper {
             //System files
             if (!prefs.getBoolean(
                     showSystemPref.getId(),
-                    ((Boolean)showSystemPref.getDefaultValue()).booleanValue()) || jailRoom) {
+                    ((Boolean)showSystemPref.getDefaultValue()).booleanValue()) || chRooted) {
                 if (file instanceof SystemFile) {
                     files.remove(i);
                     continue;
@@ -501,7 +501,7 @@ public final class FileHelper {
             //Symlinks files
             if (!prefs.getBoolean(
                     showSymlinksPref.getId(),
-                    ((Boolean)showSymlinksPref.getDefaultValue()).booleanValue()) || jailRoom) {
+                    ((Boolean)showSymlinksPref.getDefaultValue()).booleanValue()) || chRooted) {
                 if (file instanceof Symlink) {
                     files.remove(i);
                     continue;
@@ -509,7 +509,7 @@ public final class FileHelper {
             }
 
             //Mime/Type
-            if (jailRoom && !isDirectory(file)) {
+            if (chRooted && !isDirectory(file)) {
                 if (mimeType != null && mimeType.compareTo(MimeTypeHelper.ALL_MIME_TYPES) != 0) {
                     // NOTE: We don't need the context here, because mime-type database should
                     // be loaded prior to this call