am 4bc95d19: Merge change Iab089078 into eclair-mr2

Merge commit '4bc95d19c9ccf9cfe4c51b1e697db8cc1d86a579' into eclair-mr2-plus-aosp

* commit '4bc95d19c9ccf9cfe4c51b1e697db8cc1d86a579':
  Fix for a race condition that can occur if an utterance
This commit is contained in:
Charles Chen
2009-12-22 17:42:25 -08:00
committed by Android Git Automerger

View File

@@ -596,22 +596,27 @@ public class TtsService extends Service implements OnCompletionListener {
}
}
public void onCompletion(MediaPlayer arg0) {
String callingApp = mCurrentSpeechItem.mCallingApp;
ArrayList<String> params = mCurrentSpeechItem.mParams;
String utteranceId = "";
if (params != null){
for (int i = 0; i < params.size() - 1; i = i + 2){
String param = params.get(i);
if (param.equals(TextToSpeech.Engine.KEY_PARAM_UTTERANCE_ID)){
utteranceId = params.get(i+1);
}
}
}
if (utteranceId.length() > 0){
dispatchUtteranceCompletedCallback(utteranceId, callingApp);
}
processSpeechQueue();
public void onCompletion(MediaPlayer arg0) {
// mCurrentSpeechItem may become null if it is stopped at the same
// time it completes.
SpeechItem currentSpeechItemCopy = mCurrentSpeechItem;
if (currentSpeechItemCopy != null) {
String callingApp = currentSpeechItemCopy.mCallingApp;
ArrayList<String> params = currentSpeechItemCopy.mParams;
String utteranceId = "";
if (params != null) {
for (int i = 0; i < params.size() - 1; i = i + 2) {
String param = params.get(i);
if (param.equals(TextToSpeech.Engine.KEY_PARAM_UTTERANCE_ID)) {
utteranceId = params.get(i + 1);
}
}
}
if (utteranceId.length() > 0) {
dispatchUtteranceCompletedCallback(utteranceId, callingApp);
}
}
processSpeechQueue();
}
private int playSilence(String callingApp, long duration, int queueMode,