Skip to content

Comments

Fix crash when opening Recent Files without storage permission#4569

Merged
EmmanuelMess merged 1 commit intoTeamAmaze:release/4.0from
geoffreysisco:fix/recent-files-permission-denied-4_0
Feb 20, 2026
Merged

Fix crash when opening Recent Files without storage permission#4569
EmmanuelMess merged 1 commit intoTeamAmaze:release/4.0from
geoffreysisco:fix/recent-files-permission-denied-4_0

Conversation

@geoffreysisco
Copy link
Contributor

Description

Fix crash when opening Recent Files while storage permission is denied on release/4.0.

Root cause

LoadFilesListTask.listRecentFiles() performs a MediaStore query that can throw SecurityException when READ_EXTERNAL_STORAGE is denied. The exception escapes AsyncTask.doInBackground() and crashes the app.

Fix

Catch SecurityException around the MediaStore query and return the current recentFiles list (empty) when permission is denied.

Behavior

  • Permission denied → no crash; Recent Files shows empty list
  • Permission granted → unchanged behavior

Issue tracker

Addresses #3396

Verification (manual)

  • Device: Android Emulator (Pixel 2)
  • OS: Android 8.1 (x86)
  • Install: fresh
  • Package tested: com.amaze.filemanager.debug
  • Version: 3.11.2 (versionCode 124), build v3.11.2-76-gd99897689

Steps:

  1. Launch app
  2. Deny storage permission
  3. Open Recent Files

Results:

  • Before: crash with SecurityException
  • After: no crash with permission denied
  • Regression: works normally with permission granted

Build checks

  • ./gradlew assembleDebug
  • ./gradlew spotlessCheck

Artifacts (logcat + screen recordings) captured locally; not included in the repo.

Wrap MediaStore query in listRecentFiles() with try/catch for SecurityException.
When READ_EXTERNAL_STORAGE is denied, return the current list instead of letting
the exception escape doInBackground() and crash the app.
@EmmanuelMess
Copy link
Member

Approved, but the actual issue here is the user being allowed to use the app without permissions given IMO.

@EmmanuelMess EmmanuelMess merged commit 9d4ffcc into TeamAmaze:release/4.0 Feb 20, 2026
5 checks passed
@geoffreysisco
Copy link
Contributor Author

Thanks for the review.

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.

2 participants