As of Android 5.0, TextToSpeech.setLanguage calls the new TextToSpeechService.onGetDefaultVoiceNameFor(lang,country,variant) and uses the specified voice name. The default Android 5.0 implementation of onGetDefaultVoiceNameFor does not work with eSpeak. This provides a working implementation. This fixes the TextToSpeechTest.testLanguages tests on Android 5.0.master
| @@ -201,7 +201,13 @@ public class TtsService extends TextToSpeechService { | |||
| @Override | |||
| public String onGetDefaultVoiceNameFor(String language, String country, String variant) { | |||
| return super.onGetDefaultVoiceNameFor(language, country, variant); | |||
| final int result = onLoadLanguage(language, country, variant); | |||
| switch (result) { | |||
| case TextToSpeech.LANG_MISSING_DATA: | |||
| case TextToSpeech.LANG_NOT_SUPPORTED: | |||
| return null; | |||
| } | |||
| return mMatchingVoice.name; | |||
| } | |||
| @Override | |||