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

Commit f564ed87 authored by Narayan Kamath's avatar Narayan Kamath Committed by Android (Google) Code Review
Browse files

Merge "Improve TextToSpeech#isSpeaking()"

parents 3bfa72b1 c34f76fe
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -103,6 +103,14 @@ class AudioPlaybackHandler {
        stop(getCurrentParams());
    }

    /**
     * @return false iff the queue is empty and no queue item is currently
     *        being handled, true otherwise.
     */
    public boolean isSpeaking() {
        return (mQueue.peek() != null) || (mCurrentParams != null);
    }

    /**
     * Shut down the audio playback thread.
     */
+9 −1
Original line number Diff line number Diff line
@@ -109,6 +109,11 @@ public class TextToSpeech {
    /**
     * Broadcast Action: The TextToSpeech synthesizer has completed processing
     * of all the text in the speech queue.
     *
     * Note that this notifies callers when the <b>engine</b> has finished has
     * processing text data. Audio playback might not have completed (or even started)
     * at this point. If you wish to be notified when this happens, see
     * {@link OnUtteranceCompletedListener}.
     */
    @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
    public static final String ACTION_TTS_QUEUE_PROCESSING_COMPLETED =
@@ -796,7 +801,10 @@ public class TextToSpeech {
    }

    /**
     * Checks whether the TTS engine is busy speaking.
     * Checks whether the TTS engine is busy speaking. Note that a speech item is
     * considered complete once it's audio data has been sent to the audio mixer, or
     * written to a file. There might be a finite lag between this point, and when
     * the audio hardware completes playback.
     *
     * @return {@code true} if the TTS engine is speaking.
     */
+1 −1
Original line number Diff line number Diff line
@@ -719,7 +719,7 @@ public abstract class TextToSpeechService extends Service {
        }

        public boolean isSpeaking() {
            return mSynthHandler.isSpeaking();
            return mSynthHandler.isSpeaking() || mAudioPlaybackHandler.isSpeaking();
        }

        public int stop(String callingApp) {