Merge change Iab089078 into eclair-mr2
* changes: Fix for a race condition that can occur if an utterance is stopped right when it completes.
This commit is contained in:
@@ -597,19 +597,24 @@ 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.
|
||||||
String utteranceId = "";
|
SpeechItem currentSpeechItemCopy = mCurrentSpeechItem;
|
||||||
if (params != null){
|
if (currentSpeechItemCopy != null) {
|
||||||
for (int i = 0; i < params.size() - 1; i = i + 2){
|
String callingApp = currentSpeechItemCopy.mCallingApp;
|
||||||
String param = params.get(i);
|
ArrayList<String> params = currentSpeechItemCopy.mParams;
|
||||||
if (param.equals(TextToSpeech.Engine.KEY_PARAM_UTTERANCE_ID)){
|
String utteranceId = "";
|
||||||
utteranceId = params.get(i+1);
|
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) {
|
||||||
if (utteranceId.length() > 0){
|
dispatchUtteranceCompletedCallback(utteranceId, callingApp);
|
||||||
dispatchUtteranceCompletedCallback(utteranceId, callingApp);
|
}
|
||||||
}
|
}
|
||||||
processSpeechQueue();
|
processSpeechQueue();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user