Loading packages/SettingsLib/res/values/strings.xml +109 −0 Original line number Diff line number Diff line Loading @@ -231,4 +231,113 @@ <!-- Launch defaults preference summary with none set [CHAR LIMIT=40] --> <string name="launch_defaults_none">No defaults set</string> <!-- Text-To-Speech (TTS) settings --><skip /> <!-- Name of the TTS package as listed by the package manager. --> <string name="tts_settings">Text-to-speech settings</string> <!-- TTS option item name in the main settings screen --> <string name="tts_settings_title">Text-to-speech output</string> <!-- On main TTS Settings screen, in default settings section, setting default speech rate for synthesized voice --> <string name="tts_default_rate_title">Speech rate</string> <!-- On main TTS Settings screen, summary for default speech rate for synthesized voice --> <string name="tts_default_rate_summary">Speed at which the text is spoken</string> <!-- On main TTS Settings screen, in default settings section, setting default language for synthesized voice --> <string name="tts_default_lang_title">Language</string> <!-- Entry in the TTS engine language/locale picker, when selected will try to default to the system language [CHAR LIMIT=50] --> <string name="tts_lang_use_system">Use system language</string> <!-- On main TTS Settings screen, language summary if it can't default to system language [CHAR LIMIT=50] --> <string name="tts_lang_not_selected">Language not selected</string> <!-- On main TTS Settings screen, summary for default language for synthesized voice --> <string name="tts_default_lang_summary">Sets the language-specific voice for the spoken text</string> <!-- On main TTS Settings screen, triggers playback of an example of speech synthesis --> <string name="tts_play_example_title">Listen to an example</string> <!-- On main TTS Settings screen, summary for triggering playback of an example of speech synthesis --> <string name="tts_play_example_summary">Play a short demonstration of speech synthesis</string> <!-- On main TTS Settings screen, click to install required speech synthesis data --> <string name="tts_install_data_title">Install voice data</string> <!-- On main TTS Settings screen, summary for click to install required speech synthesis data --> <string name="tts_install_data_summary">Install the voice data required for speech synthesis</string> <!-- Warning message about security implications of enabling a TTS engine, displayed as a dialog message when the user selects to enable an engine. --> <string name="tts_engine_security_warning">This speech synthesis engine may be able to collect all the text that will be spoken, including personal data like passwords and credit card numbers. It comes from the <xliff:g id="tts_plugin_engine_name">%s</xliff:g> engine. Enable the use of this speech synthesis engine?</string> <!-- Warning message about required internet conectivity for TTS synthesis, displayed as a dialog message when the user selects to play an example for network only locale and there's no internet connectivity. --> <string name="tts_engine_network_required">This language requires a working network connection for text-to-speech output.</string> <!-- Text spoken by the TTS engine as an example if the engine doesn't provide sample text [CHAR LIMIT=100] --> <string name="tts_default_sample_string">This is an example of speech synthesis</string> <!-- On main TTS Settings screen, title of a field explaining current TTS engine status for current default language [CHAR LIMIT=50] --> <string name="tts_status_title">Default language status</string> <!-- On main TTS Settings screen, current TTS engine status for the current default language, selected language is fully supported by the engine [CHAR LIMIT=150]--> <string name="tts_status_ok"><xliff:g id="locale" example="English (United States)">%1$s</xliff:g> is fully supported</string> <!-- On main TTS Settings screen, current TTS engine status for the current default language, selected language is supported by the engine only if there's a working network connection [CHAR LIMIT=150] --> <string name="tts_status_requires_network"><xliff:g id="locale" example="English (United States)">%1$s</xliff:g> requires network connection</string> <!-- On main TTS Settings screen, current TTS engine status for the current default language, selected language is not supported by the engine [CHAR LIMIT=150] --> <string name="tts_status_not_supported"><xliff:g id="locale" example="English (United States)">%1$s</xliff:g> is not supported</string> <!-- On main TTS Settings screen, current TTS engine status for the current default language, tts engine is queried for status [CHAR LIMIT=150] --> <string name="tts_status_checking">Checking…</string> <!-- Title for a preference in the main TTS settings screen, which launches the settings screen for a given TTS engine when clicked [CHAR LIMIT=30]--> <string name="tts_engine_settings_title">Settings for <xliff:g id="tts_engine_name">%s</xliff:g></string> <!-- [CHAR LIMIT=150] Text for screen readers / accessibility programs for the image that launches the TTS engine settings when clicked. --> <string name="tts_engine_settings_button">Launch engine settings</string> <!-- [CHAR LIMIT=50] The text for the settings section that users to set a preferred text to speech engine --> <string name="tts_engine_preference_section_title">Preferred engine</string> <!-- [CHAR LIMIT=50] Title of the settings section that displays general preferences that are applicable to all engines, such as the speech rate --> <string name="tts_general_section_title">General</string> <!-- Default speech rate choices --> <string-array name="tts_rate_entries"> <item>Very slow</item> <item>Slow</item> <item>Normal</item> <item>Fast</item> <item>Faster</item> <item>Very fast</item> <item>Rapid</item> <item>Very rapid</item> <item>Fastest</item> </string-array> <!-- Do not translate. --> <string-array name="tts_rate_values"> <item>60</item> <item>80</item> <item>100</item> <item>150</item> <item>200</item> <item>250</item> <item>300</item> <item>350</item> <item>400</item> </string-array> <!-- Do not translate. --> <string-array name="tts_demo_strings" translatable="false"> <item>This is an example of speech synthesis in English.</item> <item>Voici un échantillon de synthèse vocale en français.</item> <item>Dies ist ein Beispiel für Sprachsynthese in Deutsch.</item> <item>Questo è un esempio di sintesi vocale in italiano.</item> <item>Este es un ejemplo de síntesis de voz en español.</item> <item>이것은 한국어 음성 합성의 예입니다.</item> </string-array> <!-- Do not translate. --> <string-array name="tts_demo_string_langs" translatable="false"> <item>eng</item> <item>fra</item> <item>deu</item> <item>ita</item> <item>spa</item> <item>kor</item> </string-array> </resources> packages/SettingsLib/src/com/android/settingslib/accessibility/AccessibilityUtils.java +81 −1 Original line number Diff line number Diff line Loading @@ -16,15 +16,20 @@ package com.android.settingslib.accessibility; import android.accessibilityservice.AccessibilityServiceInfo; import android.content.ComponentName; import android.content.Context; import android.content.pm.ResolveInfo; import android.content.res.Configuration; import android.content.res.Resources; import android.provider.Settings; import android.text.TextUtils; import android.util.ArraySet; import android.view.accessibility.AccessibilityManager; import java.util.Collections; import java.util.HashSet; import java.util.List; import java.util.Locale; import java.util.Set; Loading @@ -45,7 +50,7 @@ public class AccessibilityUtils { return Collections.emptySet(); } final Set<ComponentName> enabledServices = new HashSet<ComponentName>(); final Set<ComponentName> enabledServices = new HashSet<>(); final TextUtils.SimpleStringSplitter colonSplitter = sStringColonSplitter; colonSplitter.setString(enabledServicesSetting); Loading @@ -71,4 +76,79 @@ public class AccessibilityUtils { final Context langContext = context.createConfigurationContext(config); return langContext.getText(resId); } public static void setAccessibilityServiceState(Context context, ComponentName toggledService, boolean enabled) { // Parse the enabled services. Set<ComponentName> enabledServices = AccessibilityUtils.getEnabledServicesFromSettings( context); if (enabledServices.isEmpty()) { enabledServices = new ArraySet<>(1); } // Determine enabled services and accessibility state. boolean accessibilityEnabled = false; if (enabled) { enabledServices.add(toggledService); // Enabling at least one service enables accessibility. accessibilityEnabled = true; } else { enabledServices.remove(toggledService); // Check how many enabled and installed services are present. Set<ComponentName> installedServices = getInstalledServices(context); for (ComponentName enabledService : enabledServices) { if (installedServices.contains(enabledService)) { // Disabling the last service disables accessibility. accessibilityEnabled = true; break; } } } // Update the enabled services setting. StringBuilder enabledServicesBuilder = new StringBuilder(); // Keep the enabled services even if they are not installed since we // have no way to know whether the application restore process has // completed. In general the system should be responsible for the // clean up not settings. for (ComponentName enabledService : enabledServices) { enabledServicesBuilder.append(enabledService.flattenToString()); enabledServicesBuilder.append( AccessibilityUtils.ENABLED_ACCESSIBILITY_SERVICES_SEPARATOR); } final int enabledServicesBuilderLength = enabledServicesBuilder.length(); if (enabledServicesBuilderLength > 0) { enabledServicesBuilder.deleteCharAt(enabledServicesBuilderLength - 1); } Settings.Secure.putString(context.getContentResolver(), Settings.Secure.ENABLED_ACCESSIBILITY_SERVICES, enabledServicesBuilder.toString()); // Update accessibility enabled. Settings.Secure.putInt(context.getContentResolver(), Settings.Secure.ACCESSIBILITY_ENABLED, accessibilityEnabled ? 1 : 0); } private static Set<ComponentName> getInstalledServices(Context context) { final Set<ComponentName> installedServices = new HashSet<>(); installedServices.clear(); final List<AccessibilityServiceInfo> installedServiceInfos = AccessibilityManager.getInstance(context) .getInstalledAccessibilityServiceList(); if (installedServiceInfos == null) { return installedServices; } for (final AccessibilityServiceInfo info : installedServiceInfos) { final ResolveInfo resolveInfo = info.getResolveInfo(); final ComponentName installedService = new ComponentName( resolveInfo.serviceInfo.packageName, resolveInfo.serviceInfo.name); installedServices.add(installedService); } return installedServices; } } Loading
packages/SettingsLib/res/values/strings.xml +109 −0 Original line number Diff line number Diff line Loading @@ -231,4 +231,113 @@ <!-- Launch defaults preference summary with none set [CHAR LIMIT=40] --> <string name="launch_defaults_none">No defaults set</string> <!-- Text-To-Speech (TTS) settings --><skip /> <!-- Name of the TTS package as listed by the package manager. --> <string name="tts_settings">Text-to-speech settings</string> <!-- TTS option item name in the main settings screen --> <string name="tts_settings_title">Text-to-speech output</string> <!-- On main TTS Settings screen, in default settings section, setting default speech rate for synthesized voice --> <string name="tts_default_rate_title">Speech rate</string> <!-- On main TTS Settings screen, summary for default speech rate for synthesized voice --> <string name="tts_default_rate_summary">Speed at which the text is spoken</string> <!-- On main TTS Settings screen, in default settings section, setting default language for synthesized voice --> <string name="tts_default_lang_title">Language</string> <!-- Entry in the TTS engine language/locale picker, when selected will try to default to the system language [CHAR LIMIT=50] --> <string name="tts_lang_use_system">Use system language</string> <!-- On main TTS Settings screen, language summary if it can't default to system language [CHAR LIMIT=50] --> <string name="tts_lang_not_selected">Language not selected</string> <!-- On main TTS Settings screen, summary for default language for synthesized voice --> <string name="tts_default_lang_summary">Sets the language-specific voice for the spoken text</string> <!-- On main TTS Settings screen, triggers playback of an example of speech synthesis --> <string name="tts_play_example_title">Listen to an example</string> <!-- On main TTS Settings screen, summary for triggering playback of an example of speech synthesis --> <string name="tts_play_example_summary">Play a short demonstration of speech synthesis</string> <!-- On main TTS Settings screen, click to install required speech synthesis data --> <string name="tts_install_data_title">Install voice data</string> <!-- On main TTS Settings screen, summary for click to install required speech synthesis data --> <string name="tts_install_data_summary">Install the voice data required for speech synthesis</string> <!-- Warning message about security implications of enabling a TTS engine, displayed as a dialog message when the user selects to enable an engine. --> <string name="tts_engine_security_warning">This speech synthesis engine may be able to collect all the text that will be spoken, including personal data like passwords and credit card numbers. It comes from the <xliff:g id="tts_plugin_engine_name">%s</xliff:g> engine. Enable the use of this speech synthesis engine?</string> <!-- Warning message about required internet conectivity for TTS synthesis, displayed as a dialog message when the user selects to play an example for network only locale and there's no internet connectivity. --> <string name="tts_engine_network_required">This language requires a working network connection for text-to-speech output.</string> <!-- Text spoken by the TTS engine as an example if the engine doesn't provide sample text [CHAR LIMIT=100] --> <string name="tts_default_sample_string">This is an example of speech synthesis</string> <!-- On main TTS Settings screen, title of a field explaining current TTS engine status for current default language [CHAR LIMIT=50] --> <string name="tts_status_title">Default language status</string> <!-- On main TTS Settings screen, current TTS engine status for the current default language, selected language is fully supported by the engine [CHAR LIMIT=150]--> <string name="tts_status_ok"><xliff:g id="locale" example="English (United States)">%1$s</xliff:g> is fully supported</string> <!-- On main TTS Settings screen, current TTS engine status for the current default language, selected language is supported by the engine only if there's a working network connection [CHAR LIMIT=150] --> <string name="tts_status_requires_network"><xliff:g id="locale" example="English (United States)">%1$s</xliff:g> requires network connection</string> <!-- On main TTS Settings screen, current TTS engine status for the current default language, selected language is not supported by the engine [CHAR LIMIT=150] --> <string name="tts_status_not_supported"><xliff:g id="locale" example="English (United States)">%1$s</xliff:g> is not supported</string> <!-- On main TTS Settings screen, current TTS engine status for the current default language, tts engine is queried for status [CHAR LIMIT=150] --> <string name="tts_status_checking">Checking…</string> <!-- Title for a preference in the main TTS settings screen, which launches the settings screen for a given TTS engine when clicked [CHAR LIMIT=30]--> <string name="tts_engine_settings_title">Settings for <xliff:g id="tts_engine_name">%s</xliff:g></string> <!-- [CHAR LIMIT=150] Text for screen readers / accessibility programs for the image that launches the TTS engine settings when clicked. --> <string name="tts_engine_settings_button">Launch engine settings</string> <!-- [CHAR LIMIT=50] The text for the settings section that users to set a preferred text to speech engine --> <string name="tts_engine_preference_section_title">Preferred engine</string> <!-- [CHAR LIMIT=50] Title of the settings section that displays general preferences that are applicable to all engines, such as the speech rate --> <string name="tts_general_section_title">General</string> <!-- Default speech rate choices --> <string-array name="tts_rate_entries"> <item>Very slow</item> <item>Slow</item> <item>Normal</item> <item>Fast</item> <item>Faster</item> <item>Very fast</item> <item>Rapid</item> <item>Very rapid</item> <item>Fastest</item> </string-array> <!-- Do not translate. --> <string-array name="tts_rate_values"> <item>60</item> <item>80</item> <item>100</item> <item>150</item> <item>200</item> <item>250</item> <item>300</item> <item>350</item> <item>400</item> </string-array> <!-- Do not translate. --> <string-array name="tts_demo_strings" translatable="false"> <item>This is an example of speech synthesis in English.</item> <item>Voici un échantillon de synthèse vocale en français.</item> <item>Dies ist ein Beispiel für Sprachsynthese in Deutsch.</item> <item>Questo è un esempio di sintesi vocale in italiano.</item> <item>Este es un ejemplo de síntesis de voz en español.</item> <item>이것은 한국어 음성 합성의 예입니다.</item> </string-array> <!-- Do not translate. --> <string-array name="tts_demo_string_langs" translatable="false"> <item>eng</item> <item>fra</item> <item>deu</item> <item>ita</item> <item>spa</item> <item>kor</item> </string-array> </resources>
packages/SettingsLib/src/com/android/settingslib/accessibility/AccessibilityUtils.java +81 −1 Original line number Diff line number Diff line Loading @@ -16,15 +16,20 @@ package com.android.settingslib.accessibility; import android.accessibilityservice.AccessibilityServiceInfo; import android.content.ComponentName; import android.content.Context; import android.content.pm.ResolveInfo; import android.content.res.Configuration; import android.content.res.Resources; import android.provider.Settings; import android.text.TextUtils; import android.util.ArraySet; import android.view.accessibility.AccessibilityManager; import java.util.Collections; import java.util.HashSet; import java.util.List; import java.util.Locale; import java.util.Set; Loading @@ -45,7 +50,7 @@ public class AccessibilityUtils { return Collections.emptySet(); } final Set<ComponentName> enabledServices = new HashSet<ComponentName>(); final Set<ComponentName> enabledServices = new HashSet<>(); final TextUtils.SimpleStringSplitter colonSplitter = sStringColonSplitter; colonSplitter.setString(enabledServicesSetting); Loading @@ -71,4 +76,79 @@ public class AccessibilityUtils { final Context langContext = context.createConfigurationContext(config); return langContext.getText(resId); } public static void setAccessibilityServiceState(Context context, ComponentName toggledService, boolean enabled) { // Parse the enabled services. Set<ComponentName> enabledServices = AccessibilityUtils.getEnabledServicesFromSettings( context); if (enabledServices.isEmpty()) { enabledServices = new ArraySet<>(1); } // Determine enabled services and accessibility state. boolean accessibilityEnabled = false; if (enabled) { enabledServices.add(toggledService); // Enabling at least one service enables accessibility. accessibilityEnabled = true; } else { enabledServices.remove(toggledService); // Check how many enabled and installed services are present. Set<ComponentName> installedServices = getInstalledServices(context); for (ComponentName enabledService : enabledServices) { if (installedServices.contains(enabledService)) { // Disabling the last service disables accessibility. accessibilityEnabled = true; break; } } } // Update the enabled services setting. StringBuilder enabledServicesBuilder = new StringBuilder(); // Keep the enabled services even if they are not installed since we // have no way to know whether the application restore process has // completed. In general the system should be responsible for the // clean up not settings. for (ComponentName enabledService : enabledServices) { enabledServicesBuilder.append(enabledService.flattenToString()); enabledServicesBuilder.append( AccessibilityUtils.ENABLED_ACCESSIBILITY_SERVICES_SEPARATOR); } final int enabledServicesBuilderLength = enabledServicesBuilder.length(); if (enabledServicesBuilderLength > 0) { enabledServicesBuilder.deleteCharAt(enabledServicesBuilderLength - 1); } Settings.Secure.putString(context.getContentResolver(), Settings.Secure.ENABLED_ACCESSIBILITY_SERVICES, enabledServicesBuilder.toString()); // Update accessibility enabled. Settings.Secure.putInt(context.getContentResolver(), Settings.Secure.ACCESSIBILITY_ENABLED, accessibilityEnabled ? 1 : 0); } private static Set<ComponentName> getInstalledServices(Context context) { final Set<ComponentName> installedServices = new HashSet<>(); installedServices.clear(); final List<AccessibilityServiceInfo> installedServiceInfos = AccessibilityManager.getInstance(context) .getInstalledAccessibilityServiceList(); if (installedServiceInfos == null) { return installedServices; } for (final AccessibilityServiceInfo info : installedServiceInfos) { final ResolveInfo resolveInfo = info.getResolveInfo(); final ComponentName installedService = new ComponentName( resolveInfo.serviceInfo.packageName, resolveInfo.serviceInfo.name); installedServices.add(installedService); } return installedServices; } }