Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ForegroundServiceStartNotAllowedException on boot on some Android 12 devices #1090

Closed
barbeau opened this issue Jun 21, 2022 · 1 comment
Closed
Labels
Milestone

Comments

@barbeau
Copy link
Member

barbeau commented Jun 21, 2022

Summary:

I'm seeing this crash in the Play console from around 20 Samsung devices on Android 12 from version 2.10.1 that's rolling out now:

java.lang.RuntimeException: 
  at android.app.ActivityThread.handleReceiver (ActivityThread.java:4770)
  at android.app.ActivityThread.access$1800 (ActivityThread.java:310)
  at android.app.ActivityThread$H.handleMessage (ActivityThread.java:2292)
  at android.os.Handler.dispatchMessage (Handler.java:106)
  at android.os.Looper.loopOnce (Looper.java:226)
  at android.os.Looper.loop (Looper.java:313)
  at android.app.ActivityThread.main (ActivityThread.java:8663)
  at java.lang.reflect.Method.invoke (Native Method)
  at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:567)
  at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1135)
Caused by: android.app.ForegroundServiceStartNotAllowedException: 
  at android.app.ForegroundServiceStartNotAllowedException$1.createFromParcel (ForegroundServiceStartNotAllowedException.java:54)
  at android.app.ForegroundServiceStartNotAllowedException$1.createFromParcel (ForegroundServiceStartNotAllowedException.java:50)
  at android.os.Parcel.readParcelable (Parcel.java:3345)
  at android.os.Parcel.createExceptionOrNull (Parcel.java:2432)
  at android.os.Parcel.createException (Parcel.java:2421)
  at android.os.Parcel.readException (Parcel.java:2404)
  at android.os.Parcel.readException (Parcel.java:2346)
  at android.app.IActivityManager$Stub$Proxy.startService (IActivityManager.java:6965)
  at android.app.ContextImpl.startServiceCommon (ContextImpl.java:1926)
  at android.app.ContextImpl.startForegroundService (ContextImpl.java:1892)
  at android.content.ContextWrapper.startForegroundService (ContextWrapper.java:796)
  at android.content.ContextWrapper.startForegroundService (ContextWrapper.java:796)
  at org.onebusaway.android.tripservice.TripService.scheduleAll (TripService.java:282)
  at org.onebusaway.android.tripservice.BootstrapService.onReceive (BootstrapService.java:31)
  at android.app.ActivityThread.handleReceiver (ActivityThread.java:4761)
Caused by: android.os.RemoteException: 
  at com.android.server.am.ActiveServices.startServiceLocked (ActiveServices.java:771)
  at com.android.server.am.ActiveServices.startServiceLocked (ActiveServices.java:679)
  at com.android.server.am.ActivityManagerService.startService (ActivityManagerService.java:14099)
  at android.app.IActivityManager$Stub.onTransact (IActivityManager.java:2958)
  at com.android.server.am.ActivityManagerService.onTransact (ActivityManagerService.java:3036)

On reboot, we receive the ACTION_BOOT_COMPLETED broadcast and schedule all our reminder alarms via a foreground service. This is one of the "special cases" where a foreground service should be exempt from the background launch limitation:
https://developer.android.com/guide/components/foreground-services#background-start-restriction-exemptions

But for some reason it's still crashing. Not sure if the crash is visible to user or not because it's a service. No one has reported it to me yet, I'm just seeing it in the Play console.

Seems to only happen on Samsung devices, so maybe it's a Samsung-specific bug? Wouldn't be the first time.

Steps to reproduce:

Unknown - I can't repro on Samsung Galaxy S21+ w/ Android 12

Expected behavior:

Not crash and schedule saved alarms

Observed behavior:

Seems to be a crash on reboot on some devices

Device and Android version:

All Samsung devices w/ Android 12 - Galaxy S21 FE, Galaxy A52, Galaxy S10+, Galaxy S20 FE, S10e, S10, A31, A53, S10e, Note10+, M32, S21 Ultra, S22.

@amrhossamdev
Copy link
Member

Fixed: #1258

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants