Relex callback barrier

The PlaybackService will notify GUI elements about state changes.
However: These callbacks are async and the gui may already have updated its own state, so the code checks
for 'old' RPCs. This fails on fast devices, where click -> service -> state-change -> callback takes less than 1ms

The new code relexes this and accepts messages with the same timestamp
This commit is contained in:
Adrian Ulrich 2015-11-04 13:04:12 +01:00
parent d42bd1c252
commit 37527e17cc

View File

@ -257,7 +257,7 @@ public abstract class PlaybackActivity extends Activity
*/ */
public void setState(long uptime, int state) public void setState(long uptime, int state)
{ {
if (uptime > mLastStateEvent) if (uptime >= mLastStateEvent)
setState(state); setState(state);
} }
@ -311,7 +311,7 @@ public abstract class PlaybackActivity extends Activity
*/ */
public void setSong(long uptime, Song song) public void setSong(long uptime, Song song)
{ {
if (uptime > mLastSongEvent) if (uptime >= mLastSongEvent)
setSong(song); setSong(song);
} }