fixes random ForegroundService crash#2818
Closed
AbhinandAK350 wants to merge 1 commit intoMetrolistGroup:mainfrom
Closed
fixes random ForegroundService crash#2818AbhinandAK350 wants to merge 1 commit intoMetrolistGroup:mainfrom
AbhinandAK350 wants to merge 1 commit intoMetrolistGroup:mainfrom
Conversation
Removes the conditional `startForegroundService` calls in widget receivers, simplifying them to just `startService`. This is safe because the service already calls `startForeground` itself when appropriate.
Collaborator
|
@AbhinandAK350 Build faied because of unresolved references, make sure the app builds next time before you create an PR and that your fix indeed works |
maximillions-dev
suggested changes
Feb 14, 2026
Contributor
maximillions-dev
left a comment
There was a problem hiding this comment.
@AbhinandAK350 Hey, thanks for looking into the ForegroundService crash — it's a real issue and the core idea of switching to startService in the widget receivers (since they already check MusicService.isRunning) is actually sound.
That said, I don't think we can merge this as-is. A few things:
- The build is broken. There are unresolved references because some
Player.*constants were unqualified without adding the corresponding static imports (e.g.STATE_ENDED,EVENT_MEDIA_ITEM_TRANSITION). Please always build before opening a PR. - There's a bug introduced. The
val previousShuffleEnabled = player.shuffleModeEnabledremoval left a bareplayer.shuffleModeEnabledexpression that does nothing. That line should just be deleted entirely. - Duplicate
isRunning = false.onDestroyalready setsisRunning = falseat the top — the PR adds a second one beforesuper.onDestroy(). Pick one spot, don't have both. - Too much scope creep. About half the diff is unrelated cleanup — FQN shortening, property access syntax for
shuffleOrder, unused destructuring, a lint suppression onMediaButtonReceiver. These aren't bad changes on their own, but they don't belong in a PR titled "fixes random ForegroundService crash". It makes it harder to review and harder to bisect if something breaks. - Commit message says "remove redundant receiver" but no receiver is removed.
The actual fix (3startForegroundService→startServiceswaps in the widget receivers) is like 6 lines. I'd suggest stripping this down to just that, making sure it builds, and resubmitting. The cleanup stuff can go in a separate PR if you want.
Contributor
Author
|
Sure |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Removes the conditional
startForegroundServicecalls in widget receivers, simplifying them to juststartService. This is safe because the service already callsstartForegrounditself when appropriate.