Attempt to fix uncancelable sleep timers (#8154)

Try to disable the sleep timer in onDestroy too and disable the sleep timer as long as it's available, regardless of whether it's active or not.
This commit is contained in:
eblis
2025-12-14 12:21:13 +02:00
committed by GitHub
parent 41edc90c86
commit 0658ca2a2d

View File

@ -309,6 +309,7 @@ public class PlaybackService extends MediaBrowserServiceCompat {
public void onDestroy() {
super.onDestroy();
Log.d(TAG, "Service is about to be destroyed");
disableSleepTimer();
if (notificationBuilder.getPlayerStatus() == PlayerStatus.PLAYING) {
notificationBuilder.setPlayerStatus(PlayerStatus.STOPPED);
@ -1222,7 +1223,7 @@ public class PlaybackService extends MediaBrowserServiceCompat {
}
public void disableSleepTimer() {
if (sleepTimerActive()) {
if (sleepTimer != null) {
Log.d(TAG, "Disabling sleep timer");
sleepTimer.stop();
}