jroal / a2dpvolume

Automatically exported from code.google.com/p/a2dpvolume
http://jimroal.com/slist.htm
95 stars 33 forks source link

"Storage" (WRITE_EXTERNAL_STORAGE) permission before export and import of data #232

Closed ReyhanJB closed 7 years ago

ReyhanJB commented 7 years ago

I have installed the latest version of the app (2.12.8) on my Google Nexus 5x. When I try to export/import database to/from the storage (from the "Manage Data" menu), the import/export operation fails due to permission denied exception as follows:

12-27 20:09:09.861 6175-7100/a2dp.Vol E/A2DP Volume: open failed: EACCES (Permission denied) java.io.IOException: open failed: EACCES (Permission denied) at java.io.File.createNewFile(File.java:939) at a2dp.Vol.ManageData$ImportDatabaseFileTask.doInBackground(ManageData.java:328) at a2dp.Vol.ManageData$ImportDatabaseFileTask.doInBackground(ManageData.java:300) at android.os.AsyncTask$2.call(AsyncTask.java:295) at java.util.concurrent.FutureTask.run(FutureTask.java:237) at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:234) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588) at java.lang.Thread.run(Thread.java:818) Caused by: android.system.ErrnoException: open failed: EACCES (Permission denied) at libcore.io.Posix.open(Native Method) at libcore.io.BlockGuardOs.open(BlockGuardOs.java:186) at java.io.File.createNewFile(File.java:932) at a2dp.Vol.ManageData$ImportDatabaseFileTask.doInBackground(ManageData.java:328)  at a2dp.Vol.ManageData$ImportDatabaseFileTask.doInBackground(ManageData.java:300)  at android.os.AsyncTask$2.call(AsyncTask.java:295)  at java.util.concurrent.FutureTask.run(FutureTask.java:237)  at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:234)  at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)  at java.lang.Thread.run(Thread.java:818) 

or

12-27 20:09:08.777 6175-7083/a2dp.Vol E/A2DP Volume: open failed: EACCES (Permission denied) java.io.IOException: open failed: EACCES (Permission denied) at java.io.File.createNewFile(File.java:939) at a2dp.Vol.ManageData$ExportDatabaseFileTask.doInBackground(ManageData.java:185) at a2dp.Vol.ManageData$ExportDatabaseFileTask.doInBackground(ManageData.java:160) at android.os.AsyncTask$2.call(AsyncTask.java:295) at java.util.concurrent.FutureTask.run(FutureTask.java:237) at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:234) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588) at java.lang.Thread.run(Thread.java:818) Caused by: android.system.ErrnoException: open failed: EACCES (Permission denied) at libcore.io.Posix.open(Native Method) at libcore.io.BlockGuardOs.open(BlockGuardOs.java:186) at java.io.File.createNewFile(File.java:932) at a2dp.Vol.ManageData$ExportDatabaseFileTask.doInBackground(ManageData.java:185)  at a2dp.Vol.ManageData$ExportDatabaseFileTask.doInBackground(ManageData.java:160)  at android.os.AsyncTask$2.call(AsyncTask.java:295)  at java.util.concurrent.FutureTask.run(FutureTask.java:237)  at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:234)  at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)  at java.lang.Thread.run(Thread.java:818) 

I believe the APIs for checking(checkSelfPermission)/asking(requestPermissions) STORAGE permission should be called after clicking "Export Database to SD card" and "Import Database from SD card" buttons to fix this issue, as the Android never asks me to grant any specific permission while running this app.

jroal commented 7 years ago

Fixed in 2.12.9 which I am still working on. Once released it will have this fix.