Anki-Android icon indicating copy to clipboard operation
Anki-Android copied to clipboard

feat: Make all file access permission optional on full builds

Open Fandroid745 opened this issue 6 months ago • 8 comments

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

  1. Added a skip button on the permisssion screen (PermissionStartingAt30Fragment).
  2. 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.
  3. If the user confirms Prefs.UsePrivateStorage is set to true and PREF_COLLECTION_PATH is written to the the app private directory.
  4. 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

photo_2026-05-15_10-33-52

Dialog explaning the trade-offs photo_2026-05-15_10-33-50 (2)

The app private storage being used photo_2026-05-15_10-33-51

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

Fandroid745 avatar May 15 '26 05:05 Fandroid745

The title shouldn't include "needs"

AnkiDroid works better with these permissions

david-allison avatar May 15 '26 14:05 david-allison

[!IMPORTANT] Maintainers: This PR contains https://github.com/ankidroid/Anki-Android/labels/Strings changes

  1. Sync Translations before merging this PR and wait for the action to complete
  2. Review and merge the auto-generated PR in order to sync all user-submitted translations
  3. 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

github-actions[bot] avatar May 16 '26 13:05 github-actions[bot]

I have addressed the review comments now, could you please review

Fandroid745 avatar May 16 '26 14:05 Fandroid745

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

github-actions[bot] avatar Jun 05 '26 03:06 github-actions[bot]

@david-allison could you reopen this

Fandroid745 avatar Jun 13 '26 09:06 Fandroid745

Done

david-allison avatar Jun 13 '26 09:06 david-allison

Snapshot diff report vs main. Open screenshot-diff for diffs.

  • AllActivitiesScreenshotTest: 2 changes
All 2 changed screenshots

AllActivitiesScreenshotTest

  • PermissionsActivity_compare.png
  • PermissionsActivity_edgeToEdge_compare.png

github-actions[bot] avatar Jun 15 '26 07:06 github-actions[bot]

@david-allison I have added the tests, could you please review when you have time.

Fandroid745 avatar Jun 20 '26 13:06 Fandroid745

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

github-actions[bot] avatar Jul 22 '26 09:07 github-actions[bot]

@david-allison could you review this, I have handled the case where the user has given full storage access but revokes permission now

Fandroid745 avatar Aug 14 '26 11:08 Fandroid745

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

david-allison avatar Aug 15 '26 20:08 david-allison

Thanks for the help! I have limited time currently, could you get this over the line.

Fandroid745 avatar Aug 16 '26 11:08 Fandroid745

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

github-actions[bot] avatar Sep 05 '26 23:09 github-actions[bot]

Still working through it

  • https://github.com/ankidroid/Anki-Android/pull/21734

david-allison avatar Sep 05 '26 23:09 david-allison