Mark EGL/GLES libs as vendor_available

EGL/GLES libs are marked as vendor_available, otherwise vendors are not
able to use OpenGL. The libs were not simply declared as LL-NDK because
doing so causes the dual loading of libui.so in vendor processes;
platform version of libui.so is loaded since it is depended by libEGL.so
whereas there also is vendor version of libui.so in /system/lib/vndk.

When libEGL.so is built for vendors, 1) libgraphicsenv is removed from
its dependency list as the lib must not be available to vendors and 2)
eglGetNativeClientBufferANDROID is unusable since the function relies on
AHardwareBuffer_to_ANativeWindowBuffer which isn't available to vendor.

Bug: 37731063
Test: BOARD_VNDK_VERSION=current m -j libEGL.vendor
Test: BOARD_VNDK_VERSION=current m -j libGLESv2.vendor

Change-Id: I83a128b14a5d852bb0f2cd821a8e3f82c66a313f
diff --git a/opengl/libs/Android.bp b/opengl/libs/Android.bp
index 4e275db..a344636 100644
--- a/opengl/libs/Android.bp
+++ b/opengl/libs/Android.bp
@@ -64,6 +64,16 @@
         "liblog",
         "libdl",
     ],
+    static_libs: [
+        "libarect",
+    ],
+    header_libs: [
+        "gl_headers",
+        "libsystem_headers",
+        "libhardware_headers",
+        "libnativebase_headers",
+    ],
+    export_header_lib_headers: ["gl_headers"],
 
     // we need to access the private Bionic header <bionic_tls.h>
     include_dirs: ["bionic/libc/private"],
@@ -75,6 +85,7 @@
 cc_defaults {
     name: "egl_libs_defaults",
     defaults: ["gl_libs_defaults"],
+    vendor_available: true,
     cflags: [
         "-DLOG_TAG=\"libEGL\"",
     ],
@@ -85,6 +96,11 @@
         "libnativewindow",
         "libbacktrace",
     ],
+    target: {
+        vendor: {
+            exclude_shared_libs: ["libgraphicsenv"],
+        },
+    },
 }
 
 cc_library_static {
@@ -129,6 +145,7 @@
 cc_defaults {
     name: "gles_libs_defaults",
     defaults: ["gl_libs_defaults"],
+    vendor_available: true,
     arch: {
         arm: {
             instruction_set: "arm",