diff options
| author | 2024-04-03 16:51:08 -0700 | |
|---|---|---|
| committer | 2024-04-04 06:34:40 +0000 | |
| commit | efd40ba956fabefa800b94edbfccd50829224cad (patch) | |
| tree | 7438fdaf2b85995cd5dc3306f51fdac50873cb34 | |
| parent | 65dc94c7e4e207568180e629f993fd25e1117cd2 (diff) | |
Ensure font is loaded by PHASE_SYSTEM_SERVICES_READY
This is needed to fix the corner cases where system_server tries to draw
some text before FontManagerService is initialized.
Bug: 327941215
Test: successful boot
Change-Id: Iee21f13112681fa43fb08828d27dfe34d2e58b41
| -rw-r--r-- | core/java/android/text/flags/flags.aconfig | 13 | ||||
| -rw-r--r-- | services/core/java/com/android/server/graphics/fonts/FontManagerService.java | 6 |
2 files changed, 18 insertions, 1 deletions
diff --git a/core/java/android/text/flags/flags.aconfig b/core/java/android/text/flags/flags.aconfig index 559fa96d0198..44fa1863afc1 100644 --- a/core/java/android/text/flags/flags.aconfig +++ b/core/java/android/text/flags/flags.aconfig @@ -53,6 +53,19 @@ flag { } flag { + name: "complete_font_load_in_system_services_ready" + namespace: "text" + description: "Fix to ensure that font loading is complete on system-services-ready boot phase." + # Make read only, as font loading is in the critical boot path which happens before the read-write + # flags propagate to the device. + is_fixed_read_only: true + bug: "327941215" + metadata { + purpose: PURPOSE_BUGFIX + } +} + +flag { name: "phrase_strict_fallback" namespace: "text" description: "Feature flag for automatic fallback from phrase based line break to strict line break." diff --git a/services/core/java/com/android/server/graphics/fonts/FontManagerService.java b/services/core/java/com/android/server/graphics/fonts/FontManagerService.java index 7b844a099841..f3836794c32e 100644 --- a/services/core/java/com/android/server/graphics/fonts/FontManagerService.java +++ b/services/core/java/com/android/server/graphics/fonts/FontManagerService.java @@ -165,7 +165,11 @@ public final class FontManagerService extends IFontManager.Stub { @Override public void onBootPhase(int phase) { - if (phase == SystemService.PHASE_ACTIVITY_MANAGER_READY) { + final int latestFontLoadBootPhase = + (Flags.completeFontLoadInSystemServicesReady()) + ? SystemService.PHASE_SYSTEM_SERVICES_READY + : SystemService.PHASE_ACTIVITY_MANAGER_READY; + if (phase == latestFontLoadBootPhase) { // Wait for FontManagerService to start since it will be needed after this point. mServiceStarted.join(); } |