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

Commit 0a87ae79 authored by Romain Guy's avatar Romain Guy Committed by Android (Google) Code Review
Browse files

Merge "Fix native crash when enabling hardware acceleration."

parents 20ea8d0f c6133285
Loading
Loading
Loading
Loading
+9 −3
Original line number Diff line number Diff line
@@ -259,11 +259,17 @@ public final class ViewRoot extends Handler implements ViewParent, View.AttachIn
        mViewConfiguration = ViewConfiguration.get(context);
        mDensity = context.getResources().getDisplayMetrics().densityDpi;

        // Only enable hardware acceleration if we are not in the system process
        // The window manager creates ViewRoots to display animated preview windows
        // of launching apps and we don't want those to be hardware accelerated
        if (Process.myUid() != Process.SYSTEM_UID) {
            // Try to enable hardware acceleration if requested
        if ((context.getApplicationInfo().flags & ApplicationInfo.FLAG_HARDWARE_ACCELERATED) != 0) {
            if ((context.getApplicationInfo().flags &
                    ApplicationInfo.FLAG_HARDWARE_ACCELERATED) != 0) {
                mHwRenderer = HardwareRenderer.createGlRenderer(1);
            }
        }
    }

    // For debug only
    /*
+2 −0
Original line number Diff line number Diff line
@@ -114,6 +114,7 @@ extern int register_android_graphics_Xfermode(JNIEnv* env);
extern int register_android_graphics_PixelFormat(JNIEnv* env);
extern int register_com_android_internal_graphics_NativeUtils(JNIEnv *env);
extern int register_android_view_Display(JNIEnv* env);
extern int register_android_view_HardwareRenderer(JNIEnv* env);
extern int register_android_view_Surface(JNIEnv* env);
extern int register_android_view_ViewRoot(JNIEnv* env);
extern int register_android_database_CursorWindow(JNIEnv* env);
@@ -1207,6 +1208,7 @@ static const RegJNIRec gRegJNI[] = {
    REG_JNI(register_android_nio_utils),
    REG_JNI(register_android_graphics_PixelFormat),
    REG_JNI(register_android_graphics_Graphics),
    REG_JNI(register_android_view_HardwareRenderer),
    REG_JNI(register_android_view_Surface),
    REG_JNI(register_android_view_ViewRoot),
    REG_JNI(register_com_google_android_gles_jni_EGLImpl),