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

Commit 4f6aff38 authored by Romain Guy's avatar Romain Guy
Browse files

Only enable GL rendering on the main thread.

Change-Id: I41950f4c0a5063ee5d6950cf137eb60a1c7a72fe
parent c038ea35
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -36,7 +36,7 @@ import javax.microedition.khronos.opengles.GL;
 * @hide
 */
public abstract class HardwareRenderer {
    private static final String LOG_TAG = "HardwareRenderer";
    static final String LOG_TAG = "HardwareRenderer";

    /**
     * A process can set this flag to false to prevent the use of hardware
+8 −1
Original line number Diff line number Diff line
@@ -486,6 +486,13 @@ public final class ViewRoot extends Handler implements ViewParent,
        mAttachInfo.mHardwareAccelerated = false;
        mAttachInfo.mHardwareAccelerationRequested = false;

        // Don't enable hardware acceleration when we're not on the main thread
        if (Looper.getMainLooper() != Looper.myLooper()) {
            Log.w(HardwareRenderer.LOG_TAG, "Attempting to initialize hardware acceleration " 
                    + "outside of the main thread, aborting");
            return;
        }

        // Try to enable hardware acceleration if requested
        if (attrs != null &&
                (attrs.flags & WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED) != 0) {