From 834e5c3410a5babbffec7d72612382666b0d8975 Mon Sep 17 00:00:00 2001 From: Sally Date: Mon, 28 Sep 2020 23:02:42 +0000 Subject: [PATCH] For Force Bold Text, adjust the configuration between users When the user changes, populate the global config with the current user's setting state. For new users, don't keep the previous user's preference Test: manual, switched between users Bug: b/110991537 Change-Id: Iae412bccd64784a597ed8d493f1bda4984841cac --- core/java/android/provider/Settings.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/core/java/android/provider/Settings.java b/core/java/android/provider/Settings.java index 1dbf95f7db865..ef55c012f3a12 100644 --- a/core/java/android/provider/Settings.java +++ b/core/java/android/provider/Settings.java @@ -3567,6 +3567,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, + userHandle); final String localeValue = Settings.System.getStringForUser(cr, SYSTEM_LOCALES, userHandle); @@ -3597,6 +3600,7 @@ public final class Settings { if (!inoutConfig.userSetLocale && !inoutConfig.getLocales().isEmpty()) { inoutConfig.clearLocales(); } + inoutConfig.forceBoldText = Configuration.FORCE_BOLD_TEXT_UNDEFINED; } /** @@ -3620,7 +3624,11 @@ public final class Settings { DEFAULT_OVERRIDEABLE_BY_RESTORE); } - /** @hide */ + /** + * Convenience function for checking if settings should be overwritten with config changes. + * @see #putConfigurationForUser(ContentResolver, Configuration, int) + * @hide + */ public static boolean hasInterestingConfigurationChanges(int changes) { return (changes & ActivityInfo.CONFIG_FONT_SCALE) != 0 || (changes & ActivityInfo.CONFIG_LOCALE) != 0;