Loading core/java/android/view/ThreadedRenderer.java +25 −3 Original line number Diff line number Diff line Loading @@ -29,6 +29,7 @@ import android.os.IBinder; import android.os.ParcelFileDescriptor; import android.os.RemoteException; import android.os.ServiceManager; import android.os.SystemProperties; import android.os.Trace; import android.util.Log; import android.view.Surface.OutOfResourcesException; Loading Loading @@ -188,6 +189,11 @@ public final class ThreadedRenderer { public static final String DEBUG_SHOW_NON_RECTANGULAR_CLIP_PROPERTY = "debug.hwui.show_non_rect_clip"; static { // Try to check OpenGL support early if possible. isAvailable(); } /** * A process can set this flag to false to prevent the use of threaded * rendering. Loading Loading @@ -227,8 +233,7 @@ public final class ThreadedRenderer { sTrimForeground = true; } private static native boolean nSupportsOpenGL(); private static boolean sSupportsOpenGL = nSupportsOpenGL(); private static Boolean sSupportsOpenGL; /** * Indicates whether threaded rendering is available under any form for Loading @@ -238,7 +243,24 @@ public final class ThreadedRenderer { * false otherwise */ public static boolean isAvailable() { return sSupportsOpenGL; if (sSupportsOpenGL != null) { return sSupportsOpenGL.booleanValue(); } if (SystemProperties.getInt("ro.kernel.qemu", 0) == 0) { // Device is not an emulator. sSupportsOpenGL = true; return true; } int qemu_gles = SystemProperties.getInt("qemu.gles", -1); if (qemu_gles == -1) { // In this case, the value of the qemu.gles property is not ready // because the SurfaceFlinger service may not start at this point. return false; } // In the emulator this property will be set > 0 when OpenGL ES 2.0 is // enabled, 0 otherwise. On old emulator versions it will be undefined. sSupportsOpenGL = qemu_gles > 0; return sSupportsOpenGL.booleanValue(); } /** Loading core/jni/android_view_ThreadedRenderer.cpp +0 −13 Original line number Diff line number Diff line Loading @@ -570,18 +570,6 @@ void NotifyHandler::handleMessage(const Message& message) { mObserver->decStrong(nullptr); } static jboolean android_view_ThreadedRenderer_supportsOpenGL(JNIEnv* env, jobject clazz) { char prop[PROPERTY_VALUE_MAX]; if (property_get("ro.kernel.qemu", prop, NULL) == 0) { // not in the emulator return JNI_TRUE; } // In the emulator this property will be set > 0 when OpenGL ES 2.0 is // enabled, 0 otherwise. On old emulator versions it will be undefined. property_get("qemu.gles", prop, "0"); return atoi(prop) > 0 ? JNI_TRUE : JNI_FALSE; } static void android_view_ThreadedRenderer_rotateProcessStatsBuffer(JNIEnv* env, jobject clazz) { RenderProxy::rotateProcessStatsBuffer(); } Loading Loading @@ -898,7 +886,6 @@ static void android_view_ThreadedRenderer_setupShadersDiskCache(JNIEnv* env, job const char* const kClassPathName = "android/view/ThreadedRenderer"; static const JNINativeMethod gMethods[] = { { "nSupportsOpenGL", "()Z", (void*) android_view_ThreadedRenderer_supportsOpenGL }, { "nRotateProcessStatsBuffer", "()V", (void*) android_view_ThreadedRenderer_rotateProcessStatsBuffer }, { "nSetProcessStatsBuffer", "(I)V", (void*) android_view_ThreadedRenderer_setProcessStatsBuffer }, { "nGetRenderThreadTid", "(J)I", (void*) android_view_ThreadedRenderer_getRenderThreadTid }, Loading Loading
core/java/android/view/ThreadedRenderer.java +25 −3 Original line number Diff line number Diff line Loading @@ -29,6 +29,7 @@ import android.os.IBinder; import android.os.ParcelFileDescriptor; import android.os.RemoteException; import android.os.ServiceManager; import android.os.SystemProperties; import android.os.Trace; import android.util.Log; import android.view.Surface.OutOfResourcesException; Loading Loading @@ -188,6 +189,11 @@ public final class ThreadedRenderer { public static final String DEBUG_SHOW_NON_RECTANGULAR_CLIP_PROPERTY = "debug.hwui.show_non_rect_clip"; static { // Try to check OpenGL support early if possible. isAvailable(); } /** * A process can set this flag to false to prevent the use of threaded * rendering. Loading Loading @@ -227,8 +233,7 @@ public final class ThreadedRenderer { sTrimForeground = true; } private static native boolean nSupportsOpenGL(); private static boolean sSupportsOpenGL = nSupportsOpenGL(); private static Boolean sSupportsOpenGL; /** * Indicates whether threaded rendering is available under any form for Loading @@ -238,7 +243,24 @@ public final class ThreadedRenderer { * false otherwise */ public static boolean isAvailable() { return sSupportsOpenGL; if (sSupportsOpenGL != null) { return sSupportsOpenGL.booleanValue(); } if (SystemProperties.getInt("ro.kernel.qemu", 0) == 0) { // Device is not an emulator. sSupportsOpenGL = true; return true; } int qemu_gles = SystemProperties.getInt("qemu.gles", -1); if (qemu_gles == -1) { // In this case, the value of the qemu.gles property is not ready // because the SurfaceFlinger service may not start at this point. return false; } // In the emulator this property will be set > 0 when OpenGL ES 2.0 is // enabled, 0 otherwise. On old emulator versions it will be undefined. sSupportsOpenGL = qemu_gles > 0; return sSupportsOpenGL.booleanValue(); } /** Loading
core/jni/android_view_ThreadedRenderer.cpp +0 −13 Original line number Diff line number Diff line Loading @@ -570,18 +570,6 @@ void NotifyHandler::handleMessage(const Message& message) { mObserver->decStrong(nullptr); } static jboolean android_view_ThreadedRenderer_supportsOpenGL(JNIEnv* env, jobject clazz) { char prop[PROPERTY_VALUE_MAX]; if (property_get("ro.kernel.qemu", prop, NULL) == 0) { // not in the emulator return JNI_TRUE; } // In the emulator this property will be set > 0 when OpenGL ES 2.0 is // enabled, 0 otherwise. On old emulator versions it will be undefined. property_get("qemu.gles", prop, "0"); return atoi(prop) > 0 ? JNI_TRUE : JNI_FALSE; } static void android_view_ThreadedRenderer_rotateProcessStatsBuffer(JNIEnv* env, jobject clazz) { RenderProxy::rotateProcessStatsBuffer(); } Loading Loading @@ -898,7 +886,6 @@ static void android_view_ThreadedRenderer_setupShadersDiskCache(JNIEnv* env, job const char* const kClassPathName = "android/view/ThreadedRenderer"; static const JNINativeMethod gMethods[] = { { "nSupportsOpenGL", "()Z", (void*) android_view_ThreadedRenderer_supportsOpenGL }, { "nRotateProcessStatsBuffer", "()V", (void*) android_view_ThreadedRenderer_rotateProcessStatsBuffer }, { "nSetProcessStatsBuffer", "(I)V", (void*) android_view_ThreadedRenderer_setProcessStatsBuffer }, { "nGetRenderThreadTid", "(J)I", (void*) android_view_ThreadedRenderer_getRenderThreadTid }, Loading