From e3510a82a0fbddbb71ba31a704cff7b4c09da60e Mon Sep 17 00:00:00 2001 From: Seigo Nonaka Date: Mon, 3 Jul 2023 14:25:26 +0900 Subject: Deprecate fonts.xml and add hidden font_fallback.xml Not to break the apps that reads fonts.xml and add new features to the system font customization at the same time, this CL introduces new hidden XML file font_fallback.xml which is currently a copy of the fonts.xml. The fonts.xml still exists but may not contain the latest system font settings due to compatibility problems. Application should use the public API for accessing system installed fonts which is available from API29. Bug: 281769620 Test: atest CtsGraphicsTestCases Test: atest CtsTextTestCases Change-Id: I556b5fffb0c78f0c6150b472fd240b9a546de93f Merged-In: I556b5fffb0c78f0c6150b472fd240b9a546de93f --- graphics/java/android/graphics/fonts/SystemFonts.java | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'graphics/java/android') diff --git a/graphics/java/android/graphics/fonts/SystemFonts.java b/graphics/java/android/graphics/fonts/SystemFonts.java index 6278c0e23f27..1c1723cbd195 100644 --- a/graphics/java/android/graphics/fonts/SystemFonts.java +++ b/graphics/java/android/graphics/fonts/SystemFonts.java @@ -46,7 +46,7 @@ import java.util.Set; public final class SystemFonts { private static final String TAG = "SystemFonts"; - private static final String FONTS_XML = "/system/etc/fonts.xml"; + private static final String FONTS_XML = "/system/etc/font_fallback.xml"; /** @hide */ public static final String SYSTEM_FONT_DIR = "/system/fonts/"; private static final String OEM_XML = "/product/etc/fonts_customization.xml"; @@ -207,6 +207,19 @@ public final class SystemFonts { fallbackListMap.put(familyName, fallback); } + /** + * Get the updated FontConfig for testing purposes. + * @hide + */ + public static @NonNull FontConfig getSystemFontConfigForTesting( + @NonNull String fontsXmlPath, + @Nullable Map updatableFontMap, + long lastModifiedDate, + int configVersion) { + return getSystemFontConfigInternal(fontsXmlPath, SYSTEM_FONT_DIR, OEM_XML, OEM_FONT_DIR, + updatableFontMap, lastModifiedDate, configVersion); + } + /** * Get the updated FontConfig. * -- cgit v1.2.3-59-g8ed1b