question: private void reloadQueue ( ) { String q = null ; int id = mCardId ; if ( mPreferences . contains ( "cardid" ) ) { id = mPreferences . getInt ( "cardid" , ~ mCardId ) ; } if ( id == mCardId ) { q = mPreferences . getString ( "queue" , "" ) ; } int qlen = q != null ? q . length ( ) : 0 ; if ( qlen > 1 ) { int plen = 0 ; int n = 0 ; int shift = 0 ; for ( int i = 0 ; i < qlen ; i ++ ) { final char c = q . charAt ( i ) ; if ( c == ';' ) { ensurePlayListCapacity ( plen + 1 ) ; mPlayList [ plen ] = n ; plen ++ ; n = 0 ; shift = 0 ; } else { if ( c >= '0' && c <= '9' ) { n += c - '0' << shift ; } else if ( c >= 'a' && c <= 'f' ) { n += 10 + c - 'a' << shift ; } else { plen = 0 ; break ; } shift += 4 ; } } mPlayListLen = plen ; final int pos = mPreferences . getInt ( "curpos" , 0 ) ; if ( pos < 0 || pos >= mPlayListLen ) { mPlayListLen = 0 ; return ; } mPlayPos = pos ; updateCursor ( mPlayList [ mPlayPos ] ) ; if ( mCursor == null ) { SystemClock . sleep ( 3000 ) ; updateCursor ( mPlayList [ mPlayPos ] ) ; } synchronized ( this ) { closeCursor ( ) ; mOpenFailedCounter = 20 ; openCurrentAndNext ( ) ; } if ( mPlayer == null || ! mPlayer . isInitialized ( ) ) { mPlayListLen = 0 ; return ; } final long seekpos = mPreferences . getLong ( "seekpos" , 0 ) ; seek ( seekpos >= 0 && seekpos < duration ( ) ? seekpos : 0 ) ; if ( D ) { LOG . info ( "restored queue, currently at position " + position ( ) + "/" + duration ( ) + " (requested " + seekpos + ")" ) ; } int repmode = mPreferences . getInt ( "repeatmode" , REPEAT_NONE ) ; if ( repmode != REPEAT_ALL && repmode != REPEAT_CURRENT ) { repmode = REPEAT_NONE ; } mRepeatMode = repmode ; int shufmode = mPreferences . getInt ( "shufflemode" , SHUFFLE_NONE ) ; if ( shufmode != SHUFFLE_AUTO && shufmode != SHUFFLE_NORMAL ) { shufmode = SHUFFLE_NONE ; } if ( shufmode != SHUFFLE_NONE ) { q = mPreferences . getString ( "history" , "" ) ; qlen = q != null ? q . length ( ) : 0 ; if ( qlen > 1 ) { n = 0 ; shift = 0 ; mHistory . clear ( ) ; for ( int i = 0 ; i < qlen ; i ++ ) { final char c = q . charAt ( i ) ; if ( c == ';' ) { if ( n >= mPlayListLen ) { mHistory . clear ( ) ; break ; } mHistory . add ( n ) ; n = 0 ; shift = 0 ; } else { if ( c >= '0' && c <= '9' ) { n += c - '0' << shift ; } else if ( c >= 'a' && c <= 'f' ) { n += 10 + c - 'a' << shift ; } else { mHistory . clear ( ) ; break ; } shift += 4 ; } } } } if ( shufmode == SHUFFLE_AUTO ) { if ( ! makeAutoShuffleList ( ) ) { shufmode = SHUFFLE_NONE ; } } mShuffleMode = shufmode ; } }
target:  Reloads the queue as the user left it the last time they stopped using Apollo