diff options
| author | 2009-06-18 15:07:00 -0700 | |
|---|---|---|
| committer | 2009-06-18 15:07:00 -0700 | |
| commit | 7153739a92dda971fd865defae0747bec921d8af (patch) | |
| tree | dfde4bbb137462a9e551c233b8821fe108fcaf22 | |
| parent | 8696d7030af6f0d58859f1027c423143b67f9fb4 (diff) | |
| parent | d146874d7341bc9602c93719582b4209e7b81f01 (diff) | |
Merge change 4661 into donut
* changes:
Grouping under TextToSpeech.Engine the constants to be used by a TTS engine implementation or a settings application for default values, and data integrity check return codes.
| -rwxr-xr-x | core/java/android/speech/tts/TextToSpeech.java | 22 | ||||
| -rwxr-xr-x | packages/TtsService/src/android/tts/TtsService.java | 16 |
2 files changed, 29 insertions, 9 deletions
diff --git a/core/java/android/speech/tts/TextToSpeech.java b/core/java/android/speech/tts/TextToSpeech.java index 8f581940da26..9fc143d6c19e 100755 --- a/core/java/android/speech/tts/TextToSpeech.java +++ b/core/java/android/speech/tts/TextToSpeech.java @@ -81,6 +81,28 @@ public class TextToSpeech { } /** + * Internal constants for the TTS functionality + * + * {@hide} + */ + public class Engine { + // default values for a TTS engine when settings are not found in the provider + public static final int FALLBACK_TTS_DEFAULT_RATE = 100; // 1x + public static final int FALLBACK_TTS_DEFAULT_PITCH = 100;// 1x + public static final int FALLBACK_TTS_USE_DEFAULTS = 0; // false + public static final String FALLBACK_TTS_DEFAULT_LANG = "eng"; + public static final String FALLBACK_TTS_DEFAULT_COUNTRY = ""; + public static final String FALLBACK_TTS_DEFAULT_VARIANT = ""; + + // return codes for a TTS engine's check data activity + public static final int CHECK_VOICE_DATA_PASS = 1; + public static final int CHECK_VOICE_DATA_FAIL = 0; + public static final int CHECK_VOICE_DATA_BAD_DATA = -1; + public static final int CHECK_VOICE_DATA_MISSING_DATA = -2; + public static final int CHECK_VOICE_DATA_MISSING_DATA_NO_SDCARD = -3; + } + + /** * Connection needed for the TTS. */ private ServiceConnection mServiceConnection; diff --git a/packages/TtsService/src/android/tts/TtsService.java b/packages/TtsService/src/android/tts/TtsService.java index b50add62cfc9..e9c4ab74d27f 100755 --- a/packages/TtsService/src/android/tts/TtsService.java +++ b/packages/TtsService/src/android/tts/TtsService.java @@ -15,9 +15,6 @@ */ package android.tts; -import android.speech.tts.ITts.Stub; -import android.speech.tts.ITtsCallback; - import android.app.Service; import android.content.ContentResolver; import android.content.Context; @@ -32,6 +29,9 @@ import android.os.IBinder; import android.os.RemoteCallbackList; import android.os.RemoteException; import android.preference.PreferenceManager; +import android.speech.tts.ITts.Stub; +import android.speech.tts.ITtsCallback; +import android.speech.tts.TextToSpeech; import android.util.Log; import java.util.ArrayList; import java.util.Arrays; @@ -93,10 +93,6 @@ public class TtsService extends Service implements OnCompletionListener { private static final String CATEGORY = "android.intent.category.TTS"; private static final String PKGNAME = "android.tts"; - private static final int FALLBACK_TTS_DEFAULT_RATE = 100; // 1x - private static final int FALLBACK_TTS_DEFAULT_PITCH = 100;// 1x - private static final int FALLBACK_TTS_USE_DEFAULTS = 0; - final RemoteCallbackList<android.speech.tts.ITtsCallback> mCallbacks = new RemoteCallbackList<ITtsCallback>(); private Boolean mIsSpeaking; @@ -162,14 +158,16 @@ public class TtsService extends Service implements OnCompletionListener { private boolean isDefaultEnforced() { return (android.provider.Settings.Secure.getInt(mResolver, - android.provider.Settings.Secure.TTS_USE_DEFAULTS, FALLBACK_TTS_USE_DEFAULTS) + android.provider.Settings.Secure.TTS_USE_DEFAULTS, + TextToSpeech.Engine.FALLBACK_TTS_USE_DEFAULTS) == 1 ); } private int getDefaultRate() { return android.provider.Settings.Secure.getInt(mResolver, - android.provider.Settings.Secure.TTS_DEFAULT_RATE, FALLBACK_TTS_DEFAULT_RATE); + android.provider.Settings.Secure.TTS_DEFAULT_RATE, + TextToSpeech.Engine.FALLBACK_TTS_DEFAULT_RATE); } |