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

Commit 51269bbf authored by Jeykumar Sankaran's avatar Jeykumar Sankaran Committed by Arne Coucheron
Browse files

opengl/java/android: Validate created surface before creating eglSurface

 This change validates the surface created in GLSurfaceView before passing it for eglSurface creation

 CRs-Fixed: 291106

(cherry picked from commit b29268a8dfb16aa842ef439129fff354d2eb75e5)

Change-Id: Id63158dbf213f7776cdbfa17ce1ccafe11aafc7f
parent c23a086f
Loading
Loading
Loading
Loading
+7 −1
Original line number Diff line number Diff line
@@ -36,6 +36,7 @@ import android.util.AttributeSet;
import android.util.Log;
import android.view.SurfaceHolder;
import android.view.SurfaceView;
import android.view.Surface;

/**
 * An implementation of SurfaceView that uses the dedicated surface for
@@ -1389,7 +1390,12 @@ public class GLSurfaceView extends SurfaceView implements SurfaceHolder.Callback
        }

        private boolean readyToDraw() {
            return (!mPaused) && mHasSurface
            boolean isSurfaceValid = false;
            if(mHasSurface){
                Surface sur = getHolder().getSurface();
                if(sur.isValid())isSurfaceValid = true;
            }
            return (!mPaused) && isSurfaceValid
                && (mWidth > 0) && (mHeight > 0)
                && (mRequestRender || (mRenderMode == RENDERMODE_CONTINUOUSLY));
        }