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

Commit 2d940bcb authored by Przemyslaw Szczepaniak's avatar Przemyslaw Szczepaniak Committed by Android (Google) Code Review
Browse files

Make TTS input string limit public and documented.

TTS input limit is now publicly available from getMaxSpeechInputLength()
static method.

Bug: 7456118
Change-Id: Ib2afbb7202ad9dc15895f322fbd1480a5f1f7278
parent fdb36725
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -20547,6 +20547,7 @@ package android.speech.tts {
    method public java.util.List<android.speech.tts.TextToSpeech.EngineInfo> getEngines();
    method public java.util.Set<java.lang.String> getFeatures(java.util.Locale);
    method public java.util.Locale getLanguage();
    method public static int getMaxSpeechInputLength();
    method public int isLanguageAvailable(java.util.Locale);
    method public boolean isSpeaking();
    method public int playEarcon(java.lang.String, int, java.util.HashMap<java.lang.String, java.lang.String>);
+13 −2
Original line number Diff line number Diff line
@@ -802,7 +802,8 @@ public class TextToSpeech {
     * {@link #setOnUtteranceProgressListener}) and using the
     * {@link Engine#KEY_PARAM_UTTERANCE_ID} parameter.
     *
     * @param text The string of text to be spoken.
     * @param text The string of text to be spoken. No longer than
     *            {@link #getMaxSpeechInputLength()} characters.
     * @param queueMode The queuing strategy to use, {@link #QUEUE_ADD} or {@link #QUEUE_FLUSH}.
     * @param params Parameters for the request. Can be null.
     *            Supported parameter names:
@@ -1124,7 +1125,8 @@ public class TextToSpeech {
     * {@link #setOnUtteranceProgressListener}) and using the
     * {@link Engine#KEY_PARAM_UTTERANCE_ID} parameter.
     *
     * @param text The text that should be synthesized
     * @param text The text that should be synthesized. No longer than
     *            {@link #getMaxSpeechInputLength()} characters.
     * @param params Parameters for the request. Can be null.
     *            Supported parameter names:
     *            {@link Engine#KEY_PARAM_UTTERANCE_ID}.
@@ -1483,4 +1485,13 @@ public class TextToSpeech {

    }

    /**
     * Limit of length of input string passed to speak and synthesizeToFile.
     *
     * @see #speak
     * @see #synthesizeToFile
     */
    public static int getMaxSpeechInputLength() {
        return 4000;
    }
}
+2 −2
Original line number Diff line number Diff line
@@ -73,7 +73,7 @@ public abstract class TextToSpeechService extends Service {
    private static final boolean DBG = false;
    private static final String TAG = "TextToSpeechService";

    private static final int MAX_SPEECH_ITEM_CHAR_LENGTH = 4000;

    private static final String SYNTH_THREAD_NAME = "SynthThread";

    private SynthHandler mSynthHandler;
@@ -576,7 +576,7 @@ public abstract class TextToSpeechService extends Service {
                Log.e(TAG, "null synthesis text");
                return false;
            }
            if (mText.length() >= MAX_SPEECH_ITEM_CHAR_LENGTH) {
            if (mText.length() >= TextToSpeech.getMaxSpeechInputLength()) {
                Log.w(TAG, "Text too long: " + mText.length() + " chars");
                return false;
            }