aboutsummaryrefslogtreecommitdiff
path: root/src/com/cyanogenmod/filemanager/util/FileHelper.java
Commit message (Collapse)AuthorAgeFilesLines
* Fix Rename on VFatherriojr2016-06-201-13/+22
| | | | | | | | | Changed how the java console handles detecting if a file rename collides with another file to more represent how the particular filesystem implementation handles it (I'm looking at you vfat). Change-Id: I6ac9ae848ee47fa33f02225c310c92f2a03fb50d (cherry picked from commit bd4178a860ab7da89549036c6a4815239b903b61)
* Fix improper exception handling during copy operation.Matt Garnes2015-08-131-2/+6
| | | | | | | - Do not cast ClosedByInterruptException to CancelledOperationException; return a new CancelledOperationException instead. Change-Id: I41cb0c605c55fc896a3e483cb5b1f1fcc913676e
* Improve copy/move performance with nio and reintroduce cancel.Matt Garnes2015-08-121-38/+50
| | | | | | | | | | | | | | Utilize FileChannel.transferFrom to copy files faster. Chunk the file transfer so that we can check between each chunk if the user has cancelled the copy. In my tests copying a large file (650MB), this improved performance by 45%. Also, bring the cancel feature back for non secure storage. Fixes QRDL-976. Change-Id: I112cee7b9dfe682a438516f7f938dfd7538f1efb
* Revert "Made NavigationView reliant on FileObserver to keep up to date."herriojr2015-08-051-146/+120
| | | | | | This reverts commit 7b09bb0f1390b72d0ac18484721998eaf805e605. Change-Id: I24b6115c89e568f6895a3a9d0c074151b85c0be2
* Made NavigationView reliant on FileObserver to keep up to date.herriojr2015-07-311-120/+146
| | | | | | | | | | | | | We no longer deal with having to refresh a directory upon reentering. Instead we now just listen on the directory for changes and update as necessary. This will make it much more difficult to get out of sync with the file system in pretty much all situations. Changed per comments on patch to no longer do refreshes for the list when items change as the FileObserver handles all of this. Change-Id: I28a6af965708ce76107a09d6b931f4c7bafb8365 Ticket: QRDL-932
* Sizes: Let disk usage show sizes as doublesStephen Bird2015-06-111-5/+9
| | | | | | | | This way, weird file system sizes display nicely. Without this a mountpoint with a size of 1.68GB displays as 1GB. Change-Id: I72e0d8ff911dd942efd5860f2d86607ebbb30fcb
* Delete destination file when copy failsd34d2015-06-111-0/+7
| | | | | | Change-Id: Ic398a2eaa7ac06d8c2ffccc10033d2d32a0dba60 (cherry picked from commit 766c7ba627fb8d685408429ce027c6826bb9c2ab) (cherry picked from commit b2dfe80d30f5e82ae231fe7392ed0786a4661dfa)
* CMFileManager: when cancel coping, the dest file also exists and is incomplete.jing.zhao2015-04-211-0/+5
| | | | | | When cancel coping, will delete the dest file. Change-Id: I0acf7cc196dec82ed2156e9706c1364922581cdf
* Implement ability to cancel file copy.Martin Brabham2015-04-131-4/+21
| | | | | | | | | | - Short circuit Java CopyCommand for move/copy when the user cancels the dialog. - Bubble up CancelledOperationException when the Cancel/Move operation is cancelled. Handle cancellation differently than success. Change-Id: I3e4426aaccf42e12bf299041d489e72b3b76a626 (cherry picked from commit 7e13ec2fa4fc052c2a880a8dba8ed871b3bc10ca)
* CM File Manager - Gracefully handle renaming on case-insensitive filesystemsRohit Yengisetty2015-03-211-0/+15
| | | | | | | | | | | Add edge case handling to move/copy commands wherein something is being renamed to a different-cased version of itself. Ex : renaming 'mydocuments' to 'MyDocuments' https://jira.cyanogenmod.org/browse/BACON-3074 Change-Id: Id90de5fd083e341371f250c0194f200388cf4941
* cmfm: add support for init navigation in a concrete folderJorge Ruesga2015-02-271-0/+5
| | | | | | | Add an ACTION_VIEW intent with matches with "resource/folder" mime type and a file/folder/directory scheme Change-Id: I91afe762ebcaf9ead25d091ffaf4f705a8dd0515 Signed-off-by: Jorge Ruesga <jorge@ruesga.com>
* cmfm: add support for Intent.EXTRA_MIME_TYPESJorge Ruesga2015-02-271-4/+18
| | | | | | | | Since KitKat GET_CONTENT supports Intent.EXTRA_MIME_TYPES to limit the mime types of the returned data. Use this information to add mimetype restrictions (if #getType is not present). Change-Id: Ia968e06d899f695ea555c746d90bb5a3231cc1c9 Signed-off-by: Jorge Ruesga <jorge@ruesga.com>
* CM File Manager : Populate results as they are found while searchingRohit Yengisetty2015-01-291-8/+78
| | | | | | | | Eliminate the need to wait for a search to finish before accessing the search results. The search results are streamed concurrently while the search is still in progress. Change-Id: I15f5b87ef4fbbbe9df2ee7a8428d9c812cadf159
* Inform the user if copy/move fails with no space remaining.Matt Garnes2015-01-211-1/+12
| | | | | | | | | - Detect the specific IOException representing no space left on the device. Throw an ExecutionException for this particular case. - Support translatable ExecutionExceptions that specify a string resource as a message. Change-Id: I798cc3c194b78d3a2d13685d29cfbb580de3f30e
* CMFileManager: Include sort by typeRaj Yengisetty2015-01-131-0/+11
| | | | Change-Id: I44730f6493ee79bbcff49045568d14192544839b
* CMFileManager: Add sort by sizeRaj Yengisetty2015-01-121-0/+9
| | | | Change-Id: Iae8c47beb8f229bb5e1936c0dbd153f356b099d7
* cmfm: fix ensure read, write and execute checks in java consoleJorge Ruesga2014-11-211-0/+16
| | | | | Change-Id: I03e6117f6f660c46aa9df9ff8ebf7c602badb40a Signed-off-by: Jorge Ruesga <jorge@ruesga.com>
* cmfm: secure storage and other improvementsJorge Ruesga2014-11-101-6/+53
| | | | | | | | | | | | | | | | | | | | | | | | | | This patch adds support for virtual filesystems and implements a SecureStorage filesystem (a password protected area) mounted in /storage or /sdcard/storage (in chrooted environments). Also includes a better print support and a cleanup of the code and design of the menu drawer. Bump version to 2.0.0 Required: https://github.com/jruesga/android_external_libtruezip located in external/libtruezip Patchset 4: Fix selection of unmounted virtual storages. Fix actions on virtual mount points folders. Fix strings and typos. Change drop for delete secure storage. Patchset 5: Move actionbar buttons to navigation drawer Remove history position Patchset 6: Update theme preview images Fix filesystem status image on theme change Patchset 7: Fix binary file detection in editor (including unicode files) Patchset 8: Fix unsafe operations in virtual mountpoint logic Patchset 9: Rebase Change-Id: I65511352ca649dcbf238c8b07cf8c22465296e8e Signed-off-by: Jorge Ruesga <jorge@ruesga.com>
* Some optimizations spotted during profiling.Danny Baumann2013-09-201-9/+5
| | | | Change-Id: Ice5cc24d2574894798370eaaae144713414eb6cf
* CMFM: User-defined date/time formatJorge Ruesga2013-04-191-0/+61
| | | | | | | | | Allow the user to select the date/time format to use. JIRA: CYAN-863 Issue: https://jira.cyanogenmod.org/browse/CYAN-863 Change-Id: I13730e8c82e5de96645c9c70f244535eb449e261 Signed-off-by: Jorge Ruesga <jorge@ruesga.com>
* CMFM: Editor initial highlight support + props syntax processor + others ↵Jorge Ruesga2013-03-271-12/+12
| | | | | | | | | | | | | | | | | | | | | | | features - This change enables support of syntax highlight in editor. Adds also the next syntax processors: * PropertiesSyntaxHighlightProcessor - Option for toggle "no suggestion" in editor - CleanUp Patchset 2: Theme color scheme support Patchset 3: Hexdump binary editor preference No suggestions editor preference Syntax Highlight color scheme Add android-syntax-highlight (CMFM) and color-picker-view libraries ColorPickerDialog and ColorPickerPreference Separate preference to its own file Extract themes strings from dark_theme.xml to strings.xml Rebased Change-Id: I9df65e6193d46ebafadee5d545dcde1fc5ce20e9 Signed-off-by: Jorge Ruesga <jorge@ruesga.com>
* CMFM: Ask to gain privileges for asynchronous commandsJorge Ruesga2013-03-221-23/+169
| | | | | Change-Id: I35c48174e2e6093ada8e45786fe9320193effb96 Signed-off-by: Jorge Ruesga <jorge@ruesga.com>
* CMFM: CYAN-200 - Archiving and Extracting .ZIP files in CM File ManagerJorge Ruesga2013-03-171-2/+13
| | | | | | | | | | | | | | | | Added support for zip and unrar commands. Zip, unzip, unlzma, unxz, uncompress and unrar are now optional. Compress or uncompress of these types are only available if its commands are present in filesystem NOTE: This change requires that zip and unrar commands are present in the filesystem at /system/xbin, which actually don't. Patchset 2: Rebased Change-Id: I30667c802bc5b678015b28bb3170377ceb37a1b8 JIRA: https://jira.cyanogenmod.org/browse/CYAN-200 Bugfix: CYAN-200 Signed-off-by: Jorge Ruesga <jorge@ruesga.com>
* Allow picking of directories.Danny Baumann2013-01-231-0/+9
| | | | | | | | | | | | | | | | | This is used e.g. by k-9 to select an attachment storage path. There are a number of intent filter conventions for picking directories. In k-9's code I found the following: - action org.openintents.action.PICK_DIRECTORY, scheme file - action com.estrongs.action.PICK_DIRECTORY, scheme file - action Intent.ACTION_PICK, scheme folder - action com.androidworkz.action.PICK_DIRECTORY, scheme file Implemented is the third variant, as it's the most generic way to describe the intention. Change-Id: I8752fe0db923a9ca169cc09eeee6a13bb5236626
* Add ability to toggle .nomedia file in storage locationsNathan Grebowiec2013-01-111-0/+31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Patchset 1) Initial commit Patchset 2) Fixed tabs and whitespace Patchset 3) Moved everything to the properties dialog Patchset 4) Clean up Patchset 5) Added check for .nomedia dir Patchset 6) Tab cleanup Patchset 7) Rebase Regorganize FsoPropertiesDialog Refresh navigation listview if a .nomedia file was created or deleted Use FileHelper.deleteFolder instead of DeleteDirCommand Mark/Unmark checkbox when user response no or an error occurs (let checkbox as his initial status) Internationalize error messages Fix nomedia layout id Use match_layout instead of fill_parent (deprecated) Ensure that the fso is a canonical path Use File.exists() to detect the present of .nomedia Theme nomedia label Format code and clean Up Remove W.I.P Patchset 8) Align .nomedia layout Split toggleNoMediaFile logic Ask user if .nomedia file is not empty Fix typos Patchset 9) Fix typo Change-Id: I048d1da75f24230380aa7503f2d2c9ad95f9b873
* CMFM: Fix name and parent for root directoryJorge Ruesga2013-01-061-2/+2
| | | | | Change-Id: I56aed1dff9fda651e30d0eb29e488d3736e42900 Signed-off-by: jruesga <jorge@ruesga.com>
* CMFM: Fixes and ImprovementsJorge Ruesga2013-01-051-9/+55
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Some performance improvements: - Use stat instead of ls. This allow improve listing of directories with symlinks. Symlinks are resolved by File.getCanonicalFile. - Simplify ls, fileinfo, find and readlink command - Simplify the parsing of FolderUsage (only type, size and category is required), and avoid to load a lot of on unused objects - Add new file datetime information from stat: access, change and modify - Improve list, find and resolvelink java commands * FadeEffect and symlink handling * Remove context from AIDHelper and add new helpful methods * New getAbsolutePath method * Use file separator for paths and ROOT_DIRECTORY for root directory path * Organize startup - Initialize variables prior to register receivers - Load AID data for improve performance through caching - Load the theme base used by AOSP widgets * Allow Editor to show zero-length files Allow the editor to load zero-length files (like /proc/mounts) and change the buffer type to no editable in binary files. * Invert allowed mount points detection. This change inverts the algorithm for prevent unmount needed rw filesystems. Now uses known restricted filesystems instead of known allowed filesystems. Now filesystems like yaffs2, fuse, and other linux filesystems are allowed by default. * Remove unused xliff namespace * Add flagNoFullscreen to EditText widgets * Fix listview selectors of history and bookmarks * Fix race condition When the command was executed prior to block the execution, the thread wait for the timeout. Add a sync access check to ensure that prior to lock and wait the program executed is not finished. * Fix for async programs When the partial buffer received for an async program is not complete (ends with a EOL), the partial buffer was discarded. Add a new buffer with this lost chars to complete this bytes next time * Fix list command Use -n1 for xargs in list command to prevent "argument line too long" * If parent is null then assume that it is the root folder * Use only name and parent for equals method on FileSystemObject A FileSystemObject is the same if his name and path are the same. * Increase performance of adapters Use argument data when possible to avoid call the adapter methods * Do not clear selection on some actions Actions like create new file/folder, show properties and other actions that explicit requires clear the active selection, shouldn't removed the active selection. * Add a new additional line to dialog messages to fill the dialog * Fix spanish translations * Fix theme roulette on tablets * Clean NLS and Override warnings * Fix parse size data with dots * Add listeners after set the values to avoid raising triggers * Increase performance of adapters. Notify the data changed at the end of the changes, and only to super adapters (the internal structure has already been updated) * Ensure that all the Cursor references were closed after used them. * Remove unused SuppressLint * Clean up Change-Id: I4326e97cbc942c767829f1a0ff6b380ad768cfef Signed-off-by: jruesga <jorge@ruesga.com>
* Issue 6743: CM FileManager can't recognize file types if named with capital ↵Jorge Ruesga2012-12-111-1/+1
| | | | | | | | | | suffix Issue: http://code.google.com/p/cyanogenmod/issues/detail?id=6743 Added case compare to extension and mime/types. Change-Id: I394472e03b5a92590088fdebbb75dd13ee4bade2
* CMFileManager: AOSP GET_CONTENT_DATA compatibilityJorge Ruesga2012-12-111-11/+84
| | | | | | | | | | | | | | | This change brings compatibility to GET_CONTENT_DATA for AOSP apps when using the PickerActivity: * Detect crop extra; use the com.android.camera.action.CROP action of Gallery3d to crop and return the requested image. This gets compatilibity for example with the contacts app, when a user try to set the image of a contact. * Detect android.provider.MediaStore.Audio.Media.EXTRA_MAX_BYTES; when this extra is present the PickerActivity only display (and allow select) files with a size lower than requested. * Detect Intent.EXTRA_LOCAL_ONLY; useless until CMFM allow access remote file systems. Change-Id: I1020458505b236653e869ec1c1f532dd6d686633
* CMFileManager: Fixes for non-rooted devicesJorge Ruesga2012-11-131-0/+109
| | | | | | | | | | | | | Various fixes for non-rooted devices running under java console: * Improve navigation (caching unsused data on chrooted mode: aids, mountpoints, ...) * Editor: Don't ask user to gain privileges (non rooted devices never can gain privileged access) * Move common file operations to FileHelper * MoveCommand: As shell console, java console doesn't allow to move between filesystems. Use a copy-delete operation when renameTo is not allowed. * On non-rooted devices, not allow to change to other access mode. Change-Id: I7ae8b4f4203fc8a20f498e43f45c0a956731b02e
* Change application name to 'File Manager' (issue #20)jruesga2012-10-261-0/+839
Full refactoring of package from explorer to filemanager