Simple-Music-Player icon indicating copy to clipboard operation
Simple-Music-Player copied to clipboard

Sleep Timer (and possibly all FINISH intents) leads to "non-graceful exits" (state is not saved)

Open Sayrus opened this issue 3 years ago • 0 comments

Description

When using Sleep Timer, the application exits without saving progress, current track and possibly more state related to what's currently playing. As far as I could tell, this seems to be related to the stopSelf call done after a FINISH intent.

This also lead to inconsistent application UI:

  • Set sleep timer to 5m
  • Lock
  • Wait until Sleep Timer is done
  • Unlock: the application looks like the song is playing. The main button is a Pause button (same for the widget on Android Launcher)
  • Leave the app (no need to force close), reopen: The track has been reset to the first track and the main button is now correctly a Play button

Steps to reproduce:

  • Set a sleep timer and start a playlist
  • Lock (Not sure about this one as my device auto lock after less than a sleep timer of time. I'll try to keep it awake)
  • Wait for sleep timer to expire

From there:

  • Headset buttons don't work anymore (probably the expected behavior since we are killing the service)
  • Widget reports that the song (last song that was playing before timet triggered) is playing
  • if App was opened, App reports the same
  • When reopening the application, Shuffle was reset, the current song is the first that was playing on last start (last save?), ...

I'm not sure Sleep Timer is the only way to trigger, I feel like I've triggered it during the day (aggressive memory management?) but I don't have concrete evidence or a reproductible process yet.

Version: 5.10.1 (reproduced on earlier versions too)

Sayrus avatar Apr 03 '22 23:04 Sayrus