Android Dev Intro - ANativeWindow
The public Surface class is implemented in the Java programming language. The equivalent in C/C++ is the ANativeWindow class, semi-exposed by the Android
NDK. You can get the ANativeWindow from a Surface with the
ANativeWindow_fromSurface() call. Just like its Java-language cousin, you can lock it, render in software, and unlock-and-post.
To create an EGL window surface from native code, you pass an instance of EGLNativeWindowType to
eglCreateWindowSurface(). EGLNativeWindowType is just a synonym for ANativeWindow, so you
can freely cast one to the other.
The fact that the basic "native window" type just wraps the producer side of a BufferQueue should not come as a surprise.