fix(android-auto): resolve playlist freeze and playback delay#4060
fix(android-auto): resolve playlist freeze and playback delay#4060kairosci wants to merge 1 commit into
Conversation
…leting unfinished futures and moving IO off main thread
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughMediaLibrarySessionCallback now returns an immediate empty ChangesPlayback callback updates
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Suggested reviewers
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
@akash-banjade could you try this and verify whether this solves your issue? Thanks |
|
HI @kairosci, thanks now the app is responding as expected. Thank you very much |
|
@mostafaalagamy could you take a look? thanks! |
Problem
Android Auto playlist view freezes with infinite loading spinner and song playback is significantly delayed with incomplete metadata.
Cause
onPlaybackResumptioninMediaLibrarySessionCallbackreturned aSettableFuturethat was never resolved. When Android Auto connected and called this callback, the future blocked the entire media session pipeline indefinitely. All subsequent browsing and playback commands from the car UI were queued behind this hung future, causing both the playlist freeze and playback delay. Additionally,onSetMediaItemsdispatched database queries onDispatchers.Maininstead ofDispatchers.IO, blocking the main thread during song selection and compounding the playback delay.Solution
Replaced the never-completing
SettableFutureinonPlaybackResumptionwithFutures.immediateFuture(emptyList())so the callback completes instantly and unblocks the session. Added explicitDispatchers.IOtoonSetMediaItemsto move database work off the main thread, consistent with howonGetChildrenalready runs.Testing
Built successfully with
assembleFossDebug, no warnings or errors introduced. The fix is a minimal two-line change with no new dependencies or side effects.Related Issues
Closes #4055
Summary by CodeRabbit