Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ddc1397e authored by Andreas Gampe's avatar Andreas Gampe
Browse files

Frameworks/base: Refactor TextView initialization

To allow static initialization of a number of View classes based
on TextView, refactor the initialization of the font cache to be
explicit from the zygote.

Bug: 27265238
Change-Id: I1b71086d3f49d8b3e72eea2bf8359351d25fc0fd
parent 187b9b9e
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -662,11 +662,12 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
     */
    private int mDeviceProvisionedState = DEVICE_PROVISIONED_UNKNOWN;

    /*
    /**
     * Kick-start the font cache for the zygote process (to pay the cost of
     * initializing freetype for our default font only once).
     * @hide
     */
    static {
    public static void preloadFontCache() {
        Paint p = new Paint();
        p.setAntiAlias(true);
        // We don't care about the result, just the side-effect of measuring.
+2 −0
Original line number Diff line number Diff line
@@ -36,6 +36,7 @@ import android.text.Hyphenator;
import android.util.EventLog;
import android.util.Log;
import android.webkit.WebViewFactory;
import android.widget.TextView;

import com.android.internal.os.InstallerConnection.InstallerException;

@@ -214,6 +215,7 @@ public class ZygoteInit {

    private static void preloadTextResources() {
        Hyphenator.init();
        TextView.preloadFontCache();
    }

    /**