connect/disconnect is now deprecated.

these hooks are replaced by api_connect/api_disconnect
which serve exactly the same purpose than before.
the old hooks are deprecated because they won't be called
from the gl driver anymore, but instead will be called
by our EGL wrapper. to maintain binary compatibility
it was necessary to introduce these new hooks.

Change-Id: I11756a5d99e3ea3d6fb61b943f82037932dfa56a
diff --git a/include/system/window.h b/include/system/window.h
index 4d519c5..8ff464b 100644
--- a/include/system/window.h
+++ b/include/system/window.h
@@ -216,8 +216,8 @@
 /* valid operations for the (*perform)() hook */
 enum {
     NATIVE_WINDOW_SET_USAGE                 =  0,
-    NATIVE_WINDOW_CONNECT                   =  1,
-    NATIVE_WINDOW_DISCONNECT                =  2,
+    NATIVE_WINDOW_CONNECT                   =  1,   /* deprecated */
+    NATIVE_WINDOW_DISCONNECT                =  2,   /* deprecated */
     NATIVE_WINDOW_SET_CROP                  =  3,
     NATIVE_WINDOW_SET_BUFFER_COUNT          =  4,
     NATIVE_WINDOW_SET_BUFFERS_GEOMETRY      =  5,   /* deprecated */
@@ -228,9 +228,11 @@
     NATIVE_WINDOW_SET_SCALING_MODE          = 10,
     NATIVE_WINDOW_LOCK                      = 11,   /* private */
     NATIVE_WINDOW_UNLOCK_AND_POST           = 12,   /* private */
+    NATIVE_WINDOW_API_CONNECT               = 13,   /* private */
+    NATIVE_WINDOW_API_DISCONNECT            = 14,   /* private */
 };
 
-/* parameter for NATIVE_WINDOW_[DIS]CONNECT */
+/* parameter for NATIVE_WINDOW_[API_][DIS]CONNECT */
 enum {
     /* Buffers will be queued by EGL via eglSwapBuffers after being filled using
      * OpenGL ES.
@@ -388,8 +390,8 @@
      *
      * The valid operations are:
      *     NATIVE_WINDOW_SET_USAGE
-     *     NATIVE_WINDOW_CONNECT
-     *     NATIVE_WINDOW_DISCONNECT
+     *     NATIVE_WINDOW_CONNECT               (deprecated)
+     *     NATIVE_WINDOW_DISCONNECT            (deprecated)
      *     NATIVE_WINDOW_SET_CROP
      *     NATIVE_WINDOW_SET_BUFFER_COUNT
      *     NATIVE_WINDOW_SET_BUFFERS_GEOMETRY  (deprecated)
@@ -400,6 +402,8 @@
      *     NATIVE_WINDOW_SET_SCALING_MODE
      *     NATIVE_WINDOW_LOCK                   (private)
      *     NATIVE_WINDOW_UNLOCK_AND_POST        (private)
+     *     NATIVE_WINDOW_API_CONNECT            (private)
+     *     NATIVE_WINDOW_API_DISCONNECT         (private)
      *
      */
 
@@ -442,27 +446,15 @@
     return window->perform(window, NATIVE_WINDOW_SET_USAGE, usage);
 }
 
-/*
- * native_window_connect(..., NATIVE_WINDOW_API_EGL)
- * Must be called by EGL when the window is made current.
- * Returns -EINVAL if for some reason the window cannot be connected, which
- * can happen if it's connected to some other API.
- */
+/* deprecated. Always returns 0. Don't call. */
 static inline int native_window_connect(
-        struct ANativeWindow* window, int api)
-{
+        struct ANativeWindow* window, int api) {
     return window->perform(window, NATIVE_WINDOW_CONNECT, api);
 }
 
-/*
- * native_window_disconnect(..., NATIVE_WINDOW_API_EGL)
- * Must be called by EGL when the window is made not current.
- * An error is returned if for instance the window wasn't connected in the
- * first place.
- */
+/* deprecated. Always returns 0. Don't call. */
 static inline int native_window_disconnect(
-        struct ANativeWindow* window, int api)
-{
+        struct ANativeWindow* window, int api) {
     return window->perform(window, NATIVE_WINDOW_DISCONNECT, api);
 }
 
@@ -591,6 +583,32 @@
             mode);
 }
 
+
+/*
+ * native_window_api_connect(..., int api)
+ * connects an API to this window. only one API can be connected at a time.
+ * Returns -EINVAL if for some reason the window cannot be connected, which
+ * can happen if it's connected to some other API.
+ */
+static inline int native_window_api_connect(
+        struct ANativeWindow* window, int api)
+{
+    return window->perform(window, NATIVE_WINDOW_CONNECT, api);
+}
+
+/*
+ * native_window_api_disconnect(..., int api)
+ * disconnect the API from this window.
+ * An error is returned if for instance the window wasn't connected in the
+ * first place.
+ */
+static inline int native_window_api_disconnect(
+        struct ANativeWindow* window, int api)
+{
+    return window->perform(window, NATIVE_WINDOW_DISCONNECT, api);
+}
+
+
 __END_DECLS
 
 #endif /* SYSTEM_CORE_INCLUDE_ANDROID_WINDOW_H */