io7m-com / exfilac

Simple, reliable, automated S3 uploads for Android
https://www.io7m.com/software/exfilac
ISC License
10 stars 1 forks source link

Background service startup failures #17

Closed io7m closed 1 month ago

io7m commented 2 months ago

On a Pixel 8a running Graphene, background services refuse to start:

android.app.BackgroundServiceStartNotAllowedException: Not allowed to start service Intent { cmp=com.io7m.exfilac.main/.EFPhotoService }: app is in background uid UidRecord{c8b1f10 u0a157 CEM  bg:+511ms idle chan
ge:idle|cached|procstate procs:0 seq(1380,1072)} caps=-------
        at android.app.ContextImpl.startServiceCommon(ContextImpl.java:1978)
        at android.app.ContextImpl.startService(ContextImpl.java:1933)
        at android.content.ContextWrapper.startService(ContextWrapper.java:827)
        at com.io7m.exfilac.main.EFApplication$Companion.startServices(EFApplication.kt:65)
        at com.io7m.exfilac.main.EFApplication.onCreate(EFApplication.kt:101)
        at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1391)
        at android.app.ActivityThread.handleBindApplication(ActivityThread.java:7429)
        at android.app.ActivityThread.-$$Nest$mhandleBindApplication(Unknown Source:0)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2386)
        at android.os.Handler.dispatchMessage(Handler.java:107)
        at android.os.Looper.loopOnce(Looper.java:232)
        at android.os.Looper.loop(Looper.java:317)
        at android.app.ActivityThread.main(ActivityThread.java:8623)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:580)
        at com.android.internal.os.ExecInit.main(ExecInit.java:50)
        at com.android.internal.os.RuntimeInit.nativeFinishInit(Native Method)
        at com.android.internal.os.RuntimeInit.main(RuntimeInit.java:369)
io7m commented 2 months ago

Google have broken Android to such a degree that we might be forced to switch to scheduled jobs instead of background services. Thankfully, the background services are just minimal stubs.

io7m commented 2 months ago

Perhaps foreground services would be better. Make it clear that exfilac is running and is supervising directories and so on.