summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCharles Chen <clchen@google.com>2010-03-17 23:47:07 -0700
committerCharles Chen <clchen@google.com>2010-03-17 23:47:07 -0700
commit726a40bc503060b52064cb74c2a56f589e5fa2b4 (patch)
treedb830538278bfa9746204545705a60f1fbbb5206
parente4eb5bf243cb51b75b0717ebcd8c317a5b8fae8a (diff)
downloadframeworks_base-726a40bc503060b52064cb74c2a56f589e5fa2b4.zip
frameworks_base-726a40bc503060b52064cb74c2a56f589e5fa2b4.tar.gz
frameworks_base-726a40bc503060b52064cb74c2a56f589e5fa2b4.tar.bz2
Enabling plugin engines to pass in their engine specific settings
via a ContentProvider to the TtsService so that the TtsService can invoke their .so file with those settings. Change-Id: Icd0e966971c36ebb4da191a50cda96d6f4525df5
-rwxr-xr-xpackages/TtsService/src/android/tts/TtsService.java26
1 files changed, 20 insertions, 6 deletions
diff --git a/packages/TtsService/src/android/tts/TtsService.java b/packages/TtsService/src/android/tts/TtsService.java
index 2a3486f..0d2921e 100755
--- a/packages/TtsService/src/android/tts/TtsService.java
+++ b/packages/TtsService/src/android/tts/TtsService.java
@@ -24,6 +24,7 @@ import android.content.pm.ActivityInfo;
import android.content.pm.PackageManager;
import android.content.pm.PackageManager.NameNotFoundException;
import android.content.pm.ResolveInfo;
+import android.database.Cursor;
import android.media.AudioManager;
import android.media.MediaPlayer;
import android.media.MediaPlayer.OnCompletionListener;
@@ -164,11 +165,6 @@ public class TtsService extends Service implements OnCompletionListener {
currentSpeechEngineSOFile = "";
setEngine(getDefaultEngine());
- String soLibPath = "/system/lib/libttspico.so";
- if (sNativeSynth == null) {
- sNativeSynth = new SynthProxy(soLibPath, "");
- }
-
mSelf = this;
mIsSpeaking = false;
mSynthBusy = false;
@@ -269,7 +265,25 @@ public class TtsService extends Service implements OnCompletionListener {
sNativeSynth.shutdown();
sNativeSynth = null;
}
- sNativeSynth = new SynthProxy(soFilename, "");
+
+ // Load the engineConfig from the plugin if it has any special configuration
+ // to be loaded. By convention, if an engine wants the TTS framework to pass
+ // in any configuration, it must put it into its content provider which has the URI:
+ // content://<packageName>.providers.SettingsProvider
+ // That content provider must provide a Cursor which returns the String that
+ // is to be passed back to the native .so file for the plugin when getString(0) is
+ // called on it.
+ // Note that the TTS framework does not care what this String data is: it is something
+ // that comes from the engine plugin and is consumed only by the engine plugin itself.
+ String engineConfig = "";
+ Cursor c = getContentResolver().query(Uri.parse("content://" + enginePackageName
+ + ".providers.SettingsProvider"), null, null, null, null);
+ if (c != null){
+ c.moveToFirst();
+ engineConfig = c.getString(0);
+ c.close();
+ }
+ sNativeSynth = new SynthProxy(soFilename, engineConfig);
currentSpeechEngineSOFile = soFilename;
return TextToSpeech.SUCCESS;
}