From bd2492e14ee9db9139cc0ff0bd29fc9864b0126c Mon Sep 17 00:00:00 2001 From: Narayan Kamath Date: Mon, 27 Jun 2011 18:35:47 +0100 Subject: [PATCH] Expose the currently used engine to bundled apps. This is required to fix a couple of niggles and annoyances in the Settings app. Change-Id: I0ad0c41744282b552e844ba9a2157cea74c64234 --- core/java/android/speech/tts/TextToSpeech.java | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/core/java/android/speech/tts/TextToSpeech.java b/core/java/android/speech/tts/TextToSpeech.java index 5ee33e1679b8f..8e4725fbe7ec9 100755 --- a/core/java/android/speech/tts/TextToSpeech.java +++ b/core/java/android/speech/tts/TextToSpeech.java @@ -442,7 +442,7 @@ public class TextToSpeech { private final Map mUtterances; private final Bundle mParams = new Bundle(); private final TtsEngines mEnginesHelper; - private String mCurrentEngine = null; + private volatile String mCurrentEngine = null; /** * The constructor for the TextToSpeech class, using the default TTS engine. @@ -573,6 +573,7 @@ public class TextToSpeech { service.setCallback(getPackageName(), null); service.stop(getPackageName()); mServiceConnection.disconnect(); + mCurrentEngine = null; return null; } }, null, "shutdown"); @@ -868,6 +869,14 @@ public class TextToSpeech { return ERROR; } + /** + * @return the engine currently in use by this TextToSpeech instance. + * @hide + */ + public String getCurrentEngine() { + return mCurrentEngine; + } + /** * Sets the text-to-speech language. * The TTS engine will try to use the closest match to the specified