TeamAmaze / TeamAmaze/AmazeFileManager
Move/copy image from internal to external storage getting exception
Nobody has claimed this yet.
- 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:
- Find an image from internal storage
- Tap cut or copy
- At the other tab, go to external storage
- Tap paste
- File gets copied
- Tap the file directly from within Amaze, and use Gallery to open image when prompted
- Image is correctly displayed
- Press home to get out of Amaze
- Open Gallery App
- Find the file copied to external storage
- 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.5branch
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
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- 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