mpcjanssen / simpletask-android

GNU General Public License v3.0
548 stars 128 forks source link

Can't save or open todo.txt to/from internal storage anymore after upgrade to Android 10 #1095

Closed jensberke closed 4 years ago

jensberke commented 4 years ago

Hi, first of all, thanks a lot for your work on Simpletask.

Setup

Simpletask 10.7.0 Cloudless Granted app permissions: Storage, Calendar todo.txt location: /storage/emulated/0/Simpletask/todo.txt

Problems

Can't save todo.txt anymore. Saving shows "Saving todo file failed". Can't open a todo.txt anymore because the file dialog only shows empty directories (though files exists in these directories).

Details

2020-09-23: I upgraded my phone from Android 9 to 10. Simpletask configuration has been the same for months and working without issues until then. 2020-09-24: Simpletask still must have worked that day because I'm quite sure that I was able to make changes to my todo.txt. I don't 100% remember doing it, but the time stamp of the todo.txt is 2020-09-24, so I'm quite confident that I did changes successfully. 2020-09-25: Simpletask suddenly is not able to save the todo.txt anymore, showing "Saving todo file failed".

Using menu "Open todo file" to open the same todo.txt again (or to open any other todo.txt) is also not possible. The file dialog doesn't show any file. It only shows the current directory's name in the first line and ".." in the second. It's possible to navigate to parent directory tapping the ".." until I reach root "/". It then only shows "/" in the first and "/storage/emulated/0/" in the second line, nothing else. Tapping "/storage/emulated/0/" brings me there and I can only go upward per ".." again.

I have made no changes to file or app permissions since the Android 10 upgrade, but I guess that somehow they must have been changed by the system in a way that Simpletask suddenly doesn't see any files on /storage/emulated/0 anymore.

Other apps have no problems reading from and writing to "/storage/emulated/0/".

Log

09-26 17:40:09.629 25079 25307 E TodoList: TodoList save to /storage/emulated/0/Simpletask/todo.txt failed
09-26 17:40:09.629 25079 25307 E TodoList: java.io.FileNotFoundException: /storage/emulated/0/Simpletask/todo.txt: open failed: EACCES (Permission denied)
09-26 17:40:09.629 25079 25307 E TodoList:  at libcore.io.IoBridge.open(IoBridge.java:496)
09-26 17:40:09.629 25079 25307 E TodoList:  at java.io.FileOutputStream.<init>(FileOutputStream.java:235)
09-26 17:40:09.629 25079 25307 E TodoList:  at nl.mpcjanssen.simpletask.util.TaskIo.writeToFile(TaskIo.kt:2)
09-26 17:40:09.629 25079 25307 E TodoList:  at nl.mpcjanssen.simpletask.remote.FileStore.saveTasksToFile(FileStore.kt:4)
09-26 17:40:09.629 25079 25307 E TodoList:  at nl.mpcjanssen.simpletask.task.TodoList$save$2$2$onFinish$1.invoke(TodoList.kt:4)
09-26 17:40:09.629 25079 25307 E TodoList:  at nl.mpcjanssen.simpletask.task.TodoList$save$2$2$onFinish$1.invoke(TodoList.kt:1)
09-26 17:40:09.629 25079 25307 E TodoList:  at nl.mpcjanssen.simpletask.util.ActionQueue$add$1.invoke(ActionQueues.kt:3)
09-26 17:40:09.629 25079 25307 E TodoList:  at nl.mpcjanssen.simpletask.util.ActionQueue$add$1.invoke(ActionQueues.kt:1)
09-26 17:40:09.629 25079 25307 E TodoList:  at org.jetbrains.anko.AsyncKt$doAsync$1.invoke(Async.kt:1)
09-26 17:40:09.629 25079 25307 E TodoList:  at org.jetbrains.anko.AsyncKt$doAsync$1.invoke(Unknown Source:0)
09-26 17:40:09.629 25079 25307 E TodoList:  at org.jetbrains.anko.AsyncKt$sam$java_util_concurrent_Callable$0.call(Unknown Source:2)
09-26 17:40:09.629 25079 25307 E TodoList:  at java.util.concurrent.FutureTask.run(FutureTask.java:266)
09-26 17:40:09.629 25079 25307 E TodoList:  at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:301)
09-26 17:40:09.629 25079 25307 E TodoList:  at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
09-26 17:40:09.629 25079 25307 E TodoList:  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
09-26 17:40:09.629 25079 25307 E TodoList:  at java.lang.Thread.run(Thread.java:919)
09-26 17:40:09.629 25079 25307 E TodoList: Caused by: android.system.ErrnoException: open failed: EACCES (Permission denied)
09-26 17:40:09.629 25079 25307 E TodoList:  at libcore.io.Linux.open(Native Method)
09-26 17:40:09.629 25079 25307 E TodoList:  at libcore.io.ForwardingOs.open(ForwardingOs.java:167)
09-26 17:40:09.629 25079 25307 E TodoList:  at libcore.io.BlockGuardOs.open(BlockGuardOs.java:252)
09-26 17:40:09.629 25079 25307 E TodoList:  at libcore.io.ForwardingOs.open(ForwardingOs.java:167)
09-26 17:40:09.629 25079 25307 E TodoList:  at android.app.ActivityThread$AndroidOs.open(ActivityThread.java:7296)
09-26 17:40:09.629 25079 25307 E TodoList:  at libcore.io.IoBridge.open(IoBridge.java:482)
09-26 17:40:09.629 25079 25307 E TodoList:  ... 15 more
09-26 17:40:09.629 25079 25307 I Util    : Sending file sync done changed broadcast
09-26 17:40:10.136 25079 25463 I FileDialog: File list from /storage/emulated/0 loaded
09-26 17:40:10.156 25079 25103 D OpenGLRenderer: endAllActiveAnimators on 0x792146a900 (AlertController$RecycleListView) with handle 0x7982757ee0
09-26 17:40:11.430 25079 25464 I FileDialog: File list from /storage/emulated loaded
09-26 17:40:11.447 25079 25103 D OpenGLRenderer: endAllActiveAnimators on 0x7938cdad00 (AlertController$RecycleListView) with handle 0x79873609e0
09-26 17:40:12.233 25079 25465 I FileDialog: File list from /storage loaded
09-26 17:40:12.262 25079 25103 D OpenGLRenderer: endAllActiveAnimators on 0x7938fc2500 (AlertController$RecycleListView) with handle 0x7921165580
09-26 17:40:13.132 25079 25079 W Thread-13: type=1400 audit(0.0:7767): avc: denied { read } for name="/" dev="dm-0" ino=2 scontext=u:r:untrusted_app:s0:c122,c256,c512,c768 tcontext=u:object_r:rootfs:s0 tclass=dir permissive=0
09-26 17:40:13.147 25079 25466 I FileDialog: File list from / loaded
09-26 17:40:13.158 25079 25103 D OpenGLRenderer: endAllActiveAnimators on 0x7937802700 (AlertController$RecycleListView) with handle 0x7987360b00
09-26 17:40:14.364 25079 25079 I FileDialog: Selected entry /storage/emulated/0, folder: true
09-26 17:40:14.367 25079 25467 I FileDialog: File list from /storage/emulated/0 loaded
09-26 17:40:14.378 25079 25103 D OpenGLRenderer: endAllActiveAnimators on 0x7914f76500 (AlertController$RecycleListView) with handle 0x798729f2e0
09-26 17:40:15.490 25079 25468 I FileDialog: File list from /storage/emulated loaded
09-26 17:40:15.503 25079 25103 D OpenGLRenderer: endAllActiveAnimators on 0x79215a0200 (AlertController$RecycleListView) with handle 0x7987360b40
09-26 17:40:16.368 25079 25470 I FileDialog: File list from /storage loaded
09-26 17:40:16.378 25079 25103 D OpenGLRenderer: endAllActiveAnimators on 0x792169d600 (AlertController$RecycleListView) with handle 0x7987360b80
09-26 17:40:17.102 25079 25079 W Thread-17: type=1400 audit(0.0:7769): avc: denied { read } for name="/" dev="dm-0" ino=2 scontext=u:r:untrusted_app:s0:c122,c256,c512,c768 tcontext=u:object_r:rootfs:s0 tclass=dir permissive=0
09-26 17:40:17.112 25079 25471 I FileDialog: File list from / loaded
09-26 17:40:17.121 25079 25103 D OpenGLRenderer: endAllActiveAnimators on 0x792174da00 (AlertController$RecycleListView) with handle 0x7987360be0
09-26 17:40:18.546 25079 25079 I FileDialog: Selected entry /storage/emulated/0, folder: true
09-26 17:40:18.548 25079 25472 I FileDialog: File list from /storage/emulated/0 loaded
09-26 17:40:18.560 25079 25103 D OpenGLRenderer: endAllActiveAnimators on 0x7938c9ee00 (AlertController$RecycleListView) with handle 0x7987360d40
09-26 17:40:19.774 25079 25079 W InputEventReceiver: Attempted to finish an input event but the input event receiver has already been disposed.
09-26 17:40:24.911 25079 25079 I Simpletask: onMenuItemSelected: 2131296560
09-26 17:40:24.936 25079 25079 W ActivityThread: handleWindowVisibility: no activity for token android.os.BinderProxy@62e903c
09-26 17:40:24.959 25079 25079 I Preferences: Registering broadcast receiver
09-26 17:40:25.275 25079 25103 D OpenGLRenderer: endAllActiveAnimators on 0x7938fd9500 (MenuPopupWindow$MenuDropDownListView) with handle 0x7987360ea0
09-26 17:40:41.846 25079 25079 W ActivityThread: handleWindowVisibility: no activity for token android.os.BinderProxy@b0d17c8
09-26 17:45:41.529 25943 25943 E ssen.simpletas: Not starting debugger since process cannot load the jdwp agent.
09-26 17:45:41.559 25943 25943 I Perf    : Connecting to perf service.
09-26 17:45:41.600 25943 25943 D QueryStore: Saved applyFilter ids: []
09-26 17:45:41.611 25943 25943 I Config  : Getting 91 items todoList from cache
09-26 17:45:41.663 25943 25943 I TodoApplication: onCreate()
09-26 17:45:41.663 25943 25943 I TodoApplication: Created todolist nl.mpcjanssen.simpletask.task.TodoList@fcdd60b
09-26 17:45:41.664 25943 25943 I TodoApplication: Started Simpletask cloudless v10.7.0 (10007000) Git: 10.7.0
09-26 17:45:41.667 25943 25943 I TodoApplication: Scheduling daily UI updateCache alarm, first at Sun Sep 27 00:02:00 GMT+02:00 2020
09-26 17:45:41.668 25943 25943 I TodoApplication: Scheduling task list reload
09-26 17:45:41.751 25943 25943 I Simpletask: onCreate
09-26 17:45:41.820 25943 25943 I FileStore: onCreate
09-26 17:45:41.821 25943 25943 I FileStore: Default path: /storage/emulated/0/data/nl.mpcjanssen.simpletask/todo.txt
mpcjanssen commented 4 years ago

This is caused by tightened storage permissions in Android 10. Please use the version from https://mpcjanssen.nl/artifacts/10.8.0/cloudless/release/app-cloudless-release.apk for a fix. You will need to move the todo.txt file to /storage/emulated/0/Android/data/nl.mpcjanssen.simpletask/files/todo.txt easiest is to reinstall cloudless and create a new task in the new version and then copy the existing todo.txt over it (or paste it in Simpletask directly)

jensberke commented 4 years ago

I've already tried 10.8.0 released via F-Droid by now but the problem persists (removed 10.7.0 from Google Play and reinstalled 10.8.0 from F-Droid). The path to todo.txt which is actually used is different from the one you posted above:

Posted by you: /storage/emulated/0/Android/data/nl.mpcjanssen.simpletask/files/todo.txt

Actually used: /storage/emulated/0/data/nl.mpcjanssen.simpletask/todo.txt

09-27 12:02:35.581  2033  2682 I FileStore: Saving tasks to file: /storage/emulated/0/data/nl.mpcjanssen.simpletask/todo.txt
09-27 12:02:35.588  2033  2682 E Util    : Could not create dirs: /storage/emulated/0/data
09-27 12:02:35.590  2033  2682 E TodoList: TodoList save to /storage/emulated/0/data/nl.mpcjanssen.simpletask/todo.txt failed
09-27 12:02:35.590  2033  2682 E TodoList: nl.mpcjanssen.simpletask.TodoException: Could not create dirs: /storage/emulated/0/data
mpcjanssen commented 4 years ago

@jensberke you'll need the unreleased https://mpcjanssen.nl/artifacts/10.8.0-2-b732e3b/cloudless/release/app-cloudless-release.apk for https://github.com/mpcjanssen/simpletask-android/commit/6f084e4cdd0ecb6904a0c7b78930e7a1d85cf027 . Sorry for the wrong link.

jensberke commented 4 years ago

Ok, thanks, that version fixes the problem. I copied my backup of the todo.txt to /storage/emulated/0/Android/data/nl.mpcjanssen.simpletask/files/ after installing the apk and now everything's back and working.

idlinds commented 4 years ago

I was having exactly the same problem and that fixed it. Thanks for this and all your work on this useful app. Is this going to have to remain the storage location for future versions or do you think future updates will allow different locations to be selected again?

mpcjanssen commented 4 years ago

@idlinds I have no plans to try jump through hoops to be able to write to the old location again (just for Google to break the hoops in the next Android release)

ddisanti commented 4 years ago

@mpcjanssen I've switched to a new Android 10 device and I'm experimenting this same issue. Do you plan to publish the new version in the play store soon? Thanks in advance.

mpcjanssen commented 4 years ago

@ddisanti not sure when I have time but if you install the version linked above it will fix the issue and be update once a newer version comes on the playstore