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

Commit f4cb55fd authored by Sally's avatar Sally
Browse files

Add Reduce Bright Colors to Settings

Add values to track activation, intensity level, and persistence state
Add an activity action to open the subpage directly

Test: builds
Bug: b/128465252
Change-Id: Icc9989254bc044377c162a8d94eec37723d86c19
parent b2b50a4f
Loading
Loading
Loading
Loading
+42 −0
Original line number Diff line number Diff line
@@ -325,6 +325,21 @@ public final class Settings {
    public static final String ACTION_ACCESSIBILITY_DETAILS_SETTINGS =
            "android.settings.ACCESSIBILITY_DETAILS_SETTINGS";
    /**
     * Activity Action: Show settings to allow configuration of Reduce Bright Colors.
     * <p>
     * In some cases, a matching Activity may not exist, so ensure you
     * safeguard against this.
     * <p>
     * Input: Nothing.
     * <p>
     * Output: Nothing.
     * @hide
     */
    @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
    public static final String ACTION_REDUCE_BRIGHT_COLORS_SETTINGS =
            "android.settings.REDUCE_BRIGHT_COLORS_SETTINGS";
    /**
     * Activity Action: Show settings to control access to usage information.
     * <p>
@@ -7123,6 +7138,33 @@ public final class Settings {
        public static final String ACCESSIBILITY_INTERACTIVE_UI_TIMEOUT_MS =
                "accessibility_interactive_ui_timeout_ms";
        /**
         * Setting that specifies whether Reduce Bright Colors, or brightness dimming by color
         * adjustment, is enabled.
         *
         * @hide
         */
        public static final String REDUCE_BRIGHT_COLORS_ACTIVATED =
                "reduce_bright_colors_activated";
        /**
         * Setting that specifies the level of Reduce Bright Colors in intensity. The range is
         * [0, 100].
         *
         * @hide
         */
        public static final String REDUCE_BRIGHT_COLORS_LEVEL =
                "reduce_bright_colors_level";
        /**
         * Setting that specifies whether Reduce Bright Colors should persist across reboots.
         *
         * @hide
         */
        public static final String REDUCE_BRIGHT_COLORS_PERSIST_ACROSS_REBOOTS =
                "reduce_bright_colors_persist_across_reboots";
        /**
         * List of the enabled print services.
         *
+2 −0
Original line number Diff line number Diff line
@@ -60,6 +60,8 @@ public class SecureSettings {
        Settings.Secure.ACCESSIBILITY_CAPTIONING_TYPEFACE,
        Settings.Secure.ACCESSIBILITY_CAPTIONING_FONT_SCALE,
        Settings.Secure.ACCESSIBILITY_CAPTIONING_WINDOW_COLOR,
        Settings.Secure.REDUCE_BRIGHT_COLORS_LEVEL,
        Settings.Secure.REDUCE_BRIGHT_COLORS_PERSIST_ACROSS_REBOOTS,
        Settings.Secure.TTS_DEFAULT_RATE,
        Settings.Secure.TTS_DEFAULT_PITCH,
        Settings.Secure.TTS_DEFAULT_SYNTH,
+3 −0
Original line number Diff line number Diff line
@@ -29,6 +29,7 @@ import static android.provider.settings.validators.SettingsValidators.NONE_NEGAT
import static android.provider.settings.validators.SettingsValidators.NON_NEGATIVE_INTEGER_VALIDATOR;
import static android.provider.settings.validators.SettingsValidators.NULLABLE_COMPONENT_NAME_VALIDATOR;
import static android.provider.settings.validators.SettingsValidators.PACKAGE_NAME_VALIDATOR;
import static android.provider.settings.validators.SettingsValidators.PERCENTAGE_INTEGER_VALIDATOR;
import static android.provider.settings.validators.SettingsValidators.TILE_LIST_VALIDATOR;
import static android.provider.settings.validators.SettingsValidators.TTS_LIST_VALIDATOR;

@@ -101,6 +102,8 @@ public class SecureSettingsValidators {
                Secure.ACCESSIBILITY_CAPTIONING_FONT_SCALE,
                new InclusiveFloatRangeValidator(0.5f, 2.0f));
        VALIDATORS.put(Secure.ACCESSIBILITY_CAPTIONING_WINDOW_COLOR, ANY_INTEGER_VALIDATOR);
        VALIDATORS.put(Secure.REDUCE_BRIGHT_COLORS_LEVEL, PERCENTAGE_INTEGER_VALIDATOR);
        VALIDATORS.put(Secure.REDUCE_BRIGHT_COLORS_PERSIST_ACROSS_REBOOTS, BOOLEAN_VALIDATOR);
        VALIDATORS.put(Secure.TTS_DEFAULT_RATE, NON_NEGATIVE_INTEGER_VALIDATOR);
        VALIDATORS.put(Secure.TTS_DEFAULT_PITCH, NON_NEGATIVE_INTEGER_VALIDATOR);
        VALIDATORS.put(Secure.TTS_DEFAULT_SYNTH, PACKAGE_NAME_VALIDATOR);
+2 −1
Original line number Diff line number Diff line
@@ -743,7 +743,8 @@ public class SettingsBackupTest {
                 Settings.Secure.NEARBY_SHARING_COMPONENT, // not user configurable
                 Settings.Secure.WINDOW_MAGNIFICATION,
                 Settings.Secure.ACCESSIBILITY_SHORTCUT_TARGET_MAGNIFICATION_CONTROLLER,
                 Settings.Secure.SUPPRESS_DOZE);
                 Settings.Secure.SUPPRESS_DOZE,
                 Settings.Secure.REDUCE_BRIGHT_COLORS_ACTIVATED);

    @Test
    public void systemSettingsBackedUpOrDenied() {