Merge "Make Accessibility Settings can support Relate project in Speech category"

This commit is contained in:
TreeHugger Robot
2023-01-30 14:40:56 +00:00
committed by Android (Google) Code Review
3 changed files with 45 additions and 12 deletions

View File

@@ -101,6 +101,14 @@
--> -->
</string-array> </string-array>
<!-- List containing the component names of pre-installed speech services. -->
<string-array name="config_preinstalled_speech_services" translatable="false">
<!--
<item>com.example.package.first/com.example.class.FirstService</item>
<item>com.example.package.second/com.example.class.SecondService</item>
-->
</string-array>
<!-- List containing the component names of pre-installed interaction control services. --> <!-- List containing the component names of pre-installed interaction control services. -->
<string-array name="config_preinstalled_interaction_control_services" translatable="false"> <string-array name="config_preinstalled_interaction_control_services" translatable="false">
<!-- <!--
@@ -109,8 +117,9 @@
--> -->
</string-array> </string-array>
<!-- List containing the order of services in screen reader category by componentname. <!-- List containing the order of services in screen reader category by {@link ComponentName}.
All componentnames in a category need to be specified to guarantee correct behavior.--> All {@link ComponentName} in a category need to be specified to guarantee correct
behavior.-->
<string-array name="config_order_screen_reader_services" translatable="false"> <string-array name="config_order_screen_reader_services" translatable="false">
<!-- <!--
<item>com.example.package.first/com.example.class.FirstService</item> <item>com.example.package.first/com.example.class.FirstService</item>
@@ -119,8 +128,8 @@
</string-array> </string-array>
<!-- List containing the order of services in captions category by preference key or <!-- List containing the order of services in captions category by preference key or
componentname. All preference keys in a category need to be specified to guarantee correct {@link ComponentName}. All preference keys in a category need to be specified to guarantee
behavior.--> correct behavior.-->
<string-array name="config_order_captions_services" translatable="false"> <string-array name="config_order_captions_services" translatable="false">
<!-- <!--
<item>com.example.package.first/com.example.class.FirstService</item> <item>com.example.package.first/com.example.class.FirstService</item>
@@ -131,8 +140,8 @@
--> -->
</string-array> </string-array>
<!-- List containing the order of services in audio and caption category by preference key <!-- List containing the order of services in audio and caption category by preference key or
or componentname. All preference keys in a category need to be specified to guarantee {@link ComponentName}. All preference keys in a category need to be specified to guarantee
correct behavior.--> correct behavior.-->
<string-array name="config_order_audio_services" translatable="false"> <string-array name="config_order_audio_services" translatable="false">
<!-- <!--
@@ -144,8 +153,8 @@
--> -->
</string-array> </string-array>
<!-- List containing the order of services in display category by preference key <!-- List containing the order of services in display category by preference key or
or componentname. All preference keys in a category need to be specified to guarantee {@link ComponentName}. All preference keys in a category need to be specified to guarantee
correct behavior.--> correct behavior.-->
<string-array name="config_order_display_services" translatable="false"> <string-array name="config_order_display_services" translatable="false">
<!-- <!--
@@ -157,8 +166,21 @@
--> -->
</string-array> </string-array>
<!-- List containing the order of services in interaction control category by preference key <!-- List containing the order of services in speech category by preference key or
or componentname. All preference keys in a category need to be specified to guarantee {@link ComponentName}. All preference keys in a category need to be specified to guarantee
correct behavior.-->
<string-array name="config_order_speech_services" translatable="false">
<!--
<item>com.example.package.first/com.example.class.FirstService</item>
<item>com.example.package.second/com.example.class.SecondService</item>
<item>font_size_preference_screen</item>
<item>dark_ui_mode_accessibility</item>
<item>...</item>
-->
</string-array>
<!-- List containing the order of services in interaction control category by preference key or
{@link ComponentName}. All preference keys in a category need to be specified to guarantee
correct behavior.--> correct behavior.-->
<string-array name="config_order_interaction_control_services" translatable="false"> <string-array name="config_order_interaction_control_services" translatable="false">
<!-- <!--

View File

@@ -169,6 +169,11 @@
</PreferenceCategory> </PreferenceCategory>
<PreferenceCategory
android:key="speech_category"
android:persistent="false"
android:title="@string/speech_category_title"/>
<PreferenceCategory <PreferenceCategory
android:persistent="false" android:persistent="false"
android:title="@string/general_category_title"> android:title="@string/general_category_title">

View File

@@ -63,6 +63,7 @@ public class AccessibilitySettings extends DashboardFragment {
private static final String CATEGORY_SCREEN_READER = "screen_reader_category"; private static final String CATEGORY_SCREEN_READER = "screen_reader_category";
private static final String CATEGORY_CAPTIONS = "captions_category"; private static final String CATEGORY_CAPTIONS = "captions_category";
private static final String CATEGORY_AUDIO = "audio_category"; private static final String CATEGORY_AUDIO = "audio_category";
private static final String CATEGORY_SPEECH = "speech_category";
private static final String CATEGORY_DISPLAY = "display_category"; private static final String CATEGORY_DISPLAY = "display_category";
private static final String CATEGORY_DOWNLOADED_SERVICES = "user_installed_services_category"; private static final String CATEGORY_DOWNLOADED_SERVICES = "user_installed_services_category";
@VisibleForTesting @VisibleForTesting
@@ -70,7 +71,7 @@ public class AccessibilitySettings extends DashboardFragment {
private static final String[] CATEGORIES = new String[]{ private static final String[] CATEGORIES = new String[]{
CATEGORY_SCREEN_READER, CATEGORY_CAPTIONS, CATEGORY_AUDIO, CATEGORY_DISPLAY, CATEGORY_SCREEN_READER, CATEGORY_CAPTIONS, CATEGORY_AUDIO, CATEGORY_DISPLAY,
CATEGORY_INTERACTION_CONTROL, CATEGORY_DOWNLOADED_SERVICES CATEGORY_SPEECH, CATEGORY_INTERACTION_CONTROL, CATEGORY_DOWNLOADED_SERVICES
}; };
// Extras passed to sub-fragments. // Extras passed to sub-fragments.
@@ -351,6 +352,8 @@ public class AccessibilitySettings extends DashboardFragment {
R.array.config_preinstalled_audio_services); R.array.config_preinstalled_audio_services);
initializePreBundledServicesMapFromArray(CATEGORY_DISPLAY, initializePreBundledServicesMapFromArray(CATEGORY_DISPLAY,
R.array.config_preinstalled_display_services); R.array.config_preinstalled_display_services);
initializePreBundledServicesMapFromArray(CATEGORY_SPEECH,
R.array.config_preinstalled_speech_services);
initializePreBundledServicesMapFromArray(CATEGORY_INTERACTION_CONTROL, initializePreBundledServicesMapFromArray(CATEGORY_INTERACTION_CONTROL,
R.array.config_preinstalled_interaction_control_services); R.array.config_preinstalled_interaction_control_services);
@@ -390,6 +393,8 @@ public class AccessibilitySettings extends DashboardFragment {
R.array.config_order_interaction_control_services); R.array.config_order_interaction_control_services);
updateCategoryOrderFromArray(CATEGORY_DISPLAY, updateCategoryOrderFromArray(CATEGORY_DISPLAY,
R.array.config_order_display_services); R.array.config_order_display_services);
updateCategoryOrderFromArray(CATEGORY_SPEECH,
R.array.config_order_speech_services);
// Need to check each time when updateServicePreferences() called. // Need to check each time when updateServicePreferences() called.
if (downloadedServicesCategory.getPreferenceCount() == 0) { if (downloadedServicesCategory.getPreferenceCount() == 0) {
@@ -398,8 +403,9 @@ public class AccessibilitySettings extends DashboardFragment {
getPreferenceScreen().addPreference(downloadedServicesCategory); getPreferenceScreen().addPreference(downloadedServicesCategory);
} }
// Hide screen reader category if it is empty. // Hide category if it is empty.
updatePreferenceCategoryVisibility(CATEGORY_SCREEN_READER); updatePreferenceCategoryVisibility(CATEGORY_SCREEN_READER);
updatePreferenceCategoryVisibility(CATEGORY_SPEECH);
} }
private List<RestrictedPreference> getInstalledAccessibilityList(Context context) { private List<RestrictedPreference> getInstalledAccessibilityList(Context context) {