diff --git a/core/java/android/provider/Settings.java b/core/java/android/provider/Settings.java index 8093ff50bccf0..3e48168eabe0f 100644 --- a/core/java/android/provider/Settings.java +++ b/core/java/android/provider/Settings.java @@ -3580,8 +3580,9 @@ public final class Settings { if (outConfig.fontScale < 0) { outConfig.fontScale = DEFAULT_FONT_SCALE; } - outConfig.forceBoldText = Settings.Secure.getIntForUser( - cr, Settings.Secure.FORCE_BOLD_TEXT, Configuration.FORCE_BOLD_TEXT_NO, + outConfig.fontWeightAdjustment = Settings.Secure.getIntForUser( + cr, Settings.Secure.FONT_WEIGHT_ADJUSTMENT, + Configuration.FONT_WEIGHT_ADJUSTMENT_UNDEFINED, userHandle); final String localeValue = @@ -3613,7 +3614,7 @@ public final class Settings { if (!inoutConfig.userSetLocale && !inoutConfig.getLocales().isEmpty()) { inoutConfig.clearLocales(); } - inoutConfig.forceBoldText = Configuration.FORCE_BOLD_TEXT_UNDEFINED; + inoutConfig.fontWeightAdjustment = Configuration.FONT_WEIGHT_ADJUSTMENT_UNDEFINED; } /** @@ -6814,17 +6815,16 @@ public final class Settings { public static final String KEYGUARD_SLICE_URI = "keyguard_slice_uri"; /** - * Whether to draw text in bold. + * The adjustment in font weight. This is used to draw text in bold. * - *
Values: - * 1 - Text is not displayed in bold. (Default) - * 2 - Text is displayed in bold. + *
This value can be negative. To display bolded text, the adjustment used is 300, + * which is the difference between + * {@link android.graphics.fonts.FontStyle#FONT_WEIGHT_NORMAL} and + * {@link android.graphics.fonts.FontStyle#FONT_WEIGHT_BOLD}. * - * @see Configuration#FORCE_BOLD_TEXT_NO - * @see Configuration#FORCE_BOLD_TEXT_YES * @hide */ - public static final String FORCE_BOLD_TEXT = "force_bold_text"; + public static final String FONT_WEIGHT_ADJUSTMENT = "font_weight_adjustment"; /** * Whether to speak passwords while in accessibility mode. diff --git a/core/proto/android/providers/settings/secure.proto b/core/proto/android/providers/settings/secure.proto index d934b82e36c34..6f4085daf64ff 100644 --- a/core/proto/android/providers/settings/secure.proto +++ b/core/proto/android/providers/settings/secure.proto @@ -229,7 +229,7 @@ message SecureSettingsProto { optional SettingProto enhanced_voice_privacy_enabled = 23 [ (android.privacy).dest = DEST_AUTOMATIC ]; - optional SettingProto force_bold_text = 85 [ (android.privacy).dest = DEST_AUTOMATIC ]; + optional SettingProto font_weight_adjustment = 85 [ (android.privacy).dest = DEST_AUTOMATIC ]; message Gesture { optional SettingProto aware_enabled = 1 [ (android.privacy).dest = DEST_AUTOMATIC ]; diff --git a/packages/SettingsProvider/src/android/provider/settings/backup/SecureSettings.java b/packages/SettingsProvider/src/android/provider/settings/backup/SecureSettings.java index ffbc7f4cecf32..09f7866f70c64 100644 --- a/packages/SettingsProvider/src/android/provider/settings/backup/SecureSettings.java +++ b/packages/SettingsProvider/src/android/provider/settings/backup/SecureSettings.java @@ -60,7 +60,7 @@ public class SecureSettings { Settings.Secure.ACCESSIBILITY_CAPTIONING_TYPEFACE, Settings.Secure.ACCESSIBILITY_CAPTIONING_FONT_SCALE, Settings.Secure.ACCESSIBILITY_CAPTIONING_WINDOW_COLOR, - Settings.Secure.FORCE_BOLD_TEXT, + Settings.Secure.FONT_WEIGHT_ADJUSTMENT, Settings.Secure.REDUCE_BRIGHT_COLORS_LEVEL, Settings.Secure.REDUCE_BRIGHT_COLORS_PERSIST_ACROSS_REBOOTS, Settings.Secure.TTS_DEFAULT_RATE, diff --git a/packages/SettingsProvider/src/android/provider/settings/validators/SecureSettingsValidators.java b/packages/SettingsProvider/src/android/provider/settings/validators/SecureSettingsValidators.java index 46c42fc8fdd62..d16aebb4d4b4a 100644 --- a/packages/SettingsProvider/src/android/provider/settings/validators/SecureSettingsValidators.java +++ b/packages/SettingsProvider/src/android/provider/settings/validators/SecureSettingsValidators.java @@ -102,7 +102,7 @@ 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.FORCE_BOLD_TEXT, new DiscreteValueValidator(new String[] {"1", "2"})); + VALIDATORS.put(Secure.FONT_WEIGHT_ADJUSTMENT, 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); diff --git a/packages/SettingsProvider/src/com/android/providers/settings/SettingsProtoDumpUtil.java b/packages/SettingsProvider/src/com/android/providers/settings/SettingsProtoDumpUtil.java index 2e551fa80f746..e9f09e5c1f49a 100644 --- a/packages/SettingsProvider/src/com/android/providers/settings/SettingsProtoDumpUtil.java +++ b/packages/SettingsProvider/src/com/android/providers/settings/SettingsProtoDumpUtil.java @@ -1769,8 +1769,8 @@ class SettingsProtoDumpUtil { Settings.Secure.ACCESSIBILITY_HIGH_TEXT_CONTRAST_ENABLED, SecureSettingsProto.Accessibility.HIGH_TEXT_CONTRAST_ENABLED); dumpSetting(s, p, - Settings.Secure.FORCE_BOLD_TEXT, - SecureSettingsProto.FORCE_BOLD_TEXT); + Settings.Secure.FONT_WEIGHT_ADJUSTMENT, + SecureSettingsProto.FONT_WEIGHT_ADJUSTMENT); dumpSetting(s, p, Settings.Secure.ACCESSIBILITY_LARGE_POINTER_ICON, SecureSettingsProto.Accessibility.LARGE_POINTER_ICON);