Rework media player management.

An attempt to sanitize the code, make it less racy (by
just locking everything), and correctly use setNextMediaPlayer()
without causing weird playback issues.
Don't use MediaPlayer::setNextMediaPlayer().

At least while I figure out why eventually playback
gets messed up. Also fix a few NPEs and restore the
pause on headset disconnect feature.
Use wake locks for the media player.

As recommended by (recently revised?) docs.