Buggy code:
class NativeView extends SurfaceView implements SurfaceHolder . Callback , Runnable { private static final String TAG = "XCSoar" ; Handler quitHandler ; Resources resources ; final boolean hasKeyboard ; EGL10 egl ; EGLDisplay display ; EGLSurface surface ; EGLContext context ; static boolean textureNonPowerOfTwo ; Thread thread ; public NativeView ( Activity context , Handler _quitHandler ) { } private void start ( ) { } private void initGL ( SurfaceHolder holder ) { egl = ( ( EGL10 ) ( EGLContext . getEGL ( ) ) ) ; display = egl . eglGetDisplay ( EGL_DEFAULT_DISPLAY ) ; Log . d ( NativeView . TAG , ( "EGL<seq2seq4repair_space>vendor:<seq2seq4repair_space>" + ( egl . eglQueryString ( display , EGL_VENDOR ) ) ) ) ; Log . d ( NativeView . TAG , ( "EGL<seq2seq4repair_space>version:<seq2seq4repair_space>" + ( egl . eglQueryString ( display , EGL_VERSION ) ) ) ) ; Log . d ( NativeView . TAG , ( "EGL<seq2seq4repair_space>extensions:<seq2seq4repair_space>" + ( egl . eglQueryString ( display , EGL_EXTENSIONS ) ) ) ) ; int [ ] version = new int [ 2 ] ; egl . eglInitialize ( display , version ) ; int [ ] num_config = new int [ 1 ] ; int [ ] configSpec = new int [ ] { EGL10 . EGL_STENCIL_SIZE , 1 , EGL10 . EGL_RED_SIZE , 4 , EGL10 . EGL_GREEN_SIZE , 4 , EGL10 . EGL_BLUE_SIZE , 4 , EGL10 . EGL_ALPHA_SIZE , 0 , EGL10 . EGL_DEPTH_SIZE , 0 , EGL10 . EGL_NONE } ; egl . eglChooseConfig ( display , configSpec , null , 0 , num_config ) ; if ( ( num_config [ 0 ] ) == 0 ) { <START_BUG> configSpec [ 1 ] = 0 ; <END_BUG> egl . eglChooseConfig ( display , configSpec , null , 0 , num_config ) ; } int numConfigs = num_config [ 0 ] ; EGLConfig [ ] configs = new EGLConfig [ numConfigs ] ; egl . eglChooseConfig ( display , configSpec , configs , numConfigs , num_config ) ; EGLConfig closestConfig = null ; int closestDistance = 1000 ; for ( EGLConfig config : configs ) { int r = findConfigAttrib ( config , EGL_RED_SIZE , 0 ) ; int g = findConfigAttrib ( config , EGL_GREEN_SIZE , 0 ) ; int b = findConfigAttrib ( config , EGL_BLUE_SIZE , 0 ) ; int a = findConfigAttrib ( config , EGL_ALPHA_SIZE , 0 ) ; int d = findConfigAttrib ( config , EGL_DEPTH_SIZE , 0 ) ; int s = findConfigAttrib ( config , EGL_STENCIL_SIZE , 0 ) ; int distance = ( ( ( ( ( Math . abs ( ( r - 5 ) ) ) + ( Math . abs ( ( g - 6 ) ) ) ) + ( Math . abs ( ( b - 5 ) ) ) ) + ( Math . abs ( ( a - 0 ) ) ) ) + ( Math . abs ( ( d - 0 ) ) ) ) + ( Math . abs ( ( s - 8 ) ) ) ; if ( distance < closestDistance ) { closestDistance = distance ; closestConfig = config ; } } Log . d ( NativeView . TAG , ( ( ( ( ( ( ( ( ( ( ( "EGLConfig:<seq2seq4repair_space>red=" + ( findConfigAttrib ( closestConfig , EGL_RED_SIZE , 0 ) ) ) + "<seq2seq4repair_space>green=" ) + ( findConfigAttrib ( closestConfig , EGL_GREEN_SIZE , 0 ) ) ) + "<seq2seq4repair_space>blue=" ) + ( findConfigAttrib ( closestConfig , EGL_BLUE_SIZE , 0 ) ) ) + "<seq2seq4repair_space>alpha=" ) + ( findConfigAttrib ( closestConfig , EGL_ALPHA_SIZE , 0 ) ) ) + "<seq2seq4repair_space>depth=" ) + ( findConfigAttrib ( closestConfig , EGL_DEPTH_SIZE , 0 ) ) ) + "<seq2seq4repair_space>stencil=" ) + ( findConfigAttrib ( closestConfig , EGL_STENCIL_SIZE , 0 ) ) ) ) ; final int EGL_CONTEXT_CLIENT_VERSION = 12440 ; int [ ] contextAttribList = new int [ ] { EGL_CONTEXT_CLIENT_VERSION , getEglContextClientVersion ( ) , EGL10 . EGL_NONE } ; context = egl . eglCreateContext ( display , closestConfig , EGL_NO_CONTEXT , contextAttribList ) ; surface = egl . eglCreateWindowSurface ( display , closestConfig , holder , null ) ; egl . eglMakeCurrent ( display , surface , surface , context ) ; GL10 gl = ( ( GL10 ) ( context . getGL ( ) ) ) ; Log . d ( NativeView . TAG , ( "OpenGL<seq2seq4repair_space>vendor:<seq2seq4repair_space>" + ( gl . glGetString ( GL_VENDOR ) ) ) ) ; Log . d ( NativeView . TAG , ( "OpenGL<seq2seq4repair_space>version:<seq2seq4repair_space>" + ( gl . glGetString ( GL_VERSION ) ) ) ) ; Log . d ( NativeView . TAG , ( "OpenGL<seq2seq4repair_space>renderer:<seq2seq4repair_space>" + ( gl . glGetString ( GL_RENDERER ) ) ) ) ; Log . d ( NativeView . TAG , ( "OpenGL<seq2seq4repair_space>extensions:<seq2seq4repair_space>" + ( gl . glGetString ( GL_EXTENSIONS ) ) ) ) ; } private boolean initSurface ( ) { } private void deinitSurface ( ) { } private boolean setRequestedOrientation ( int requestedOrientation ) { } @ Override public void surfaceCreated ( SurfaceHolder holder ) { } @ Override public void surfaceChanged ( SurfaceHolder holder , int format , int width , int height ) { } @ Override public void surfaceDestroyed ( SurfaceHolder holder ) { } @ Override public void run ( ) { } protected native int getEglContextClientVersion ( ) { } protected native boolean initializeNative ( Context context , int width , int height , int xdpi , int ydpi , int sdk_version , String product ) { } protected native void runNative ( ) { } protected native void deinitializeNative ( ) { } protected native void resizedNative ( int width , int height ) { } protected native void pauseNative ( ) { } protected native void resumeNative ( ) { } protected native void setBatteryPercent ( int level , int plugged ) { } protected native void setHapticFeedback ( boolean on ) { }

Fix:
configSpec [ 0 ] = 0 ;