From ef7243e0694f6ec765931d5b0521acd1701d714f Mon Sep 17 00:00:00 2001 From: d34d Date: Wed, 9 Sep 2015 11:37:11 -0700 Subject: Themes: Don't use themed fonts for non themable packages Change-Id: I8a86e13a7ebc8be59286700c26a55d9d6a013db9 --- graphics/java/android/graphics/Typeface.java | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'graphics') diff --git a/graphics/java/android/graphics/Typeface.java b/graphics/java/android/graphics/Typeface.java index a64c0af..4e9788a 100644 --- a/graphics/java/android/graphics/Typeface.java +++ b/graphics/java/android/graphics/Typeface.java @@ -350,7 +350,7 @@ public class Typeface { * * This should only be called once, from the static class initializer block. */ - private static void init() { + private static void init(boolean forceSystemFonts) { // Load font config and initialize Minikin state File systemFontConfigLocation = getSystemFontConfigLocation(); File themeFontConfigLocation = getThemeFontConfigLocation(); @@ -360,7 +360,7 @@ public class Typeface { File configFile = null; File fontDir; - if (themeConfigFile.exists()) { + if (!forceSystemFonts && themeConfigFile.exists()) { configFile = themeConfigFile; fontDir = getThemeFontDirLocation(); } else { @@ -437,15 +437,20 @@ public class Typeface { } } + /** @hide */ + public static void recreateDefaults() { + recreateDefaults(false); + } + /** * Clears caches in java and skia. * Skia will then reparse font config * @hide */ - public static void recreateDefaults() { + public static void recreateDefaults(boolean forceSystemFonts) { sTypefaceCache.clear(); sSystemFontMap.clear(); - init(); + init(forceSystemFonts); DEFAULT_INTERNAL = create((String) null, 0); DEFAULT_BOLD_INTERNAL = create((String) null, Typeface.BOLD); @@ -463,7 +468,7 @@ public class Typeface { } static { - init(); + init(false); // Set up defaults and typefaces exposed in public API DEFAULT_INTERNAL = create((String) null, 0); DEFAULT_BOLD_INTERNAL = create((String) null, Typeface.BOLD); -- cgit v1.1