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

@@ -597,8 +597,12 @@ public class TtsService extends Service implements OnCompletionListener {
} }
public void onCompletion(MediaPlayer arg0) { public void onCompletion(MediaPlayer arg0) {
String callingApp = mCurrentSpeechItem.mCallingApp; // mCurrentSpeechItem may become null if it is stopped at the same
ArrayList<String> params = mCurrentSpeechItem.mParams; // time it completes.
SpeechItem currentSpeechItemCopy = mCurrentSpeechItem;
if (currentSpeechItemCopy != null) {
String callingApp = currentSpeechItemCopy.mCallingApp;
ArrayList<String> params = currentSpeechItemCopy.mParams;
String utteranceId = ""; String utteranceId = "";
if (params != null) { if (params != null) {
for (int i = 0; i < params.size() - 1; i = i + 2) { for (int i = 0; i < params.size() - 1; i = i + 2) {
@@ -611,6 +615,7 @@ public class TtsService extends Service implements OnCompletionListener {
if (utteranceId.length() > 0) { if (utteranceId.length() > 0) {
dispatchUtteranceCompletedCallback(utteranceId, callingApp); dispatchUtteranceCompletedCallback(utteranceId, callingApp);
} }
}
processSpeechQueue(); processSpeechQueue();
} }