Android: checkpoint the applied pause position, fixing the flaky isolation test (#86) #22
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
backmeupplz/absplus!22
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/86-flaky-checkpoint-assert"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Fixes agentboard #86 (https://agentboard.icefish-betta.ts.net/#86).
Cause
AccountPlayerIsolationTest.expiredSession…flaked at the checkpoint assertion (CI run on PR #20). ExoPlayer firesonIsPlayingChanged(false)synchronously from its masked state. If the app looper hasn't yet received the playback thread's update afterplay(), that masked state still holds the seek position (350 ms) while the playback thread has already rendered to 400 ms. The pause checkpoint then stores 0.35, and once the pause is applied the player reports 0.40 with no further callback. Locally the original test failed 8 of 51 iterations under CPU load with exactlyatPause=0.35 stored=0.35 settled=0.4.Fix
PlayerService.progressListener: keep the immediate pause checkpoint, then send an ExoPlayerPlayerMessagethat is delivered on the app looper after the playback thread has applied the pause (its state update is posted to the app looper before the message). If the player is still paused and not ended, it checkpoints again, so the stored position matches the position playback actually stopped at.sync's existing scope and media-id guards still apply.drainUntil { player.isPlaying }withassertTrue(player.isPlaying)so the app looper does not idle betweenplay()andpause(). This forces the stale-mask ordering every time instead of in about 15% of runs. The assertions are unchanged.Verification
expected:<0.4> but was:<0.35>) and the fix passes 30/30../gradlew testDebugUnitTestlocally (JDK 27 compile, JDK 17 test runtime): every test passes except 23ProgressSyncTestcases. Those fail only becauseHttpClientisn'tAutoCloseableon JDK 17 (the local runtime). CI uses JDK 21.