Merge change 8860 into donut

* changes:
  Fix bug 2017664 Removed the TTS_ prefix in the TextToSpeech class to follow the standard naming convention. Moved the TTS-related intents from the Intent class to TextToSpeech and TextToSpeech.Engine. Renamed the TextToSpeech.Engine constants that are used as extras for the   ACTION_TTS_CHECK_TTS_DATA intent to prefix them with EXTRA_. Cleaned up the other TextToSpeech.Engine constant to remove superfluous mentions of   "TTS" in the name.
This commit is contained in:
Android (Google) Code Review
2009-07-29 11:38:44 -07:00
4 changed files with 276 additions and 271 deletions

View File

@@ -32173,39 +32173,6 @@
visibility="public"
>
</field>
<field name="ACTION_TTS_CHECK_TTS_DATA"
type="java.lang.String"
transient="false"
volatile="false"
value="&quot;android.intent.action.CHECK_TTS_DATA&quot;"
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="&quot;android.intent.action.INSTALL_TTS_DATA&quot;"
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="&quot;android.intent.action.TTS_QUEUE_PROCESSING_COMPLETED&quot;"
static="true"
final="true"
deprecated="not deprecated"
visibility="public"
>
</field>
<field name="ACTION_UID_REMOVED"
type="java.lang.String"
transient="false"
@@ -111721,7 +111688,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="&quot;android.speech.tts.TTS_QUEUE_PROCESSING_COMPLETED&quot;"
static="true"
final="true"
deprecated="not deprecated"
visibility="public"
>
</field>
<field name="ERROR"
type="int"
transient="false"
volatile="false"
@@ -111732,7 +111710,7 @@
visibility="public"
>
</field>
<field name="TTS_LANG_AVAILABLE"
<field name="LANG_AVAILABLE"
type="int"
transient="false"
volatile="false"
@@ -111743,7 +111721,7 @@
visibility="public"
>
</field>
<field name="TTS_LANG_COUNTRY_AVAILABLE"
<field name="LANG_COUNTRY_AVAILABLE"
type="int"
transient="false"
volatile="false"
@@ -111754,7 +111732,7 @@
visibility="public"
>
</field>
<field name="TTS_LANG_COUNTRY_VAR_AVAILABLE"
<field name="LANG_COUNTRY_VAR_AVAILABLE"
type="int"
transient="false"
volatile="false"
@@ -111765,7 +111743,7 @@
visibility="public"
>
</field>
<field name="TTS_LANG_MISSING_DATA"
<field name="LANG_MISSING_DATA"
type="int"
transient="false"
volatile="false"
@@ -111776,7 +111754,7 @@
visibility="public"
>
</field>
<field name="TTS_LANG_NOT_SUPPORTED"
<field name="LANG_NOT_SUPPORTED"
type="int"
transient="false"
volatile="false"
@@ -111787,7 +111765,7 @@
visibility="public"
>
</field>
<field name="TTS_QUEUE_ADD"
<field name="QUEUE_ADD"
type="int"
transient="false"
volatile="false"
@@ -111798,7 +111776,7 @@
visibility="public"
>
</field>
<field name="TTS_QUEUE_FLUSH"
<field name="QUEUE_FLUSH"
type="int"
transient="false"
volatile="false"
@@ -111809,7 +111787,7 @@
visibility="public"
>
</field>
<field name="TTS_SUCCESS"
<field name="SUCCESS"
type="int"
transient="false"
volatile="false"
@@ -111837,6 +111815,28 @@
visibility="public"
>
</constructor>
<field name="ACTION_CHECK_TTS_DATA"
type="java.lang.String"
transient="false"
volatile="false"
value="&quot;android.speech.tts.engine.CHECK_TTS_DATA&quot;"
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="&quot;android.speech.tts.engine.INSTALL_TTS_DATA&quot;"
static="true"
final="true"
deprecated="not deprecated"
visibility="public"
>
</field>
<field name="CHECK_VOICE_DATA_BAD_DATA"
type="int"
transient="false"
@@ -111892,7 +111892,7 @@
visibility="public"
>
</field>
<field name="TTS_DEFAULT_STREAM"
<field name="DEFAULT_STREAM"
type="int"
transient="false"
volatile="false"
@@ -111903,29 +111903,7 @@
visibility="public"
>
</field>
<field name="TTS_KEY_PARAM_STREAM"
type="java.lang.String"
transient="false"
volatile="false"
value="&quot;streamType&quot;"
static="true"
final="true"
deprecated="not deprecated"
visibility="public"
>
</field>
<field name="TTS_KEY_PARAM_UTTERANCE_ID"
type="java.lang.String"
transient="false"
volatile="false"
value="&quot;utteranceId&quot;"
static="true"
final="true"
deprecated="not deprecated"
visibility="public"
>
</field>
<field name="VOICE_DATA_FILES"
<field name="EXTRA_VOICE_DATA_FILES"
type="java.lang.String"
transient="false"
volatile="false"
@@ -111936,7 +111914,7 @@
visibility="public"
>
</field>
<field name="VOICE_DATA_FILES_INFO"
<field name="EXTRA_VOICE_DATA_FILES_INFO"
type="java.lang.String"
transient="false"
volatile="false"
@@ -111947,7 +111925,7 @@
visibility="public"
>
</field>
<field name="VOICE_DATA_ROOT_DIRECTORY"
<field name="EXTRA_VOICE_DATA_ROOT_DIRECTORY"
type="java.lang.String"
transient="false"
volatile="false"
@@ -111958,6 +111936,28 @@
visibility="public"
>
</field>
<field name="KEY_PARAM_STREAM"
type="java.lang.String"
transient="false"
volatile="false"
value="&quot;streamType&quot;"
static="true"
final="true"
deprecated="not deprecated"
visibility="public"
>
</field>
<field name="KEY_PARAM_UTTERANCE_ID"
type="java.lang.String"
transient="false"
volatile="false"
value="&quot;utteranceId&quot;"
static="true"
final="true"
deprecated="not deprecated"
visibility="public"
>
</field>
</class>
<interface name="TextToSpeech.OnInitListener"
abstract="true"

View File

@@ -1683,53 +1683,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";
// ---------------------------------------------------------------------
// ---------------------------------------------------------------------

View File

@@ -18,6 +18,8 @@ package android.speech.tts;
import android.speech.tts.ITts;
import android.speech.tts.ITtsCallback;
import android.annotation.SdkConstant;
import android.annotation.SdkConstant.SdkConstantType;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
@@ -41,51 +43,60 @@ public class TextToSpeech {
/**
* Denotes a successful operation.
*/
public static final int TTS_SUCCESS = 0;
public static final int SUCCESS = 0;
/**
* Denotes a generic operation failure.
*/
public static final int TTS_ERROR = -1;
public static final int ERROR = -1;
/**
* Queue mode where all entries in the playback queue (media to be played
* and text to be synthesized) are dropped and replaced by the new entry.
*/
public static final int TTS_QUEUE_FLUSH = 0;
public static final int QUEUE_FLUSH = 0;
/**
* Queue mode where the new entry is added at the end of the playback queue.
*/
public static final int TTS_QUEUE_ADD = 1;
public static final int QUEUE_ADD = 1;
/**
* Denotes the language is available exactly as specified by the locale
*/
public static final int TTS_LANG_COUNTRY_VAR_AVAILABLE = 2;
public static final int LANG_COUNTRY_VAR_AVAILABLE = 2;
/**
* Denotes the language is available for the language and country specified
* by the locale, but not the variant.
*/
public static final int TTS_LANG_COUNTRY_AVAILABLE = 1;
public static final int LANG_COUNTRY_AVAILABLE = 1;
/**
* Denotes the language is available for the language by the locale,
* but not the country and variant.
*/
public static final int TTS_LANG_AVAILABLE = 0;
public static final int LANG_AVAILABLE = 0;
/**
* Denotes the language data is missing.
*/
public static final int TTS_LANG_MISSING_DATA = -1;
public static final int LANG_MISSING_DATA = -1;
/**
* Denotes the language is not supported by the current TTS engine.
*/
public static final int TTS_LANG_NOT_SUPPORTED = -2;
public static final int LANG_NOT_SUPPORTED = -2;
/**
* Broadcast Action: The TextToSpeech synthesizer has completed processing
* of all the text in the speech queue.
*/
@SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
public static final String ACTION_TTS_QUEUE_PROCESSING_COMPLETED =
"android.speech.tts.TTS_QUEUE_PROCESSING_COMPLETED";
/**
@@ -119,126 +130,167 @@ public class TextToSpeech {
/**
* {@hide}
*/
public static final int FALLBACK_TTS_DEFAULT_RATE = 100; // 1x
public static final int DEFAULT_RATE = 100; // 1x
/**
* {@hide}
*/
public static final int FALLBACK_TTS_DEFAULT_PITCH = 100;// 1x
public static final int DEFAULT_PITCH = 100;// 1x
/**
* {@hide}
*/
public static final int FALLBACK_TTS_USE_DEFAULTS = 0; // false
public static final int USE_DEFAULTS = 0; // false
/**
* {@hide}
*/
public static final String FALLBACK_TTS_DEFAULT_SYNTH = "com.svox.pico";
public static final String DEFAULT_SYNTH = "com.svox.pico";
// default values for rendering
public static final int TTS_DEFAULT_STREAM = AudioManager.STREAM_MUSIC;
public static final int DEFAULT_STREAM = AudioManager.STREAM_MUSIC;
// return codes for a TTS engine's check data activity
/**
* Indicates success when checking the installation status of the resources used by the
* text-to-speech engine with the android.intent.action.CHECK_TTS_DATA intent.
* text-to-speech engine with the {@link #ACTION_CHECK_TTS_DATA} intent.
*/
public static final int CHECK_VOICE_DATA_PASS = 1;
/**
* Indicates failure when checking the installation status of the resources used by the
* text-to-speech engine with the android.intent.action.CHECK_TTS_DATA intent.
* text-to-speech engine with the {@link #ACTION_CHECK_TTS_DATA} intent.
*/
public static final int CHECK_VOICE_DATA_FAIL = 0;
/**
* Indicates erroneous data when checking the installation status of the resources used by
* the text-to-speech engine with the android.intent.action.CHECK_TTS_DATA intent.
* the text-to-speech engine with the {@link #ACTION_CHECK_TTS_DATA} intent.
*/
public static final int CHECK_VOICE_DATA_BAD_DATA = -1;
/**
* Indicates missing resources when checking the installation status of the resources used
* by the text-to-speech engine with the android.intent.action.CHECK_TTS_DATA intent.
* by the text-to-speech engine with the {@link #ACTION_CHECK_TTS_DATA} intent.
*/
public static final int CHECK_VOICE_DATA_MISSING_DATA = -2;
/**
* Indicates missing storage volume when checking the installation status of the resources
* used by the text-to-speech engine with the android.intent.action.CHECK_TTS_DATA intent.
* used by the text-to-speech engine with the {@link #ACTION_CHECK_TTS_DATA} intent.
*/
public static final int CHECK_VOICE_DATA_MISSING_VOLUME = -3;
// return codes for a TTS engine's check data activity
// intents to ask engine to install data or check its data
/**
* Extra information received with the android.intent.action.CHECK_TTS_DATA intent where
* 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_CHECK_TTS_DATA}.
*/
@SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
public static final String ACTION_INSTALL_TTS_DATA =
"android.speech.tts.engine.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 #CHECK_VOICE_DATA_PASS},
* {@link #CHECK_VOICE_DATA_FAIL},
* {@link #CHECK_VOICE_DATA_BAD_DATA},
* {@link #CHECK_VOICE_DATA_MISSING_DATA}, or
* {@link #CHECK_VOICE_DATA_MISSING_VOLUME}.
* <p> Moreover, the data received in the activity result will contain the following
* fields:
* <ul>
* <li>{@link #EXTRA_VOICE_DATA_ROOT_DIRECTORY} which
* indicates the path to the location of the resource files</li>,
* <li>{@link #EXTRA_VOICE_DATA_FILES} which contains
* the list of all the resource files</li>,
* <li>and {@link #EXTRA_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_CHECK_TTS_DATA =
"android.speech.tts.engine.CHECK_TTS_DATA";
// extras for a TTS engine's check data activity
/**
* Extra information received with the {@link #ACTION_CHECK_TTS_DATA} intent where
* the text-to-speech engine specifies the path to its resources.
*/
public static final String VOICE_DATA_ROOT_DIRECTORY = "dataRoot";
public static final String EXTRA_VOICE_DATA_ROOT_DIRECTORY = "dataRoot";
/**
* Extra information received with the android.intent.action.CHECK_TTS_DATA intent where
* Extra information received with the {@link #ACTION_CHECK_TTS_DATA} intent where
* the text-to-speech engine specifies the file names of its resources under the
* resource path.
*/
public static final String VOICE_DATA_FILES = "dataFiles";
public static final String EXTRA_VOICE_DATA_FILES = "dataFiles";
/**
* Extra information received with the android.intent.action.CHECK_TTS_DATA intent where
* Extra information received with the {@link #ACTION_CHECK_TTS_DATA} intent where
* the text-to-speech engine specifies the locale associated with each resource file.
*/
public static final String VOICE_DATA_FILES_INFO = "dataFilesInfo";
public static final String EXTRA_VOICE_DATA_FILES_INFO = "dataFilesInfo";
// keys for the parameters passed with speak commands. Hidden keys are used internally
// to maintain engine state for each TextToSpeech instance.
/**
* {@hide}
*/
public static final String TTS_KEY_PARAM_RATE = "rate";
public static final String KEY_PARAM_RATE = "rate";
/**
* {@hide}
*/
public static final String TTS_KEY_PARAM_LANGUAGE = "language";
public static final String KEY_PARAM_LANGUAGE = "language";
/**
* {@hide}
*/
public static final String TTS_KEY_PARAM_COUNTRY = "country";
public static final String KEY_PARAM_COUNTRY = "country";
/**
* {@hide}
*/
public static final String TTS_KEY_PARAM_VARIANT = "variant";
public static final String KEY_PARAM_VARIANT = "variant";
/**
* Parameter key to specify the audio stream type to be used when speaking text
* or playing back a file.
*/
public static final String TTS_KEY_PARAM_STREAM = "streamType";
public static final String KEY_PARAM_STREAM = "streamType";
/**
* Parameter key to identify an utterance in the completion listener after text has been
* spoken, a file has been played back or a silence duration has elapsed.
*/
public static final String TTS_KEY_PARAM_UTTERANCE_ID = "utteranceId";
public static final String KEY_PARAM_UTTERANCE_ID = "utteranceId";
// key positions in the array of cached parameters
/**
* {@hide}
*/
protected static final int TTS_PARAM_POSITION_RATE = 0;
protected static final int PARAM_POSITION_RATE = 0;
/**
* {@hide}
*/
protected static final int TTS_PARAM_POSITION_LANGUAGE = 2;
protected static final int PARAM_POSITION_LANGUAGE = 2;
/**
* {@hide}
*/
protected static final int TTS_PARAM_POSITION_COUNTRY = 4;
protected static final int PARAM_POSITION_COUNTRY = 4;
/**
* {@hide}
*/
protected static final int TTS_PARAM_POSITION_VARIANT = 6;
protected static final int PARAM_POSITION_VARIANT = 6;
/**
* {@hide}
*/
protected static final int TTS_PARAM_POSITION_STREAM = 8;
protected static final int PARAM_POSITION_STREAM = 8;
/**
* {@hide}
*/
protected static final int TTS_PARAM_POSITION_UTTERANCE_ID = 10;
protected static final int PARAM_POSITION_UTTERANCE_ID = 10;
/**
* {@hide}
*/
protected static final int TTS_NB_CACHED_PARAMS = 6;
protected static final int NB_CACHED_PARAMS = 6;
}
/**
@@ -273,25 +325,25 @@ public class TextToSpeech {
mPackageName = mContext.getPackageName();
mInitListener = listener;
mCachedParams = new String[2*Engine.TTS_NB_CACHED_PARAMS]; // store key and value
mCachedParams[Engine.TTS_PARAM_POSITION_RATE] = Engine.TTS_KEY_PARAM_RATE;
mCachedParams[Engine.TTS_PARAM_POSITION_LANGUAGE] = Engine.TTS_KEY_PARAM_LANGUAGE;
mCachedParams[Engine.TTS_PARAM_POSITION_COUNTRY] = Engine.TTS_KEY_PARAM_COUNTRY;
mCachedParams[Engine.TTS_PARAM_POSITION_VARIANT] = Engine.TTS_KEY_PARAM_VARIANT;
mCachedParams[Engine.TTS_PARAM_POSITION_STREAM] = Engine.TTS_KEY_PARAM_STREAM;
mCachedParams[Engine.TTS_PARAM_POSITION_UTTERANCE_ID] = Engine.TTS_KEY_PARAM_UTTERANCE_ID;
mCachedParams = new String[2*Engine.NB_CACHED_PARAMS]; // store key and value
mCachedParams[Engine.PARAM_POSITION_RATE] = Engine.KEY_PARAM_RATE;
mCachedParams[Engine.PARAM_POSITION_LANGUAGE] = Engine.KEY_PARAM_LANGUAGE;
mCachedParams[Engine.PARAM_POSITION_COUNTRY] = Engine.KEY_PARAM_COUNTRY;
mCachedParams[Engine.PARAM_POSITION_VARIANT] = Engine.KEY_PARAM_VARIANT;
mCachedParams[Engine.PARAM_POSITION_STREAM] = Engine.KEY_PARAM_STREAM;
mCachedParams[Engine.PARAM_POSITION_UTTERANCE_ID] = Engine.KEY_PARAM_UTTERANCE_ID;
mCachedParams[Engine.TTS_PARAM_POSITION_RATE + 1] =
String.valueOf(Engine.FALLBACK_TTS_DEFAULT_RATE);
mCachedParams[Engine.PARAM_POSITION_RATE + 1] =
String.valueOf(Engine.DEFAULT_RATE);
// initialize the language cached parameters with the current Locale
Locale defaultLoc = Locale.getDefault();
mCachedParams[Engine.TTS_PARAM_POSITION_LANGUAGE + 1] = defaultLoc.getISO3Language();
mCachedParams[Engine.TTS_PARAM_POSITION_COUNTRY + 1] = defaultLoc.getISO3Country();
mCachedParams[Engine.TTS_PARAM_POSITION_VARIANT + 1] = defaultLoc.getVariant();
mCachedParams[Engine.PARAM_POSITION_LANGUAGE + 1] = defaultLoc.getISO3Language();
mCachedParams[Engine.PARAM_POSITION_COUNTRY + 1] = defaultLoc.getISO3Country();
mCachedParams[Engine.PARAM_POSITION_VARIANT + 1] = defaultLoc.getVariant();
mCachedParams[Engine.TTS_PARAM_POSITION_STREAM + 1] =
String.valueOf(Engine.TTS_DEFAULT_STREAM);
mCachedParams[Engine.TTS_PARAM_POSITION_UTTERANCE_ID + 1] = "";
mCachedParams[Engine.PARAM_POSITION_STREAM + 1] =
String.valueOf(Engine.DEFAULT_STREAM);
mCachedParams[Engine.PARAM_POSITION_UTTERANCE_ID + 1] = "";
initTts();
}
@@ -308,7 +360,7 @@ public class TextToSpeech {
mStarted = true;
if (mInitListener != null) {
// TODO manage failures and missing resources
mInitListener.onInit(TTS_SUCCESS);
mInitListener.onInit(SUCCESS);
}
}
}
@@ -349,8 +401,7 @@ public class TextToSpeech {
/**
* Adds a mapping between a string of text and a sound resource in a
* package.
*
* @see #TTS.speak(String text, int queueMode, String[] params)
* @see #speak(String, int, HashMap)
*
* @param text
* Example: <b><code>"south_south_east"</code></b><br/>
@@ -371,16 +422,16 @@ public class TextToSpeech {
* @param resourceId
* Example: <b><code>R.raw.south_south_east</code></b>
*
* @return Code indicating success or failure. See TTS_ERROR and TTS_SUCCESS.
* @return Code indicating success or failure. See {@link #ERROR} and {@link #SUCCESS}.
*/
public int addSpeech(String text, String packagename, int resourceId) {
synchronized(mStartLock) {
if (!mStarted) {
return TTS_ERROR;
return ERROR;
}
try {
mITts.addSpeech(mPackageName, text, packagename, resourceId);
return TTS_SUCCESS;
return SUCCESS;
} catch (RemoteException e) {
// TTS died; restart it.
Log.e("TextToSpeech.java - addSpeech", "RemoteException");
@@ -400,7 +451,7 @@ public class TextToSpeech {
mStarted = false;
initTts();
}
return TTS_ERROR;
return ERROR;
}
}
@@ -415,16 +466,16 @@ public class TextToSpeech {
* The full path to the sound file (for example:
* "/sdcard/mysounds/hello.wav")
*
* @return Code indicating success or failure. See TTS_ERROR and TTS_SUCCESS.
* @return Code indicating success or failure. See {@link #ERROR} and {@link #SUCCESS}.
*/
public int addSpeech(String text, String filename) {
synchronized (mStartLock) {
if (!mStarted) {
return TTS_ERROR;
return ERROR;
}
try {
mITts.addSpeechFile(mPackageName, text, filename);
return TTS_SUCCESS;
return SUCCESS;
} catch (RemoteException e) {
// TTS died; restart it.
Log.e("TextToSpeech.java - addSpeech", "RemoteException");
@@ -444,7 +495,7 @@ public class TextToSpeech {
mStarted = false;
initTts();
}
return TTS_ERROR;
return ERROR;
}
}
@@ -453,7 +504,7 @@ public class TextToSpeech {
* Adds a mapping between a string of text and a sound resource in a
* package.
*
* @see #TTS.playEarcon(String earcon, int queueMode, String[] params)
* @see #playEarcon(String, int, HashMap)
*
* @param earcon The name of the earcon
* Example: <b><code>"[tick]"</code></b><br/>
@@ -474,16 +525,16 @@ public class TextToSpeech {
* @param resourceId
* Example: <b><code>R.raw.tick_snd</code></b>
*
* @return Code indicating success or failure. See TTS_ERROR and TTS_SUCCESS.
* @return Code indicating success or failure. See {@link #ERROR} and {@link #SUCCESS}.
*/
public int addEarcon(String earcon, String packagename, int resourceId) {
synchronized(mStartLock) {
if (!mStarted) {
return TTS_ERROR;
return ERROR;
}
try {
mITts.addEarcon(mPackageName, earcon, packagename, resourceId);
return TTS_SUCCESS;
return SUCCESS;
} catch (RemoteException e) {
// TTS died; restart it.
Log.e("TextToSpeech.java - addEarcon", "RemoteException");
@@ -503,7 +554,7 @@ public class TextToSpeech {
mStarted = false;
initTts();
}
return TTS_ERROR;
return ERROR;
}
}
@@ -518,16 +569,16 @@ public class TextToSpeech {
* The full path to the sound file (for example:
* "/sdcard/mysounds/tick.wav")
*
* @return Code indicating success or failure. See TTS_ERROR and TTS_SUCCESS.
* @return Code indicating success or failure. See {@link #ERROR} and {@link #SUCCESS}.
*/
public int addEarcon(String earcon, String filename) {
synchronized (mStartLock) {
if (!mStarted) {
return TTS_ERROR;
return ERROR;
}
try {
mITts.addEarconFile(mPackageName, earcon, filename);
return TTS_SUCCESS;
return SUCCESS;
} catch (RemoteException e) {
// TTS died; restart it.
Log.e("TextToSpeech.java - addEarcon", "RemoteException");
@@ -547,7 +598,7 @@ public class TextToSpeech {
mStarted = false;
initTts();
}
return TTS_ERROR;
return ERROR;
}
}
@@ -563,29 +614,29 @@ public class TextToSpeech {
* The string of text to be spoken.
* @param queueMode
* The queuing strategy to use.
* See TTS_QUEUE_ADD and TTS_QUEUE_FLUSH.
* See QUEUE_ADD and QUEUE_FLUSH.
* @param params
* The hashmap of speech parameters to be used.
*
* @return Code indicating success or failure. See TTS_ERROR and TTS_SUCCESS.
* @return Code indicating success or failure. See {@link #ERROR} and {@link #SUCCESS}.
*/
public int speak(String text, int queueMode, HashMap<String,String> params)
{
synchronized (mStartLock) {
int result = TTS_ERROR;
int result = ERROR;
Log.i("TTS received: ", text);
if (!mStarted) {
return result;
}
try {
if ((params != null) && (!params.isEmpty())) {
String extra = params.get(Engine.TTS_KEY_PARAM_STREAM);
String extra = params.get(Engine.KEY_PARAM_STREAM);
if (extra != null) {
mCachedParams[Engine.TTS_PARAM_POSITION_STREAM + 1] = extra;
mCachedParams[Engine.PARAM_POSITION_STREAM + 1] = extra;
}
extra = params.get(Engine.TTS_KEY_PARAM_UTTERANCE_ID);
extra = params.get(Engine.KEY_PARAM_UTTERANCE_ID);
if (extra != null) {
mCachedParams[Engine.TTS_PARAM_POSITION_UTTERANCE_ID + 1] = extra;
mCachedParams[Engine.PARAM_POSITION_UTTERANCE_ID + 1] = extra;
}
}
result = mITts.speak(mPackageName, text, queueMode, mCachedParams);
@@ -621,28 +672,28 @@ public class TextToSpeech {
* @param earcon
* The earcon that should be played
* @param queueMode
* See TTS_QUEUE_ADD and TTS_QUEUE_FLUSH.
* See QUEUE_ADD and QUEUE_FLUSH.
* @param params
* The hashmap of parameters to be used.
*
* @return Code indicating success or failure. See TTS_ERROR and TTS_SUCCESS.
* @return Code indicating success or failure. See {@link #ERROR} and {@link #SUCCESS}.
*/
public int playEarcon(String earcon, int queueMode,
HashMap<String,String> params) {
synchronized (mStartLock) {
int result = TTS_ERROR;
int result = ERROR;
if (!mStarted) {
return result;
}
try {
if ((params != null) && (!params.isEmpty())) {
String extra = params.get(Engine.TTS_KEY_PARAM_STREAM);
String extra = params.get(Engine.KEY_PARAM_STREAM);
if (extra != null) {
mCachedParams[Engine.TTS_PARAM_POSITION_STREAM + 1] = extra;
mCachedParams[Engine.PARAM_POSITION_STREAM + 1] = extra;
}
extra = params.get(Engine.TTS_KEY_PARAM_UTTERANCE_ID);
extra = params.get(Engine.KEY_PARAM_UTTERANCE_ID);
if (extra != null) {
mCachedParams[Engine.TTS_PARAM_POSITION_UTTERANCE_ID + 1] = extra;
mCachedParams[Engine.PARAM_POSITION_UTTERANCE_ID + 1] = extra;
}
}
result = mITts.playEarcon(mPackageName, earcon, queueMode, null);
@@ -678,21 +729,21 @@ public class TextToSpeech {
* @param durationInMs
* A long that indicates how long the silence should last.
* @param queueMode
* See TTS_QUEUE_ADD and TTS_QUEUE_FLUSH.
* See QUEUE_ADD and QUEUE_FLUSH.
*
* @return Code indicating success or failure. See TTS_ERROR and TTS_SUCCESS.
* @return Code indicating success or failure. See {@link #ERROR} and {@link #SUCCESS}.
*/
public int playSilence(long durationInMs, int queueMode, HashMap<String,String> params) {
synchronized (mStartLock) {
int result = TTS_ERROR;
int result = ERROR;
if (!mStarted) {
return result;
}
try {
if ((params != null) && (!params.isEmpty())) {
String extra = params.get(Engine.TTS_KEY_PARAM_UTTERANCE_ID);
String extra = params.get(Engine.KEY_PARAM_UTTERANCE_ID);
if (extra != null) {
mCachedParams[Engine.TTS_PARAM_POSITION_UTTERANCE_ID + 1] = extra;
mCachedParams[Engine.PARAM_POSITION_UTTERANCE_ID + 1] = extra;
}
}
result = mITts.playSilence(mPackageName, durationInMs, queueMode, mCachedParams);
@@ -760,11 +811,11 @@ public class TextToSpeech {
/**
* Stops speech from the TTS.
*
* @return Code indicating success or failure. See TTS_ERROR and TTS_SUCCESS.
* @return Code indicating success or failure. See {@link #ERROR} and {@link #SUCCESS}.
*/
public int stop() {
synchronized (mStartLock) {
int result = TTS_ERROR;
int result = ERROR;
if (!mStarted) {
return result;
}
@@ -808,24 +859,24 @@ public class TextToSpeech {
* lower values slow down the speech (0.5 is half the normal speech rate),
* greater values accelerate it (2 is twice the normal speech rate).
*
* @return Code indicating success or failure. See TTS_ERROR and TTS_SUCCESS.
* @return Code indicating success or failure. See {@link #ERROR} and {@link #SUCCESS}.
*/
public int setSpeechRate(float speechRate) {
synchronized (mStartLock) {
int result = TTS_ERROR;
int result = ERROR;
if (!mStarted) {
return result;
}
try {
if (speechRate > 0) {
int rate = (int)(speechRate*100);
mCachedParams[Engine.TTS_PARAM_POSITION_RATE + 1] = String.valueOf(rate);
mCachedParams[Engine.PARAM_POSITION_RATE + 1] = String.valueOf(rate);
// the rate is not set here, instead it is cached so it will be associated
// with all upcoming utterances.
if (speechRate > 0.0f) {
result = TTS_SUCCESS;
result = SUCCESS;
} else {
result = TTS_ERROR;
result = ERROR;
}
}
} catch (NullPointerException e) {
@@ -860,11 +911,11 @@ public class TextToSpeech {
* lower values lower the tone of the synthesized voice,
* greater values increase it.
*
* @return Code indicating success or failure. See TTS_ERROR and TTS_SUCCESS.
* @return Code indicating success or failure. See {@link #ERROR} and {@link #SUCCESS}.
*/
public int setPitch(float pitch) {
synchronized (mStartLock) {
int result = TTS_ERROR;
int result = ERROR;
if (!mStarted) {
return result;
}
@@ -907,27 +958,27 @@ public class TextToSpeech {
* @param loc
* The locale describing the language to be used.
*
* @return code indicating the support status for the locale. See {@link #TTS_LANG_AVAILABLE},
* {@link #TTS_LANG_COUNTRY_AVAILABLE}, {@link #TTS_LANG_COUNTRY_VAR_AVAILABLE},
* {@link #TTS_LANG_MISSING_DATA} and {@link #TTS_LANG_NOT_SUPPORTED}.
* @return code indicating the support status for the locale. See {@link #LANG_AVAILABLE},
* {@link #LANG_COUNTRY_AVAILABLE}, {@link #LANG_COUNTRY_VAR_AVAILABLE},
* {@link #LANG_MISSING_DATA} and {@link #LANG_NOT_SUPPORTED}.
*/
public int setLanguage(Locale loc) {
synchronized (mStartLock) {
int result = TTS_LANG_NOT_SUPPORTED;
int result = LANG_NOT_SUPPORTED;
if (!mStarted) {
return result;
}
try {
mCachedParams[Engine.TTS_PARAM_POSITION_LANGUAGE + 1] = loc.getISO3Language();
mCachedParams[Engine.TTS_PARAM_POSITION_COUNTRY + 1] = loc.getISO3Country();
mCachedParams[Engine.TTS_PARAM_POSITION_VARIANT + 1] = loc.getVariant();
mCachedParams[Engine.PARAM_POSITION_LANGUAGE + 1] = loc.getISO3Language();
mCachedParams[Engine.PARAM_POSITION_COUNTRY + 1] = loc.getISO3Country();
mCachedParams[Engine.PARAM_POSITION_VARIANT + 1] = loc.getVariant();
// the language is not set here, instead it is cached so it will be associated
// with all upcoming utterances. But we still need to report the language support,
// which is achieved by calling isLanguageAvailable()
result = mITts.isLanguageAvailable(
mCachedParams[Engine.TTS_PARAM_POSITION_LANGUAGE + 1],
mCachedParams[Engine.TTS_PARAM_POSITION_COUNTRY + 1],
mCachedParams[Engine.TTS_PARAM_POSITION_VARIANT + 1] );
mCachedParams[Engine.PARAM_POSITION_LANGUAGE + 1],
mCachedParams[Engine.PARAM_POSITION_COUNTRY + 1],
mCachedParams[Engine.PARAM_POSITION_VARIANT + 1] );
} catch (RemoteException e) {
// TTS died; restart it.
Log.e("TextToSpeech.java - setLanguage", "RemoteException");
@@ -999,13 +1050,13 @@ public class TextToSpeech {
* @param loc
* The Locale describing the language to be used.
*
* @return code indicating the support status for the locale. See {@link #TTS_LANG_AVAILABLE},
* {@link #TTS_LANG_COUNTRY_AVAILABLE}, {@link #TTS_LANG_COUNTRY_VAR_AVAILABLE},
* {@link #TTS_LANG_MISSING_DATA} and {@link #TTS_LANG_NOT_SUPPORTED}.
* @return code indicating the support status for the locale. See {@link #LANG_AVAILABLE},
* {@link #LANG_COUNTRY_AVAILABLE}, {@link #LANG_COUNTRY_VAR_AVAILABLE},
* {@link #LANG_MISSING_DATA} and {@link #LANG_NOT_SUPPORTED}.
*/
public int isLanguageAvailable(Locale loc) {
synchronized (mStartLock) {
int result = TTS_LANG_NOT_SUPPORTED;
int result = LANG_NOT_SUPPORTED;
if (!mStarted) {
return result;
}
@@ -1048,25 +1099,25 @@ public class TextToSpeech {
* The string that gives the full output filename; it should be
* something like "/sdcard/myappsounds/mysound.wav".
*
* @return Code indicating success or failure. See TTS_ERROR and TTS_SUCCESS.
* @return Code indicating success or failure. See {@link #ERROR} and {@link #SUCCESS}.
*/
public int synthesizeToFile(String text, HashMap<String,String> params,
String filename) {
synchronized (mStartLock) {
int result = TTS_ERROR;
int result = ERROR;
if (!mStarted) {
return result;
}
try {
if ((params != null) && (!params.isEmpty())) {
// no need to read the stream type here
String extra = params.get(Engine.TTS_KEY_PARAM_UTTERANCE_ID);
String extra = params.get(Engine.KEY_PARAM_UTTERANCE_ID);
if (extra != null) {
mCachedParams[Engine.TTS_PARAM_POSITION_UTTERANCE_ID + 1] = extra;
mCachedParams[Engine.PARAM_POSITION_UTTERANCE_ID + 1] = extra;
}
}
if (mITts.synthesizeToFile(mPackageName, text, mCachedParams, filename)){
result = TTS_SUCCESS;
result = SUCCESS;
}
} catch (RemoteException e) {
// TTS died; restart it.
@@ -1099,9 +1150,9 @@ public class TextToSpeech {
* if they are not persistent between calls to the service.
*/
private void resetCachedParams() {
mCachedParams[Engine.TTS_PARAM_POSITION_STREAM + 1] =
String.valueOf(Engine.TTS_DEFAULT_STREAM);
mCachedParams[Engine.TTS_PARAM_POSITION_UTTERANCE_ID+ 1] = "";
mCachedParams[Engine.PARAM_POSITION_STREAM + 1] =
String.valueOf(Engine.DEFAULT_STREAM);
mCachedParams[Engine.PARAM_POSITION_UTTERANCE_ID+ 1] = "";
}
/**
@@ -1110,12 +1161,12 @@ public class TextToSpeech {
* @param listener
* The OnUtteranceCompletedListener
*
* @return Code indicating success or failure. See TTS_ERROR and TTS_SUCCESS.
* @return Code indicating success or failure. See {@link #ERROR} and {@link #SUCCESS}.
*/
public int setOnUtteranceCompletedListener(
final OnUtteranceCompletedListener listener) {
synchronized (mStartLock) {
int result = TTS_ERROR;
int result = ERROR;
if (!mStarted) {
return result;
}

View File

@@ -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 );
}
@@ -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);
}
@@ -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);
@@ -355,7 +355,7 @@ public class TtsService extends Service implements OnCompletionListener {
if (!mIsSpeaking) {
processSpeechQueue();
}
return TextToSpeech.TTS_SUCCESS;
return TextToSpeech.SUCCESS;
}
/**
@@ -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);
@@ -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 =
@@ -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");
}
@@ -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 =
@@ -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");
}
@@ -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);
}
}
@@ -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) {
@@ -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);
}
}
@@ -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));
@@ -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);
}
}
@@ -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);
}
@@ -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) {
@@ -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;
}
/**