+++ /dev/null
-From 16d66568ce9eb9a5fbc06281415a56d3f292f0e9 Mon Sep 17 00:00:00 2001
-From: 0xD34D <clark@scheffsblend.com>
-Date: Wed, 22 Jun 2016 23:54:23 +0300
-Subject: [PATCH 25/44] N-Extras: Add dynamic theme fonts support
-
-Due to the nature of the removal of assetSeq in OMS7+, we now use the
-more controllable font scale updating code to update the fonts on
-demand.
-
-Extracted from Themes: Port to CM13 [1/3]
-http://review.cyanogenmod.org/#/c/113273/14
-
-Squashed:
-
-Small adjustment to Font commit
-Author camcory
-https://github.com/SubstratumResources/platform_frameworks_base/commit/a13f088dff70bc52f2053f32acff47a7a377a807
-
-Themes: Ensure themed fonts always have fallbacks
-Author 0xD34D
-https://github.com/CyanogenMod/android_frameworks_base/commit/18b301874e2a658eb01f97defd70da038521f450
-
-Themes: Let garbage collector free up native instances
-Author 0xD34D
-https://github.com/CyanogenMod/android_frameworks_base/commit/b7108ea9ce7ad2226aa6340046d24e069c6e8e21
-
-Themes: Make parse() method in FontListParser public
-Author 0xD34D
-https://github.com/CyanogenMod/android_frameworks_base/commit/b3ae4609f2754fd156e34dfbf39551041e976031
-
-Fonts: add sans-serif fallback fonts first
-Author 0xD34D
-https://github.com/CyanogenMod/android_frameworks_base/commit/f1d7b86dd267ed5b59e51339edc4553d37561a39
-
-Themes: Add config change flag for font change
-Author 0xD34D
-https://github.com/CyanogenMod/android_frameworks_base/commit/2ec1a33b70d3c013daa956696b68167a5eeef70d
-
-Themes: don't recreateDefaults on typeface when locale changes
-Author romanbb
-https://github.com/CyanogenMod/android_frameworks_base/commit/e05ffea4ea55a4eb6b40436a864a570509eb33ac
-
-Change-Id: I1f61bd269b42ab6145482a51d25fe5b1b5308f94
----
- core/java/android/app/ActivityThread.java | 7 +-
- core/java/android/content/pm/ActivityInfo.java | 5 +
- core/java/android/content/res/Configuration.java | 5 +-
- core/java/android/os/Process.java | 7 +-
- .../com/android/internal/os/ZygoteConnection.java | 10 ++
- graphics/java/android/graphics/FontListParser.java | 48 ++++--
- graphics/java/android/graphics/Typeface.java | 174 +++++++++++++++++++--
- .../android/server/am/ActivityManagerService.java | 11 +-
- 8 files changed, 240 insertions(+), 27 deletions(-)
-
-diff --git a/core/java/android/app/ActivityThread.java b/core/java/android/app/ActivityThread.java
-index 55fc25de68b..44a900b3a1f 100644
---- a/core/java/android/app/ActivityThread.java
-+++ b/core/java/android/app/ActivityThread.java
-@@ -48,6 +48,7 @@ import android.database.sqlite.SQLiteDebug;
- import android.database.sqlite.SQLiteDebug.DbStats;
- import android.graphics.Bitmap;
- import android.graphics.Canvas;
-+import android.graphics.Typeface;
- import android.hardware.display.DisplayManagerGlobal;
- import android.net.ConnectivityManager;
- import android.net.IConnectivityManager;
-@@ -4852,8 +4853,12 @@ public final class ActivityThread {
- if (configDiff != 0) {
- // Ask text layout engine to free its caches if there is a locale change
- boolean hasLocaleConfigChange = ((configDiff & ActivityInfo.CONFIG_LOCALE) != 0);
-- if (hasLocaleConfigChange) {
-+ boolean hasFontConfigChange = ((configDiff & ActivityInfo.CONFIG_THEME_FONT) != 0);
-+ if (hasLocaleConfigChange || hasFontConfigChange) {
- Canvas.freeTextLayoutCaches();
-+ if (hasFontConfigChange) {
-+ Typeface.recreateDefaults();
-+ }
- if (DEBUG_CONFIGURATION) Slog.v(TAG, "Cleared TextLayout Caches");
- }
- }
-diff --git a/core/java/android/content/pm/ActivityInfo.java b/core/java/android/content/pm/ActivityInfo.java
-index 5a09c0028cd..42febcfe59c 100644
---- a/core/java/android/content/pm/ActivityInfo.java
-+++ b/core/java/android/content/pm/ActivityInfo.java
-@@ -624,6 +624,11 @@ public class ActivityInfo extends ComponentInfo
- */
- public static final int CONFIG_LAYOUT_DIRECTION = 0x2000;
- /**
-+ * Bit in {@link #configChanges} that indicates a font change occurred
-+ * @hide
-+ */
-+ public static final int CONFIG_THEME_FONT = 0x200000;
-+ /**
- * Bit in {@link #configChanges} that indicates that the activity
- * can itself handle changes to the font scaling factor. Set from the
- * {@link android.R.attr#configChanges} attribute. This is
-diff --git a/core/java/android/content/res/Configuration.java b/core/java/android/content/res/Configuration.java
-index b2d518c56ca..2f7c3ec18dc 100644
---- a/core/java/android/content/res/Configuration.java
-+++ b/core/java/android/content/res/Configuration.java
-@@ -955,6 +955,7 @@ public final class Configuration implements Parcelable, Comparable<Configuration
- int changed = 0;
- if (delta.fontScale > 0 && fontScale != delta.fontScale) {
- changed |= ActivityInfo.CONFIG_FONT_SCALE;
-+ changed |= ActivityInfo.CONFIG_THEME_FONT;
- fontScale = delta.fontScale;
- }
- if (delta.mcc != 0 && mcc != delta.mcc) {
-@@ -1121,6 +1122,7 @@ public final class Configuration implements Parcelable, Comparable<Configuration
- int changed = 0;
- if (delta.fontScale > 0 && fontScale != delta.fontScale) {
- changed |= ActivityInfo.CONFIG_FONT_SCALE;
-+ changed |= ActivityInfo.CONFIG_THEME_FONT;
- }
- if (delta.mcc != 0 && mcc != delta.mcc) {
- changed |= ActivityInfo.CONFIG_MCC;
-@@ -1211,7 +1213,8 @@ public final class Configuration implements Parcelable, Comparable<Configuration
- */
- public static boolean needNewResources(@Config int configChanges,
- @Config int interestingChanges) {
-- return (configChanges & (interestingChanges|ActivityInfo.CONFIG_FONT_SCALE)) != 0;
-+ return (configChanges & (interestingChanges|ActivityInfo.CONFIG_FONT_SCALE|
-+ ActivityInfo.CONFIG_THEME_FONT)) != 0;
- }
-
- /**
-diff --git a/core/java/android/os/Process.java b/core/java/android/os/Process.java
-index e1b7fdad25e..6dcd045b07f 100644
---- a/core/java/android/os/Process.java
-+++ b/core/java/android/os/Process.java
-@@ -516,11 +516,12 @@ public class Process {
- String abi,
- String instructionSet,
- String appDataDir,
-+ boolean refreshTheme,
- String[] zygoteArgs) {
- try {
- return startViaZygote(processClass, niceName, uid, gid, gids,
- debugFlags, mountExternal, targetSdkVersion, seInfo,
-- abi, instructionSet, appDataDir, zygoteArgs);
-+ abi, instructionSet, appDataDir, refreshTheme, zygoteArgs);
- } catch (ZygoteStartFailedEx ex) {
- Log.e(LOG_TAG,
- "Starting VM process through Zygote failed");
-@@ -648,6 +649,7 @@ public class Process {
- String abi,
- String instructionSet,
- String appDataDir,
-+ boolean refreshTheme,
- String[] extraArgs)
- throws ZygoteStartFailedEx {
- synchronized(Process.class) {
-@@ -689,6 +691,9 @@ public class Process {
- } else if (mountExternal == Zygote.MOUNT_EXTERNAL_WRITE) {
- argsForZygote.add("--mount-external-write");
- }
-+ if (refreshTheme) {
-+ argsForZygote.add("--refresh_theme");
-+ }
- argsForZygote.add("--target-sdk-version=" + targetSdkVersion);
-
- //TODO optionally enable debuger
-diff --git a/core/java/com/android/internal/os/ZygoteConnection.java b/core/java/com/android/internal/os/ZygoteConnection.java
-index 85d84bb3f98..81257f0d341 100644
---- a/core/java/com/android/internal/os/ZygoteConnection.java
-+++ b/core/java/com/android/internal/os/ZygoteConnection.java
-@@ -22,6 +22,7 @@ import static android.system.OsConstants.STDERR_FILENO;
- import static android.system.OsConstants.STDIN_FILENO;
- import static android.system.OsConstants.STDOUT_FILENO;
-
-+import android.graphics.Typeface;
- import android.net.Credentials;
- import android.net.LocalSocket;
- import android.os.Process;
-@@ -194,6 +195,10 @@ class ZygoteConnection {
- Os.fcntlInt(childPipeFd, F_SETFD, 0);
- }
-
-+ if (parsedArgs.refreshTheme) {
-+ Typeface.recreateDefaults();
-+ }
-+
- /**
- * In order to avoid leaking descriptors to the Zygote child,
- * the native code must close the two Zygote socket descriptors
-@@ -373,6 +378,9 @@ class ZygoteConnection {
- */
- String appDataDir;
-
-+ /** from --refresh_theme */
-+ boolean refreshTheme;
-+
- /**
- * Constructs instance and parses args
- * @param args zygote command-line args
-@@ -531,6 +539,8 @@ class ZygoteConnection {
- instructionSet = arg.substring(arg.indexOf('=') + 1);
- } else if (arg.startsWith("--app-data-dir=")) {
- appDataDir = arg.substring(arg.indexOf('=') + 1);
-+ } else if (arg.equals("--refresh_theme")) {
-+ refreshTheme = true;
- } else {
- break;
- }
-diff --git a/graphics/java/android/graphics/FontListParser.java b/graphics/java/android/graphics/FontListParser.java
-index 7871aa81dde..f4590c94647 100644
---- a/graphics/java/android/graphics/FontListParser.java
-+++ b/graphics/java/android/graphics/FontListParser.java
-@@ -21,6 +21,9 @@ import android.util.Xml;
- import org.xmlpull.v1.XmlPullParser;
- import org.xmlpull.v1.XmlPullParserException;
-
-+import java.io.BufferedInputStream;
-+import java.io.File;
-+import java.io.FileInputStream;
- import java.io.IOException;
- import java.io.InputStream;
- import java.util.ArrayList;
-@@ -88,18 +91,41 @@ public class FontListParser {
- }
-
- /* Parse fallback list (no names) */
-- public static Config parse(InputStream in) throws XmlPullParserException, IOException {
-+ public static Config parse(File configFilename, String fontDir)
-+ throws XmlPullParserException, IOException {
-+ FileInputStream in = null;
-+ in = new FileInputStream(configFilename);
-+ return FontListParser.parse(in, fontDir);
-+ }
-+
-+ /* Parse fallback list (no names) */
-+ public static Config parse(InputStream in, String fontDir)
-+ throws XmlPullParserException, IOException {
-+ BufferedInputStream bis = null;
- try {
-+ // wrap input stream in a BufferedInputStream, if it's not already, for mark support
-+ if (!(in instanceof BufferedInputStream)) {
-+ bis = new BufferedInputStream(in);
-+ } else {
-+ bis = (BufferedInputStream) in;
-+ }
-+ // mark the beginning so we can reset to this position after checking format
-+ bis.mark(in.available());
-+ return parseNormalFormat(bis, fontDir);
-+ } finally {
-+ if (bis != null) bis.close();
-+ }
-+ }
-+
-+ public static Config parseNormalFormat(InputStream in, String dirName)
-+ throws XmlPullParserException, IOException {
- XmlPullParser parser = Xml.newPullParser();
- parser.setInput(in, null);
- parser.nextTag();
-- return readFamilies(parser);
-- } finally {
-- in.close();
-- }
-+ return readFamilies(parser, dirName);
- }
-
-- private static Config readFamilies(XmlPullParser parser)
-+ private static Config readFamilies(XmlPullParser parser, String dirPath)
- throws XmlPullParserException, IOException {
- Config config = new Config();
- parser.require(XmlPullParser.START_TAG, null, "familyset");
-@@ -107,7 +133,7 @@ public class FontListParser {
- if (parser.getEventType() != XmlPullParser.START_TAG) continue;
- String tag = parser.getName();
- if (tag.equals("family")) {
-- config.families.add(readFamily(parser));
-+ config.families.add(readFamily(parser, dirPath));
- } else if (tag.equals("alias")) {
- config.aliases.add(readAlias(parser));
- } else {
-@@ -117,7 +143,7 @@ public class FontListParser {
- return config;
- }
-
-- private static Family readFamily(XmlPullParser parser)
-+ private static Family readFamily(XmlPullParser parser, String dirPath)
- throws XmlPullParserException, IOException {
- String name = parser.getAttributeValue(null, "name");
- String lang = parser.getAttributeValue(null, "lang");
-@@ -127,7 +153,7 @@ public class FontListParser {
- if (parser.getEventType() != XmlPullParser.START_TAG) continue;
- String tag = parser.getName();
- if (tag.equals("font")) {
-- fonts.add(readFont(parser));
-+ fonts.add(readFont(parser, dirPath));
- } else {
- skip(parser);
- }
-@@ -139,7 +165,7 @@ public class FontListParser {
- private static final Pattern FILENAME_WHITESPACE_PATTERN =
- Pattern.compile("^[ \\n\\r\\t]+|[ \\n\\r\\t]+$");
-
-- private static Font readFont(XmlPullParser parser)
-+ private static Font readFont(XmlPullParser parser, String dirPath)
- throws XmlPullParserException, IOException {
- String indexStr = parser.getAttributeValue(null, "index");
- int index = indexStr == null ? 0 : Integer.parseInt(indexStr);
-@@ -160,7 +186,7 @@ public class FontListParser {
- skip(parser);
- }
- }
-- String fullFilename = "/system/fonts/" +
-+ String fullFilename = dirPath + File.separatorChar +
- FILENAME_WHITESPACE_PATTERN.matcher(filename).replaceAll("");
- return new Font(fullFilename, index, axes, weight, isItalic);
- }
-diff --git a/graphics/java/android/graphics/Typeface.java b/graphics/java/android/graphics/Typeface.java
-index 2886f0dd4a2..990c9bd1fbf 100644
---- a/graphics/java/android/graphics/Typeface.java
-+++ b/graphics/java/android/graphics/Typeface.java
-@@ -17,6 +17,7 @@
- package android.graphics;
-
- import android.content.res.AssetManager;
-+import android.graphics.FontListParser.Family;
- import android.util.Log;
- import android.util.LongSparseArray;
- import android.util.LruCache;
-@@ -75,6 +76,8 @@ public class Typeface {
-
- static final String FONTS_CONFIG = "fonts.xml";
-
-+ static final String SANS_SERIF_FAMILY_NAME = "sans-serif";
-+
- /**
- * @hide
- */
-@@ -88,6 +91,13 @@ public class Typeface {
-
- private int mStyle = 0;
-
-+ // Typefaces that we can garbage collect when changing fonts, and so we don't break public APIs
-+ private static Typeface DEFAULT_INTERNAL;
-+ private static Typeface DEFAULT_BOLD_INTERNAL;
-+ private static Typeface SANS_SERIF_INTERNAL;
-+ private static Typeface SERIF_INTERNAL;
-+ private static Typeface MONOSPACE_INTERNAL;
-+
- private static void setDefault(Typeface t) {
- sDefaultTypeface = t;
- nativeSetDefault(t.native_instance);
-@@ -263,7 +273,10 @@ public class Typeface {
- for (int i = 0; i < families.length; i++) {
- ptrArray[i] = families[i].mNativePtr;
- }
-- return new Typeface(nativeCreateFromArray(ptrArray));
-+
-+
-+ Typeface typeface = new Typeface(nativeCreateFromArray(ptrArray));
-+ return typeface;
- }
-
- /**
-@@ -318,6 +331,73 @@ public class Typeface {
- return fontFamily;
- }
-
-+ /**
-+ * Adds the family from src with the name familyName as a fallback font in dst
-+ * @param src Source font config
-+ * @param dst Destination font config
-+ * @param familyName Name of family to add as a fallback
-+ */
-+ private static void addFallbackFontsForFamilyName(FontListParser.Config src,
-+ FontListParser.Config dst, String familyName) {
-+ for (Family srcFamily : src.families) {
-+ if (familyName.equals(srcFamily.name)) {
-+ // set the name to null so that it will be added as a fallback
-+ srcFamily.name = null;
-+ dst.families.add(srcFamily);
-+ return;
-+ }
-+ }
-+ }
-+
-+ /**
-+ * Adds any font families in src that do not exist in dst
-+ * @param src Source font config
-+ * @param dst Destination font config
-+ */
-+ private static void addMissingFontFamilies(FontListParser.Config src,
-+ FontListParser.Config dst) {
-+ final int N = dst.families.size();
-+ // add missing families
-+ for (Family srcFamily : src.families) {
-+ boolean addFamily = true;
-+ for (int i = 0; i < N && addFamily; i++) {
-+ final Family dstFamily = dst.families.get(i);
-+ final String dstFamilyName = dstFamily.name;
-+ if (dstFamilyName != null && dstFamilyName.equals(srcFamily.name)) {
-+ addFamily = false;
-+ break;
-+ }
-+ }
-+ if (addFamily) {
-+ dst.families.add(srcFamily);
-+ }
-+ }
-+ }
-+
-+ /**
-+ * Adds any aliases in src that do not exist in dst
-+ * @param src Source font config
-+ * @param dst Destination font config
-+ */
-+ private static void addMissingFontAliases(FontListParser.Config src,
-+ FontListParser.Config dst) {
-+ final int N = dst.aliases.size();
-+ // add missing aliases
-+ for (FontListParser.Alias alias : src.aliases) {
-+ boolean addAlias = true;
-+ for (int i = 0; i < N && addAlias; i++) {
-+ final String dstAliasName = dst.aliases.get(i).name;
-+ if (dstAliasName != null && dstAliasName.equals(alias.name)) {
-+ addAlias = false;
-+ break;
-+ }
-+ }
-+ if (addAlias) {
-+ dst.aliases.add(alias);
-+ }
-+ }
-+ }
-+
- /*
- * (non-Javadoc)
- *
-@@ -326,10 +406,36 @@ public class Typeface {
- private static void init() {
- // Load font config and initialize Minikin state
- File systemFontConfigLocation = getSystemFontConfigLocation();
-- File configFilename = new File(systemFontConfigLocation, FONTS_CONFIG);
-+ File themeFontConfigLocation = getThemeFontConfigLocation();
-+
-+ File systemConfigFile = new File(systemFontConfigLocation, FONTS_CONFIG);
-+ File themeConfigFile = new File(themeFontConfigLocation, FONTS_CONFIG);
-+ File configFile = null;
-+ File fontDir;
-+
-+ if (themeConfigFile.exists()) {
-+ configFile = themeConfigFile;
-+ fontDir = getThemeFontDirLocation();
-+ } else {
-+ configFile = systemConfigFile;
-+ fontDir = getSystemFontDirLocation();
-+ }
-+
- try {
-- FileInputStream fontsIn = new FileInputStream(configFilename);
-- FontListParser.Config fontConfig = FontListParser.parse(fontsIn);
-+ FontListParser.Config fontConfig = FontListParser.parse(configFile,
-+ fontDir.getAbsolutePath());
-+ FontListParser.Config systemFontConfig = null;
-+
-+ // If the fonts are coming from a theme, we will need to make sure that we include
-+ // any font families from the system fonts that the theme did not include.
-+ // NOTE: All the system font families without names ALWAYS get added.
-+ if (configFile == themeConfigFile) {
-+ systemFontConfig = FontListParser.parse(systemConfigFile,
-+ getSystemFontDirLocation().getAbsolutePath());
-+ addFallbackFontsForFamilyName(systemFontConfig, fontConfig, SANS_SERIF_FAMILY_NAME);
-+ addMissingFontFamilies(systemFontConfig, fontConfig);
-+ addMissingFontAliases(systemFontConfig, fontConfig);
-+ }
-
- Map<String, ByteBuffer> bufferForPath = new HashMap<String, ByteBuffer>();
-
-@@ -342,6 +448,7 @@ public class Typeface {
- familyList.add(makeFamilyFromParsed(f, bufferForPath));
- }
- }
-+
- sFallbackFonts = familyList.toArray(new FontFamily[familyList.size()]);
- setDefault(Typeface.createFromFamilies(sFallbackFonts));
-
-@@ -377,22 +484,53 @@ public class Typeface {
- Log.w(TAG, "Didn't create default family (most likely, non-Minikin build)", e);
- // TODO: normal in non-Minikin case, remove or make error when Minikin-only
- } catch (FileNotFoundException e) {
-- Log.e(TAG, "Error opening " + configFilename, e);
-+ Log.e(TAG, "Error opening " + configFile, e);
- } catch (IOException e) {
-- Log.e(TAG, "Error reading " + configFilename, e);
-+ Log.e(TAG, "Error reading " + configFile, e);
- } catch (XmlPullParserException e) {
-- Log.e(TAG, "XML parse exception for " + configFilename, e);
-+ Log.e(TAG, "XML parse exception for " + configFile, e);
- }
- }
-
-+ /**
-+ * Clears caches in java and skia.
-+ * Skia will then reparse font config
-+ * @hide
-+ */
-+ public static void recreateDefaults() {
-+ sTypefaceCache.clear();
-+ sSystemFontMap.clear();
-+ init();
-+
-+ DEFAULT_INTERNAL = create((String) null, 0);
-+ DEFAULT_BOLD_INTERNAL = create((String) null, Typeface.BOLD);
-+ SANS_SERIF_INTERNAL = create("sans-serif", 0);
-+ SERIF_INTERNAL = create("serif", 0);
-+ MONOSPACE_INTERNAL = create("monospace", 0);
-+
-+ DEFAULT.native_instance = DEFAULT_INTERNAL.native_instance;
-+ DEFAULT_BOLD.native_instance = DEFAULT_BOLD_INTERNAL.native_instance;
-+ SANS_SERIF.native_instance = SANS_SERIF_INTERNAL.native_instance;
-+ SERIF.native_instance = SERIF_INTERNAL.native_instance;
-+ MONOSPACE.native_instance = MONOSPACE_INTERNAL.native_instance;
-+ sDefaults[2] = create((String) null, Typeface.ITALIC);
-+ sDefaults[3] = create((String) null, Typeface.BOLD_ITALIC);
-+ }
-+
- static {
- init();
- // Set up defaults and typefaces exposed in public API
-- DEFAULT = create((String) null, 0);
-- DEFAULT_BOLD = create((String) null, Typeface.BOLD);
-- SANS_SERIF = create("sans-serif", 0);
-- SERIF = create("serif", 0);
-- MONOSPACE = create("monospace", 0);
-+ DEFAULT_INTERNAL = create((String) null, 0);
-+ DEFAULT_BOLD_INTERNAL = create((String) null, Typeface.BOLD);
-+ SANS_SERIF_INTERNAL = create("sans-serif", 0);
-+ SERIF_INTERNAL = create("serif", 0);
-+ MONOSPACE_INTERNAL = create("monospace", 0);
-+
-+ DEFAULT = new Typeface(DEFAULT_INTERNAL.native_instance);
-+ DEFAULT_BOLD = new Typeface(DEFAULT_BOLD_INTERNAL.native_instance);
-+ SANS_SERIF = new Typeface(SANS_SERIF_INTERNAL.native_instance);
-+ SERIF = new Typeface(SERIF_INTERNAL.native_instance);
-+ MONOSPACE = new Typeface(MONOSPACE_INTERNAL.native_instance);
-
- sDefaults = new Typeface[] {
- DEFAULT,
-@@ -407,6 +545,18 @@ public class Typeface {
- return new File("/system/etc/");
- }
-
-+ private static File getSystemFontDirLocation() {
-+ return new File("/system/fonts/");
-+ }
-+
-+ private static File getThemeFontConfigLocation() {
-+ return new File("/data/system/theme/fonts/");
-+ }
-+
-+ private static File getThemeFontDirLocation() {
-+ return new File("/data/system/theme/fonts/");
-+ }
-+
- @Override
- protected void finalize() throws Throwable {
- try {
-diff --git a/services/core/java/com/android/server/am/ActivityManagerService.java b/services/core/java/com/android/server/am/ActivityManagerService.java
-index f4d07aff3e6..5d8ab51d077 100644
---- a/services/core/java/com/android/server/am/ActivityManagerService.java
-+++ b/services/core/java/com/android/server/am/ActivityManagerService.java
-@@ -513,6 +513,8 @@ public final class ActivityManagerService extends ActivityManagerNative
- // as one line, but close enough for now.
- static final int RESERVED_BYTES_PER_LOGCAT_LINE = 100;
-
-+ static final String PROP_REFRESH_THEME = "sys.refresh_theme";
-+
- // Access modes for handleIncomingUser.
- static final int ALLOW_NON_FULL = 0;
- static final int ALLOW_NON_FULL_IN_PROFILE = 1;
-@@ -3948,6 +3950,13 @@ public final class ActivityManagerService extends ActivityManagerNative
- mNativeDebuggingApp = null;
- }
-
-+ //Check if zygote should refresh its fonts
-+ boolean refreshTheme = false;
-+ if (SystemProperties.getBoolean(PROP_REFRESH_THEME, false)) {
-+ SystemProperties.set(PROP_REFRESH_THEME, "false");
-+ refreshTheme = true;
-+ }
-+
- String requiredAbi = (abiOverride != null) ? abiOverride : app.info.primaryCpuAbi;
- if (requiredAbi == null) {
- requiredAbi = Build.SUPPORTED_ABIS[0];
-@@ -3972,7 +3981,7 @@ public final class ActivityManagerService extends ActivityManagerNative
- Process.ProcessStartResult startResult = Process.start(entryPoint,
- app.processName, uid, uid, gids, debugFlags, mountExternal,
- app.info.targetSdkVersion, app.info.seinfo, requiredAbi, instructionSet,
-- app.info.dataDir, entryPointArgs);
-+ app.info.dataDir, refreshTheme, entryPointArgs);
- checkTime(startTime, "startProcess: returned from zygote!");
- Trace.traceEnd(Trace.TRACE_TAG_ACTIVITY_MANAGER);
-
---
-2.11.1
-