Skip to content

feat: Make all file access permission optional on full builds#21046

Open
Fandroid745 wants to merge 1 commit into
ankidroid:mainfrom
Fandroid745:feat/storage-permission-optional
Open

feat: Make all file access permission optional on full builds#21046
Fandroid745 wants to merge 1 commit into
ankidroid:mainfrom
Fandroid745:feat/storage-permission-optional

Conversation

@Fandroid745
Copy link
Copy Markdown
Contributor

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

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

  • 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
  • You have performed a self-review of your own code
  • 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

Copy link
Copy Markdown
Member

@BrayanDSO BrayanDSO left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of a skip button, simply don't disable the Continue button if the permission hasn't been allowed. If they tap the button, the dialog should be shown

Comment on lines +273 to +275
<string name="btn_skip_permission">Skip</string>
<string name="private_storage_warning_title"> Limited Storage access</string>
<string name="private_storage_warning">Without this permission, Your Ankidroid collection will be stored in app\'s private storage and will be permanently deleted if you uninstall Ankidroid.</string>
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this file isn't translated, so those strings shouldn't be here

@BrayanDSO BrayanDSO added Needs Author Reply Waiting for a reply from the original author and removed Needs Review labels May 15, 2026
@david-allison
Copy link
Copy Markdown
Member

The title shouldn't include "needs"

AnkiDroid works better with these permissions

Copy link
Copy Markdown
Member

@david-allison david-allison left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is one of our really badly wanted fixes, thank you!!!!!!!!!!!!!

Initially this looks good to me. This will want a lower priority follow up issue to fix the AnkiDroid directory preference. Please don't fix it in this PR, as that dialog is being rewritten

  • change the button text to "skip", don't add another button
  • Fix the title, see my other comment
  • Use "app private", not "private"

<string name="use_private_storage_key">usePrivatestorage</string>
<string name="btn_skip_permission">Skip</string>
<string name="private_storage_warning_title"> Limited Storage access</string>
<string name="private_storage_warning">Without this permission, Your Ankidroid collection will be stored in app\'s private storage and will be permanently deleted if you uninstall Ankidroid.</string>
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AnkiDroid


I don't like this warning, the UI should be a selection, rather than showing a user a scary dialog during the onboarding process

I'd block this if it weren't F-Droid only - users there are more understanding of privacy

Add an issue and a TODO to rethink the UI

Copy link
Copy Markdown
Contributor Author

@Fandroid745 Fandroid745 May 15, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AnkiDroid

I don't like this warning, the UI should be a selection, rather than showing a user a scary dialog during the onboarding process

I'd block this if it weren't F-Droid only - users there are more understanding of privacy

Add an issue and a TODO to rethink the UI

Will do!
I had created that dialog as it was one of the comments on the issue


val externalFilesDir =
requireContext().getExternalFilesDir(null) ?: requireContext().filesDir
val privateDir = File(externalFilesDir, "AnkiDroid").apply { mkdirs() }
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: mkdirs() return value isn't checked. If it fails (disk full/corrupted), the pref gets set to a non existent path.

@github-actions
Copy link
Copy Markdown
Contributor

Important

Maintainers: This PR contains 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

@Fandroid745 Fandroid745 force-pushed the feat/storage-permission-optional branch from 83f9a8b to 51b427b Compare May 16, 2026 13:25
@Fandroid745 Fandroid745 force-pushed the feat/storage-permission-optional branch from 51b427b to b73806c Compare May 16, 2026 13:50
@Fandroid745
Copy link
Copy Markdown
Contributor Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Needs Author Reply Waiting for a reply from the original author Strings

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Don't force full (F-Droid/GitHub) releases users to grant the All files access permission

4 participants