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.
diff --git a/core/java/android/speech/tts/TextToSpeech.java b/core/java/android/speech/tts/TextToSpeech.java
index 8f58194..9fc143d 100755
--- a/core/java/android/speech/tts/TextToSpeech.java
+++ b/core/java/android/speech/tts/TextToSpeech.java
@@ -81,6 +81,28 @@
}
/**
+ * 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 b50add6..e9c4ab7 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.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 @@
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 @@
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);
}