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.
This commit is contained in:
@@ -80,6 +80,28 @@ public class TextToSpeech {
|
||||
public void onSpeechCompleted();
|
||||
}
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user