Fix shuffle state cycling

Prevent the addition from overflowing
This commit is contained in:
Christopher Eby 2011-10-11 02:11:16 -05:00
parent 557649d7e5
commit c09eadb951

View File

@ -681,8 +681,10 @@ public final class PlaybackService extends Service implements Handler.Callback,
public int cycleShuffle() public int cycleShuffle()
{ {
synchronized (mStateLock) { synchronized (mStateLock) {
int step = (mState & MASK_SHUFFLE) == 0x200 ? 0x200 : 0x100; int state = mState;
return updateState(mState + step); int step = (state & MASK_SHUFFLE) == 0x200 ? 0x200 : 0x100;
state = (state & ~MASK_SHUFFLE) | ((state + step) & MASK_SHUFFLE);
return updateState(state);
} }
} }