TeamAmaze / TeamAmaze/AmazeFileManager

Move/copy image from internal to external storage getting exception

Open
#1,917 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Describe the bug
Move/copy an image from internal storage to external storage got exception in logcat. Though file was correctly copied and visible using gallery app, but seems mediastore didn't get updated because of the exception.

To Reproduce
Steps to reproduce the behavior:

  1. Find an image from internal storage
  2. Tap cut or copy
  3. At the other tab, go to external storage
  4. Tap paste
  5. File gets copied
  6. Tap the file directly from within Amaze, and use Gallery to open image when prompted
  7. Image is correctly displayed
  8. Press home to get out of Amaze
  9. Open Gallery App
  10. Find the file copied to external storage
  11. Image displayed as grey, similar to "broken image"

Expected behavior
No exception should be thrown, and image should be visible correctly in Gallery app.

Smartphone (please complete the following information):

  • Device: Fairphone 3
  • OS: LineageOS 16.0 GSI (9.0)
  • Rooted: Yes
  • Version: release/3.5 branch

Additional context
Logcat stacktrace:

2020-07-02 13:30:40.949 6419-6419/com.amaze.filemanager.debug W/System.err: java.io.FileNotFoundException: /storage/12C4-1A1A/AugendiagnoseDummyFile1 (Permission denied)
2020-07-02 13:30:40.949 6419-6419/com.amaze.filemanager.debug W/System.err:     at java.io.FileOutputStream.open0(Native Method)
2020-07-02 13:30:40.949 6419-6419/com.amaze.filemanager.debug W/System.err:     at java.io.FileOutputStream.open(FileOutputStream.java:308)
2020-07-02 13:30:40.950 6419-6419/com.amaze.filemanager.debug W/System.err:     at java.io.FileOutputStream.<init>(FileOutputStream.java:238)
2020-07-02 13:30:40.950 6419-6419/com.amaze.filemanager.debug W/System.err:     at com.amaze.filemanager.filesystem.FileUtil.isWritable(FileUtil.java:699)
2020-07-02 13:30:40.950 6419-6419/com.amaze.filemanager.debug W/System.err:     at com.amaze.filemanager.filesystem.FileUtil.isWritableNormalOrSaf(FileUtil.java:746)
2020-07-02 13:30:40.950 6419-6419/com.amaze.filemanager.debug W/System.err:     at com.amaze.filemanager.utils.MainActivityHelper.checkFolder(MainActivityHelper.java:392)
2020-07-02 13:30:40.950 6419-6419/com.amaze.filemanager.debug W/System.err:     at com.amaze.filemanager.asynchronous.asynctasks.PrepareCopyTask.finishCopying(PrepareCopyTask.java:325)
2020-07-02 13:30:40.950 6419-6419/com.amaze.filemanager.debug W/System.err:     at com.amaze.filemanager.asynchronous.asynctasks.PrepareCopyTask.onEndDialog(PrepareCopyTask.java:275)
2020-07-02 13:30:40.950 6419-6419/com.amaze.filemanager.debug W/System.err:     at com.amaze.filemanager.asynchronous.asynctasks.PrepareCopyTask.onEndDialog(PrepareCopyTask.java:269)
2020-07-02 13:30:40.950 6419-6419/com.amaze.filemanager.debug W/System.err:     at com.amaze.filemanager.asynchronous.asynctasks.PrepareCopyTask.onPostExecute(PrepareCopyTask.java:186)
2020-07-02 13:30:40.950 6419-6419/com.amaze.filemanager.debug W/System.err:     at com.amaze.filemanager.asynchronous.asynctasks.PrepareCopyTask.onPostExecute(PrepareCopyTask.java:64)
2020-07-02 13:30:40.950 6419-6419/com.amaze.filemanager.debug W/System.err:     at android.os.AsyncTask.finish(AsyncTask.java:695)
2020-07-02 13:30:40.950 6419-6419/com.amaze.filemanager.debug W/System.err:     at android.os.AsyncTask.access$600(AsyncTask.java:180)
2020-07-02 13:30:40.950 6419-6419/com.amaze.filemanager.debug W/System.err:     at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:712)
2020-07-02 13:30:40.950 6419-6419/com.amaze.filemanager.debug W/System.err:     at android.os.Handler.dispatchMessage(Handler.java:106)
2020-07-02 13:30:40.950 6419-6419/com.amaze.filemanager.debug W/System.err:     at android.os.Looper.loop(Looper.java:193)
2020-07-02 13:30:40.950 6419-6419/com.amaze.filemanager.debug W/System.err:     at android.app.ActivityThread.main(ActivityThread.java:6718)
2020-07-02 13:30:40.950 6419-6419/com.amaze.filemanager.debug W/System.err:     at java.lang.reflect.Method.invoke(Native Method)
2020-07-02 13:30:40.950 6419-6419/com.amaze.filemanager.debug W/System.err:     at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
2020-07-02 13:30:40.950 6419-6419/com.amaze.filemanager.debug W/System.err:     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
2020-07-02 13:30:41.484 6419-10828/com.amaze.filemanager.debug W/System.err: java.io.FileNotFoundException: /storage/12C4-1A1A/AugendiagnoseDummyFile1 (Permission denied)
2020-07-02 13:30:41.485 6419-10828/com.amaze.filemanager.debug W/System.err:     at java.io.FileOutputStream.open0(Native Method)
2020-07-02 13:30:41.485 6419-10828/com.amaze.filemanager.debug W/System.err:     at java.io.FileOutputStream.open(FileOutputStream.java:308)
2020-07-02 13:30:41.485 6419-10828/com.amaze.filemanager.debug W/System.err:     at java.io.FileOutputStream.<init>(FileOutputStream.java:238)
2020-07-02 13:30:41.485 6419-10828/com.amaze.filemanager.debug W/System.err:     at com.amaze.filemanager.filesystem.FileUtil.isWritable(FileUtil.java:699)
2020-07-02 13:30:41.485 6419-10828/com.amaze.filemanager.debug W/System.err:     at com.amaze.filemanager.filesystem.FileUtil.isWritableNormalOrSaf(FileUtil.java:746)
2020-07-02 13:30:41.485 6419-10828/com.amaze.filemanager.debug W/System.err:     at com.amaze.filemanager.filesystem.FileUtil.checkFolder(FileUtil.java:984)
2020-07-02 13:30:41.485 6419-10828/com.amaze.filemanager.debug W/System.err:     at com.amaze.filemanager.asynchronous.services.CopyService$DoInBackground$Copy.execute(CopyService.java:370)
2020-07-02 13:30:41.485 6419-10828/com.amaze.filemanager.debug W/System.err:     at com.amaze.filemanager.asynchronous.services.CopyService$DoInBackground.doInBackground(CopyService.java:266)
2020-07-02 13:30:41.485 6419-10828/com.amaze.filemanager.debug W/System.err:     at com.amaze.filemanager.asynchronous.services.CopyService$DoInBackground.doInBackground(CopyService.java:231)
2020-07-02 13:30:41.485 6419-10828/com.amaze.filemanager.debug W/System.err:     at android.os.AsyncTask$2.call(AsyncTask.java:333)
2020-07-02 13:30:41.485 6419-10828/com.amaze.filemanager.debug W/System.err:     at java.util.concurrent.FutureTask.run(FutureTask.java:266)
2020-07-02 13:30:41.485 6419-10828/com.amaze.filemanager.debug W/System.err:     at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:245)
2020-07-02 13:30:41.485 6419-10828/com.amaze.filemanager.debug W/System.err:     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
2020-07-02 13:30:41.485 6419-10828/com.amaze.filemanager.debug W/System.err:     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
2020-07-02 13:30:41.485 6419-10828/com.amaze.filemanager.debug W/System.err:     at java.lang.Thread.run(Thread.java:764)
2020-07-02 13:30:42.072 6419-10828/com.amaze.filemanager.debug W/System.err: java.io.FileNotFoundException: /storage/12C4-1A1A/Screenshot_20200411-123617_MX_Player.png (Permission denied)
2020-07-02 13:30:42.072 6419-10828/com.amaze.filemanager.debug W/System.err:     at java.io.FileOutputStream.open0(Native Method)
2020-07-02 13:30:42.072 6419-10828/com.amaze.filemanager.debug W/System.err:     at java.io.FileOutputStream.open(FileOutputStream.java:308)
2020-07-02 13:30:42.072 6419-10828/com.amaze.filemanager.debug W/System.err:     at java.io.FileOutputStream.<init>(FileOutputStream.java:238)
2020-07-02 13:30:42.073 6419-10828/com.amaze.filemanager.debug W/System.err:     at com.amaze.filemanager.filesystem.FileUtil.isWritable(FileUtil.java:699)
2020-07-02 13:30:42.073 6419-10828/com.amaze.filemanager.debug W/System.err:     at com.amaze.filemanager.utils.files.GenericCopyUtil.startCopy(GenericCopyUtil.java:283)
2020-07-02 13:30:42.073 6419-10828/com.amaze.filemanager.debug W/System.err:     at com.amaze.filemanager.utils.files.GenericCopyUtil.copy(GenericCopyUtil.java:363)
2020-07-02 13:30:42.073 6419-10828/com.amaze.filemanager.debug W/System.err:     at com.amaze.filemanager.asynchronous.services.CopyService$DoInBackground$Copy.copyFiles(CopyService.java:510)
2020-07-02 13:30:42.073 6419-10828/com.amaze.filemanager.debug W/System.err:     at com.amaze.filemanager.asynchronous.services.CopyService$DoInBackground$Copy.execute(CopyService.java:402)
2020-07-02 13:30:42.073 6419-10828/com.amaze.filemanager.debug W/System.err:     at com.amaze.filemanager.asynchronous.services.CopyService$DoInBackground.doInBackground(CopyService.java:266)
2020-07-02 13:30:42.073 6419-10828/com.amaze.filemanager.debug W/System.err:     at com.amaze.filemanager.asynchronous.services.CopyService$DoInBackground.doInBackground(CopyService.java:231)
2020-07-02 13:30:42.073 6419-10828/com.amaze.filemanager.debug W/System.err:     at android.os.AsyncTask$2.call(AsyncTask.java:333)
2020-07-02 13:30:42.073 6419-10828/com.amaze.filemanager.debug W/System.err:     at java.util.concurrent.FutureTask.run(FutureTask.java:266)
2020-07-02 13:30:42.073 6419-10828/com.amaze.filemanager.debug W/System.err:     at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:245)
2020-07-02 13:30:42.073 6419-10828/com.amaze.filemanager.debug W/System.err:     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
2020-07-02 13:30:42.073 6419-10828/com.amaze.filemanager.debug W/System.err:     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
2020-07-02 13:30:42.073 6419-10828/com.amaze.filemanager.debug W/System.err:     at java.lang.Thread.run(Thread.java:764)

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 with the stack-trace locations in FileUtil.isWritable and isWritableNormalOrSaf, then follow MainActivityHelper.checkFolder, PrepareCopyTask, CopyService, and GenericCopyUtil during the internal-to-external copy flow. Reproduce the listed cut or copy steps on the affected Android storage setup; done means no exception is logged and the copied image is visible in Gallery.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, java, kotlin
Domain
mobile
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.