Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 4bc95d19 authored by Android (Google) Code Review's avatar Android (Google) Code Review
Browse files

Merge change Iab089078 into eclair-mr2

* changes:
  Fix for a race condition that can occur if an utterance is stopped right when it completes.
parents 484d2888 ab089078
Loading
Loading
Loading
Loading
+21 −16
Original line number Diff line number Diff line
@@ -597,8 +597,12 @@ public class TtsService extends Service implements OnCompletionListener {
    }

    public void onCompletion(MediaPlayer arg0) {
        String callingApp = mCurrentSpeechItem.mCallingApp;
        ArrayList<String> params = mCurrentSpeechItem.mParams;
        // 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) {
@@ -611,6 +615,7 @@ public class TtsService extends Service implements OnCompletionListener {
            if (utteranceId.length() > 0) {
                dispatchUtteranceCompletedCallback(utteranceId, callingApp);
            }
        }
        processSpeechQueue();
    }