Skip to content

Commit

Permalink
Update comment for ForegroundServiceStartNotAllowedException workar…
Browse files Browse the repository at this point in the history
…ound
  • Loading branch information
cketti committed Jun 27, 2024
1 parent 8ef8304 commit 15ff901
Showing 1 changed file with 2 additions and 13 deletions.
15 changes: 2 additions & 13 deletions app/core/src/main/java/com/fsck/k9/controller/push/PushService.kt
Original file line number Diff line number Diff line change
Expand Up @@ -56,19 +56,8 @@ class PushService : Service() {
} catch (e: ForegroundServiceStartNotAllowedException) {
Timber.e(e, "Ignoring ForegroundServiceStartNotAllowedException during automatic restart.")

// There are quite a few crash reports where calling startForeground() throws
// ForegroundServiceStartNotAllowedException when the system is restarting the service. This shouldn't
// happen since the app was allowed to start a foreground service when it was originally started.
// We haven't been able to reliably reproduce this behavior. So it's not clear if and how we can work
// around this.
//
// Possible workarounds:
// - [X] Catch and ignore ForegroundServiceStartNotAllowedException.
// - [ ] Skip call to startForeground() when onStartCommand() is called with intent == null.
// - [ ] Catch ForegroundServiceStartNotAllowedException and stop the service. Create a notification
// asking the user to tap it to restart the push service.
//
// See https://github.com/thunderbird/thunderbird-android/issues/7416
// This works around what seems to be a bug in at least Android 14.
// See https://github.com/thunderbird/thunderbird-android/issues/7416 for more details.
}
}
}
Expand Down

0 comments on commit 15ff901

Please sign in to comment.