diff options
author | Charles Chen <clchen@google.com> | 2010-04-07 14:26:31 -0700 |
---|---|---|
committer | Charles Chen <clchen@google.com> | 2010-04-07 14:26:31 -0700 |
commit | cf31e652d68ac607cabe4ba5aca1f17b175731eb (patch) | |
tree | f35a56bf60ccd6c02dc35a35362066e590a83964 | |
parent | 473111bcfca1342fdbd74af10189931a386c8f24 (diff) | |
download | packages_apps_settings-cf31e652d68ac607cabe4ba5aca1f17b175731eb.zip packages_apps_settings-cf31e652d68ac607cabe4ba5aca1f17b175731eb.tar.gz packages_apps_settings-cf31e652d68ac607cabe4ba5aca1f17b175731eb.tar.bz2 |
Fix for bug #2577984 - Settings app was trying to access the TTS
before the TTS was ready.
Change-Id: Ic8127f12a2608982fb35e126c7522cf6747b93ac
-rw-r--r-- | src/com/android/settings/TextToSpeechSettings.java | 25 |
1 files changed, 16 insertions, 9 deletions
diff --git a/src/com/android/settings/TextToSpeechSettings.java b/src/com/android/settings/TextToSpeechSettings.java index fa9ea58..5366bd0 100644 --- a/src/com/android/settings/TextToSpeechSettings.java +++ b/src/com/android/settings/TextToSpeechSettings.java @@ -99,6 +99,7 @@ public class TextToSpeechSettings extends PreferenceActivity implements private boolean mVoicesMissing = false; private TextToSpeech mTts = null; + private boolean mTtsStarted = false; /** * Request code (arbitrary value) for voice data check through @@ -120,8 +121,7 @@ public class TextToSpeechSettings extends PreferenceActivity implements setVolumeControlStream(TextToSpeech.Engine.DEFAULT_STREAM); mEnableDemo = false; - initClickers(); - initDefaultSettings(); + mTtsStarted = false; mTts = new TextToSpeech(this, this); } @@ -130,12 +130,14 @@ public class TextToSpeechSettings extends PreferenceActivity implements @Override protected void onStart() { super.onStart(); - // whenever we return to this screen, we don't know the state of the - // system, so we have to recheck that we can play the demo, or it must be disabled. - // TODO make the TTS service listen to "changes in the system", i.e. sd card un/mount - initClickers(); - updateWidgetState(); - checkVoiceData(); + if (mTtsStarted){ + // whenever we return to this screen, we don't know the state of the + // system, so we have to recheck that we can play the demo, or it must be disabled. + // TODO make the TTS service listen to "changes in the system", i.e. sd card un/mount + initClickers(); + updateWidgetState(); + checkVoiceData(); + } } @@ -327,7 +329,6 @@ public class TextToSpeechSettings extends PreferenceActivity implements */ public void onInit(int status) { if (status == TextToSpeech.SUCCESS) { - Log.v(TAG, "TTS engine for settings screen initialized."); mEnableDemo = true; if (mDefaultLanguage == null) { mDefaultLanguage = Locale.getDefault().getISO3Language(); @@ -340,6 +341,12 @@ public class TextToSpeechSettings extends PreferenceActivity implements } mTts.setLanguage(new Locale(mDefaultLanguage, mDefaultCountry, mDefaultLocVariant)); mTts.setSpeechRate((float)(mDefaultRate/100.0f)); + initDefaultSettings(); + initClickers(); + updateWidgetState(); + checkVoiceData(); + mTtsStarted = true; + Log.v(TAG, "TTS engine for settings screen initialized."); } else { Log.v(TAG, "TTS engine for settings screen failed to initialize successfully."); mEnableDemo = false; |