diff options
| author | Jesse Hall <jessehall@google.com> | 2017-05-23 15:46:55 -0700 |
|---|---|---|
| committer | Jesse Hall <jessehall@google.com> | 2017-05-23 16:37:11 -0700 |
| commit | 317fa5a92a6088ee2c3ce5e3895560439049664f (patch) | |
| tree | 8bec97afb1f7fd6d6d0f0c416f2a83bfc1d741d4 /core/java/android/os/GraphicsEnvironment.java | |
| parent | e16b83bb399f04cfbe227d3f1df0c3fd56862dc5 (diff) | |
Refactor graphics environment initialization
Put all of the setupGraphicsSupport-related code into one function so
its easier to follow the full logic, and less intrusive to the code
around the call-site. This isn't supposed to change behavior at all,
but is preparation for the next change which will.
Bug: 38215658
Test: launch Clock, observe relevant events in systrace
Change-Id: I157b6233c0e9daf65e41697b504aa7e7d684401c
Diffstat (limited to 'core/java/android/os/GraphicsEnvironment.java')
| -rw-r--r-- | core/java/android/os/GraphicsEnvironment.java | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/core/java/android/os/GraphicsEnvironment.java b/core/java/android/os/GraphicsEnvironment.java index f9eaba921cc1..a204c84819a5 100644 --- a/core/java/android/os/GraphicsEnvironment.java +++ b/core/java/android/os/GraphicsEnvironment.java @@ -37,18 +37,7 @@ public final class GraphicsEnvironment { 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( - () -> { - EGL14.eglGetDisplay(EGL14.EGL_DEFAULT_DISPLAY); - }, - "EGL Init"); - eglInitThread.start(); + earlyInitEGL(); } private static void chooseDriver(Context context) { @@ -101,6 +90,19 @@ public final class GraphicsEnvironment { setDriverPath(paths); } + private static void earlyInitEGL() { + // Once 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 means that it's usually done + // long before we start drawing the first frame. + Thread eglInitThread = new Thread( + () -> { + EGL14.eglGetDisplay(EGL14.EGL_DEFAULT_DISPLAY); + }, + "EGL Init"); + eglInitThread.start(); + } + private static String chooseAbi(ApplicationInfo ai) { String isa = VMRuntime.getCurrentInstructionSet(); if (ai.primaryCpuAbi != null && |
