TeamAmaze / TeamAmaze/AmazeFileManager

`SecurityException` when reading from `MediaProvider`

Open
#3,396 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Issue-Bug
Dominant language
Kotlin
Stars
6.4k
Forks
1.7k
Avg merge
3d 9h
Merged PRs (30d)
1

Description

Describe the bug
do not give permission to AmazeFileManager, then click recent files, app crashes on version 3.7.2

To Reproduce
Steps to reproduce the behavior:

  1. install app and open it
  2. do not give permission to app
  3. click menu
  4. click recent files
  5. see crash

Expected behavior
no crash

Screenshots
If applicable, add screenshots to help explain your problem.

https://user-images.githubusercontent.com/31406320/178181100-78c4a1fa-975b-4376-9ea4-2d038e353e04.mp4

Smartphone (please complete the following information):

  • Device: [e.g. Google Pixel 2]
  • OS: [Android 8]
  • Rooted: [e.g. No]
  • Version: [ 3.7.2]

Additional context
Add any other context about the problem here.

Issue explanation (write below this line)

Exception

  • App Name: Amaze File Manager
  • Package: com.amaze.filemanager
  • Version: 3.7.2
  • User Action: UI Error
  • Request: Application crash
  • OS: Linux Android 8.0.0 - 26
  • Device: generic_x86
  • Model: Android SDK built for x86
  • Product: sdk_gphone_x86
Crash log

java.lang.RuntimeException: An error occurred while executing doInBackground()
	at android.os.AsyncTask$3.done(AsyncTask.java:353)
	at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:383)
	at java.util.concurrent.FutureTask.setException(FutureTask.java:252)
	at java.util.concurrent.FutureTask.run(FutureTask.java:271)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636)
	at java.lang.Thread.run(Thread.java:764)
Caused by: java.lang.SecurityException: Permission Denial: reading com.android.providers.media.MediaProvider uri content://media/external/file from pid=4454, uid=10077 requires android.permission.READ_EXTERNAL_STORAGE, or grantUriPermission()
	at android.os.Parcel.readException(Parcel.java:1943)
	at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:183)
	at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:135)
	at android.content.ContentProviderProxy.query(ContentProviderNative.java:418)
	at android.content.ContentResolver.query(ContentResolver.java:754)
	at android.content.ContentResolver.query(ContentResolver.java:704)
	at android.content.ContentResolver.query(ContentResolver.java:662)
	at com.amaze.filemanager.asynchronous.asynctasks.LoadFilesListTask.listRecentFiles(LoadFilesListTask.java:551)
	at com.amaze.filemanager.asynchronous.asynctasks.LoadFilesListTask.doInBackground(LoadFilesListTask.java:200)
	at com.amaze.filemanager.asynchronous.asynctasks.LoadFilesListTask.doInBackground(LoadFilesListTask.java:77)
	at android.os.AsyncTask$2.call(AsyncTask.java:333)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	... 3 more


Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in LoadFilesListTask at listRecentFiles (line 551), called from doInBackground (line 200), and reproduce opening Recent Files without storage permission on Android 8. The crash log shows the failing MediaProvider query; done means opening Recent Files no longer crashes when permission is denied.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, kotlin
Domain
mobile
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.