This is something coming in from Crashlytics that we have been unable to reproduce so far. After upgrading our app to target API 31, we received numerous crashes including this one. Very similar to issue #1815 but distinct from it. This crash is coming from line 139 in SdlRouterStatusProvider.bindToService() when context.startForegroundService is called. Likely needs a fix similar to #1823.
Reproduction Steps
Unfortunately unable to reproduce at the moment. This crash came from our Crashlytics logs and was observed after targeting API 31 and moving to SDL 5.4.0.
Which projects have you seen this bug on?
Android
Android Version(s)
12, 13
Android Device(s)
Mostly Samsung, but also across the full range of Google devices which support Android 12+, numerous OnePlus devices
sdl_java_suite Version
5.4.0
Testing Environment(s)
N/A
Relevant log output
Fatal Exception: android.app.ForegroundServiceStartNotAllowedException: startForegroundService() not allowed due to mAllowStartForeground false: service com.cisco.webex.meetings/.SdlRouterService
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:6968)
at android.app.ContextImpl.startServiceCommon(ContextImpl.java:1927)
at android.app.ContextImpl.startForegroundService(ContextImpl.java:1893)
at android.content.ContextWrapper.startForegroundService(ContextWrapper.java:798)
at com.smartdevicelink.transport.SdlRouterStatusProvider.bindToService(SdlRouterStatusProvider.java:139)
at com.smartdevicelink.transport.SdlRouterStatusProvider.checkIsConnected(SdlRouterStatusProvider.java:111)
at com.smartdevicelink.transport.SdlBroadcastReceiver$6.onListObtained(SdlBroadcastReceiver.java:569)
at com.smartdevicelink.transport.RouterServiceValidator.createTrustedListRequest(RouterServiceValidator.java:603)
at com.smartdevicelink.transport.RouterServiceValidator.createTrustedListRequest(RouterServiceValidator.java:595)
at com.smartdevicelink.transport.SdlBroadcastReceiver.requestTransportStatus(SdlBroadcastReceiver.java:565)
at com.smartdevicelink.transport.SdlBroadcastReceiver.access$700(SdlBroadcastReceiver.java:72)
at com.smartdevicelink.transport.SdlBroadcastReceiver$4.onComplete(SdlBroadcastReceiver.java:512)
at com.smartdevicelink.util.ServiceFinder.onFinished(ServiceFinder.java:122)
at com.smartdevicelink.util.ServiceFinder.access$000(ServiceFinder.java:56)
at com.smartdevicelink.util.ServiceFinder$1.run(ServiceFinder.java:82)
at android.os.Handler.handleCallback(Handler.java:938)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loopOnce(Looper.java:226)
at android.os.Looper.loop(Looper.java:313)
at android.app.ActivityThread.main(ActivityThread.java:8669)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:571)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1135)
Caused by android.os.RemoteException: Remote stack trace:
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:2960)
at com.android.server.am.ActivityManagerService.onTransact(ActivityManagerService.java:3036)
Fatal Exception: java.lang.RuntimeException: Error receiving broadcast Intent { act=com.clearchannel.iheartradio.controller.ServiceFinder flg=0x10000010 (has extras) } in com.smartdevicelink.util.ServiceFinder$b@2c2ed92
at android.app.LoadedApk$ReceiverDispatcher$Args.lambda$getRunnable$0$LoadedApk$ReceiverDispatcher$Args(LoadedApk.java:1815)
at android.app.LoadedApk$ReceiverDispatcher$Args$$ExternalSyntheticLambda0.run(LoadedApk.java:2)
at android.os.Handler.handleCallback(Handler.java:938)
at android.os.Handler.dispatchMessage(Handler.java:99)
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(Method.java)
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: startForegroundService() not allowed due to mAllowStartForeground false: service com.cisco.webex.meetings/.SdlRouterService
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:6917)
at android.app.ContextImpl.startServiceCommon(ContextImpl.java:1927)
at android.app.ContextImpl.startForegroundService(ContextImpl.java:1893)
at android.content.ContextWrapper.startForegroundService(ContextWrapper.java:798)
at com.smartdevicelink.transport.SdlRouterStatusProvider.bindToService(SdlRouterStatusProvider.java:139)
at com.smartdevicelink.transport.SdlRouterStatusProvider.checkIsConnected(SdlRouterStatusProvider.java:111)
at com.smartdevicelink.transport.SdlBroadcastReceiver$6.onListObtained(SdlBroadcastReceiver.java:570)
at com.smartdevicelink.transport.RouterServiceValidator.createTrustedListRequest(RouterServiceValidator.java:603)
at com.smartdevicelink.transport.RouterServiceValidator.createTrustedListRequest(RouterServiceValidator.java:595)
at com.smartdevicelink.transport.SdlBroadcastReceiver.requestTransportStatus(SdlBroadcastReceiver.java:566)
at com.smartdevicelink.transport.SdlBroadcastReceiver.access$700(SdlBroadcastReceiver.java:74)
at com.smartdevicelink.transport.SdlBroadcastReceiver$4.onComplete(SdlBroadcastReceiver.java:513)
at com.smartdevicelink.util.ServiceFinder.onFinished(ServiceFinder.java:122)
at com.smartdevicelink.util.ServiceFinder.access$000(ServiceFinder.java:56)
at com.smartdevicelink.util.ServiceFinder$2.onReceive(ServiceFinder.java:113)
at android.app.LoadedApk$ReceiverDispatcher$Args.lambda$getRunnable$0$LoadedApk$ReceiverDispatcher$Args(LoadedApk.java:1805)
at android.app.LoadedApk$ReceiverDispatcher$Args$$ExternalSyntheticLambda0.run(LoadedApk.java:2)
at android.os.Handler.handleCallback(Handler.java:938)
at android.os.Handler.dispatchMessage(Handler.java:99)
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(Method.java)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:567)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1135)
Bug Summary
This is something coming in from Crashlytics that we have been unable to reproduce so far. After upgrading our app to target API 31, we received numerous crashes including this one. Very similar to issue #1815 but distinct from it. This crash is coming from line 139 in
SdlRouterStatusProvider.bindToService()
whencontext.startForegroundService
is called. Likely needs a fix similar to #1823.Reproduction Steps
Unfortunately unable to reproduce at the moment. This crash came from our Crashlytics logs and was observed after targeting API 31 and moving to SDL 5.4.0.
Which projects have you seen this bug on?
Android
Android Version(s)
12, 13
Android Device(s)
Mostly Samsung, but also across the full range of Google devices which support Android 12+, numerous OnePlus devices
sdl_java_suite Version
5.4.0
Testing Environment(s)
Relevant log output