- PlaybackService: the pauseOnHeadphoneDisconnect settings-watcher collector
ran on globalScope (Dispatchers.IO) and called setHandleAudioBecomingNoisy
on the ExoPlayer, which is thread-affine to the Main thread it was built on
→ latent IllegalStateException('Player accessed on the wrong thread') that
fires every service start (the StateFlow emits on first subscription). Run
the collector on Dispatchers.Main (mirrors resumePollJob).
- SearchViewModel: recordSearch (json-encode + SharedPrefs write) was on Main;
wrap in withContext(Dispatchers.IO).
Both adversarially verified in the multi-agent perf audit (pass 2).
|
||
|---|---|---|
| .. | ||
| src/main/kotlin | ||
| build.gradle.kts | ||