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

Crash when receiving a message from FCM but battery usage is restricted #3500

Open
Hocuri opened this issue Dec 17, 2024 · 0 comments · May be fixed by #3501
Open

Crash when receiving a message from FCM but battery usage is restricted #3500

Hocuri opened this issue Dec 17, 2024 · 0 comments · May be fixed by #3501
Assignees
Labels

Comments

@Hocuri
Copy link
Collaborator

Hocuri commented Dec 17, 2024

Steps to reproduce:

  • Use a chatmail account and a DC build with Google Play services enabled
  • In the system settings, enable "Apps -> Delta Chat -> App Battery usage -> Restricted"
  • Swipe away DC so that it's not running in the background
  • Receive a message

The crash, as reported via the Google Play Console:

Exception android.app.ForegroundServiceStartNotAllowedException: startForegroundService() not allowed due to mAllowStartForeground false: service chat.delta/org.thoughtcrime.securesms.service.FetchForegroundService
  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:4775)
  at android.os.Parcel.readParcelable (Parcel.java:4743)
  at android.os.Parcel.createExceptionOrNull (Parcel.java:3006)
  at android.os.Parcel.createException (Parcel.java:2995)
  at android.os.Parcel.readException (Parcel.java:2978)
  at android.os.Parcel.readException (Parcel.java:2920)
  at android.app.IActivityManager$Stub$Proxy.startService (IActivityManager.java:5335)
  at android.app.ContextImpl.startServiceCommon (ContextImpl.java:1894)
  at android.app.ContextImpl.startForegroundService (ContextImpl.java:1870)
  at android.content.ContextWrapper.startForegroundService (ContextWrapper.java:822)
  at androidx.core.content.ContextCompat$Api26Impl.startForegroundService (ContextCompat.java:1128)
  at androidx.core.content.ContextCompat.startForegroundService (ContextCompat.java:700)
  at org.thoughtcrime.securesms.service.FetchForegroundService.start (FetchForegroundService.java:36)
  at org.thoughtcrime.securesms.notifications.FcmReceiveService.onMessageReceived (FcmReceiveService.java:94)
  at com.google.firebase.messaging.FirebaseMessagingService.dispatchMessage (FirebaseMessagingService.java:243)
  at com.google.firebase.messaging.FirebaseMessagingService.passMessageIntentToSdk (FirebaseMessagingService.java:193)
  at com.google.firebase.messaging.FirebaseMessagingService.handleMessageIntent (FirebaseMessagingService.java:179)
  at com.google.firebase.messaging.FirebaseMessagingService.handleIntent (FirebaseMessagingService.java:168)
  at com.google.firebase.messaging.EnhancedIntentService.lambda$processIntent$0$com-google-firebase-messaging-EnhancedIntentService (EnhancedIntentService.java:82)
  at com.google.firebase.messaging.EnhancedIntentService$$ExternalSyntheticLambda0.run (Unknown Source:6)
  at java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1145)
  at java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:644)
  at com.google.android.gms.common.util.concurrent.zza.run (com.google.android.gms:play-services-basement@@18.3.0:2)
  at java.lang.Thread.run (Thread.java:1012)

The problem is that we're not allowed to start a foreground service if battery usage is "restricted".

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