Change forceBoldText to fontWeightAdjustment in Settings

Bug: b/170966021, b/110991537
Test: builds; switched between users
Change-Id: I61958e7f7926aa773d2326eaed34352d69bf057b
This commit is contained in:
Sally
2020-11-03 19:41:05 +00:00
committed by Sally Yuen
parent e6f11af6d3
commit 3be3d32392
5 changed files with 15 additions and 15 deletions

View File

@@ -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.
*
* <p>Values:
* 1 - Text is not displayed in bold. (Default)
* 2 - Text is displayed in bold.
* <p> 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.

View File

@@ -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 ];

View File

@@ -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,

View File

@@ -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);

View File

@@ -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);