Merge "Prevent cases of bogus action bar measurement." into honeycomb-mr2
diff --git a/docs/html/guide/topics/graphics/opengl.jd b/docs/html/guide/topics/graphics/opengl.jd
index 1f51c2d..9f88954 100644
--- a/docs/html/guide/topics/graphics/opengl.jd
+++ b/docs/html/guide/topics/graphics/opengl.jd
@@ -5,13 +5,15 @@
 
 
 <p>Android includes support for high performance 3D graphics 
-via the OpenGL API &mdash; specifically, the OpenGL ES API.</p>
+via the OpenGL API&mdash;specifically, the OpenGL ES API.</p>
 
-<p>OpenGL ES is a flavor of the OpenGL specification intended for embedded
-devices. Versions of <a href="http://www.khronos.org/opengles/">OpenGL ES</a> are loosely peered to versions of the primary
-OpenGL standard. Android currently supports OpenGL ES 1.0, which corresponds
-to OpenGL 1.3. So, if the application you have in mind is possible with OpenGL
-1.3 on a desktop system, it should be possible on Android.</p>
+<p>OpenGL ES is a flavor of the OpenGL specification intended for embedded devices. Versions of <a
+href="http://www.khronos.org/opengles/">OpenGL ES</a> are loosely peered to versions of the primary
+OpenGL standard. Beginning with Android 2.2, the platform supports OpenGL ES 2.0 (with
+backward compatibility support for OpenGL ES 1.1). For information about the relative number of
+Android-powered devices that support a given version of OpenGL ES, see the <a
+href="http://developer.android.com/resources/dashboard/opengl.html">OpenGL ES Versions</a>
+dashboard.</p>
 
 <p>The specific API provided by Android is similar to the J2ME JSR239 OpenGL
 ES API. However, it may not be identical, so watch out for deviations.</p>
@@ -21,17 +23,18 @@
 <p>Here's how to use the API at an extremely high level:</p>
 
 <ol>
-<li>Write a custom View subclass.</li>
+<li>Write a custom {@link android.view.View} subclass.</li>
 <li>Obtain a handle to an OpenGLContext, which provides access to the OpenGL functionality.</li>
-<li>In your View's onDraw() method, get a handle to a GL object, and use its methods to perform GL operations.</li>
+<li>In your View's {@link android.view.View#onDraw onDraw()} method, get a handle to a GL object,
+and use its methods to perform GL operations.</li>
 </ol>
 
-<p>For an example of this usage model (based on the classic GL ColorCube), showing how to use
-it with threads can be found in 
-<a href="{@docRoot}resources/samples/ApiDemos/src/com/example/android/apis/graphics/GLSurfaceViewActivity.html">com.android.samples.graphics.GLSurfaceViewActivity.java</a>.
+<p>Several samples using OpenGL ES are available in the <a
+href="{@docRoot}resources/samples/ApiDemos/src/com/example/android/apis/graphics/index.html">API
+Demos</a> sample application.
 </p>
 
-<p>Writing a summary of how to actually write 3D applications using OpenGL is
+<p>A summary of how to actually write 3D applications using OpenGL is
 beyond the scope of this text and is left as an exercise for the reader.</p>
 
 <h2>Links to Additional Information</h2>
@@ -45,9 +48,6 @@
 at <a title="http://www.khronos.org/opengles/1_X/"
 href="http://www.khronos.org/opengles/1_X/">http://www.khronos.org/opengles/1_X/</a>.</p>
 
-<p>The documentation for the Android {@link javax.microedition.khronos.opengles
-OpenGL ES implementations} are also available.</p>
+<p>The documentation for the Android OpenGL ES implementations are available in {@link
+android.opengl} and {@link javax.microedition.khronos.opengles}.</p>
 
-<p>Finally, note that though Android does include some basic support for
-OpenGL ES 1.1, the support is <strong>not complete</strong>, and should not be relied
-upon at this time.</p>
diff --git a/media/libstagefright/matroska/MatroskaExtractor.cpp b/media/libstagefright/matroska/MatroskaExtractor.cpp
index 733de92..642835a 100644
--- a/media/libstagefright/matroska/MatroskaExtractor.cpp
+++ b/media/libstagefright/matroska/MatroskaExtractor.cpp
@@ -660,7 +660,8 @@
         // AudioSpecificInfo (with size prefix) follows
     };
 
-    CHECK(asiSize < 128);
+    // Make sure all sizes can be coded in a single byte.
+    CHECK(asiSize + 22 - 2 < 128);
     size_t esdsSize = sizeof(kStaticESDS) + asiSize + 1;
     uint8_t *esds = new uint8_t[esdsSize];
     memcpy(esds, kStaticESDS, sizeof(kStaticESDS));
@@ -668,6 +669,11 @@
     *ptr++ = asiSize;
     memcpy(ptr, asi, asiSize);
 
+    // Increment by codecPrivateSize less 2 bytes that are accounted for
+    // already in lengths of 22/17
+    esds[1] += asiSize - 2;
+    esds[6] += asiSize - 2;
+
     meta->setData(kKeyESDS, 0, esds, esdsSize);
 
     delete[] esds;