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

Commit c64531bb authored by Ben Lin's avatar Ben Lin
Browse files

Revert "Add ability to show/hide Color Correction and Color Inversion."

This reverts commit f1346930.

Reason for revert: Moving logic elsewhere.

Change-Id: Ia07b3f4c33e0078e8f35c69d5ed51daf197ff165
parent 463c9a07
Loading
Loading
Loading
Loading
+0 −6
Original line number Diff line number Diff line
@@ -150,12 +150,6 @@
    <!-- Whether default_home should be shown or not. -->
    <bool name="config_show_default_home">true</bool>

    <!-- Whether color correction preference should be shown or not. -->
    <bool name="config_show_color_correction_preference">true</bool>

    <!-- Whether color inversion preference should be shown or not. -->
    <bool name="config_show_color_inversion_preference">true</bool>

    <!-- Whether assist_and_voice_input should be shown or not. -->
    <bool name="config_show_assist_and_voice_input">true</bool>

+3 −20
Original line number Diff line number Diff line
@@ -92,6 +92,8 @@ public class AccessibilitySettings extends SettingsPreferenceFragment implements
    // Preferences
    private static final String TOGGLE_HIGH_TEXT_CONTRAST_PREFERENCE =
            "toggle_high_text_contrast_preference";
    private static final String TOGGLE_INVERSION_PREFERENCE =
            "toggle_inversion_preference";
    private static final String TOGGLE_POWER_BUTTON_ENDS_CALL_PREFERENCE =
            "toggle_power_button_ends_call_preference";
    private static final String TOGGLE_LOCK_SCREEN_ROTATION_PREFERENCE =
@@ -117,10 +119,7 @@ public class AccessibilitySettings extends SettingsPreferenceFragment implements
            "autoclick_preference_screen";
    private static final String VIBRATION_PREFERENCE_SCREEN =
            "vibration_preference_screen";

    @VisibleForTesting static final String TOGGLE_INVERSION_PREFERENCE =
            "toggle_inversion_preference";
    @VisibleForTesting static final String DISPLAY_DALTONIZER_PREFERENCE_SCREEN =
    private static final String DISPLAY_DALTONIZER_PREFERENCE_SCREEN =
            "daltonizer_preference_screen";

    // Extras passed to sub-fragments.
@@ -626,8 +625,6 @@ public class AccessibilitySettings extends SettingsPreferenceFragment implements
            displayCategory.addPreference(mToggleInversionPreference);
            displayCategory.addPreference(mDisplayDaltonizerPreferenceScreen);
        }
        checkColorCorrectionVisibility(mDisplayDaltonizerPreferenceScreen);
        checkColorInversionVisibility(mToggleInversionPreference);

        // Text contrast.
        mToggleHighTextContrastPreference.setChecked(
@@ -802,20 +799,6 @@ public class AccessibilitySettings extends SettingsPreferenceFragment implements
        }
    }

    @VisibleForTesting void checkColorCorrectionVisibility(Preference preference) {
        if (!getContext().getResources().getBoolean(
                R.bool.config_show_color_correction_preference)) {
            removePreference(DISPLAY_DALTONIZER_PREFERENCE_SCREEN);
        }
    }

    @VisibleForTesting void checkColorInversionVisibility(Preference preference) {
        if (!getContext().getResources().getBoolean(
                R.bool.config_show_color_inversion_preference)) {
            removePreference(TOGGLE_INVERSION_PREFERENCE);
        }
    }

    private static void configureMagnificationPreferenceIfNeeded(Preference preference) {
        // Some devices support only a single magnification mode. In these cases, we redirect to
        // the magnification mode's UI directly, rather than showing a PreferenceScreen with a
+0 −2
Original line number Diff line number Diff line
@@ -54,8 +54,6 @@
    <bool name="config_show_tts_settings_summary">false</bool>
    <bool name="config_show_pointer_speed">false</bool>
    <bool name="config_show_vibrate_input_devices">false</bool>
    <bool name="config_show_color_correction_preference">false</bool>
    <bool name="config_show_color_inversion_preference">false</bool>
    <bool name="config_show_system_update_settings">false</bool>
    <bool name="config_wifi_support_connected_mac_randomization">false</bool>
    <bool name="config_show_device_model">false</bool>
+0 −34
Original line number Diff line number Diff line
@@ -47,38 +47,4 @@ public class AccessibilitySettingsTest {

        assertThat(keys).containsAllIn(niks);
    }

    @Test
    public void testColorInversionPreference_byDefault_shouldBeShown() {
        final Preference preference = new Preference(mContext);
        mFragment.checkColorInversionVisibility(preference);

        assertThat(mColorInversionPreferenceRemoved).isEqualTo(false);
    }

    @Test
    @Config(qualifiers = "mcc999")
    public void testColorInversionPreference_ifDisabled_shouldNotBeShown() {
        final Preference preference = new Preference(mContext);
        mFragment.checkColorInversionVisibility(preference);

        assertThat(mColorInversionPreferenceRemoved).isEqualTo(true);
    }

    @Test
    public void testColorCorrectionPreference_byDefault_shouldBeShown() {
        final Preference preference = new Preference(mContext);
        mFragment.checkColorCorrectionVisibility(preference);

        assertThat(mColorCorrectionPreferenceRemoved).isEqualTo(false);
    }

    @Test
    @Config(qualifiers = "mcc999")
    public void testColorCorrectionPreference_ifDisabled_shouldNotBeShown() {
        final Preference preference = new Preference(mContext);
        mFragment.checkColorCorrectionVisibility(preference);

        assertThat(mColorCorrectionPreferenceRemoved).isEqualTo(true);
    }
}