Fix for bug #2577984 - Settings app was trying to access the TTS
before the TTS was ready. Change-Id: Ic8127f12a2608982fb35e126c7522cf6747b93ac
This commit is contained in:
@@ -99,6 +99,7 @@ public class TextToSpeechSettings extends PreferenceActivity implements
|
|||||||
private boolean mVoicesMissing = false;
|
private boolean mVoicesMissing = false;
|
||||||
|
|
||||||
private TextToSpeech mTts = null;
|
private TextToSpeech mTts = null;
|
||||||
|
private boolean mTtsStarted = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Request code (arbitrary value) for voice data check through
|
* Request code (arbitrary value) for voice data check through
|
||||||
@@ -120,8 +121,7 @@ public class TextToSpeechSettings extends PreferenceActivity implements
|
|||||||
setVolumeControlStream(TextToSpeech.Engine.DEFAULT_STREAM);
|
setVolumeControlStream(TextToSpeech.Engine.DEFAULT_STREAM);
|
||||||
|
|
||||||
mEnableDemo = false;
|
mEnableDemo = false;
|
||||||
initClickers();
|
mTtsStarted = false;
|
||||||
initDefaultSettings();
|
|
||||||
|
|
||||||
mTts = new TextToSpeech(this, this);
|
mTts = new TextToSpeech(this, this);
|
||||||
}
|
}
|
||||||
@@ -130,12 +130,14 @@ public class TextToSpeechSettings extends PreferenceActivity implements
|
|||||||
@Override
|
@Override
|
||||||
protected void onStart() {
|
protected void onStart() {
|
||||||
super.onStart();
|
super.onStart();
|
||||||
// whenever we return to this screen, we don't know the state of the
|
if (mTtsStarted){
|
||||||
// system, so we have to recheck that we can play the demo, or it must be disabled.
|
// whenever we return to this screen, we don't know the state of the
|
||||||
// TODO make the TTS service listen to "changes in the system", i.e. sd card un/mount
|
// system, so we have to recheck that we can play the demo, or it must be disabled.
|
||||||
initClickers();
|
// TODO make the TTS service listen to "changes in the system", i.e. sd card un/mount
|
||||||
updateWidgetState();
|
initClickers();
|
||||||
checkVoiceData();
|
updateWidgetState();
|
||||||
|
checkVoiceData();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -327,7 +329,6 @@ public class TextToSpeechSettings extends PreferenceActivity implements
|
|||||||
*/
|
*/
|
||||||
public void onInit(int status) {
|
public void onInit(int status) {
|
||||||
if (status == TextToSpeech.SUCCESS) {
|
if (status == TextToSpeech.SUCCESS) {
|
||||||
Log.v(TAG, "TTS engine for settings screen initialized.");
|
|
||||||
mEnableDemo = true;
|
mEnableDemo = true;
|
||||||
if (mDefaultLanguage == null) {
|
if (mDefaultLanguage == null) {
|
||||||
mDefaultLanguage = Locale.getDefault().getISO3Language();
|
mDefaultLanguage = Locale.getDefault().getISO3Language();
|
||||||
@@ -340,6 +341,12 @@ public class TextToSpeechSettings extends PreferenceActivity implements
|
|||||||
}
|
}
|
||||||
mTts.setLanguage(new Locale(mDefaultLanguage, mDefaultCountry, mDefaultLocVariant));
|
mTts.setLanguage(new Locale(mDefaultLanguage, mDefaultCountry, mDefaultLocVariant));
|
||||||
mTts.setSpeechRate((float)(mDefaultRate/100.0f));
|
mTts.setSpeechRate((float)(mDefaultRate/100.0f));
|
||||||
|
initDefaultSettings();
|
||||||
|
initClickers();
|
||||||
|
updateWidgetState();
|
||||||
|
checkVoiceData();
|
||||||
|
mTtsStarted = true;
|
||||||
|
Log.v(TAG, "TTS engine for settings screen initialized.");
|
||||||
} else {
|
} else {
|
||||||
Log.v(TAG, "TTS engine for settings screen failed to initialize successfully.");
|
Log.v(TAG, "TTS engine for settings screen failed to initialize successfully.");
|
||||||
mEnableDemo = false;
|
mEnableDemo = false;
|
||||||
|
Reference in New Issue
Block a user