Update producer's cache of frame events in de/queue

* Cache is only updated during queue and dequeue if
    the getFrameTimestamps is enabled.
* The consumer avoids sending a copy of the acquire
    fence back to the producer since the producer
    already has a copy.

Test: adb shell /data/nativetest/libgui_test/libgui_test
--gtest_filter=*GetFrameTimestamps*

Change-Id: I6a8b965ae79441a40893b5df937f9ed004fe7359
diff --git a/opengl/libs/EGL/eglApi.cpp b/opengl/libs/EGL/eglApi.cpp
index d5a02e3..3d3df76 100644
--- a/opengl/libs/EGL/eglApi.cpp
+++ b/opengl/libs/EGL/eglApi.cpp
@@ -1218,7 +1218,6 @@
         if (!s->win.get()) {
             return setError(EGL_BAD_SURFACE, EGL_FALSE);
         }
-        s->enableTimestamps = value;
         int err = native_window_enable_frame_timestamps(
                 s->win.get(), value ? true : false);
         return (err == NO_ERROR) ? EGL_TRUE :
@@ -2040,7 +2039,7 @@
 
     egl_surface_t const * const s = get_surface(surface);
 
-    if (!s->enableTimestamps) {
+    if (!s->win.get()) {
         return setError(EGL_BAD_SURFACE, EGL_FALSE);
     }
 
@@ -2090,6 +2089,8 @@
         return EGL_TRUE;
       case NAME_NOT_FOUND:
         return setError(EGL_BAD_ACCESS, EGL_FALSE);
+      case INVALID_OPERATION:
+        return setError(EGL_BAD_SURFACE, EGL_FALSE);
       case BAD_VALUE:
         return setError(EGL_BAD_PARAMETER, EGL_FALSE);
       default: