Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom File Chooser Implementation for SDcard location choosing #138

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

Doplgangr
Copy link
Contributor

This pull request implements a new file chooser.

Since there is still no definite solution to the external SDCard problem we are facing, I am thinking about solving it in a more generic manner.

Problem:

  • User cannot select their external SD location to store vaults in.

Old Solution:

  • Use aFileChooser with a mount point finder to locate possible mount points for removable devices.
  • Use Storage Access Framework for API>=19 to locate possible mount points.

Problem persists:

  • Users of API<19 may face problems where their desired mount point is not found.
    • e.g. for Samsung devices with atypical external SD mount points
    • e.g. for USB OTG users where the USB is not registered with mount point files

New Solution:

  • Custom file chooser instead of aFileChooser
  • Allow user to traverse around the file system up to / root
  • Users can find almost any mount point they want
    • Additionally, user can create a new folder from the interface without having to leave the app and create the folder in an alternative file explorer.
  • For unaccessible mount points, directory will be "disabled" to prevent users from choosing non-readable locations
  • Continue to use Storage Access Framework for API >=19 since its UI is more intuitive and easier to use for users.

Use case: change vault root to external SD

  • Users generally know where their external mount points are. e.g. /mnt/extSd
  • User click "move vault" option
  • User is presented with "/storage/sdcard/SECRECFILES" folder
  • User clicks ".." several times to travel to "/"
  • User clicks "mnt" and then "extSd" to get to the external SD
  • User clicks "add folder" to create a new folder and "OK" to set it as new vault root.

TODOs

  • Implement basic file chooser
  • Link the file chooser to preference page
  • Add a "add folder" option for users to create folder

@L-Henke
Copy link
Contributor

L-Henke commented May 20, 2015

But I don't think this solves the general problem. The main problem is not selecting the folder. With Android >= 4.4, access to all files and folders on an sd card is permitted, and can only be granted to the app by a special intent. This also hasn't been solved in my PR. Or am I missing something? See this comment from an Google developer: https://groups.google.com/forum/#!msg/android-platform/14VUiIgwUjY/UsxMYwu02z0J

Or am I missing something? Sadly I can't just test it, because I have no device with an external sd card (only the emulator)...

@Doplgangr
Copy link
Contributor Author

See this line:
"Before KitKat, some OEMs chose to leave external storage devices unprotected, where apps could write if they guessed a special filesystem path."

This solution is just for before kitkat, where the file access is not limited provided that you can find the path to the specific directory you want. Since after kitkat access to all files need special intents as you mentioned, we need to use the storage access framework you implement.

I am aiming to create a fallback solution for before kitkat that cannot use the framework.

@L-Henke
Copy link
Contributor

L-Henke commented May 20, 2015

Ok. That sounds reasonable. I'll keep watching this PR.

@Doplgangr Doplgangr changed the title [Work in Progress] Custom File Chooser Implementation for SDcard location choosing Custom File Chooser Implementation for SDcard location choosing May 21, 2015
@Doplgangr
Copy link
Contributor Author

Ready for review.

@minusdavid
Copy link

I'm keen for this problem to be solved, and I have devices with external SD cards. Happy to take a look at this when I have some time. Maybe later in the week.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants