diff options
| author | 2022-11-11 13:43:43 +0000 | |
|---|---|---|
| committer | 2022-11-23 19:26:53 +0000 | |
| commit | 511ddd3d05521d9c3047d0fec1a6b79b7b2e3e27 (patch) | |
| tree | f0602911042081529dfa5afe014aa576915750f4 | |
| parent | b7b84320d4f528518e4e6696eef7534b4d064448 (diff) | |
Add contrast level in settings
Test: treehugger
Bug: 259091608
Change-Id: Ib68b6688fdc06843b80a2582a78942b514149f3e
5 files changed, 13 insertions, 0 deletions
diff --git a/core/java/android/provider/Settings.java b/core/java/android/provider/Settings.java index fd45fca53722..ed59456e2281 100644 --- a/core/java/android/provider/Settings.java +++ b/core/java/android/provider/Settings.java @@ -7776,6 +7776,13 @@ public final class Settings { "high_text_contrast_enabled"; /** + * The color contrast, float in [-1, 1], 1 being the highest contrast. + * + * @hide + */ + public static final String CONTRAST_LEVEL = "contrast_level"; + + /** * Setting that specifies whether the display magnification is enabled via a system-wide * triple tap gesture. Display magnifications allows the user to zoom in the display content * and is targeted to low vision users. The current magnification scale is controlled by diff --git a/core/proto/android/providers/settings/secure.proto b/core/proto/android/providers/settings/secure.proto index 285258a979e4..556636ddd210 100644 --- a/core/proto/android/providers/settings/secure.proto +++ b/core/proto/android/providers/settings/secure.proto @@ -88,6 +88,7 @@ message SecureSettingsProto { optional SettingProto odi_captions_volume_ui_enabled = 42 [ (android.privacy).dest = DEST_AUTOMATIC ]; // Setting for accessibility magnification for following typing. optional SettingProto accessibility_magnification_follow_typing_enabled = 43 [ (android.privacy).dest = DEST_AUTOMATIC ]; + optional SettingProto contrast_level = 44 [ (android.privacy).dest = DEST_AUTOMATIC ]; } optional Accessibility accessibility = 2; diff --git a/packages/SettingsProvider/src/android/provider/settings/backup/SecureSettings.java b/packages/SettingsProvider/src/android/provider/settings/backup/SecureSettings.java index 8946516af8a2..92a938cb0b47 100644 --- a/packages/SettingsProvider/src/android/provider/settings/backup/SecureSettings.java +++ b/packages/SettingsProvider/src/android/provider/settings/backup/SecureSettings.java @@ -53,6 +53,7 @@ public class SecureSettings { Settings.Secure.ACCESSIBILITY_SHORTCUT_DIALOG_SHOWN, Settings.Secure.ACCESSIBILITY_SHORTCUT_ON_LOCK_SCREEN, Settings.Secure.ACCESSIBILITY_HIGH_TEXT_CONTRAST_ENABLED, + Settings.Secure.CONTRAST_LEVEL, Settings.Secure.ACCESSIBILITY_CAPTIONING_PRESET, Settings.Secure.ACCESSIBILITY_CAPTIONING_ENABLED, Settings.Secure.ACCESSIBILITY_CAPTIONING_LOCALE, diff --git a/packages/SettingsProvider/src/android/provider/settings/validators/SecureSettingsValidators.java b/packages/SettingsProvider/src/android/provider/settings/validators/SecureSettingsValidators.java index cbf79530a6b6..eabf4cc8edfd 100644 --- a/packages/SettingsProvider/src/android/provider/settings/validators/SecureSettingsValidators.java +++ b/packages/SettingsProvider/src/android/provider/settings/validators/SecureSettingsValidators.java @@ -86,6 +86,7 @@ public class SecureSettingsValidators { VALIDATORS.put(Secure.ACCESSIBILITY_SHORTCUT_DIALOG_SHOWN, BOOLEAN_VALIDATOR); VALIDATORS.put(Secure.ACCESSIBILITY_SHORTCUT_ON_LOCK_SCREEN, BOOLEAN_VALIDATOR); VALIDATORS.put(Secure.ACCESSIBILITY_HIGH_TEXT_CONTRAST_ENABLED, BOOLEAN_VALIDATOR); + VALIDATORS.put(Secure.CONTRAST_LEVEL, new InclusiveFloatRangeValidator(-1f, 1f)); VALIDATORS.put( Secure.ACCESSIBILITY_CAPTIONING_PRESET, new DiscreteValueValidator(new String[] {"-1", "0", "1", "2", "3", "4"})); diff --git a/packages/SettingsProvider/src/com/android/providers/settings/SettingsProtoDumpUtil.java b/packages/SettingsProvider/src/com/android/providers/settings/SettingsProtoDumpUtil.java index aa3a983e9971..a78faaf90c37 100644 --- a/packages/SettingsProvider/src/com/android/providers/settings/SettingsProtoDumpUtil.java +++ b/packages/SettingsProvider/src/com/android/providers/settings/SettingsProtoDumpUtil.java @@ -1756,6 +1756,9 @@ class SettingsProtoDumpUtil { Settings.Secure.ACCESSIBILITY_HIGH_TEXT_CONTRAST_ENABLED, SecureSettingsProto.Accessibility.HIGH_TEXT_CONTRAST_ENABLED); dumpSetting(s, p, + Settings.Secure.CONTRAST_LEVEL, + SecureSettingsProto.Accessibility.CONTRAST_LEVEL); + dumpSetting(s, p, Settings.Secure.FONT_WEIGHT_ADJUSTMENT, SecureSettingsProto.FONT_WEIGHT_ADJUSTMENT); dumpSetting(s, p, |