Merge "Accessibility settings display category restructure, add text and display fragment for related accessibility services."
diff --git a/res/values/strings.xml b/res/values/strings.xml
index df66263..ebc8fc5 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -4952,6 +4952,8 @@
<string name="audio_and_captions_category_title">Audio & on-screen text</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] -->
+ <string name="accessibility_text_and_display_title">Text and display</string>
<!-- Title for the accessibility preference category of interaction control services and settings. [CHAR LIMIT=50] -->
<string name="interaction_control_category_title">Interaction controls</string>
<!-- Title for the accessibility preference category of services downloaded by the user. [CHAR LIMIT=50] -->
diff --git a/res/xml/accessibility_settings.xml b/res/xml/accessibility_settings.xml
index 6781e28..6efd884 100644
--- a/res/xml/accessibility_settings.xml
+++ b/res/xml/accessibility_settings.xml
@@ -45,52 +45,19 @@
android:title="@string/display_category_title">
<Preference
- android:fragment="com.android.settings.display.ToggleFontSizePreferenceFragment"
- android:key="font_size_preference_screen"
+ android:fragment="com.android.settings.accessibility.TextAndDisplayFragment"
+ android:key="text_and_display_preference_screen"
android:persistent="false"
- android:title="@string/title_font_size"
- settings:controller="com.android.settings.display.FontSizePreferenceController"
- settings:searchable="false"/>
+ android:title="@string/accessibility_text_and_display_title"
+ settings:searchable="true"/>
- <com.android.settings.display.ScreenZoomPreference
- android:fragment="com.android.settings.display.ScreenZoomSettings"
- android:key="accessibility_settings_screen_zoom"
- android:persistent="false"
- android:title="@string/screen_zoom_title"
- settings:searchable="false"/>
-
- <SwitchPreference
- android:key="dark_ui_mode_accessibility"
- android:persistent="false"
- android:title="@string/dark_ui_mode"
- settings:controller="com.android.settings.display.DarkUIPreferenceController"
- settings:searchable="false"/>
-
- <Preference
+ <Preference
android:fragment="com.android.settings.accessibility.MagnificationPreferenceFragment"
android:icon="@drawable/ic_accessibility_magnification"
android:key="magnification_preference_screen"
android:persistent="false"
android:title="@string/accessibility_screen_magnification_title"
settings:controller="com.android.settings.accessibility.MagnificationPreferenceController"/>
-
- <SwitchPreference
- android:key="toggle_large_pointer_icon"
- android:persistent="false"
- android:title="@string/accessibility_toggle_large_pointer_icon_title"
- settings:controller="com.android.settings.accessibility.LargePointerIconPreferenceController"/>
-
- <SwitchPreference
- android:key="toggle_disable_animations"
- android:persistent="false"
- android:title="@string/accessibility_disable_animations"
- settings:controller="com.android.settings.accessibility.DisableAnimationsPreferenceController"/>
-
- <SwitchPreference
- android:key="toggle_force_bold_text"
- android:persistent="false"
- android:title="@string/force_bold_text"
- settings:controller="com.android.settings.accessibility.FontWeightAdjustmentPreferenceController"/>
</PreferenceCategory>
<PreferenceCategory
@@ -203,42 +170,12 @@
settings:initialExpandedChildrenCount="1">
<SwitchPreference
- android:key="toggle_high_text_contrast_preference"
- android:persistent="false"
- android:title="@string/accessibility_toggle_high_text_contrast_preference_title"
- settings:controller="com.android.settings.accessibility.HighTextContrastPreferenceController"/>
-
- <Preference
- android:fragment="com.android.settings.accessibility.ToggleDaltonizerPreferenceFragment"
- android:icon="@drawable/ic_daltonizer"
- android:key="daltonizer_preference"
- android:persistent="false"
- android:title="@string/accessibility_display_daltonizer_preference_title"
- settings:controller="com.android.settings.accessibility.DaltonizerPreferenceController"/>
-
- <Preference
- android:fragment="com.android.settings.accessibility.ToggleColorInversionPreferenceFragment"
- android:icon="@drawable/ic_color_inversion"
- android:key="toggle_inversion_preference"
- android:persistent="false"
- android:title="@string/accessibility_display_inversion_preference_title"
- settings:controller="com.android.settings.accessibility.ColorInversionPreferenceController"/>
-
- <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"/>
- <!--TODO(b/170973645): Get icon-->
- <Preference
- android:fragment="com.android.settings.accessibility.ToggleReduceBrightColorsPreferenceFragment"
- android:key="reduce_bright_colors_preference"
- android:persistent="false"
- android:title="@string/reduce_bright_colors_preference_title"
- settings:controller="com.android.settings.accessibility.ReduceBrightColorsPreferenceController"/>
-
</PreferenceCategory>
</PreferenceScreen>
diff --git a/res/xml/accessibility_text_and_display.xml b/res/xml/accessibility_text_and_display.xml
new file mode 100644
index 0000000..7dce826
--- /dev/null
+++ b/res/xml/accessibility_text_and_display.xml
@@ -0,0 +1,100 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2021 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<PreferenceScreen
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:settings="http://schemas.android.com/apk/res-auto"
+ android:key="accessibility_text_and_display"
+ android:persistent="false"
+ android:title="@string/accessibility_text_and_display_title">
+
+ <SwitchPreference
+ android:key="toggle_high_text_contrast_preference"
+ android:persistent="false"
+ android:title="@string/accessibility_toggle_high_text_contrast_preference_title"
+ settings:controller="com.android.settings.accessibility.HighTextContrastPreferenceController"/>
+
+ <SwitchPreference
+ android:key="dark_ui_mode_accessibility"
+ android:persistent="false"
+ android:title="@string/dark_ui_mode"
+ settings:controller="com.android.settings.display.DarkUIPreferenceController"
+ settings:searchable="false"/>
+
+ <Preference
+ android:fragment="com.android.settings.accessibility.ToggleDaltonizerPreferenceFragment"
+ android:icon="@drawable/ic_daltonizer"
+ android:key="daltonizer_preference"
+ android:persistent="false"
+ android:title="@string/accessibility_display_daltonizer_preference_title"
+ settings:controller="com.android.settings.accessibility.DaltonizerPreferenceController"/>
+
+ <Preference
+ android:fragment="com.android.settings.accessibility.ToggleColorInversionPreferenceFragment"
+ android:icon="@drawable/ic_color_inversion"
+ android:key="toggle_inversion_preference"
+ android:persistent="false"
+ android:title="@string/accessibility_display_inversion_preference_title"
+ settings:controller="com.android.settings.accessibility.ColorInversionPreferenceController"/>
+
+ <!--TODO(b/170973645): Get icon-->
+ <Preference
+ android:fragment="com.android.settings.accessibility.ToggleReduceBrightColorsPreferenceFragment"
+ android:key="reduce_bright_colors_preference"
+ android:persistent="false"
+ android:title="@string/reduce_bright_colors_preference_title"
+ settings:controller="com.android.settings.accessibility.ReduceBrightColorsPreferenceController"/>
+
+ <SwitchPreference
+ android:key="toggle_disable_animations"
+ android:persistent="false"
+ android:title="@string/accessibility_disable_animations"
+ settings:controller="com.android.settings.accessibility.DisableAnimationsPreferenceController"/>
+
+ <com.android.settings.display.ScreenZoomPreference
+ android:fragment="com.android.settings.display.ScreenZoomSettings"
+ android:key="accessibility_settings_screen_zoom"
+ android:persistent="false"
+ android:title="@string/screen_zoom_title"
+ settings:searchable="false"/>
+
+ <Preference
+ android:fragment="com.android.settings.display.ToggleFontSizePreferenceFragment"
+ android:key="font_size_preference_screen"
+ android:persistent="false"
+ android:title="@string/title_font_size"
+ settings:controller="com.android.settings.display.FontSizePreferenceController"
+ settings:searchable="false"/>
+
+ <SwitchPreference
+ android:key="toggle_force_bold_text"
+ android:persistent="false"
+ android:title="@string/force_bold_text"
+ settings:controller="com.android.settings.accessibility.FontWeightAdjustmentPreferenceController"/>
+
+ <SwitchPreference
+ android:key="toggle_large_pointer_icon"
+ android:persistent="false"
+ android:title="@string/accessibility_toggle_large_pointer_icon_title"
+ settings:controller="com.android.settings.accessibility.LargePointerIconPreferenceController"/>
+
+ <PreferenceCategory
+ android:key="experimental_category"
+ android:persistent="false"
+ android:title="@string/experimental_category_title"
+ settings:initialExpandedChildrenCount="1">
+ </PreferenceCategory>
+</PreferenceScreen>
\ No newline at end of file
diff --git a/src/com/android/settings/accessibility/AccessibilitySettings.java b/src/com/android/settings/accessibility/AccessibilitySettings.java
index e5bc3f5..4709c66 100644
--- a/src/com/android/settings/accessibility/AccessibilitySettings.java
+++ b/src/com/android/settings/accessibility/AccessibilitySettings.java
@@ -29,7 +29,6 @@
import android.content.pm.ResolveInfo;
import android.content.pm.ServiceInfo;
import android.graphics.drawable.Drawable;
-import android.hardware.display.ColorDisplayManager;
import android.net.Uri;
import android.os.Bundle;
import android.os.Handler;
@@ -43,7 +42,6 @@
import androidx.core.content.ContextCompat;
import androidx.preference.Preference;
import androidx.preference.PreferenceCategory;
-import androidx.preference.SwitchPreference;
import com.android.internal.accessibility.AccessibilityShortcutController;
import com.android.internal.content.PackageMonitor;
@@ -51,7 +49,6 @@
import com.android.settings.Utils;
import com.android.settings.accessibility.AccessibilityUtil.AccessibilityServiceFragmentType;
import com.android.settings.dashboard.DashboardFragment;
-import com.android.settings.display.DarkUIPreferenceController;
import com.android.settings.search.BaseSearchIndexProvider;
import com.android.settingslib.RestrictedLockUtils.EnforcedAdmin;
import com.android.settingslib.RestrictedLockUtilsInternal;
@@ -82,23 +79,14 @@
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[] {
+ private static final String[] CATEGORIES = new String[]{
CATEGORY_SCREEN_READER, CATEGORY_AUDIO_AND_CAPTIONS, CATEGORY_DISPLAY,
CATEGORY_INTERACTION_CONTROL, CATEGORY_EXPERIMENTAL, CATEGORY_DOWNLOADED_SERVICES
};
// Preferences
- private static final String TOGGLE_INVERSION_PREFERENCE =
- "toggle_inversion_preference";
- private static final String TOGGLE_LARGE_POINTER_ICON =
- "toggle_large_pointer_icon";
- private static final String TOGGLE_DISABLE_ANIMATIONS = "toggle_disable_animations";
private static final String DISPLAY_MAGNIFICATION_PREFERENCE_SCREEN =
"magnification_preference_screen";
- private static final String DISPLAY_DALTONIZER_PREFERENCE_SCREEN =
- "daltonizer_preference";
- private static final String DISPLAY_REDUCE_BRIGHT_COLORS_PREFERENCE_SCREEN =
- "reduce_bright_colors_preference";
// Extras passed to sub-fragments.
static final String EXTRA_PREFERENCE_KEY = "preference_key";
@@ -167,13 +155,7 @@
private final Map<ComponentName, PreferenceCategory> mPreBundledServiceComponentToCategoryMap =
new ArrayMap<>();
- private SwitchPreference mToggleLargePointerIconPreference;
- private SwitchPreference mToggleDisableAnimationsPreference;
private Preference mDisplayMagnificationPreferenceScreen;
- private Preference mDisplayDaltonizerPreferenceScreen;
- private Preference mToggleInversionPreference;
- private Preference mReduceBrightColorsPreference;
-
/**
* Check if the color transforms are color accelerated. Some transforms are experimental only
@@ -226,7 +208,6 @@
@Override
public void onAttach(Context context) {
super.onAttach(context);
- use(DarkUIPreferenceController.class).setParentFragment(this);
use(AccessibilityHearingAidPreferenceController.class)
.setFragmentManager(getFragmentManager());
}
@@ -259,8 +240,8 @@
/**
* Returns the summary for the current state of this accessibilityService.
*
- * @param context A valid context
- * @param info The accessibilityService's info
+ * @param context A valid context
+ * @param info The accessibilityService's info
* @param serviceEnabled Whether the accessibility service is enabled.
* @return The service summary
*/
@@ -299,8 +280,8 @@
/**
* Returns the description for the current state of this accessibilityService.
*
- * @param context A valid context
- * @param info The accessibilityService's info
+ * @param context A valid context
+ * @param info The accessibilityService's info
* @param serviceEnabled Whether the accessibility service is enabled.
* @return The service description
*/
@@ -325,24 +306,9 @@
mCategoryToPrefCategoryMap.put(CATEGORIES[i], prefCategory);
}
- // Display inversion.
- mToggleInversionPreference = findPreference(TOGGLE_INVERSION_PREFERENCE);
-
- // Large pointer icon.
- mToggleLargePointerIconPreference = findPreference(TOGGLE_LARGE_POINTER_ICON);
-
- mToggleDisableAnimationsPreference = findPreference(TOGGLE_DISABLE_ANIMATIONS);
-
// Display magnification.
mDisplayMagnificationPreferenceScreen = findPreference(
DISPLAY_MAGNIFICATION_PREFERENCE_SCREEN);
-
- // Display color adjustments.
- mDisplayDaltonizerPreferenceScreen = findPreference(DISPLAY_DALTONIZER_PREFERENCE_SCREEN);
-
- // Reduce brightness.
- mReduceBrightColorsPreference =
- findPreference(DISPLAY_REDUCE_BRIGHT_COLORS_PREFERENCE_SCREEN);
}
private void updateAllPreferences() {
@@ -392,13 +358,13 @@
// 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);
+ R.array.config_order_screen_reader_services);
updateCategoryOrderFromArray(CATEGORY_AUDIO_AND_CAPTIONS,
- R.array.config_order_audio_and_caption_services);
+ R.array.config_order_audio_and_caption_services);
updateCategoryOrderFromArray(CATEGORY_INTERACTION_CONTROL,
- R.array.config_order_interaction_control_services);
+ R.array.config_order_interaction_control_services);
updateCategoryOrderFromArray(CATEGORY_DISPLAY,
- R.array.config_order_display_services);
+ R.array.config_order_display_services);
// Need to check each time when updateServicePreferences() called.
if (downloadedServicesCategory.getPreferenceCount() == 0) {
@@ -468,7 +434,7 @@
* key with the string array of preference order which is defined in the xml.
*
* @param categoryKey The key of the category need to update the order
- * @param key The key of the string array which defines the order of category
+ * @param key The key of the string array which defines the order of category
*/
private void updateCategoryOrderFromArray(String categoryKey, int key) {
String[] services = getResources().getStringArray(key);
@@ -486,39 +452,11 @@
}
}
+ /**
+ * Updates preferences related to system configurations.
+ */
protected void updateSystemPreferences() {
- // Move color inversion and color correction preferences to Display category if device
- // supports HWC hardware-accelerated color transform.
- if (ColorDisplayManager.isColorTransformAccelerated(getContext())) {
- PreferenceCategory experimentalCategory =
- mCategoryToPrefCategoryMap.get(CATEGORY_EXPERIMENTAL);
- PreferenceCategory displayCategory =
- mCategoryToPrefCategoryMap.get(CATEGORY_DISPLAY);
- experimentalCategory.removePreference(mToggleInversionPreference);
- experimentalCategory.removePreference(mDisplayDaltonizerPreferenceScreen);
- experimentalCategory.removePreference(mReduceBrightColorsPreference);
- mDisplayMagnificationPreferenceScreen.setSummary(
- ToggleScreenMagnificationPreferenceFragment.getServiceSummary(getContext()));
- mDisplayDaltonizerPreferenceScreen.setOrder(
- mDisplayMagnificationPreferenceScreen.getOrder() + 1);
- mDisplayDaltonizerPreferenceScreen.setSummary(AccessibilityUtil.getSummary(
- getContext(), Settings.Secure.ACCESSIBILITY_DISPLAY_DALTONIZER_ENABLED));
- mToggleInversionPreference.setOrder(
- mDisplayDaltonizerPreferenceScreen.getOrder() + 1);
- mToggleLargePointerIconPreference.setOrder(
- mToggleInversionPreference.getOrder() + 1);
- mToggleDisableAnimationsPreference.setOrder(
- mToggleLargePointerIconPreference.getOrder() + 1);
- mToggleInversionPreference.setSummary(AccessibilityUtil.getSummary(
- getContext(), Settings.Secure.ACCESSIBILITY_DISPLAY_INVERSION_ENABLED));
- mReduceBrightColorsPreference.setOrder(
- mToggleDisableAnimationsPreference.getOrder() + 1);
- mReduceBrightColorsPreference.setSummary(AccessibilityUtil.getSummary(
- getContext(), Settings.Secure.REDUCE_BRIGHT_COLORS_ACTIVATED));
- displayCategory.addPreference(mToggleInversionPreference);
- displayCategory.addPreference(mDisplayDaltonizerPreferenceScreen);
- displayCategory.addPreference(mReduceBrightColorsPreference);
- }
+ // Do nothing.
}
public static final BaseSearchIndexProvider SEARCH_INDEX_DATA_PROVIDER =
diff --git a/src/com/android/settings/accessibility/TextAndDisplayFragment.java b/src/com/android/settings/accessibility/TextAndDisplayFragment.java
new file mode 100644
index 0000000..b496e3d
--- /dev/null
+++ b/src/com/android/settings/accessibility/TextAndDisplayFragment.java
@@ -0,0 +1,136 @@
+/*
+ * Copyright (C) 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.settings.accessibility;
+
+import android.app.settings.SettingsEnums;
+import android.content.Context;
+import android.hardware.display.ColorDisplayManager;
+import android.os.Bundle;
+import android.provider.Settings;
+
+import androidx.preference.Preference;
+import androidx.preference.PreferenceCategory;
+import androidx.preference.SwitchPreference;
+
+import com.android.settings.R;
+import com.android.settings.dashboard.DashboardFragment;
+import com.android.settings.display.DarkUIPreferenceController;
+import com.android.settings.search.BaseSearchIndexProvider;
+import com.android.settingslib.search.SearchIndexable;
+
+/** Accessibility settings for text and display. */
+@SearchIndexable(forTarget = SearchIndexable.ALL & ~SearchIndexable.ARC)
+public class TextAndDisplayFragment extends DashboardFragment {
+
+ private static final String TAG = "TextAndDisplayFragment";
+
+ private static final String CATEGORY_EXPERIMENTAL = "experimental_category";
+
+ // Preferences
+ private static final String DISPLAY_DALTONIZER_PREFERENCE_SCREEN = "daltonizer_preference";
+ private static final String TOGGLE_INVERSION_PREFERENCE = "toggle_inversion_preference";
+ private static final String DISPLAY_REDUCE_BRIGHT_COLORS_PREFERENCE_SCREEN =
+ "reduce_bright_colors_preference";
+ private static final String TOGGLE_DISABLE_ANIMATIONS = "toggle_disable_animations";
+ private static final String TOGGLE_LARGE_POINTER_ICON = "toggle_large_pointer_icon";
+
+ private Preference mDisplayDaltonizerPreferenceScreen;
+ private Preference mToggleInversionPreference;
+ private Preference mReduceBrightColorsPreference;
+ private SwitchPreference mToggleDisableAnimationsPreference;
+ private SwitchPreference mToggleLargePointerIconPreference;
+
+ @Override
+ public int getMetricsCategory() {
+ return SettingsEnums.ACCESSIBILITY_TEXT_AND_DISPLAY;
+ }
+
+
+ @Override
+ public void onCreate(Bundle icicle) {
+ super.onCreate(icicle);
+ initializeAllPreferences();
+ updateSystemPreferences();
+ }
+
+ @Override
+ public void onAttach(Context context) {
+ super.onAttach(context);
+ use(DarkUIPreferenceController.class).setParentFragment(this);
+ }
+
+ @Override
+ protected int getPreferenceScreenResId() {
+ return R.xml.accessibility_text_and_display;
+ }
+
+ @Override
+ protected String getLogTag() {
+ return TAG;
+ }
+
+ private void initializeAllPreferences() {
+ // Display color adjustments.
+ mDisplayDaltonizerPreferenceScreen = findPreference(DISPLAY_DALTONIZER_PREFERENCE_SCREEN);
+
+ // Display inversion.
+ mToggleInversionPreference = findPreference(TOGGLE_INVERSION_PREFERENCE);
+
+ // Reduce brightness.
+ mReduceBrightColorsPreference =
+ findPreference(DISPLAY_REDUCE_BRIGHT_COLORS_PREFERENCE_SCREEN);
+
+ // Disable animation.
+ mToggleDisableAnimationsPreference = findPreference(TOGGLE_DISABLE_ANIMATIONS);
+
+ // Large pointer icon.
+ mToggleLargePointerIconPreference = findPreference(TOGGLE_LARGE_POINTER_ICON);
+ }
+
+ /**
+ * Updates preferences related to system configurations.
+ */
+ private void updateSystemPreferences() {
+ final PreferenceCategory experimentalCategory = getPreferenceScreen().findPreference(
+ CATEGORY_EXPERIMENTAL);
+ if (ColorDisplayManager.isColorTransformAccelerated(getContext())) {
+ mDisplayDaltonizerPreferenceScreen.setSummary(AccessibilityUtil.getSummary(
+ getContext(), Settings.Secure.ACCESSIBILITY_DISPLAY_DALTONIZER_ENABLED));
+ mToggleInversionPreference.setSummary(AccessibilityUtil.getSummary(
+ getContext(), Settings.Secure.ACCESSIBILITY_DISPLAY_INVERSION_ENABLED));
+ mReduceBrightColorsPreference.setSummary(AccessibilityUtil.getSummary(
+ getContext(), Settings.Secure.REDUCE_BRIGHT_COLORS_ACTIVATED));
+ getPreferenceScreen().removePreference(experimentalCategory);
+ } else {
+ // Move following preferences to experimental category if device don't supports HWC
+ // hardware-accelerated color transform.
+ getPreferenceScreen().removePreference(mDisplayDaltonizerPreferenceScreen);
+ getPreferenceScreen().removePreference(mToggleInversionPreference);
+ getPreferenceScreen().removePreference(mReduceBrightColorsPreference);
+ getPreferenceScreen().removePreference(mToggleDisableAnimationsPreference);
+ getPreferenceScreen().removePreference(mToggleLargePointerIconPreference);
+ experimentalCategory.addPreference(mDisplayDaltonizerPreferenceScreen);
+ experimentalCategory.addPreference(mToggleInversionPreference);
+ experimentalCategory.addPreference(mReduceBrightColorsPreference);
+ experimentalCategory.addPreference(mToggleDisableAnimationsPreference);
+ experimentalCategory.addPreference(mToggleLargePointerIconPreference);
+ }
+ }
+
+ public static final BaseSearchIndexProvider SEARCH_INDEX_DATA_PROVIDER =
+ new BaseSearchIndexProvider(R.xml.accessibility_text_and_display);
+}
diff --git a/tests/robotests/src/com/android/settings/accessibility/TextAndDisplayFragmentTest.java b/tests/robotests/src/com/android/settings/accessibility/TextAndDisplayFragmentTest.java
new file mode 100644
index 0000000..96756ecd
--- /dev/null
+++ b/tests/robotests/src/com/android/settings/accessibility/TextAndDisplayFragmentTest.java
@@ -0,0 +1,49 @@
+/*
+ * Copyright (C) 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.settings.accessibility;
+
+import static com.google.common.truth.Truth.assertThat;
+
+import android.content.Context;
+
+import androidx.test.core.app.ApplicationProvider;
+
+import com.android.settings.R;
+import com.android.settings.testutils.XmlTestUtils;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.robolectric.RobolectricTestRunner;
+
+import java.util.List;
+
+@RunWith(RobolectricTestRunner.class)
+public class TextAndDisplayFragmentTest {
+
+ private Context mContext = ApplicationProvider.getApplicationContext();
+
+ @Test
+ public void getNonIndexableKeys_existInXmlLayout() {
+ final List<String> niks = TextAndDisplayFragment.SEARCH_INDEX_DATA_PROVIDER
+ .getNonIndexableKeys(mContext);
+ final List<String> keys =
+ XmlTestUtils.getKeysFromPreferenceXml(mContext,
+ R.xml.accessibility_text_and_display);
+
+ assertThat(keys).containsAtLeastElementsIn(niks);
+ }
+}