feat: Make all file access permission optional on full builds
Purpose / Description
AnkiDroid forces the users to grant the "All files access" permission on full builds(fdroid/github) with no way to opt out. The users who sync via AnkiWeb or manage their have no need to grant this permission.
Fixes
- Fixes #13574
Approach
- Added a skip button on the permisssion screen (PermissionStartingAt30Fragment).
- When tapped, a dialog appears the tradeoff that the collection will be stored in app-private storage /storage/emulated/0/Android/data/com.ichi2.anki.debug/files/AnkiDroid and deleted on uninstall.
- If the user confirms Prefs.UsePrivateStorage is set to true and PREF_COLLECTION_PATH is written to the the app private directory.
- The selectAnkidroidFolder returns the AppPrivateFolder directly, matching the Play Store build behaviour
How Has This Been Tested?
Tested on Android 15 device (with the build variants fullDebug and fullRelease)
Screenshots
Skip button to skip all files permission
Dialog explaning the trade-offs
The app private storage being used
Checklist
- [X] You have a descriptive commit message with a short title (first line, max 50 chars).
- [ ] You have commented your code, particularly in hard-to-understand areas
- [X] You have performed a self-review of your own code
- [X] UI changes: include screenshots of all affected screens (in particular showing any new or changed strings)
- [ ] UI Changes: You have tested your change using the Google Accessibility Scanner
The title shouldn't include "needs"
AnkiDroid works better with these permissions
[!IMPORTANT] Maintainers: This PR contains https://github.com/ankidroid/Anki-Android/labels/Strings changes
- Sync Translations before merging this PR and wait for the action to complete
- Review and merge the auto-generated PR in order to sync all user-submitted translations
- Sync Translations again and merge the PR so the huge automated string changes caused by merging this PR are by themselves and easy to review
I have addressed the review comments now, could you please review
Hello 👋, this PR has had no activity for more than 2 weeks and needs a reply from the author. If you think this is a mistake please comment and ping a maintainer to get this merged ASAP! Thanks for contributing! You have 7 days until this gets closed automatically
@david-allison could you reopen this
Done
Snapshot diff report vs main. Open screenshot-diff for diffs.
- AllActivitiesScreenshotTest: 2 changes
All 2 changed screenshots
AllActivitiesScreenshotTest
PermissionsActivity_compare.pngPermissionsActivity_edgeToEdge_compare.png
@david-allison I have added the tests, could you please review when you have time.
Hello 👋, this PR has had no activity for more than 2 weeks and needs a reply from the author. If you think this is a mistake please comment and ping a maintainer to get this merged ASAP! Thanks for contributing! You have 7 days until this gets closed automatically
@david-allison could you review this, I have handled the case where the user has given full storage access but revokes permission now
Bug: on a new install, "Skip" loops back to the permission screen (until they grant the permission)
Could you add a regression test for this?
This PR should be using the StorageDecision mechanism (which is now live), rather than directly modifying the collection path. We previously did not have a concept of "path chosen by the user", and StorageDecision was designed for this.
Sorry for the back & forth here, StorageDecision took time to merge, and I've had limited AnkiDroid time
Feel free to delegate a few PRs to me here to get this over the line sooner. This is our most requested feature and I've now got capacity to see it through:
https://github.com/ankidroid/Anki-Android/issues?q=is%3Aissue%20state%3Aopen%20sort%3Areactions-%2B1-desc
Thanks for the help! I have limited time currently, could you get this over the line.
Hello 👋, this PR has had no activity for more than 2 weeks and needs a reply from the author. If you think this is a mistake please comment and ping a maintainer to get this merged ASAP! Thanks for contributing! You have 7 days until this gets closed automatically
Still working through it
- https://github.com/ankidroid/Anki-Android/pull/21734