Merge "SurfaceFlinger: fix releaseBuffer in updateTexImage"
diff --git a/cmds/dumpstate/dumpstate.c b/cmds/dumpstate/dumpstate.c
index 89bea91..ed362d7 100644
--- a/cmds/dumpstate/dumpstate.c
+++ b/cmds/dumpstate/dumpstate.c
@@ -278,6 +278,15 @@
     run_command("DUMPSYS", 60, "dumpsys", NULL);
 
     printf("========================================================\n");
+    printf("== Checkins\n");
+    printf("========================================================\n");
+
+    run_command("CHECKIN BATTERYSTATS", 30, "dumpsys", "batterystats", "--checkin", NULL);
+    run_command("CHECKIN NETSTATS", 30, "dumpsys", "netstats", "--checkin", NULL);
+    run_command("CHECKIN PROCSTATS", 30, "dumpsys", "procstats", "--checkin", NULL);
+    run_command("CHECKIN USAGESTATS", 30, "dumpsys", "usagestats", "--c", NULL);
+
+    printf("========================================================\n");
     printf("== Running Application Activities\n");
     printf("========================================================\n");
 
diff --git a/include/media/hardware/HardwareAPI.h b/include/media/hardware/HardwareAPI.h
index fc0f070..a6a849d 100644
--- a/include/media/hardware/HardwareAPI.h
+++ b/include/media/hardware/HardwareAPI.h
@@ -18,8 +18,8 @@
 
 #define HARDWARE_API_H_
 
-#include <OMXPluginBase.h>
-#include <MetadataBufferType.h>
+#include <media/hardware/OMXPluginBase.h>
+#include <media/hardware/MetadataBufferType.h>
 #include <system/window.h>
 #include <utils/RefBase.h>
 
diff --git a/include/media/openmax/OMX_Video.h b/include/media/openmax/OMX_Video.h
index 4f8485d..4441a7a 100644
--- a/include/media/openmax/OMX_Video.h
+++ b/include/media/openmax/OMX_Video.h
@@ -85,7 +85,8 @@
     OMX_VIDEO_CodingRV,         /**< all versions of Real Video */
     OMX_VIDEO_CodingAVC,        /**< H.264/AVC */
     OMX_VIDEO_CodingMJPEG,      /**< Motion JPEG */
-    OMX_VIDEO_CodingVPX,        /**< Google VPX, formerly known as On2 VP8 */
+    OMX_VIDEO_CodingVP8,        /**< Google VP8, formerly known as On2 VP8 */
+    OMX_VIDEO_CodingVP9,        /**< Google VP9 */
     OMX_VIDEO_CodingKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ 
     OMX_VIDEO_CodingVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
     OMX_VIDEO_CodingMax = 0x7FFFFFFF
diff --git a/include/media/openmax/OMX_VideoExt.h b/include/media/openmax/OMX_VideoExt.h
index 5e79b47..fa24168 100644
--- a/include/media/openmax/OMX_VideoExt.h
+++ b/include/media/openmax/OMX_VideoExt.h
@@ -58,12 +58,6 @@
     OMX_NALUFORMATSTYPE eNaluFormat;
 } OMX_NALSTREAMFORMATTYPE;
 
-/** Enum for standard video codingtype extensions */
-typedef enum OMX_VIDEO_CODINGEXTTYPE {
-    OMX_VIDEO_ExtCodingUnused = OMX_VIDEO_CodingKhronosExtensions,
-    OMX_VIDEO_CodingVP8,        /**< VP8/WebM */
-} OMX_VIDEO_CODINGEXTTYPE;
-
 /** VP8 profiles */
 typedef enum OMX_VIDEO_VP8PROFILETYPE {
     OMX_VIDEO_VP8ProfileMain = 0x01,
diff --git a/opengl/libs/EGL/eglApi.cpp b/opengl/libs/EGL/eglApi.cpp
index 334e164..2bc9851 100644
--- a/opengl/libs/EGL/eglApi.cpp
+++ b/opengl/libs/EGL/eglApi.cpp
@@ -516,8 +516,11 @@
 
     egl_connection_t* cnx = NULL;
     const egl_display_ptr dp = validate_display_connection(dpy, cnx);
-    if (dpy) {
+    if (dp) {
         if (share_list != EGL_NO_CONTEXT) {
+            if (!ContextRef(dp.get(), share_list).get()) {
+                return setError(EGL_BAD_CONTEXT, EGL_NO_CONTEXT);
+            }
             egl_context_t* const c = get_context(share_list);
             share_list = c->context;
         }
@@ -601,7 +604,7 @@
     // validate the context (if not EGL_NO_CONTEXT)
     if ((ctx != EGL_NO_CONTEXT) && !_c.get()) {
         // EGL_NO_CONTEXT is valid
-        return EGL_FALSE;
+        return setError(EGL_BAD_CONTEXT, EGL_FALSE);
     }
 
     // these are the underlying implementation's object
@@ -622,12 +625,12 @@
         impl_ctx = c->context;
     } else {
         // no context given, use the implementation of the current context
+        if (draw != EGL_NO_SURFACE || read != EGL_NO_SURFACE) {
+            // calling eglMakeCurrent( ..., !=0, !=0, EGL_NO_CONTEXT);
+            return setError(EGL_BAD_MATCH, EGL_FALSE);
+        }
         if (cur_c == NULL) {
             // no current context
-            if (draw != EGL_NO_SURFACE || read != EGL_NO_SURFACE) {
-                // calling eglMakeCurrent( ..., !=0, !=0, EGL_NO_CONTEXT);
-                return setError(EGL_BAD_MATCH, EGL_FALSE);
-            }
             // not an error, there is just no current context.
             return EGL_TRUE;
         }
@@ -635,12 +638,14 @@
 
     // retrieve the underlying implementation's draw EGLSurface
     if (draw != EGL_NO_SURFACE) {
+        if (!_d.get()) return setError(EGL_BAD_SURFACE, EGL_FALSE);
         d = get_surface(draw);
         impl_draw = d->surface;
     }
 
     // retrieve the underlying implementation's read EGLSurface
     if (read != EGL_NO_SURFACE) {
+        if (!_r.get()) return setError(EGL_BAD_SURFACE, EGL_FALSE);
         r = get_surface(read);
         impl_read = r->surface;
     }
diff --git a/opengl/specs/EGL_ANDROID_presentation_time.txt b/opengl/specs/EGL_ANDROID_presentation_time.txt
index 09b3938..e1dab34 100644
--- a/opengl/specs/EGL_ANDROID_presentation_time.txt
+++ b/opengl/specs/EGL_ANDROID_presentation_time.txt
@@ -10,6 +10,7 @@
 
     Jamie Gennis
     Andy McFadden
+    Jesse Hall
 
 Contact
 
@@ -21,7 +22,7 @@
 
 Version
 
-    Version 2, April 1, 2013
+    Version 3, June 26, 2013
 
 Number
 
@@ -92,7 +93,9 @@
 
     If the surface presentation time is successfully set, EGL_TRUE is
     returned.  Otherwise EGL_FALSE is returned and an appropriate error is
-    set.
+    set.  If <dpy> is not the name of a valid, initialized EGLDisplay, an
+    EGL_BAD_DISPLAY error is generated.  If <surface> is not a valid EGLSurface
+    then an EGL_BAD_SURFACE error is generated.
 
 Issues
 
@@ -110,9 +113,21 @@
     System.nanoTime() method, or from the native clock_gettime function by
     passing CLOCK_MONOTONIC as the clock identifier.
 
+    3. Should the presentation time be state which is used by eglSwapBuffers,
+    or should it be a new parameter to an extended variant of eglSwapBuffers?
+
+    RESOLVED: The presentation time should be new state which is used by
+    the existing eglSwapBuffers call. Adding new state composes better with
+    other (hypothetical) extensions that also modify the behavior of
+    eglSwapBuffers.
+
 Revision History
 
-#1 (Jamie Gennis, April 1, 2013)
+#3 (Jesse Hall, June 26, 2013)
+    - Enumerated errors generated by eglPresentationTimeANDROID.
+    - Added Issue #3 with resolution.
+
+#2 (Jamie Gennis, April 1, 2013)
     - Clarified how uses that either do or do not need an absolute time should
       be handled.
     - Specified the eglPresentationTimeANDROID return value.