E/com.onaio.steps.helper.FileUtil: java.io.FileNotFoundException: /storage/emulated/0/steps/settings/.steps-settings-hash: open failed: EPERM (Operation not permitted)
at libcore.io.IoBridge.open(IoBridge.java:492)
at java.io.FileOutputStream.<init>(FileOutputStream.java:236)
at java.io.FileOutputStream.<init>(FileOutputStream.java:186)
at com.onaio.steps.helper.FileUtil.write(FileUtil.java:163)
at com.onaio.steps.utils.QRCodeUtils.saveToDisk(QRCodeUtils.java:183)
at com.onaio.steps.tasks.SaveQRCodeAsyncTask.doInBackground(SaveQRCodeAsyncTask.java:33)
at com.onaio.steps.tasks.SaveQRCodeAsyncTask.doInBackground(SaveQRCodeAsyncTask.java:17)
at android.os.AsyncTask$3.call(AsyncTask.java:394)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:305)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
at java.lang.Thread.run(Thread.java:923)
Caused by: android.system.ErrnoException: open failed: EPERM (Operation not permitted)
at libcore.io.Linux.open(Native Method)
at libcore.io.ForwardingOs.open(ForwardingOs.java:166)
at libcore.io.BlockGuardOs.open(BlockGuardOs.java:254)
at libcore.io.ForwardingOs.open(ForwardingOs.java:166)
at android.app.ActivityThread$AndroidOs.open(ActivityThread.java:7542)
at libcore.io.IoBridge.open(IoBridge.java:478)
at java.io.FileOutputStream.<init>(FileOutputStream.java:236)
at java.io.FileOutputStream.<init>(FileOutputStream.java:186)
at com.onaio.steps.helper.FileUtil.write(FileUtil.java:163)
at com.onaio.steps.utils.QRCodeUtils.saveToDisk(QRCodeUtils.java:183)
at com.onaio.steps.tasks.SaveQRCodeAsyncTask.doInBackground(SaveQRCodeAsyncTask.java:33)
at com.onaio.steps.tasks.SaveQRCodeAsyncTask.doInBackground(SaveQRCodeAsyncTask.java:17)
at android.os.AsyncTask$3.call(AsyncTask.java:394)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:305)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
at java.lang.Thread.run(Thread.java:923)
E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.onaio.steps, PID: 27094
android.os.FileUriExposedException: file:///storage/emulated/0/Pictures/my-steps-settings.png exposed beyond app through ClipData.Item.getUri()
at android.os.StrictMode.onFileUriExposed(StrictMode.java:2141)
at android.net.Uri.checkFileUriExposed(Uri.java:2391)
at android.content.ClipData.prepareToLeaveProcess(ClipData.java:964)
at android.content.Intent.prepareToLeaveProcess(Intent.java:11119)
at android.content.Intent.prepareToLeaveProcess(Intent.java:11125)
at android.content.Intent.prepareToLeaveProcess(Intent.java:11104)
at android.app.Instrumentation.execStartActivity(Instrumentation.java:1722)
at android.app.Activity.startActivityForResult(Activity.java:5320)
at androidx.activity.ComponentActivity.startActivityForResult(ComponentActivity.java:597)
at android.app.Activity.startActivityForResult(Activity.java:5278)
at androidx.activity.ComponentActivity.startActivityForResult(ComponentActivity.java:583)
at android.app.Activity.startActivity(Activity.java:5664)
at android.app.Activity.startActivity(Activity.java:5617)
at com.onaio.steps.handler.actions.ShareHandler$1.onSuccessfulSave(ShareHandler.java:60)
at com.onaio.steps.tasks.SaveQRCodeAsyncTask.onPostExecute(SaveQRCodeAsyncTask.java:48)
at com.onaio.steps.tasks.SaveQRCodeAsyncTask.onPostExecute(SaveQRCodeAsyncTask.java:17)
at android.os.AsyncTask.finish(AsyncTask.java:771)
at android.os.AsyncTask.access$900(AsyncTask.java:199)
at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:788)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:223)
at android.app.ActivityThread.main(ActivityThread.java:7656)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)
Steps to reproduce:
Import/Export Settings via QR Code
button.