diff options
author | Przemyslaw Szczepaniak <pszczepaniak@google.com> | 2014-05-12 15:21:52 +0100 |
---|---|---|
committer | Przemyslaw Szczepaniak <pszczepaniak@google.com> | 2014-05-12 16:07:31 +0100 |
commit | de1b5ae7a7567f03cfeecf1a62ddf429cb840474 (patch) | |
tree | 8c5ef4b7f4575bbdd7564e0356b34b4b5f1309e6 /core/java/android/speech | |
parent | c8d31963d6af81465de9801e6a88ebcbf862da35 (diff) | |
download | frameworks_base-de1b5ae7a7567f03cfeecf1a62ddf429cb840474.zip frameworks_base-de1b5ae7a7567f03cfeecf1a62ddf429cb840474.tar.gz frameworks_base-de1b5ae7a7567f03cfeecf1a62ddf429cb840474.tar.bz2 |
Add (hidden) TTSEngines#isLocaleSetToDefaultForEngine method.
TTSEngines#isLocaleSetToDefaultForEngine allows the Settings application
to distinguish if the TTS engine locale is blank (set to follow the device
locale) or if it's set to the same value as the device locale.
Change-Id: I462584547d69c21cde4ac317c8a3b3bbc1680cae
Diffstat (limited to 'core/java/android/speech')
-rw-r--r-- | core/java/android/speech/tts/TtsEngines.java | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/core/java/android/speech/tts/TtsEngines.java b/core/java/android/speech/tts/TtsEngines.java index 4f996cd..9b929a3 100644 --- a/core/java/android/speech/tts/TtsEngines.java +++ b/core/java/android/speech/tts/TtsEngines.java @@ -307,6 +307,24 @@ public class TtsEngines { } /** + * True if a given TTS engine uses the default phone locale as a default locale. Attempts to + * read the value from {@link Settings.Secure#TTS_DEFAULT_LOCALE}, failing which the + * old style value from {@link Settings.Secure#TTS_DEFAULT_LANG} is read. If + * both these values are empty, this methods returns true. + * + * @param engineName the engine to return the locale for. + */ + public boolean isLocaleSetToDefaultForEngine(String engineName) { + return (TextUtils.isEmpty(parseEnginePrefFromList( + getString(mContext.getContentResolver(), Settings.Secure.TTS_DEFAULT_LOCALE), + engineName)) && + TextUtils.isEmpty( + Settings.Secure.getString(mContext.getContentResolver(), + Settings.Secure.TTS_DEFAULT_LANG))); + } + + + /** * Parses a locale preference value delimited by {@link #LOCALE_DELIMITER}. * Varies from {@link String#split} in that it will always return an array * of length 3 with non null values. |