private int mServiceStartId = -1;
private boolean mServiceInUse = false;
private boolean mResumeAfterCall = false;
- private boolean mWasPlaying = false;
+ private boolean mIsSupposedToBePlaying = false;
private boolean mQuietMode = false;
private SharedPreferences mPreferences;
}
break;
case SERVER_DIED:
- if (mWasPlaying) {
+ if (mIsSupposedToBePlaying) {
next(true);
} else {
// the server died when we were idle, so just
next(false);
} else {
notifyChange(PLAYBACK_COMPLETE);
+ mIsSupposedToBePlaying = false;
}
break;
case RELEASE_WAKELOCK:
status.contentIntent = PendingIntent.getActivity(this, 0,
new Intent("com.android.music.PLAYBACK_VIEWER"), 0);
nm.notify(PLAYBACKSERVICE_STATUS, status);
- if (!mWasPlaying) {
+ if (!mIsSupposedToBePlaying) {
notifyChange(PLAYSTATE_CHANGED);
}
- mWasPlaying = true;
+ mIsSupposedToBePlaying = true;
} else if (mPlayListLen <= 0) {
// This is mostly so that if you press 'play' on a bluetooth headset
// without every having played anything before, it will still play
}
setForeground(false);
if (remove_status_icon) {
- mWasPlaying = false;
+ mIsSupposedToBePlaying = false;
}
}
mPlayer.pause();
gotoIdleState();
setForeground(false);
- mWasPlaying = false;
+ mIsSupposedToBePlaying = false;
notifyChange(PLAYSTATE_CHANGED);
saveBookmarkIfNeeded();
}
* @return true if playback is paused, false if not
*/
public boolean isPlaying() {
- if (mPlayer.isInitialized()) {
- return mPlayer.isPlaying();
- }
- return false;
+ return mIsSupposedToBePlaying;
}
/*
// all done
gotoIdleState();
notifyChange(PLAYBACK_COMPLETE);
+ mIsSupposedToBePlaying = false;
return;
} else if (mRepeatMode == REPEAT_ALL || force) {
mPlayPos = 0;
mMediaPlayer.pause();
}
- public boolean isPlaying() {
- return mMediaPlayer.isPlaying();
- }
-
public void setHandler(Handler handler) {
mHandler = handler;
}