Don't restart playback when the headset is plugged in

This matches the behavior of other music players for Android.
This commit is contained in:
Christopher Eby 2010-02-19 20:38:33 -06:00
parent 429aa68350
commit 229f220eef

View File

@ -166,9 +166,10 @@ public class MusicPlayer implements Runnable, MediaPlayer.OnCompletionListener,
boolean plugged = message.arg1 == 1; boolean plugged = message.arg1 == 1;
if (plugged != mPlugged) { if (plugged != mPlugged) {
mPlugged = plugged; mPlugged = plugged;
if (mCurrentSong == -1 || mPlugged == mMediaPlayer.isPlaying()) if (mCurrentSong == -1)
return; return;
setPlaying(mPlugged); if (mMediaPlayer.isPlaying())
setPlaying(false);
} }
break; break;
case HEADSET_PREF_CHANGED: case HEADSET_PREF_CHANGED: