Loading api/current.txt +1 −0 Original line number Diff line number Diff line Loading @@ -26522,6 +26522,7 @@ package android.speech.tts { } public static final class TextToSpeechClient.EngineStatus { method public java.util.Locale getDefaultLocale(); method public java.lang.String getEnginePackage(); method public java.util.List<android.speech.tts.VoiceInfo> getVoices(); } core/java/android/speech/tts/RequestConfigHelper.java +7 −5 Original line number Diff line number Diff line Loading @@ -46,7 +46,8 @@ public final class RequestConfigHelper { /** * Score positively voices that exactly match the given locale * @param locale Reference locale. If null, the default locale will be used. * @param locale Reference locale. If null, the system default locale for the * current user will be used ({@link Locale#getDefault()}). */ public ExactLocaleMatcher(Locale locale) { if (locale == null) { Loading @@ -70,7 +71,8 @@ public final class RequestConfigHelper { /** * Score positively voices with similar locale. * @param locale Reference locale. If null, default will be used. * @param locale Reference locale. If null, the system default locale for the * current user will be used ({@link Locale#getDefault()}). */ public LanguageMatcher(Locale locale) { if (locale == null) { Loading Loading @@ -164,10 +166,10 @@ public final class RequestConfigHelper { } /** * Get highest quality voice for the default locale. * Get highest quality voice for the TTS default locale. * * Call {@link #highestQuality(EngineStatus, boolean, VoiceScorer)} with * {@link LanguageMatcher} set to device default locale. * {@link LanguageMatcher} set to the {@link EngineStatus#getDefaultLocale()}. * * @param engineStatus * Voices status received from a {@link TextToSpeechClient#getEngineStatus()} call. Loading @@ -179,7 +181,7 @@ public final class RequestConfigHelper { public static RequestConfig highestQuality(EngineStatus engineStatus, boolean hasToBeEmbedded) { return highestQuality(engineStatus, hasToBeEmbedded, new LanguageMatcher(Locale.getDefault())); new LanguageMatcher(engineStatus.getDefaultLocale())); } } core/java/android/speech/tts/SynthesisRequestV2.java +1 −3 Original line number Diff line number Diff line Loading @@ -167,9 +167,7 @@ public final class SynthesisRequestV2 implements Parcelable { } }; /** * @hide */ /** @hide */ @Override public int describeContents() { return 0; Loading core/java/android/speech/tts/TextToSpeechClient.java +22 −3 Original line number Diff line number Diff line Loading @@ -42,6 +42,7 @@ import java.io.IOException; import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Locale; import java.util.concurrent.atomic.AtomicInteger; /** Loading Loading @@ -357,9 +358,13 @@ public class TextToSpeechClient { /** Name of the TTS engine package */ private final String mPackageName; private EngineStatus(String packageName, List<VoiceInfo> voices) { /** Engine default locale */ private final Locale mDefaultLocale; private EngineStatus(String packageName, List<VoiceInfo> voices, Locale defaultLocale) { this.mVoices = Collections.unmodifiableList(voices); this.mPackageName = packageName; this.mDefaultLocale = defaultLocale; } /** Loading @@ -375,6 +380,16 @@ public class TextToSpeechClient { public String getEnginePackage() { return mPackageName; } /** * Get the default locale to use for TTS with this TTS engine. * Unless the user changed the TTS settings for this engine, the value returned should be * the same as the system default locale for the current user * ({@link Locale#getDefault()}). */ public Locale getDefaultLocale() { return mDefaultLocale; } } /** Unique synthesis request identifier. */ Loading Loading @@ -638,7 +653,9 @@ public class TextToSpeechClient { return null; } return new EngineStatus(mServiceConnection.getEngineName(), voices); return new EngineStatus(mServiceConnection.getEngineName(), voices, mEnginesHelper.getLocalePrefForEngine( mServiceConnection.getEngineName())); } private class Connection implements ServiceConnection { Loading Loading @@ -696,7 +713,9 @@ public class TextToSpeechClient { public void onVoicesInfoChange(List<VoiceInfo> voicesInfo) { synchronized (mLock) { mEngineStatus = new EngineStatus(mServiceConnection.getEngineName(), voicesInfo); voicesInfo, mEnginesHelper.getLocalePrefForEngine( mServiceConnection.getEngineName())); mMainHandler.obtainMessage(InternalHandler.WHAT_ENGINE_STATUS_CHANGED, mEngineStatus).sendToTarget(); } Loading core/java/android/speech/tts/TextToSpeechService.java +2 −2 Original line number Diff line number Diff line Loading @@ -460,8 +460,8 @@ public abstract class TextToSpeechService extends Service { } private String[] getSettingsLocale() { final String locale = mEngineHelper.getLocalePrefForEngine(mPackageName); return TtsEngines.parseLocalePref(locale); final Locale locale = mEngineHelper.getLocalePrefForEngine(mPackageName); return TtsEngines.toOldLocaleStringFormat(locale); } private int getSecureSettingInt(String name, int defaultValue) { Loading Loading
api/current.txt +1 −0 Original line number Diff line number Diff line Loading @@ -26522,6 +26522,7 @@ package android.speech.tts { } public static final class TextToSpeechClient.EngineStatus { method public java.util.Locale getDefaultLocale(); method public java.lang.String getEnginePackage(); method public java.util.List<android.speech.tts.VoiceInfo> getVoices(); }
core/java/android/speech/tts/RequestConfigHelper.java +7 −5 Original line number Diff line number Diff line Loading @@ -46,7 +46,8 @@ public final class RequestConfigHelper { /** * Score positively voices that exactly match the given locale * @param locale Reference locale. If null, the default locale will be used. * @param locale Reference locale. If null, the system default locale for the * current user will be used ({@link Locale#getDefault()}). */ public ExactLocaleMatcher(Locale locale) { if (locale == null) { Loading @@ -70,7 +71,8 @@ public final class RequestConfigHelper { /** * Score positively voices with similar locale. * @param locale Reference locale. If null, default will be used. * @param locale Reference locale. If null, the system default locale for the * current user will be used ({@link Locale#getDefault()}). */ public LanguageMatcher(Locale locale) { if (locale == null) { Loading Loading @@ -164,10 +166,10 @@ public final class RequestConfigHelper { } /** * Get highest quality voice for the default locale. * Get highest quality voice for the TTS default locale. * * Call {@link #highestQuality(EngineStatus, boolean, VoiceScorer)} with * {@link LanguageMatcher} set to device default locale. * {@link LanguageMatcher} set to the {@link EngineStatus#getDefaultLocale()}. * * @param engineStatus * Voices status received from a {@link TextToSpeechClient#getEngineStatus()} call. Loading @@ -179,7 +181,7 @@ public final class RequestConfigHelper { public static RequestConfig highestQuality(EngineStatus engineStatus, boolean hasToBeEmbedded) { return highestQuality(engineStatus, hasToBeEmbedded, new LanguageMatcher(Locale.getDefault())); new LanguageMatcher(engineStatus.getDefaultLocale())); } }
core/java/android/speech/tts/SynthesisRequestV2.java +1 −3 Original line number Diff line number Diff line Loading @@ -167,9 +167,7 @@ public final class SynthesisRequestV2 implements Parcelable { } }; /** * @hide */ /** @hide */ @Override public int describeContents() { return 0; Loading
core/java/android/speech/tts/TextToSpeechClient.java +22 −3 Original line number Diff line number Diff line Loading @@ -42,6 +42,7 @@ import java.io.IOException; import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Locale; import java.util.concurrent.atomic.AtomicInteger; /** Loading Loading @@ -357,9 +358,13 @@ public class TextToSpeechClient { /** Name of the TTS engine package */ private final String mPackageName; private EngineStatus(String packageName, List<VoiceInfo> voices) { /** Engine default locale */ private final Locale mDefaultLocale; private EngineStatus(String packageName, List<VoiceInfo> voices, Locale defaultLocale) { this.mVoices = Collections.unmodifiableList(voices); this.mPackageName = packageName; this.mDefaultLocale = defaultLocale; } /** Loading @@ -375,6 +380,16 @@ public class TextToSpeechClient { public String getEnginePackage() { return mPackageName; } /** * Get the default locale to use for TTS with this TTS engine. * Unless the user changed the TTS settings for this engine, the value returned should be * the same as the system default locale for the current user * ({@link Locale#getDefault()}). */ public Locale getDefaultLocale() { return mDefaultLocale; } } /** Unique synthesis request identifier. */ Loading Loading @@ -638,7 +653,9 @@ public class TextToSpeechClient { return null; } return new EngineStatus(mServiceConnection.getEngineName(), voices); return new EngineStatus(mServiceConnection.getEngineName(), voices, mEnginesHelper.getLocalePrefForEngine( mServiceConnection.getEngineName())); } private class Connection implements ServiceConnection { Loading Loading @@ -696,7 +713,9 @@ public class TextToSpeechClient { public void onVoicesInfoChange(List<VoiceInfo> voicesInfo) { synchronized (mLock) { mEngineStatus = new EngineStatus(mServiceConnection.getEngineName(), voicesInfo); voicesInfo, mEnginesHelper.getLocalePrefForEngine( mServiceConnection.getEngineName())); mMainHandler.obtainMessage(InternalHandler.WHAT_ENGINE_STATUS_CHANGED, mEngineStatus).sendToTarget(); } Loading
core/java/android/speech/tts/TextToSpeechService.java +2 −2 Original line number Diff line number Diff line Loading @@ -460,8 +460,8 @@ public abstract class TextToSpeechService extends Service { } private String[] getSettingsLocale() { final String locale = mEngineHelper.getLocalePrefForEngine(mPackageName); return TtsEngines.parseLocalePref(locale); final Locale locale = mEngineHelper.getLocalePrefForEngine(mPackageName); return TtsEngines.toOldLocaleStringFormat(locale); } private int getSecureSettingInt(String name, int defaultValue) { Loading