syncthing-android icon indicating copy to clipboard operation
syncthing-android copied to clipboard

Service.startForeground() not allowed due to mAllowStartForeground false

Open odlg opened this issue 1 year ago • 1 comments

Description of the issue

Syncthing-Fork frequently has issues starting. The phone tells me it has crashed and provides this information:

type: crash
osVersion: google/husky/husky:14/AP1A.240505.005/2024052100:user/release-keys
package: com.github.catfriend1.syncthingandroid:1270700
process: com.github.catfriend1.syncthingandroid
processUptime: 147 + 442 ms
installer: com.machiav3lli.fdroid

java.lang.RuntimeException: Unable to start service com.nutomic.syncthingandroid.service.SyncthingService@7de6ba2 with null: android.app.ForegroundServiceStartNotAllowedException: Service.startForeground() not allowed due to mAllowStartForeground false: service com.github.catfriend1.syncthingandroid/com.nutomic.syncthingandroid.service.SyncthingService
	at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:5079)
	at android.app.ActivityThread.-$$Nest$mhandleServiceArgs(Unknown Source:0)
	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2397)
	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:8532)
	at java.lang.reflect.Method.invoke(Native Method)
	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:552)
	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:359)
Caused by: android.app.ForegroundServiceStartNotAllowedException: Service.startForeground() not allowed due to mAllowStartForeground false: service com.github.catfriend1.syncthingandroid/com.nutomic.syncthingandroid.service.SyncthingService
	at android.app.ForegroundServiceStartNotAllowedException$1.createFromParcel(ForegroundServiceStartNotAllowedException.java:54)
	at android.app.ForegroundServiceStartNotAllowedException$1.createFromParcel(ForegroundServiceStartNotAllowedException.java:50)
	at android.os.Parcel.readParcelableInternal(Parcel.java:5035)
	at android.os.Parcel.readParcelable(Parcel.java:5017)
	at android.os.Parcel.createExceptionOrNull(Parcel.java:3186)
	at android.os.Parcel.createException(Parcel.java:3175)
	at android.os.Parcel.readException(Parcel.java:3151)
	at android.os.Parcel.readException(Parcel.java:3093)
	at android.app.IActivityManager$Stub$Proxy.setServiceForeground(IActivityManager.java:6876)
	at android.app.Service.startForeground(Service.java:878)
	at com.nutomic.syncthingandroid.service.NotificationHandler.updatePersistentNotification(NotificationHandler.java:216)
	at com.nutomic.syncthingandroid.service.NotificationHandler.updatePersistentNotification(NotificationHandler.java:109)
	at com.nutomic.syncthingandroid.service.SyncthingService.onStartCommand(SyncthingService.java:306)
	at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:5061)
	... 11 more

Reproduction Steps

Version Information

  • App Version: 1.27.7.0
  • Syncthing Version: v1.27.7
  • Android Version: Android 14 - GrapheneOS
  • Device manufacturer: Google
  • Device model: Pixel 8 Pro

odlg avatar May 23 '24 06:05 odlg