Set the TTS voice name for the default language.

This changes makes the initial, default language set and
the #setLanguage call with the default language as input
exactly the same.

Previously, the requests made after the initial default language
set were missing the name of the default voice.

+ Some tests clean-up. Some of them fail due to issues with
Locale#toLanguageTag upper-casing the variant field.

Change-Id: I5470617007fe45462b7198bf62a03eb5fe47a590
This commit is contained in:
Przemyslaw Szczepaniak
2014-08-05 11:49:32 +01:00
parent faa49bc896
commit fd80746bb9
2 changed files with 41 additions and 5 deletions

View File

@@ -2029,6 +2029,11 @@ public class TextToSpeech {
mParams.putString(Engine.KEY_PARAM_LANGUAGE, defaultLanguage[0]);
mParams.putString(Engine.KEY_PARAM_COUNTRY, defaultLanguage[1]);
mParams.putString(Engine.KEY_PARAM_VARIANT, defaultLanguage[2]);
// Get the default voice for the locale.
String defaultVoiceName = mService.getDefaultVoiceNameFor(
defaultLanguage[0], defaultLanguage[1], defaultLanguage[2]);
mParams.putString(Engine.KEY_PARAM_VOICE_NAME, defaultVoiceName);
}
Log.i(TAG, "Set up connection to " + mName);