[Bug] Background playback/autoplay fails during track transition on HyperOS (Fixed by locking app in Recents)
Describe the bug
When playing music with the app in the background, the current track finishes but the autoplay for the next track fails. The app essentially goes to sleep or is killed by the OS between tracks. This occurs even after overriding all OEM battery management systems (granting "Unrestricted" battery usage, enabling "Autostart", and enabling "Keep service alive" internally).
Crucial Finding: The issue completely disappears, and autoplay works seamlessly, ONLY if the app is explicitly "Locked" in the Recents (multitasking) menu.
Steps to reproduce
- Set SimpMusic Battery to "Unrestricted" and enable Autostart in HyperOS.
- Open SimpMusic Settings -> Playback -> Enable "Keep service alive".
- Start playing a playlist.
- Go to the home screen to background the app (do NOT lock the app in Recents).
- Wait for the current song to end.
- The next song will not autoplay.
Expected behavior
The background service should hold a persistent WakeLock/Foreground Service robust enough to buffer and autoplay the next track in the queue without needing to be manually locked in the device's RAM.
Device Information
- Device: Poco X6 Pro
- OS: HyperOS 2.0.207.0.VNRINXM/ Android 15 AQ3A.240912.001
- App Version: v1.1.1
Additional context
- Network connection is stable.
- Because the "Lock app in Recents" workaround fixes the issue, this strongly points to aggressive OEM task-killers terminating the app's background service during the exact moment of the track transition.
- Logcat of the track transition failure is attached.
Logs
Click to expand logcat output
03-24 20:19:32.764 D MediaSessionService: onSessionPlaybackStateChanged: record=com.maxrave.simpmusic... playbackState=PlaybackState {state=STOPPED(1), position=200799, buffered position=200772, speed=0.0}
03-24 20:19:32.788 I ActivityManager: Cancel FGS notification userId: 0 definingUid: 10553 packageName: com.maxrave.simpmusic processName:com.maxrave.simpmusic ChannelId:media_playback_channel
03-24 20:19:32.814 D MediaSessionService: onSessionPlaybackStateChanged: record=com.maxrave.simpmusic... playbackState=PlaybackState {state=PAUSED(2), position=0, buffered position=172921, speed=0.0}
03-24 20:19:35.301 W ActivityManager: pid 2644 system sent binder code 31101 with flags 0 to frozen apps and got error -74
03-24 20:19:35.314 W ActivityManager: pid 2644 system sent binder code 31101 with flags 0 to frozen apps and got error -74
03-24 20:19:35.331 W ActivityManager: pid 2644 system sent binder code 31101 with flags 0 to frozen apps and got error -74
03-24 20:19:35.334 W ActivityManager: pid 2644 system sent binder code 31101 with flags 0 to frozen apps and got error -74
03-24 20:19:35.335 W ActivityManager: pid 2644 system sent binder code 31101 with flags 0 to frozen apps and got error -74
Key Observation from Logs
From the captured logcat:
- Playback reaches STOPPED/PAUSED state normally
- Immediately after, the system cancels the foreground service notification
- Within ~2–3 seconds, the system starts interacting with the app as a "frozen" process (binder errors)
Interpretation
- It looks like the foreground service is being stopped right after the track ends, which creates a short window where the app is no longer protected as a foreground process.
- During this gap, HyperOS aggressively freezes the app, preventing it from executing the logic required to start the next track.
- This explains why autoplay works when the app is locked in Recents (i.e., protected from freezing).
Fixed — same root cause as #2022 (foreground service dropped between tracks since v1.0.4). Please update to the latest version. Reopen with logs if it still happens.