resolve merge conflicts of 5fa7fb1d9f to master
Test: make Change-Id: I7f119535a120303796fcd08f0274269f7d0dbaba
This commit is contained in:
@@ -19,6 +19,7 @@ package android.os;
|
||||
import android.content.Context;
|
||||
import android.content.pm.ApplicationInfo;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.opengl.EGL14;
|
||||
import android.os.SystemProperties;
|
||||
import android.util.Log;
|
||||
|
||||
@@ -34,6 +35,23 @@ public final class GraphicsEnvironment {
|
||||
private static final String PROPERTY_GFX_DRIVER = "ro.gfx.driver.0";
|
||||
|
||||
public static void setupGraphicsEnvironment(Context context) {
|
||||
chooseDriver(context);
|
||||
|
||||
// Now that we've figured out which driver to use for this process, load and initialize it.
|
||||
// This can take multiple frame periods, and it would otherwise happen as part of the first
|
||||
// frame, increasing first-frame latency. Starting it here, as a low-priority background
|
||||
// thread, means that it's usually done long before we start drawing the first frame,
|
||||
// without significantly disrupting other activity launch work.
|
||||
Thread eglInitThread = new Thread(
|
||||
() -> {
|
||||
Thread.currentThread().setPriority(Thread.MIN_PRIORITY);
|
||||
EGL14.eglGetDisplay(EGL14.EGL_DEFAULT_DISPLAY);
|
||||
},
|
||||
"EGL Init");
|
||||
eglInitThread.start();
|
||||
}
|
||||
|
||||
private static void chooseDriver(Context context) {
|
||||
String driverPackageName = SystemProperties.get(PROPERTY_GFX_DRIVER);
|
||||
if (driverPackageName == null || driverPackageName.isEmpty()) {
|
||||
return;
|
||||
|
||||
@@ -25,7 +25,6 @@ import android.icu.impl.CacheValue;
|
||||
import android.icu.text.DecimalFormatSymbols;
|
||||
import android.icu.util.ULocale;
|
||||
import android.net.LocalServerSocket;
|
||||
import android.opengl.EGL14;
|
||||
import android.os.IInstalld;
|
||||
import android.os.Process;
|
||||
import android.os.RemoteException;
|
||||
@@ -125,9 +124,6 @@ public class ZygoteInit {
|
||||
bootTimingsTraceLog.traceBegin("PreloadResources");
|
||||
preloadResources();
|
||||
bootTimingsTraceLog.traceEnd(); // PreloadResources
|
||||
bootTimingsTraceLog.traceBegin("PreloadOpenGL");
|
||||
preloadOpenGL();
|
||||
bootTimingsTraceLog.traceEnd(); // PreloadOpenGL
|
||||
preloadSharedLibraries();
|
||||
preloadTextResources();
|
||||
// Ask the WebViewFactory to do any initialization that must run in the zygote process,
|
||||
@@ -177,12 +173,6 @@ public class ZygoteInit {
|
||||
System.loadLibrary("jnigraphics");
|
||||
}
|
||||
|
||||
private static void preloadOpenGL() {
|
||||
if (!SystemProperties.getBoolean(PROPERTY_DISABLE_OPENGL_PRELOADING, false)) {
|
||||
EGL14.eglGetDisplay(EGL14.EGL_DEFAULT_DISPLAY);
|
||||
}
|
||||
}
|
||||
|
||||
private static void preloadTextResources() {
|
||||
Hyphenator.init();
|
||||
TextView.preloadFontCache();
|
||||
|
||||
Reference in New Issue
Block a user