Break the dependency on the wrapper libEGL.

This was causing dlsym to return the pointer to the wrapper's function when
SwiftShader didn't support an entry point.

Bug 25152138

Change-Id: I92d1c9258c823acf0dc60dca9dc3d7dd552512b3
Reviewed-on: https://swiftshader-review.googlesource.com/4120
Reviewed-by: Nicolas Capens <capn@google.com>
Tested-by: Nicolas Capens <capn@google.com>
Tested-by: Greg Hartman <ghartman@google.com>
diff --git a/src/OpenGL/include/EGL/eglplatform.h b/src/OpenGL/include/EGL/eglplatform.h
index 3ab8844..1a3cd2e 100644
--- a/src/OpenGL/include/EGL/eglplatform.h
+++ b/src/OpenGL/include/EGL/eglplatform.h
@@ -85,8 +85,6 @@
 
 #elif defined(__ANDROID__) || defined(ANDROID)
 
-#include <android/native_window.h>
-
 struct egl_native_pixmap_t;
 
 typedef struct ANativeWindow*           EGLNativeWindowType;
diff --git a/src/OpenGL/libEGL/Android.mk b/src/OpenGL/libEGL/Android.mk
index 9ef2a77..132a3e0 100644
--- a/src/OpenGL/libEGL/Android.mk
+++ b/src/OpenGL/libEGL/Android.mk
@@ -29,7 +29,6 @@
 COMMON_SHARED_LIBRARIES := \
 	libdl \
 	liblog \
-	libandroid \
 	libutils \
 	libcutils \
 	libhardware \
diff --git a/src/OpenGL/libEGL/Surface.cpp b/src/OpenGL/libEGL/Surface.cpp
index 9654ec2..fe6de95 100644
--- a/src/OpenGL/libEGL/Surface.cpp
+++ b/src/OpenGL/libEGL/Surface.cpp
@@ -230,6 +230,22 @@
     frameBuffer = nullptr;

 }

 

+#ifdef __ANDROID__

+static int32_t getWindowProp(ANativeWindow* window, int what) {

+    int value;

+    int res = window->query(window, what, &value);

+    return res < 0 ? res : value;

+}

+

+static int32_t ANativeWindow_getHeight(ANativeWindow* window) {

+    return getWindowProp(window, NATIVE_WINDOW_HEIGHT);

+}

+

+static int32_t ANativeWindow_getWidth(ANativeWindow* window) {

+  return getWindowProp(window, NATIVE_WINDOW_WIDTH);

+}

+#endif

+

 bool WindowSurface::initialize()

 {

     ASSERT(!frameBuffer && !backBuffer && !depthStencil);