Loading api/current.xml +53 −53 Original line number Diff line number Diff line Loading @@ -35725,39 +35725,6 @@ visibility="public" > </field> <field name="ACTION_TTS_CHECK_TTS_DATA" type="java.lang.String" transient="false" volatile="false" value=""android.intent.action.CHECK_TTS_DATA"" static="true" final="true" deprecated="not deprecated" visibility="public" > </field> <field name="ACTION_TTS_INSTALL_TTS_DATA" type="java.lang.String" transient="false" volatile="false" value=""android.intent.action.INSTALL_TTS_DATA"" static="true" final="true" deprecated="not deprecated" visibility="public" > </field> <field name="ACTION_TTS_QUEUE_PROCESSING_COMPLETED" type="java.lang.String" transient="false" volatile="false" value=""android.intent.action.TTS_QUEUE_PROCESSING_COMPLETED"" static="true" final="true" deprecated="not deprecated" visibility="public" > </field> <field name="ACTION_UID_REMOVED" type="java.lang.String" transient="false" Loading Loading @@ -116289,7 +116256,18 @@ <parameter name="filename" type="java.lang.String"> </parameter> </method> <field name="TTS_ERROR" <field name="ACTION_TTS_QUEUE_PROCESSING_COMPLETED" type="java.lang.String" transient="false" volatile="false" value=""android.speech.tts.TTS_QUEUE_PROCESSING_COMPLETED"" static="true" final="true" deprecated="not deprecated" visibility="public" > </field> <field name="ERROR" type="int" transient="false" volatile="false" Loading @@ -116300,7 +116278,7 @@ visibility="public" > </field> <field name="TTS_LANG_AVAILABLE" <field name="LANG_AVAILABLE" type="int" transient="false" volatile="false" Loading @@ -116311,7 +116289,7 @@ visibility="public" > </field> <field name="TTS_LANG_COUNTRY_AVAILABLE" <field name="LANG_COUNTRY_AVAILABLE" type="int" transient="false" volatile="false" Loading @@ -116322,7 +116300,7 @@ visibility="public" > </field> <field name="TTS_LANG_COUNTRY_VAR_AVAILABLE" <field name="LANG_COUNTRY_VAR_AVAILABLE" type="int" transient="false" volatile="false" Loading @@ -116333,7 +116311,7 @@ visibility="public" > </field> <field name="TTS_LANG_MISSING_DATA" <field name="LANG_MISSING_DATA" type="int" transient="false" volatile="false" Loading @@ -116344,7 +116322,7 @@ visibility="public" > </field> <field name="TTS_LANG_NOT_SUPPORTED" <field name="LANG_NOT_SUPPORTED" type="int" transient="false" volatile="false" Loading @@ -116355,7 +116333,7 @@ visibility="public" > </field> <field name="TTS_QUEUE_ADD" <field name="QUEUE_ADD" type="int" transient="false" volatile="false" Loading @@ -116366,7 +116344,7 @@ visibility="public" > </field> <field name="TTS_QUEUE_FLUSH" <field name="QUEUE_FLUSH" type="int" transient="false" volatile="false" Loading @@ -116377,7 +116355,7 @@ visibility="public" > </field> <field name="TTS_SUCCESS" <field name="SUCCESS" type="int" transient="false" volatile="false" Loading Loading @@ -116405,6 +116383,28 @@ visibility="public" > </constructor> <field name="ACTION_CHECK_TTS_DATA" type="java.lang.String" transient="false" volatile="false" value=""android.speech.tts.engine.CHECK_TTS_DATA"" static="true" final="true" deprecated="not deprecated" visibility="public" > </field> <field name="ACTION_INSTALL_TTS_DATA" type="java.lang.String" transient="false" volatile="false" value=""android.speech.tts.engine.INSTALL_TTS_DATA"" static="true" final="true" deprecated="not deprecated" visibility="public" > </field> <field name="CHECK_VOICE_DATA_BAD_DATA" type="int" transient="false" Loading Loading @@ -116460,7 +116460,7 @@ visibility="public" > </field> <field name="TTS_DEFAULT_STREAM" <field name="DEFAULT_STREAM" type="int" transient="false" volatile="false" Loading @@ -116471,55 +116471,55 @@ visibility="public" > </field> <field name="TTS_KEY_PARAM_STREAM" <field name="EXTRA_VOICE_DATA_FILES" type="java.lang.String" transient="false" volatile="false" value=""streamType"" value=""dataFiles"" static="true" final="true" deprecated="not deprecated" visibility="public" > </field> <field name="TTS_KEY_PARAM_UTTERANCE_ID" <field name="EXTRA_VOICE_DATA_FILES_INFO" type="java.lang.String" transient="false" volatile="false" value=""utteranceId"" value=""dataFilesInfo"" static="true" final="true" deprecated="not deprecated" visibility="public" > </field> <field name="VOICE_DATA_FILES" <field name="EXTRA_VOICE_DATA_ROOT_DIRECTORY" type="java.lang.String" transient="false" volatile="false" value=""dataFiles"" value=""dataRoot"" static="true" final="true" deprecated="not deprecated" visibility="public" > </field> <field name="VOICE_DATA_FILES_INFO" <field name="KEY_PARAM_STREAM" type="java.lang.String" transient="false" volatile="false" value=""dataFilesInfo"" value=""streamType"" static="true" final="true" deprecated="not deprecated" visibility="public" > </field> <field name="VOICE_DATA_ROOT_DIRECTORY" <field name="KEY_PARAM_UTTERANCE_ID" type="java.lang.String" transient="false" volatile="false" value=""dataRoot"" value=""utteranceId"" static="true" final="true" deprecated="not deprecated" core/java/android/content/Intent.java +0 −46 Original line number Diff line number Diff line Loading @@ -1684,53 +1684,7 @@ public class Intent implements Parcelable { @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) public static final String ACTION_REBOOT = "android.intent.action.REBOOT"; /** * Broadcast Action: Triggers the platform Text-To-Speech engine to * start the activity that installs the resource files on the device * that are required for TTS to be operational. Since the installation * of the data can be interrupted or declined by the user, the application * shouldn't expect successful installation upon return from that intent, * and if need be, should check installation status with * {@link #ACTION_TTS_CHECK_TTS_DATA}. */ @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) public static final String ACTION_TTS_INSTALL_TTS_DATA = "android.intent.action.INSTALL_TTS_DATA"; /** * Broadcast Action: Starts the activity from the platform Text-To-Speech * engine to verify the proper installation and availability of the * resource files on the system. Upon completion, the activity will * return one of the following codes: * {@link android.speech.tts.TextToSpeech.Engine#CHECK_VOICE_DATA_PASS}, * {@link android.speech.tts.TextToSpeech.Engine#CHECK_VOICE_DATA_FAIL}, * {@link android.speech.tts.TextToSpeech.Engine#CHECK_VOICE_DATA_BAD_DATA}, * {@link android.speech.tts.TextToSpeech.Engine#CHECK_VOICE_DATA_MISSING_DATA}, or * {@link android.speech.tts.TextToSpeech.Engine#CHECK_VOICE_DATA_MISSING_VOLUME}. * <p> Moreover, the data received in the activity result will contain the following * fields: * <ul> * <li>{@link android.speech.tts.TextToSpeech.Engine#VOICE_DATA_ROOT_DIRECTORY} which * indicates the path to the location of the resource files</li>, * <li>{@link android.speech.tts.TextToSpeech.Engine#VOICE_DATA_FILES} which contains * the list of all the resource files</li>, * <li>and {@link android.speech.tts.TextToSpeech.Engine#VOICE_DATA_FILES_INFO} which * contains, for each resource file, the description of the language covered by * the file in the xxx-YYY format, where xxx is the 3-letter ISO language code, * and YYY is the 3-letter ISO country code.</li> * </ul> */ @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) public static final String ACTION_TTS_CHECK_TTS_DATA = "android.intent.action.CHECK_TTS_DATA"; /** * Broadcast Action: The TextToSpeech synthesizer has completed processing * all of the text in the speech queue. */ @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) public static final String ACTION_TTS_QUEUE_PROCESSING_COMPLETED = "android.intent.action.TTS_QUEUE_PROCESSING_COMPLETED"; /** * Broadcast Action: a remote intent is to be broadcasted. Loading core/java/android/speech/tts/TextToSpeech.java +177 −126 File changed.Preview size limit exceeded, changes collapsed. Show changes packages/TtsService/src/android/tts/TtsService.java +31 −31 Original line number Diff line number Diff line Loading @@ -194,7 +194,7 @@ public class TtsService extends Service implements OnCompletionListener { private boolean isDefaultEnforced() { return (android.provider.Settings.Secure.getInt(mResolver, android.provider.Settings.Secure.TTS_USE_DEFAULTS, TextToSpeech.Engine.FALLBACK_TTS_USE_DEFAULTS) TextToSpeech.Engine.USE_DEFAULTS) == 1 ); } Loading @@ -202,7 +202,7 @@ public class TtsService extends Service implements OnCompletionListener { private int getDefaultRate() { return android.provider.Settings.Secure.getInt(mResolver, android.provider.Settings.Secure.TTS_DEFAULT_RATE, TextToSpeech.Engine.FALLBACK_TTS_DEFAULT_RATE); TextToSpeech.Engine.DEFAULT_RATE); } Loading Loading @@ -346,7 +346,7 @@ public class TtsService extends Service implements OnCompletionListener { */ private int speak(String callingApp, String text, int queueMode, ArrayList<String> params) { Log.v("TtsService", "TTS service received " + text); if (queueMode == TextToSpeech.TTS_QUEUE_FLUSH) { if (queueMode == TextToSpeech.QUEUE_FLUSH) { stop(callingApp); } else if (queueMode == 2) { stopAll(callingApp); Loading @@ -355,7 +355,7 @@ public class TtsService extends Service implements OnCompletionListener { if (!mIsSpeaking) { processSpeechQueue(); } return TextToSpeech.TTS_SUCCESS; return TextToSpeech.SUCCESS; } /** Loading @@ -372,7 +372,7 @@ public class TtsService extends Service implements OnCompletionListener { */ private int playEarcon(String callingApp, String earcon, int queueMode, ArrayList<String> params) { if (queueMode == TextToSpeech.TTS_QUEUE_FLUSH) { if (queueMode == TextToSpeech.QUEUE_FLUSH) { stop(callingApp); } else if (queueMode == 2) { stopAll(callingApp); Loading @@ -381,14 +381,14 @@ public class TtsService extends Service implements OnCompletionListener { if (!mIsSpeaking) { processSpeechQueue(); } return TextToSpeech.TTS_SUCCESS; return TextToSpeech.SUCCESS; } /** * Stops all speech output and removes any utterances still in the queue for the calling app. */ private int stop(String callingApp) { int result = TextToSpeech.TTS_ERROR; int result = TextToSpeech.ERROR; boolean speechQueueAvailable = false; try{ speechQueueAvailable = Loading @@ -414,7 +414,7 @@ public class TtsService extends Service implements OnCompletionListener { mIsSpeaking = false; mCurrentSpeechItem = null; } else { result = TextToSpeech.TTS_SUCCESS; result = TextToSpeech.SUCCESS; } Log.i("TtsService", "Stopped"); } Loading @@ -437,7 +437,7 @@ public class TtsService extends Service implements OnCompletionListener { * Stops all speech output and removes any utterances still in the queue globally. */ private int stopAll(String callingApp) { int result = TextToSpeech.TTS_ERROR; int result = TextToSpeech.ERROR; boolean speechQueueAvailable = false; try{ speechQueueAvailable = Loading @@ -463,7 +463,7 @@ public class TtsService extends Service implements OnCompletionListener { mIsSpeaking = false; mCurrentSpeechItem = null; } else { result = TextToSpeech.TTS_SUCCESS; result = TextToSpeech.SUCCESS; } Log.i("TtsService", "Stopped all"); } Loading @@ -487,7 +487,7 @@ public class TtsService extends Service implements OnCompletionListener { if (params != null){ for (int i = 0; i < params.size() - 1; i = i + 2){ String param = params.get(i); if (param.equals(TextToSpeech.Engine.TTS_KEY_PARAM_UTTERANCE_ID)){ if (param.equals(TextToSpeech.Engine.KEY_PARAM_UTTERANCE_ID)){ utteranceId = params.get(i+1); } } Loading @@ -500,14 +500,14 @@ public class TtsService extends Service implements OnCompletionListener { private int playSilence(String callingApp, long duration, int queueMode, ArrayList<String> params) { if (queueMode == TextToSpeech.TTS_QUEUE_FLUSH) { if (queueMode == TextToSpeech.QUEUE_FLUSH) { stop(callingApp); } mSpeechQueue.add(new SpeechItem(callingApp, duration, params)); if (!mIsSpeaking) { processSpeechQueue(); } return TextToSpeech.TTS_SUCCESS; return TextToSpeech.SUCCESS; } private void silence(final SpeechItem speechItem) { Loading @@ -517,7 +517,7 @@ public class TtsService extends Service implements OnCompletionListener { if (speechItem.mParams != null){ for (int i = 0; i < speechItem.mParams.size() - 1; i = i + 2){ String param = speechItem.mParams.get(i); if (param.equals(TextToSpeech.Engine.TTS_KEY_PARAM_UTTERANCE_ID)){ if (param.equals(TextToSpeech.Engine.KEY_PARAM_UTTERANCE_ID)){ utteranceId = speechItem.mParams.get(i+1); } } Loading Loading @@ -562,17 +562,17 @@ public class TtsService extends Service implements OnCompletionListener { for (int i = 0; i < speechItem.mParams.size() - 1; i = i + 2){ String param = speechItem.mParams.get(i); if (param != null) { if (param.equals(TextToSpeech.Engine.TTS_KEY_PARAM_RATE)) { if (param.equals(TextToSpeech.Engine.KEY_PARAM_RATE)) { speechRate = speechItem.mParams.get(i+1); } else if (param.equals(TextToSpeech.Engine.TTS_KEY_PARAM_LANGUAGE)){ } else if (param.equals(TextToSpeech.Engine.KEY_PARAM_LANGUAGE)){ language = speechItem.mParams.get(i+1); } else if (param.equals(TextToSpeech.Engine.TTS_KEY_PARAM_COUNTRY)){ } else if (param.equals(TextToSpeech.Engine.KEY_PARAM_COUNTRY)){ country = speechItem.mParams.get(i+1); } else if (param.equals(TextToSpeech.Engine.TTS_KEY_PARAM_VARIANT)){ } else if (param.equals(TextToSpeech.Engine.KEY_PARAM_VARIANT)){ variant = speechItem.mParams.get(i+1); } else if (param.equals(TextToSpeech.Engine.TTS_KEY_PARAM_UTTERANCE_ID)){ } else if (param.equals(TextToSpeech.Engine.KEY_PARAM_UTTERANCE_ID)){ utteranceId = speechItem.mParams.get(i+1); } else if (param.equals(TextToSpeech.Engine.TTS_KEY_PARAM_STREAM)) { } else if (param.equals(TextToSpeech.Engine.KEY_PARAM_STREAM)) { try { streamType = Integer.parseInt(speechItem.mParams.get(i + 1)); Loading Loading @@ -638,15 +638,15 @@ public class TtsService extends Service implements OnCompletionListener { for (int i = 0; i < speechItem.mParams.size() - 1; i = i + 2){ String param = speechItem.mParams.get(i); if (param != null) { if (param.equals(TextToSpeech.Engine.TTS_KEY_PARAM_RATE)) { if (param.equals(TextToSpeech.Engine.KEY_PARAM_RATE)) { speechRate = speechItem.mParams.get(i+1); } else if (param.equals(TextToSpeech.Engine.TTS_KEY_PARAM_LANGUAGE)){ } else if (param.equals(TextToSpeech.Engine.KEY_PARAM_LANGUAGE)){ language = speechItem.mParams.get(i+1); } else if (param.equals(TextToSpeech.Engine.TTS_KEY_PARAM_COUNTRY)){ } else if (param.equals(TextToSpeech.Engine.KEY_PARAM_COUNTRY)){ country = speechItem.mParams.get(i+1); } else if (param.equals(TextToSpeech.Engine.TTS_KEY_PARAM_VARIANT)){ } else if (param.equals(TextToSpeech.Engine.KEY_PARAM_VARIANT)){ variant = speechItem.mParams.get(i+1); } else if (param.equals(TextToSpeech.Engine.TTS_KEY_PARAM_UTTERANCE_ID)){ } else if (param.equals(TextToSpeech.Engine.KEY_PARAM_UTTERANCE_ID)){ utteranceId = speechItem.mParams.get(i+1); } } Loading Loading @@ -698,7 +698,7 @@ public class TtsService extends Service implements OnCompletionListener { } private void broadcastTtsQueueProcessingCompleted(){ Intent i = new Intent(Intent.ACTION_TTS_QUEUE_PROCESSING_COMPLETED); Intent i = new Intent(TextToSpeech.ACTION_TTS_QUEUE_PROCESSING_COMPLETED); sendBroadcast(i); } Loading Loading @@ -843,7 +843,7 @@ public class TtsService extends Service implements OnCompletionListener { } for (int i = 0; i < paramList.size() - 1; i = i + 2) { String param = paramList.get(i); if ((param != null) && (param.equals(TextToSpeech.Engine.TTS_KEY_PARAM_STREAM))) { if ((param != null) && (param.equals(TextToSpeech.Engine.KEY_PARAM_STREAM))) { try { streamType = Integer.parseInt(paramList.get(i + 1)); } catch (NumberFormatException e) { Loading Loading @@ -910,18 +910,18 @@ public class TtsService extends Service implements OnCompletionListener { if (cb != null) { mCallbacks.register(cb); mCallbacksMap.put(packageName, cb); return TextToSpeech.TTS_SUCCESS; return TextToSpeech.SUCCESS; } return TextToSpeech.TTS_ERROR; return TextToSpeech.ERROR; } public int unregisterCallback(String packageName, ITtsCallback cb) { if (cb != null) { mCallbacksMap.remove(packageName); mCallbacks.unregister(cb); return TextToSpeech.TTS_SUCCESS; return TextToSpeech.SUCCESS; } return TextToSpeech.TTS_ERROR; return TextToSpeech.ERROR; } /** Loading Loading
api/current.xml +53 −53 Original line number Diff line number Diff line Loading @@ -35725,39 +35725,6 @@ visibility="public" > </field> <field name="ACTION_TTS_CHECK_TTS_DATA" type="java.lang.String" transient="false" volatile="false" value=""android.intent.action.CHECK_TTS_DATA"" static="true" final="true" deprecated="not deprecated" visibility="public" > </field> <field name="ACTION_TTS_INSTALL_TTS_DATA" type="java.lang.String" transient="false" volatile="false" value=""android.intent.action.INSTALL_TTS_DATA"" static="true" final="true" deprecated="not deprecated" visibility="public" > </field> <field name="ACTION_TTS_QUEUE_PROCESSING_COMPLETED" type="java.lang.String" transient="false" volatile="false" value=""android.intent.action.TTS_QUEUE_PROCESSING_COMPLETED"" static="true" final="true" deprecated="not deprecated" visibility="public" > </field> <field name="ACTION_UID_REMOVED" type="java.lang.String" transient="false" Loading Loading @@ -116289,7 +116256,18 @@ <parameter name="filename" type="java.lang.String"> </parameter> </method> <field name="TTS_ERROR" <field name="ACTION_TTS_QUEUE_PROCESSING_COMPLETED" type="java.lang.String" transient="false" volatile="false" value=""android.speech.tts.TTS_QUEUE_PROCESSING_COMPLETED"" static="true" final="true" deprecated="not deprecated" visibility="public" > </field> <field name="ERROR" type="int" transient="false" volatile="false" Loading @@ -116300,7 +116278,7 @@ visibility="public" > </field> <field name="TTS_LANG_AVAILABLE" <field name="LANG_AVAILABLE" type="int" transient="false" volatile="false" Loading @@ -116311,7 +116289,7 @@ visibility="public" > </field> <field name="TTS_LANG_COUNTRY_AVAILABLE" <field name="LANG_COUNTRY_AVAILABLE" type="int" transient="false" volatile="false" Loading @@ -116322,7 +116300,7 @@ visibility="public" > </field> <field name="TTS_LANG_COUNTRY_VAR_AVAILABLE" <field name="LANG_COUNTRY_VAR_AVAILABLE" type="int" transient="false" volatile="false" Loading @@ -116333,7 +116311,7 @@ visibility="public" > </field> <field name="TTS_LANG_MISSING_DATA" <field name="LANG_MISSING_DATA" type="int" transient="false" volatile="false" Loading @@ -116344,7 +116322,7 @@ visibility="public" > </field> <field name="TTS_LANG_NOT_SUPPORTED" <field name="LANG_NOT_SUPPORTED" type="int" transient="false" volatile="false" Loading @@ -116355,7 +116333,7 @@ visibility="public" > </field> <field name="TTS_QUEUE_ADD" <field name="QUEUE_ADD" type="int" transient="false" volatile="false" Loading @@ -116366,7 +116344,7 @@ visibility="public" > </field> <field name="TTS_QUEUE_FLUSH" <field name="QUEUE_FLUSH" type="int" transient="false" volatile="false" Loading @@ -116377,7 +116355,7 @@ visibility="public" > </field> <field name="TTS_SUCCESS" <field name="SUCCESS" type="int" transient="false" volatile="false" Loading Loading @@ -116405,6 +116383,28 @@ visibility="public" > </constructor> <field name="ACTION_CHECK_TTS_DATA" type="java.lang.String" transient="false" volatile="false" value=""android.speech.tts.engine.CHECK_TTS_DATA"" static="true" final="true" deprecated="not deprecated" visibility="public" > </field> <field name="ACTION_INSTALL_TTS_DATA" type="java.lang.String" transient="false" volatile="false" value=""android.speech.tts.engine.INSTALL_TTS_DATA"" static="true" final="true" deprecated="not deprecated" visibility="public" > </field> <field name="CHECK_VOICE_DATA_BAD_DATA" type="int" transient="false" Loading Loading @@ -116460,7 +116460,7 @@ visibility="public" > </field> <field name="TTS_DEFAULT_STREAM" <field name="DEFAULT_STREAM" type="int" transient="false" volatile="false" Loading @@ -116471,55 +116471,55 @@ visibility="public" > </field> <field name="TTS_KEY_PARAM_STREAM" <field name="EXTRA_VOICE_DATA_FILES" type="java.lang.String" transient="false" volatile="false" value=""streamType"" value=""dataFiles"" static="true" final="true" deprecated="not deprecated" visibility="public" > </field> <field name="TTS_KEY_PARAM_UTTERANCE_ID" <field name="EXTRA_VOICE_DATA_FILES_INFO" type="java.lang.String" transient="false" volatile="false" value=""utteranceId"" value=""dataFilesInfo"" static="true" final="true" deprecated="not deprecated" visibility="public" > </field> <field name="VOICE_DATA_FILES" <field name="EXTRA_VOICE_DATA_ROOT_DIRECTORY" type="java.lang.String" transient="false" volatile="false" value=""dataFiles"" value=""dataRoot"" static="true" final="true" deprecated="not deprecated" visibility="public" > </field> <field name="VOICE_DATA_FILES_INFO" <field name="KEY_PARAM_STREAM" type="java.lang.String" transient="false" volatile="false" value=""dataFilesInfo"" value=""streamType"" static="true" final="true" deprecated="not deprecated" visibility="public" > </field> <field name="VOICE_DATA_ROOT_DIRECTORY" <field name="KEY_PARAM_UTTERANCE_ID" type="java.lang.String" transient="false" volatile="false" value=""dataRoot"" value=""utteranceId"" static="true" final="true" deprecated="not deprecated"
core/java/android/content/Intent.java +0 −46 Original line number Diff line number Diff line Loading @@ -1684,53 +1684,7 @@ public class Intent implements Parcelable { @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) public static final String ACTION_REBOOT = "android.intent.action.REBOOT"; /** * Broadcast Action: Triggers the platform Text-To-Speech engine to * start the activity that installs the resource files on the device * that are required for TTS to be operational. Since the installation * of the data can be interrupted or declined by the user, the application * shouldn't expect successful installation upon return from that intent, * and if need be, should check installation status with * {@link #ACTION_TTS_CHECK_TTS_DATA}. */ @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) public static final String ACTION_TTS_INSTALL_TTS_DATA = "android.intent.action.INSTALL_TTS_DATA"; /** * Broadcast Action: Starts the activity from the platform Text-To-Speech * engine to verify the proper installation and availability of the * resource files on the system. Upon completion, the activity will * return one of the following codes: * {@link android.speech.tts.TextToSpeech.Engine#CHECK_VOICE_DATA_PASS}, * {@link android.speech.tts.TextToSpeech.Engine#CHECK_VOICE_DATA_FAIL}, * {@link android.speech.tts.TextToSpeech.Engine#CHECK_VOICE_DATA_BAD_DATA}, * {@link android.speech.tts.TextToSpeech.Engine#CHECK_VOICE_DATA_MISSING_DATA}, or * {@link android.speech.tts.TextToSpeech.Engine#CHECK_VOICE_DATA_MISSING_VOLUME}. * <p> Moreover, the data received in the activity result will contain the following * fields: * <ul> * <li>{@link android.speech.tts.TextToSpeech.Engine#VOICE_DATA_ROOT_DIRECTORY} which * indicates the path to the location of the resource files</li>, * <li>{@link android.speech.tts.TextToSpeech.Engine#VOICE_DATA_FILES} which contains * the list of all the resource files</li>, * <li>and {@link android.speech.tts.TextToSpeech.Engine#VOICE_DATA_FILES_INFO} which * contains, for each resource file, the description of the language covered by * the file in the xxx-YYY format, where xxx is the 3-letter ISO language code, * and YYY is the 3-letter ISO country code.</li> * </ul> */ @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) public static final String ACTION_TTS_CHECK_TTS_DATA = "android.intent.action.CHECK_TTS_DATA"; /** * Broadcast Action: The TextToSpeech synthesizer has completed processing * all of the text in the speech queue. */ @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) public static final String ACTION_TTS_QUEUE_PROCESSING_COMPLETED = "android.intent.action.TTS_QUEUE_PROCESSING_COMPLETED"; /** * Broadcast Action: a remote intent is to be broadcasted. Loading
core/java/android/speech/tts/TextToSpeech.java +177 −126 File changed.Preview size limit exceeded, changes collapsed. Show changes
packages/TtsService/src/android/tts/TtsService.java +31 −31 Original line number Diff line number Diff line Loading @@ -194,7 +194,7 @@ public class TtsService extends Service implements OnCompletionListener { private boolean isDefaultEnforced() { return (android.provider.Settings.Secure.getInt(mResolver, android.provider.Settings.Secure.TTS_USE_DEFAULTS, TextToSpeech.Engine.FALLBACK_TTS_USE_DEFAULTS) TextToSpeech.Engine.USE_DEFAULTS) == 1 ); } Loading @@ -202,7 +202,7 @@ public class TtsService extends Service implements OnCompletionListener { private int getDefaultRate() { return android.provider.Settings.Secure.getInt(mResolver, android.provider.Settings.Secure.TTS_DEFAULT_RATE, TextToSpeech.Engine.FALLBACK_TTS_DEFAULT_RATE); TextToSpeech.Engine.DEFAULT_RATE); } Loading Loading @@ -346,7 +346,7 @@ public class TtsService extends Service implements OnCompletionListener { */ private int speak(String callingApp, String text, int queueMode, ArrayList<String> params) { Log.v("TtsService", "TTS service received " + text); if (queueMode == TextToSpeech.TTS_QUEUE_FLUSH) { if (queueMode == TextToSpeech.QUEUE_FLUSH) { stop(callingApp); } else if (queueMode == 2) { stopAll(callingApp); Loading @@ -355,7 +355,7 @@ public class TtsService extends Service implements OnCompletionListener { if (!mIsSpeaking) { processSpeechQueue(); } return TextToSpeech.TTS_SUCCESS; return TextToSpeech.SUCCESS; } /** Loading @@ -372,7 +372,7 @@ public class TtsService extends Service implements OnCompletionListener { */ private int playEarcon(String callingApp, String earcon, int queueMode, ArrayList<String> params) { if (queueMode == TextToSpeech.TTS_QUEUE_FLUSH) { if (queueMode == TextToSpeech.QUEUE_FLUSH) { stop(callingApp); } else if (queueMode == 2) { stopAll(callingApp); Loading @@ -381,14 +381,14 @@ public class TtsService extends Service implements OnCompletionListener { if (!mIsSpeaking) { processSpeechQueue(); } return TextToSpeech.TTS_SUCCESS; return TextToSpeech.SUCCESS; } /** * Stops all speech output and removes any utterances still in the queue for the calling app. */ private int stop(String callingApp) { int result = TextToSpeech.TTS_ERROR; int result = TextToSpeech.ERROR; boolean speechQueueAvailable = false; try{ speechQueueAvailable = Loading @@ -414,7 +414,7 @@ public class TtsService extends Service implements OnCompletionListener { mIsSpeaking = false; mCurrentSpeechItem = null; } else { result = TextToSpeech.TTS_SUCCESS; result = TextToSpeech.SUCCESS; } Log.i("TtsService", "Stopped"); } Loading @@ -437,7 +437,7 @@ public class TtsService extends Service implements OnCompletionListener { * Stops all speech output and removes any utterances still in the queue globally. */ private int stopAll(String callingApp) { int result = TextToSpeech.TTS_ERROR; int result = TextToSpeech.ERROR; boolean speechQueueAvailable = false; try{ speechQueueAvailable = Loading @@ -463,7 +463,7 @@ public class TtsService extends Service implements OnCompletionListener { mIsSpeaking = false; mCurrentSpeechItem = null; } else { result = TextToSpeech.TTS_SUCCESS; result = TextToSpeech.SUCCESS; } Log.i("TtsService", "Stopped all"); } Loading @@ -487,7 +487,7 @@ public class TtsService extends Service implements OnCompletionListener { if (params != null){ for (int i = 0; i < params.size() - 1; i = i + 2){ String param = params.get(i); if (param.equals(TextToSpeech.Engine.TTS_KEY_PARAM_UTTERANCE_ID)){ if (param.equals(TextToSpeech.Engine.KEY_PARAM_UTTERANCE_ID)){ utteranceId = params.get(i+1); } } Loading @@ -500,14 +500,14 @@ public class TtsService extends Service implements OnCompletionListener { private int playSilence(String callingApp, long duration, int queueMode, ArrayList<String> params) { if (queueMode == TextToSpeech.TTS_QUEUE_FLUSH) { if (queueMode == TextToSpeech.QUEUE_FLUSH) { stop(callingApp); } mSpeechQueue.add(new SpeechItem(callingApp, duration, params)); if (!mIsSpeaking) { processSpeechQueue(); } return TextToSpeech.TTS_SUCCESS; return TextToSpeech.SUCCESS; } private void silence(final SpeechItem speechItem) { Loading @@ -517,7 +517,7 @@ public class TtsService extends Service implements OnCompletionListener { if (speechItem.mParams != null){ for (int i = 0; i < speechItem.mParams.size() - 1; i = i + 2){ String param = speechItem.mParams.get(i); if (param.equals(TextToSpeech.Engine.TTS_KEY_PARAM_UTTERANCE_ID)){ if (param.equals(TextToSpeech.Engine.KEY_PARAM_UTTERANCE_ID)){ utteranceId = speechItem.mParams.get(i+1); } } Loading Loading @@ -562,17 +562,17 @@ public class TtsService extends Service implements OnCompletionListener { for (int i = 0; i < speechItem.mParams.size() - 1; i = i + 2){ String param = speechItem.mParams.get(i); if (param != null) { if (param.equals(TextToSpeech.Engine.TTS_KEY_PARAM_RATE)) { if (param.equals(TextToSpeech.Engine.KEY_PARAM_RATE)) { speechRate = speechItem.mParams.get(i+1); } else if (param.equals(TextToSpeech.Engine.TTS_KEY_PARAM_LANGUAGE)){ } else if (param.equals(TextToSpeech.Engine.KEY_PARAM_LANGUAGE)){ language = speechItem.mParams.get(i+1); } else if (param.equals(TextToSpeech.Engine.TTS_KEY_PARAM_COUNTRY)){ } else if (param.equals(TextToSpeech.Engine.KEY_PARAM_COUNTRY)){ country = speechItem.mParams.get(i+1); } else if (param.equals(TextToSpeech.Engine.TTS_KEY_PARAM_VARIANT)){ } else if (param.equals(TextToSpeech.Engine.KEY_PARAM_VARIANT)){ variant = speechItem.mParams.get(i+1); } else if (param.equals(TextToSpeech.Engine.TTS_KEY_PARAM_UTTERANCE_ID)){ } else if (param.equals(TextToSpeech.Engine.KEY_PARAM_UTTERANCE_ID)){ utteranceId = speechItem.mParams.get(i+1); } else if (param.equals(TextToSpeech.Engine.TTS_KEY_PARAM_STREAM)) { } else if (param.equals(TextToSpeech.Engine.KEY_PARAM_STREAM)) { try { streamType = Integer.parseInt(speechItem.mParams.get(i + 1)); Loading Loading @@ -638,15 +638,15 @@ public class TtsService extends Service implements OnCompletionListener { for (int i = 0; i < speechItem.mParams.size() - 1; i = i + 2){ String param = speechItem.mParams.get(i); if (param != null) { if (param.equals(TextToSpeech.Engine.TTS_KEY_PARAM_RATE)) { if (param.equals(TextToSpeech.Engine.KEY_PARAM_RATE)) { speechRate = speechItem.mParams.get(i+1); } else if (param.equals(TextToSpeech.Engine.TTS_KEY_PARAM_LANGUAGE)){ } else if (param.equals(TextToSpeech.Engine.KEY_PARAM_LANGUAGE)){ language = speechItem.mParams.get(i+1); } else if (param.equals(TextToSpeech.Engine.TTS_KEY_PARAM_COUNTRY)){ } else if (param.equals(TextToSpeech.Engine.KEY_PARAM_COUNTRY)){ country = speechItem.mParams.get(i+1); } else if (param.equals(TextToSpeech.Engine.TTS_KEY_PARAM_VARIANT)){ } else if (param.equals(TextToSpeech.Engine.KEY_PARAM_VARIANT)){ variant = speechItem.mParams.get(i+1); } else if (param.equals(TextToSpeech.Engine.TTS_KEY_PARAM_UTTERANCE_ID)){ } else if (param.equals(TextToSpeech.Engine.KEY_PARAM_UTTERANCE_ID)){ utteranceId = speechItem.mParams.get(i+1); } } Loading Loading @@ -698,7 +698,7 @@ public class TtsService extends Service implements OnCompletionListener { } private void broadcastTtsQueueProcessingCompleted(){ Intent i = new Intent(Intent.ACTION_TTS_QUEUE_PROCESSING_COMPLETED); Intent i = new Intent(TextToSpeech.ACTION_TTS_QUEUE_PROCESSING_COMPLETED); sendBroadcast(i); } Loading Loading @@ -843,7 +843,7 @@ public class TtsService extends Service implements OnCompletionListener { } for (int i = 0; i < paramList.size() - 1; i = i + 2) { String param = paramList.get(i); if ((param != null) && (param.equals(TextToSpeech.Engine.TTS_KEY_PARAM_STREAM))) { if ((param != null) && (param.equals(TextToSpeech.Engine.KEY_PARAM_STREAM))) { try { streamType = Integer.parseInt(paramList.get(i + 1)); } catch (NumberFormatException e) { Loading Loading @@ -910,18 +910,18 @@ public class TtsService extends Service implements OnCompletionListener { if (cb != null) { mCallbacks.register(cb); mCallbacksMap.put(packageName, cb); return TextToSpeech.TTS_SUCCESS; return TextToSpeech.SUCCESS; } return TextToSpeech.TTS_ERROR; return TextToSpeech.ERROR; } public int unregisterCallback(String packageName, ITtsCallback cb) { if (cb != null) { mCallbacksMap.remove(packageName); mCallbacks.unregister(cb); return TextToSpeech.TTS_SUCCESS; return TextToSpeech.SUCCESS; } return TextToSpeech.TTS_ERROR; return TextToSpeech.ERROR; } /** Loading