private void wrapAllGLViews ( View decorView ) { ArrayList < GLSurfaceView > currentViews = viewFetcher . getCurrentViews ( GLSurfaceView . class , true , decorView ) ; final CountDownLatch latch = new CountDownLatch ( currentViews . size ( ) ) ; for ( GLSurfaceView glView : currentViews ) { Object renderContainer = new Reflect ( glView ) . field ( "mGLThread" ) . type ( GLSurfaceView . class ) . out ( Object . class ) ; Renderer renderer = new Reflect ( renderContainer ) . field ( "mRenderer" ) . out ( Renderer . class ) ; if ( renderer == null ) { renderer = new Reflect ( glView ) . field ( "mRenderer" ) . out ( Renderer . class ) ; renderContainer = glView ; } if ( renderer == null ) { latch . countDown ( ) ; continue ; } if ( renderer instanceof GLRenderWrapper ) { GLRenderWrapper wrapper = ( GLRenderWrapper ) renderer ; wrapper . setTakeScreenshot ( ) ; wrapper . setLatch ( latch ) ; } else { GLRenderWrapper wrapper = new GLRenderWrapper ( glView , renderer , latch ) ; new Reflect ( renderContainer ) . field ( "mRenderer" ) . in ( wrapper ) ; } } try { latch . await ( ) ; } catch ( InterruptedException ex ) { ex . printStackTrace ( ) ; } }
Extract and wrap the all OpenGL ES Renderer .