summaryrefslogtreecommitdiff
path: root/services/java/com/android
diff options
context:
space:
mode:
authorKohsuke Yatoh <kyatoh@google.com>2020-11-16 10:41:58 -0800
committerKohsuke Yatoh <kyatoh@google.com>2020-12-01 16:05:33 -0800
commitb11b963ed14d952cc2eb85e272780f92fa5b8b09 (patch)
tree2563d3bddd26f96c037ad05018a39b4c0549558b /services/java/com/android
parentda631e9a6714b259b5dcdb3c8768bcd3441c518d (diff)
Prepare switching font loading to system server.
Currently, fonts are loaded in Zygote. This CL adds a preparation to switch it to system server and bindApplication(), so that system server will be able to update font map at runtime. (1) Zygote will be initialized without fonts. (2) System server will maintain a serialized font map in ashmem. (3) Apps will load font map from the ashmem in bindApplication(). The change is guarded by Typeface.ENABLE_LAZY_TYPEFACE_INITIALIZATION, and the new behavior is disabled by default. I tested with ENABLE_LAZY_TYPEFACE_INITIALIZATION = true. Bug: 172891184 Test: atest FrameworksCoreTests:TypefaceTest Test: atest CtsGraphicsTestCases Test: atest CtsTextTestCases Test: atest CtsWidgetTestCases Change-Id: I40832962a4b27f6160c4dc6268689c52f6a4dd33
Diffstat (limited to 'services/java/com/android')
-rw-r--r--services/java/com/android/server/SystemServer.java11
1 files changed, 11 insertions, 0 deletions
diff --git a/services/java/com/android/server/SystemServer.java b/services/java/com/android/server/SystemServer.java
index 10b3265cd081..6525e1126478 100644
--- a/services/java/com/android/server/SystemServer.java
+++ b/services/java/com/android/server/SystemServer.java
@@ -47,6 +47,7 @@ import android.content.res.Resources.Theme;
import android.database.sqlite.SQLiteCompatibilityWalFlags;
import android.database.sqlite.SQLiteGlobal;
import android.graphics.GraphicsStatsService;
+import android.graphics.Typeface;
import android.hardware.display.DisplayManagerInternal;
import android.net.ConnectivityManager;
import android.net.ConnectivityModuleConnector;
@@ -120,6 +121,7 @@ import com.android.server.display.color.ColorDisplayService;
import com.android.server.dreams.DreamManagerService;
import com.android.server.emergency.EmergencyAffordanceService;
import com.android.server.gpu.GpuService;
+import com.android.server.graphics.fonts.FontManagerService;
import com.android.server.hdmi.HdmiControlService;
import com.android.server.incident.IncidentCompanionService;
import com.android.server.input.InputManagerService;
@@ -673,6 +675,11 @@ public final class SystemServer implements Dumpable {
SystemServerInitThreadPool tp = SystemServerInitThreadPool.start();
mDumper.addDumpable(tp);
+ // Load preinstalled system fonts for system server, so that WindowManagerService, etc
+ // can start using Typeface. Note that fonts are required not only for text rendering,
+ // but also for some text operations (e.g. TextUtils.makeSafeForPresentation()).
+ Typeface.loadPreinstalledSystemFontMap();
+
// Attach JVMTI agent if this is a debuggable build and the system property is set.
if (Build.IS_DEBUGGABLE) {
// Property is of the form "library_path=parameters".
@@ -1604,6 +1611,10 @@ public final class SystemServer implements Dumpable {
}
t.traceEnd();
+ t.traceBegin("StartFontManagerService");
+ mSystemServiceManager.startService(FontManagerService.Lifecycle.class);
+ t.traceEnd();
+
t.traceBegin("StartTextServicesManager");
mSystemServiceManager.startService(TextServicesManagerService.Lifecycle.class);
t.traceEnd();