maxrave-dev / maxrave-dev/SimpMusic
Service killed on pause — notification restarts, headphone resume broken (TECNO / Samsung)
Nobody has claimed this yet.
- Dominant language
- Kotlin
- Stars
- 11.4k
- Forks
- 599
- Avg merge
- 3d 18h
- Merged PRs (30d)
- 7
Description
Duplicate Check
- I confirm I searched for existing reports and found no duplicates.
Describe the Bug
When a song is paused and the app goes to the background, the
SimpleMediaService is killed by the OS on devices with aggressive
battery management (TECNO Spark 20 and Samsung Galaxy A02). The
playback notification disappears and reappears as if the service
restarted from scratch. After this, headphone controls can pause
the song but cannot resume it.
The same steps on a Xiaomi Redmi 10C (MIUI 13) do not reproduce
the issue — the service survives in paused state normally.
Technical note: Through static code analysis, the root cause
appears to be that MediaSessionService (Media3) drops its
foreground status when the player is paused, while simultaneously
MainActivity.onStop() unbinds from the service. This leaves the
service with no foreground claim and no bound clients — a
combination that aggressive OEMs (TECNO HiOS, Samsung One UI Core
on low-end hardware) treat as a dead process and kill within
seconds. MIUI handles media services with an active MediaSession
specially, which explains why Xiaomi devices are unaffected.
The AndroidManifest.xml correctly declares stopWithTask="false",
foregroundServiceType="mediaPlayback", and WAKE_LOCK permission.
The issue is in runtime foreground state management during pause,
likely inside SimpleMediaService (media3 submodule).
Note: root cause analysis was assisted by static code analysis
using Claude (Anthropic AI). The bug was reproduced firsthand on
the listed devices.
Steps to Reproduce
- Open SimpMusic and play any song.
- Pause the song using the in-app controls.
- Press the Home button to send the app to the background.
- Wait approximately 5–10 seconds.
- Attempt to resume using the headphone button or the
notification controls.
Expected Behavior
The song resumes from the exact position where it was paused,
as it does on Xiaomi Redmi 10C with the same steps.
App Version
1.3.0
Android Version
TECNO Spark 20: Android 13 (HiOS) Samsung Galaxy A02: Android 11 (One UI Core 3.1) (Not reproduced on: Xiaomi Redmi 10C, Android 12, MIUI 13)
Device Model
TECNO Spark 20 / Samsung Galaxy A02
Custom ROM
- I am using a custom ROM
Custom ROM Name (if applicable)
No response
Screenshots (optional)
https://github.com/user-attachments/assets/b9b5e2f5-5f0e-4a47-8d47-c307ff001114
Log / Error Details
No crash log available — the app does not crash. The service
is killed silently by the OS. The only observable evidence is
the notification disappearing and reappearing, and the loss of
playback state.
Workaround that resolves the issue completely:
Settings → Apps → SimpMusic → Battery → Unrestricted
(on Samsung: Device Care → Battery → Never sleeping apps)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by inspecting SimpleMediaService in the media3 submodule, focusing on its runtime foreground state during pause, then review MainActivity.onStop() and the relevant AndroidManifest.xml declarations. Reproduce the pause/background flow on the TECNO Spark 20 or Samsung Galaxy A02 and verify that the notification persists and headphone or notification controls resume playback from the paused position.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- android, kotlin
- Domain
- mobile
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100