Merge "Don't use serialized system font map if disabled."

This commit is contained in:
TreeHugger Robot
2020-12-02 23:06:16 +00:00
committed by Android (Google) Code Review
2 changed files with 10 additions and 5 deletions

View File

@@ -6417,11 +6417,13 @@ public final class ActivityThread extends ClientTransactionHandler {
*/
LocaleList.setDefault(data.config.getLocales());
try {
Typeface.setSystemFontMap(data.mSerializedSystemFontMap);
} catch (IOException | ErrnoException e) {
Slog.e(TAG, "Failed to parse serialized system font map");
Typeface.loadPreinstalledSystemFontMap();
if (Typeface.ENABLE_LAZY_TYPEFACE_INITIALIZATION) {
try {
Typeface.setSystemFontMap(data.mSerializedSystemFontMap);
} catch (IOException | ErrnoException e) {
Slog.e(TAG, "Failed to parse serialized system font map");
Typeface.loadPreinstalledSystemFontMap();
}
}
synchronized (mResourcesManager) {

View File

@@ -64,6 +64,9 @@ public final class FontManagerService {
@Nullable
private SharedMemory getSerializedSystemFontMap() {
if (!Typeface.ENABLE_LAZY_TYPEFACE_INITIALIZATION) {
return null;
}
synchronized (FontManagerService.this) {
if (mSerializedSystemFontMap == null) {
mSerializedSystemFontMap = createSerializedSystemFontMapLocked();