private void openCurrentAndMaybeNext(final boolean openNext){
  LOG.info("openCurrentAndMaybeNext() waiting for synchronized(this)");
synchronized (this) {
    LOG.info("openCurrentAndMaybeNext() DONE waiting for synchronized(this)\n");
    closeCursor();
    if (mPlayListLen == 0 || mPlayList == null) {
      return;
    }
    stop(false);
    mPlayPos=Math.min(mPlayPos,mPlayList.length - 1);
    updateCursor(mPlayList[mPlayPos]);
    while (true) {
      if (mCursor != null && !mCursor.isClosed() && openFile(MediaStore.Audio.Media.EXTERNAL_CONTENT_URI + "/" + mCursor.getLong(IDCOLIDX))) {
        break;
      }
      closeCursor();
      if (mOpenFailedCounter++ < 10 && mPlayListLen > 1) {
        final int pos=getNextPosition(false);
        if (scheduleShutdownAndNotifyPlayStateChange(pos))         return;
        mPlayPos=pos;
        stop(false);
        mPlayPos=pos;
        updateCursor(mPlayList[mPlayPos]);
      }
 else {
        mOpenFailedCounter=0;
        LOG.warn("Failed to open file for playback");
        scheduleDelayedShutdown();
        if (mIsSupposedToBePlaying) {
          mIsSupposedToBePlaying=false;
          notifyChange(PLAYSTATE_CHANGED);
        }
        return;
      }
    }
    if (openNext) {
      setNextTrack();
    }
  }
}

private void openCurrentAndMaybeNext ( final boolean openNext ) { LOG . info ( "openCurrentAndMaybeNext() waiting for synchronized(this)" ) ; synchronized ( this ) { LOG . info ( "openCurrentAndMaybeNext() DONE waiting for synchronized(this)\n" ) ; closeCursor ( ) ; if ( mPlayListLen == 0 || mPlayList == null ) { return ; } stop ( false ) ; mPlayPos = Math . min ( mPlayPos , mPlayList . length - 1 ) ; updateCursor ( mPlayList [ mPlayPos ] ) ; while ( true ) { if ( mCursor != null && ! mCursor . isClosed ( ) && openFile ( MediaStore . Audio . Media . EXTERNAL_CONTENT_URI + "/" + mCursor . getLong ( IDCOLIDX ) ) ) { break ; } closeCursor ( ) ; if ( mOpenFailedCounter ++ < 10 && mPlayListLen > 1 ) { final int pos = getNextPosition ( false ) ; if ( scheduleShutdownAndNotifyPlayStateChange ( pos ) ) return ; mPlayPos = pos ; stop ( false ) ; mPlayPos = pos ; updateCursor ( mPlayList [ mPlayPos ] ) ; } else { mOpenFailedCounter = 0 ; LOG . warn ( "Failed to open file for playback" ) ; scheduleDelayedShutdown ( ) ; if ( mIsSupposedToBePlaying ) { mIsSupposedToBePlaying = false ; notifyChange ( PLAYSTATE_CHANGED ) ; } return ; } } if ( openNext ) { setNextTrack ( ) ; } } }
called to open a new file as the current track and prepare the next for playback
