From 696e65a18ab894c427edc417688dacad113a39e3 Mon Sep 17 00:00:00 2001 From: Christopher Eby Date: Sun, 21 Mar 2010 17:43:32 -0500 Subject: [PATCH] Cancel the notification through updateState on service destruction The avoids a flicker to the paused notification if destroyed while playing --- src/org/kreed/vanilla/PlaybackService.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/org/kreed/vanilla/PlaybackService.java b/src/org/kreed/vanilla/PlaybackService.java index 91bd1dfc..b1bb25fc 100644 --- a/src/org/kreed/vanilla/PlaybackService.java +++ b/src/org/kreed/vanilla/PlaybackService.java @@ -179,6 +179,7 @@ public class PlaybackService extends Service implements Runnable, MediaPlayer.On saveState(true); if (mMediaPlayer != null) { + mSongTimeline = null; updateState(STATE_NORMAL); mMediaPlayer.release(); mMediaPlayer = null; @@ -189,7 +190,6 @@ public class PlaybackService extends Service implements Runnable, MediaPlayer.On } catch (IllegalArgumentException e) { // we haven't registered the receiver yet } - mNotificationManager.cancel(NOTIFICATION_ID); if (mWakeLock != null && mWakeLock.isHeld()) mWakeLock.release(); @@ -499,7 +499,7 @@ public class PlaybackService extends Service implements Runnable, MediaPlayer.On private boolean updateNotification(Song song) { - if (song == null || !mNotifyWhilePaused && mState == STATE_NORMAL) { + if (song == null || !mNotifyWhilePaused && mState == STATE_NORMAL || mState == STATE_NO_MEDIA) { if (mNotificationManager != null) mNotificationManager.cancel(NOTIFICATION_ID); return true;