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

Commit 478db865 authored by Ben Chung's avatar Ben Chung
Browse files

Update accessibility settings layout

Accessibility settings category restructure
1. Add caption category fragment for related accessibility services.
2. Remove experimental category.

Bug: 174829936
Test: atest AccessibilitySettingsTest
Change-Id: I13b1ed62afe0634329d1e340ba154454640fadd6
parent 380d004b
Loading
Loading
Loading
Loading
+23 −2
Original line number Diff line number Diff line
@@ -82,8 +82,16 @@
        -->
    </string-array>

    <!-- List containing the component names of pre-installed captioning services. -->
    <string-array name="config_preinstalled_captions_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 audio and captioning services. -->
    <string-array name="config_preinstalled_audio_and_caption_services" translatable="false">
    <string-array name="config_preinstalled_audio_services" translatable="false">
        <!--
        <item>com.example.package.first/com.example.class.FirstService</item>
        <item>com.example.package.second/com.example.class.SecondService</item>
@@ -115,10 +123,23 @@
        -->
    </string-array>

    <!-- 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
         behavior.-->
    <string-array name="config_order_captions_services" translatable="false">
        <!--
        <item>com.example.package.first/com.example.class.FirstService</item>
        <item>com.example.package.second/com.example.class.SecondService</item>
        <item>captioning_preference_screen</item>
        <item>rtt_setting</item>
        <item>...</item>
        -->
    </string-array>

    <!-- List containing the order of services in audio and caption category by preference key
         or componentname. All preference keys in a category need to be specified to guarantee
         correct behavior.-->
    <string-array name="config_order_audio_and_caption_services" translatable="false">
    <string-array name="config_order_audio_services" translatable="false">
        <!--
        <item>com.example.package.first/com.example.class.FirstService</item>
        <item>com.example.package.second/com.example.class.SecondService</item>
+3 −1
Original line number Diff line number Diff line
@@ -4963,8 +4963,10 @@
    <string name="vision_settings_suggestion_title">Change font size</string>
    <!-- Title for the accessibility preference category of screen reader services and settings. [CHAR LIMIT=50] -->
    <string name="screen_reader_category_title">Screen readers</string>
    <!-- Title for the accessibility preference category of caption services and settings. [CHAR LIMIT=50] -->
    <string name="captions_category_title">Captions</string>
    <!-- Title for the accessibility preference category of audio services and settings. [CHAR LIMIT=50] -->
    <string name="audio_and_captions_category_title">Audio &amp; on-screen text</string>
    <string name="audio_category_title">Audio</string>
    <!-- Title for the accessibility preference category of display services and settings. [CHAR LIMIT=50] -->
    <string name="display_category_title">Display</string>
    <!-- Title for the accessibility text options page. [CHAR LIMIT=50] -->
+22 −30
Original line number Diff line number Diff line
@@ -80,9 +80,9 @@
    </PreferenceCategory>

    <PreferenceCategory
        android:key="audio_and_captions_category"
        android:key="captions_category"
        android:persistent="false"
        android:title="@string/audio_and_captions_category_title">
        android:title="@string/captions_category_title">

        <Preference
            android:key="live_caption"
@@ -92,6 +92,26 @@
            settings:searchable="false"
            settings:controller="com.android.settings.accessibility.LiveCaptionPreferenceController"/>

        <Preference
            android:fragment="com.android.settings.accessibility.CaptionPropertiesFragment"
            android:key="captioning_preference_screen"
            android:persistent="false"
            android:title="@string/accessibility_captioning_title"
            settings:controller="com.android.settings.accessibility.CaptioningPreferenceController"/>

        <Preference
            android:key="rtt_setting"
            android:summary="@string/summary_placeholder"
            android:title="@string/rtt_settings_title"
            settings:controller="com.android.settings.accessibility.RTTSettingPreferenceController"/>

    </PreferenceCategory>

    <PreferenceCategory
        android:key="audio_category"
        android:persistent="false"
        android:title="@string/audio_category_title">

        <Preference
            android:key="hearing_aid_preference"
            android:persistent="false"
@@ -106,19 +126,6 @@
            android:title="@string/accessibility_audio_adjustment_title"
            settings:searchable="true"/>

        <Preference
            android:key="rtt_setting"
            android:summary="@string/summary_placeholder"
            android:title="@string/rtt_settings_title"
            settings:controller="com.android.settings.accessibility.RTTSettingPreferenceController"/>

        <Preference
            android:fragment="com.android.settings.accessibility.CaptionPropertiesFragment"
            android:key="captioning_preference_screen"
            android:persistent="false"
            android:title="@string/accessibility_captioning_title"
            settings:controller="com.android.settings.accessibility.CaptioningPreferenceController"/>

    </PreferenceCategory>

    <!-- TODO(b/174829936): Add title for shortcuts settings category. -->
@@ -140,19 +147,4 @@

    </PreferenceCategory>

    <PreferenceCategory
        android:key="experimental_category"
        android:persistent="false"
        android:title="@string/experimental_category_title"
        settings:initialExpandedChildrenCount="1">

        <SwitchPreference
            android:key="accessibility_shortcut_preference"
            android:persistent="false"
            android:title="@string/accessibility_shortcut_service_on_lock_screen_title"
            android:summary="@string/accessibility_shortcut_description"
            settings:controller="com.android.settings.accessibility.AccessibilityShortcutPreferenceController"/>

    </PreferenceCategory>

</PreferenceScreen>
+12 −8
Original line number Diff line number Diff line
@@ -73,15 +73,15 @@ public class AccessibilitySettings extends DashboardFragment {

    // Preference categories
    private static final String CATEGORY_SCREEN_READER = "screen_reader_category";
    private static final String CATEGORY_AUDIO_AND_CAPTIONS = "audio_and_captions_category";
    private static final String CATEGORY_CAPTIONS = "captions_category";
    private static final String CATEGORY_AUDIO = "audio_category";
    private static final String CATEGORY_DISPLAY = "display_category";
    private static final String CATEGORY_INTERACTION_CONTROL = "interaction_control_category";
    private static final String CATEGORY_EXPERIMENTAL = "experimental_category";
    private static final String CATEGORY_DOWNLOADED_SERVICES = "user_installed_services_category";

    private static final String[] CATEGORIES = new String[]{
            CATEGORY_SCREEN_READER, CATEGORY_AUDIO_AND_CAPTIONS, CATEGORY_DISPLAY,
            CATEGORY_INTERACTION_CONTROL, CATEGORY_EXPERIMENTAL, CATEGORY_DOWNLOADED_SERVICES
            CATEGORY_SCREEN_READER, CATEGORY_CAPTIONS, CATEGORY_AUDIO, CATEGORY_DISPLAY,
            CATEGORY_INTERACTION_CONTROL, CATEGORY_DOWNLOADED_SERVICES
    };

    // Preferences
@@ -330,8 +330,10 @@ public class AccessibilitySettings extends DashboardFragment {

        initializePreBundledServicesMapFromArray(CATEGORY_SCREEN_READER,
                R.array.config_preinstalled_screen_reader_services);
        initializePreBundledServicesMapFromArray(CATEGORY_AUDIO_AND_CAPTIONS,
                R.array.config_preinstalled_audio_and_caption_services);
        initializePreBundledServicesMapFromArray(CATEGORY_CAPTIONS,
                R.array.config_preinstalled_captions_services);
        initializePreBundledServicesMapFromArray(CATEGORY_AUDIO,
                R.array.config_preinstalled_audio_services);
        initializePreBundledServicesMapFromArray(CATEGORY_DISPLAY,
                R.array.config_preinstalled_display_services);
        initializePreBundledServicesMapFromArray(CATEGORY_INTERACTION_CONTROL,
@@ -359,8 +361,10 @@ public class AccessibilitySettings extends DashboardFragment {
        // Update the order of all the category according to the order defined in xml file.
        updateCategoryOrderFromArray(CATEGORY_SCREEN_READER,
                R.array.config_order_screen_reader_services);
        updateCategoryOrderFromArray(CATEGORY_AUDIO_AND_CAPTIONS,
                R.array.config_order_audio_and_caption_services);
        updateCategoryOrderFromArray(CATEGORY_CAPTIONS,
                R.array.config_order_captions_services);
        updateCategoryOrderFromArray(CATEGORY_AUDIO,
                R.array.config_order_audio_services);
        updateCategoryOrderFromArray(CATEGORY_INTERACTION_CONTROL,
                R.array.config_order_interaction_control_services);
        updateCategoryOrderFromArray(CATEGORY_DISPLAY,