Skip to content

Fix main-thread ANR from TTS getVoices() binder call#961

Open
davecraig wants to merge 1 commit into
Scottish-Tech-Army:v1.0from
davecraig:v1.0
Open

Fix main-thread ANR from TTS getVoices() binder call#961
davecraig wants to merge 1 commit into
Scottish-Tech-Army:v1.0from
davecraig:v1.0

Conversation

@davecraig

Copy link
Copy Markdown
Contributor

TextToSpeech.getVoices() makes a synchronous Binder IPC to the system TTS service, which can block for a long time on some OEM builds. It was being called from viewModelScope's default Main dispatcher, blocking the UI thread and triggering ANRs. Move it and getAvailableSpeechEngines() to Dispatchers.IO.

TextToSpeech.getVoices() makes a synchronous Binder IPC to the system
TTS service, which can block for a long time on some OEM builds. It
was being called from viewModelScope's default Main dispatcher,
blocking the UI thread and triggering ANRs. Move it and
getAvailableSpeechEngines() to Dispatchers.IO.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant