Accessibility settings display category restructure, add text and display fragment for related accessibility services.
Bug: 174829936 Test: atest TextAndDisplayFragmentTest, atest AccessibilitySettingsTest Change-Id: Ie2cf147de53385ae0c626c8472306f1b85317686
This commit is contained in:
@@ -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] -->
|
||||
|
@@ -45,26 +45,11 @@
|
||||
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"/>
|
||||
|
||||
<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"/>
|
||||
android:title="@string/accessibility_text_and_display_title"
|
||||
settings:searchable="true"/>
|
||||
|
||||
<Preference
|
||||
android:fragment="com.android.settings.accessibility.MagnificationPreferenceFragment"
|
||||
@@ -73,24 +58,6 @@
|
||||
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
|
||||
@@ -202,28 +169,6 @@
|
||||
android:title="@string/experimental_category_title"
|
||||
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"
|
||||
@@ -231,14 +176,6 @@
|
||||
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>
|
||||
|
100
res/xml/accessibility_text_and_display.xml
Normal file
100
res/xml/accessibility_text_and_display.xml
Normal file
@@ -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>
|
@@ -29,7 +29,6 @@ import android.content.pm.PackageManager;
|
||||
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.annotation.VisibleForTesting;
|
||||
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.R;
|
||||
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;
|
||||
@@ -88,17 +85,8 @@ public class AccessibilitySettings extends DashboardFragment {
|
||||
};
|
||||
|
||||
// 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 @@ public class AccessibilitySettings extends DashboardFragment {
|
||||
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 @@ public class AccessibilitySettings extends DashboardFragment {
|
||||
@Override
|
||||
public void onAttach(Context context) {
|
||||
super.onAttach(context);
|
||||
use(DarkUIPreferenceController.class).setParentFragment(this);
|
||||
use(AccessibilityHearingAidPreferenceController.class)
|
||||
.setFragmentManager(getFragmentManager());
|
||||
}
|
||||
@@ -325,24 +306,9 @@ public class AccessibilitySettings extends DashboardFragment {
|
||||
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() {
|
||||
@@ -486,39 +452,11 @@ public class AccessibilitySettings extends DashboardFragment {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 =
|
||||
|
@@ -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);
|
||||
}
|
@@ -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);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user