Skip to content

feat(startup): prep for making MANAGE_EXTERNAL_STORAGE skippable - #22759

Merged
mikehardy merged 3 commits into
ankidroid:mainfrom
david-allison:optional-managed-storage
Oct 26, 2026
Merged

mikehardy merged 3 commits into
ankidroid:mainfrom
david-allison:optional-managed-storage

Conversation

@david-allison

Copy link
Copy Markdown
Member

Note

Assisted-by: Claude Fable 5 - implementation
Assisted-by: GPT-6.1-Sol xhigh - review and fixups

Purpose / Description

Split out from a larger PR to land #13574

Fixes

Approach

This is effectively a non-functional change:

The collection path will now be unset until the permissions screen if the directory is inaccessible (a public folder using a full build), it now gets set when MANAGE_EXTERNAL_STORAGE is granted.

How Has This Been Tested?

This area of the code is already HEAVILY tested

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

* Startup: allows an empty AnkiDroid directory instead of throwing
  * no code paths exercise this yet
And a couple of test fixups to ensure they wouldn't hit our startup changes/
make preconditions clear.

Part of 13574

Assisted-by: Claude Fable 5 - implementation
Assisted-by: GPT-6.1-Sol xhigh - review and fixups
to `maybeSetDefaultCollectionPath` - it now may return with no change.

Part of 13574

Assisted-by: GPT-6.1-Sol xhigh
…ssible

For 'full' builds, leave the collection path unset until `MANAGE_EXTERNAL_STORAGE`
has been granted. The path will be set on the permissions screen.

No change for 'play' builds

Mostly a non-user-facing change - fixes a case with intent-based launches
closing (e.g. a direct Reviewer launch)

Part of 13574

Assisted-by: Claude Fable 5 - implementation
Assisted-by: GPT-6.1-Sol xhigh - review and fixups
@david-allison david-allison added the Review High Priority Request for high priority review label Oct 25, 2026
@david-allison david-allison reopened this Oct 25, 2026

@criticalAY criticalAY left a comment

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.

Reviewed manually, looks clean!

@criticalAY criticalAY added Needs Second Approval Has one approval, one more approval to merge and removed Needs Review labels Oct 25, 2026

@mikehardy mikehardy left a comment

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.

Assisted-by: grok-4.7-medium

Thank you — deferring the public path until All files access is granted keeps the play and legacy paths unchanged and matches the policy tests.

Git: checked out the PR branch; HEAD matched the tip; rebased three commits onto ankidroid/main without conflicts (no push).

Local validation: lint (lintAll, ktlintCheck, lint-rules:test), unit (jacocoUnitTestReport), and release emulator tests (TEST_RELEASE_BUILD=true via run_emulator_tests.py on emulator-5556 / API35_GAPI; emulator green on retry after a configuration-cache pack error).

Reviewed the startup storage deferral: on full builds UserChoosesOnPermissionScreen leaves PREF_COLLECTION_PATH unset until MANAGE_EXTERNAL_STORAGE is granted, so storageDecision stays undecided and IntentHandler no longer treats an unreadable public folder as decided; play builds stay on app-private storage and Android 10 and below stay on the legacy public path. DeckPicker / permissions flow still persist public storage only after the grant, with coverage in StoragePolicyTest and SetupStorageTest.

some acceptable findings, no action required, just leaving for posterity: UserChoosesOnPermissionScreen KDoc mentions app-private skip work not in this PR; PR body “non-functional” vs user-visible intent launch behavior; commit subjects sit just under the 50-character checklist line.

@mikehardy mikehardy added Pending Merge Things with approval that are waiting future merge (e.g. targets a future release, CI wait, etc) and removed Review High Priority Request for high priority review Needs Second Approval Has one approval, one more approval to merge labels Oct 26, 2026
@mikehardy
mikehardy added this pull request to the merge queue Oct 26, 2026
Merged via the queue into ankidroid:main with commit a90aa4c Oct 26, 2026
46 of 47 checks passed
@david-allison
david-allison deleted the optional-managed-storage branch October 26, 2026 12:37
@github-actions github-actions Bot added this to the 2.26 release milestone Oct 26, 2026
@github-actions github-actions Bot removed the Pending Merge Things with approval that are waiting future merge (e.g. targets a future release, CI wait, etc) label Oct 26, 2026
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