From 17e32ee53693b4d1044b1ab443caa8bffa67fe21 Mon Sep 17 00:00:00 2001 From: Jorge Ruesga Date: Fri, 21 Dec 2012 23:33:12 +0100 Subject: PicoTTS: Set mNativeSynth prior to TextToSpeechService#onCreate The variable mNativeSynth is used by TextToSpeechService#onCreate so it must be set prior to that call. Otherwise, the method TextToSpeech#onIsLanguageAvailable will return TextToSpeech.ERROR because the synthesizer is not ready. AOSP Change: https://android-review.googlesource.com/#/c/42781 Change-Id: I86fbfa7d928e5206b8fe88ec209f6a54fee4ffa0 --- pico/compat/src/com/android/tts/compat/CompatTtsService.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/pico/compat/src/com/android/tts/compat/CompatTtsService.java b/pico/compat/src/com/android/tts/compat/CompatTtsService.java index 475afaf..dde706b 100755 --- a/pico/compat/src/com/android/tts/compat/CompatTtsService.java +++ b/pico/compat/src/com/android/tts/compat/CompatTtsService.java @@ -37,7 +37,6 @@ public abstract class CompatTtsService extends TextToSpeechService { @Override public void onCreate() { if (DBG) Log.d(TAG, "onCreate()"); - super.onCreate(); String soFilename = getSoFilename(); @@ -71,6 +70,13 @@ public abstract class CompatTtsService extends TextToSpeechService { c.close(); } mNativeSynth = new SynthProxy(soFilename, engineConfig); + + // mNativeSynth is used by TextToSpeechService#onCreate so it must be set prior + // to that call. + // getContentResolver() is also moved prior to super.onCreate(), and it works + // because the super method don't sets a field or value that affects getContentResolver(); + // (including the content resolver itself). + super.onCreate(); } @Override -- cgit v1.1