SecUSo / privacy-friendly-todo-list

Privacy Friendly App to manage To-Do lists on Android.
Apache License 2.0
84 stars 40 forks source link

direct crash on phone startup #106

Closed Porkepix closed 5 months ago

Porkepix commented 7 months ago

On last phone restart, I got a crash message from this application.

Upon checking for other issues, I found out this exception in the logs:

03-20 13:18:23.891 10245 10245 E AndroidRuntime: FATAL EXCEPTION: main
03-20 13:18:23.891 10245 10245 E AndroidRuntime: Process: org.secuso.privacyfriendlytodolist, PID: 10245
03-20 13:18:23.891 10245 10245 E AndroidRuntime: java.lang.RuntimeException: Unable to start receiver org.secuso.privacyfriendlytodolist.model.AutoStartReceiver: java.lang.IllegalStateException: Not allowed to start service Intent { cmp=org.secuso.privacyfriendlytodolist/.model.ReminderService }: app is in background uid UidRecord{d101209 u0a286 RCVR idle procs:1 seq(0,0,0)}
03-20 13:18:23.891 10245 10245 E AndroidRuntime:    at android.app.ActivityThread.handleReceiver(ActivityThread.java:3264)
03-20 13:18:23.891 10245 10245 E AndroidRuntime:    at android.app.ActivityThread.-wrap17(Unknown Source:0)
03-20 13:18:23.891 10245 10245 E AndroidRuntime:    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1682)
03-20 13:18:23.891 10245 10245 E AndroidRuntime:    at android.os.Handler.dispatchMessage(Handler.java:105)
03-20 13:18:23.891 10245 10245 E AndroidRuntime:    at android.os.Looper.loop(Looper.java:251)
03-20 13:18:23.891 10245 10245 E AndroidRuntime:    at android.app.ActivityThread.main(ActivityThread.java:6572)
03-20 13:18:23.891 10245 10245 E AndroidRuntime:    at java.lang.reflect.Method.invoke(Native Method)
03-20 13:18:23.891 10245 10245 E AndroidRuntime:    at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)
03-20 13:18:23.891 10245 10245 E AndroidRuntime:    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767)
03-20 13:18:23.891 10245 10245 E AndroidRuntime: Caused by: java.lang.IllegalStateException: Not allowed to start service Intent { cmp=org.secuso.privacyfriendlytodolist/.model.ReminderService }: app is in background uid UidRecord{d101209 u0a286 RCVR idle procs:1 seq(0,0,0)}
03-20 13:18:23.891 10245 10245 E AndroidRuntime:    at android.app.ContextImpl.startServiceCommon(ContextImpl.java:1505)
03-20 13:18:23.891 10245 10245 E AndroidRuntime:    at android.app.ContextImpl.startService(ContextImpl.java:1461)
03-20 13:18:23.891 10245 10245 E AndroidRuntime:    at android.content.ContextWrapper.startService(ContextWrapper.java:644)
03-20 13:18:23.891 10245 10245 E AndroidRuntime:    at android.content.ContextWrapper.startService(ContextWrapper.java:644)
03-20 13:18:23.891 10245 10245 E AndroidRuntime:    at org.secuso.privacyfriendlytodolist.model.AutoStartReceiver.onReceive(AutoStartReceiver.java:34)
03-20 13:18:23.891 10245 10245 E AndroidRuntime:    at android.app.ActivityThread.handleReceiver(ActivityThread.java:3257)
03-20 13:18:23.891 10245 10245 E AndroidRuntime:    ... 8 more
03-20 13:18:23.924  1391  8706 D ActivityManager: New dropbox entry: org.secuso.privacyfriendlytodolist, data_app_crash, 2a69a55e-82b3-408b-b22f-d022b5ece4f1
03-20 13:18:24.050  1391  1428 I ActivityManager: Showing crash dialog for package org.secuso.privacyfriendlytodolist u0

Note that this appears in the crashs log, not the main or system one, which is unusual (log isn't filled with many things).

EDIT: Edited logs above for a little more lines at the bottom.

Note the issue happens on most of the boot. It might be related to the quantity of things it tries to start (could be nice to be able to disable services as on desktop OS…), but nonetheless this application is the one presenting this boot crash the most, on almost every reboot.

0xC0FFEEC0DE commented 6 months ago

I think the reason for the exceptions are the Background Execution Limits that were introduced with Android 8.0 (API level 26). The solution seems to be to do the Background Work with a JobScheduler. I'll look into that.

0xC0FFEEC0DE commented 5 months ago

I could not reproduce the issue but I hope its fixed by #115.