summaryrefslogtreecommitdiffstats
path: root/src/com/android/settings/tts
diff options
context:
space:
mode:
authorPrzemyslaw Szczepaniak <pszczepaniak@google.com>2012-12-14 14:50:45 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2012-12-14 07:26:39 -0800
commita7d2c93c2bb0e16542d22726576cfa7d8a823f3f (patch)
tree7bee1dbdffc9b31b00a3744ed411f6c4eceae16b /src/com/android/settings/tts
parent0cfbb7aabb644cbda30268bc750bf352d7585e55 (diff)
downloadpackages_apps_Settings-a7d2c93c2bb0e16542d22726576cfa7d8a823f3f.zip
packages_apps_Settings-a7d2c93c2bb0e16542d22726576cfa7d8a823f3f.tar.gz
packages_apps_Settings-a7d2c93c2bb0e16542d22726576cfa7d8a823f3f.tar.bz2
Fix for setting app not playing tts sample.
Bug: 7666482 Change-Id: I36a775312d62d3d7a5ee600b540a328b377b46c9
Diffstat (limited to 'src/com/android/settings/tts')
-rw-r--r--src/com/android/settings/tts/TextToSpeechSettings.java16
1 files changed, 10 insertions, 6 deletions
diff --git a/src/com/android/settings/tts/TextToSpeechSettings.java b/src/com/android/settings/tts/TextToSpeechSettings.java
index ab2ecc7..8f83bbc 100644
--- a/src/com/android/settings/tts/TextToSpeechSettings.java
+++ b/src/com/android/settings/tts/TextToSpeechSettings.java
@@ -214,7 +214,13 @@ public class TextToSpeechSettings extends SettingsPreferenceFragment implements
if (TextUtils.isEmpty(currentEngine)) currentEngine = mTts.getDefaultEngine();
- Locale currentLocale = mTts.getLanguage();
+
+ Locale defaultLocale = mTts.getDefaultLanguage();
+ if (defaultLocale == null) {
+ Log.e(TAG, "Failed to get default language from engine " + currentEngine);
+ return;
+ }
+ mTts.setLanguage(defaultLocale);
// TODO: This is currently a hidden private API. The intent extras
// and the intent action should be made public if we intend to make this
@@ -222,11 +228,9 @@ public class TextToSpeechSettings extends SettingsPreferenceFragment implements
// doesn't work.
Intent intent = new Intent(TextToSpeech.Engine.ACTION_GET_SAMPLE_TEXT);
- if (currentLocale != null) {
- intent.putExtra("language", currentLocale.getLanguage());
- intent.putExtra("country", currentLocale.getCountry());
- intent.putExtra("variant", currentLocale.getVariant());
- }
+ intent.putExtra("language", defaultLocale.getLanguage());
+ intent.putExtra("country", defaultLocale.getCountry());
+ intent.putExtra("variant", defaultLocale.getVariant());
intent.setPackage(currentEngine);
try {