Merge branch 'readonly-p4-donut' into donut
diff --git a/Android.mk b/Android.mk
index 949181f..de5f5f8 100644
--- a/Android.mk
+++ b/Android.mk
@@ -111,6 +111,7 @@
 	core/java/com/android/internal/view/IInputMethodManager.aidl \
 	core/java/com/android/internal/view/IInputMethodSession.aidl \
 	im/java/android/im/IImPlugin.aidl \
+	location/java/android/location/IGeocodeProvider.aidl \
 	location/java/android/location/IGpsStatusListener.aidl \
 	location/java/android/location/ILocationCollector.aidl \
 	location/java/android/location/ILocationListener.aidl \
diff --git a/api/current.xml b/api/current.xml
index 2b508a6..1bf1d5a9 100644
--- a/api/current.xml
+++ b/api/current.xml
@@ -848,6 +848,17 @@
  visibility="public"
 >
 </field>
+<field name="SDCARD_WRITE"
+ type="java.lang.String"
+ transient="false"
+ volatile="false"
+ value="&quot;android.permission.SDCARD_WRITE&quot;"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
 <field name="SEND_SMS"
  type="java.lang.String"
  transient="false"
@@ -1283,6 +1294,17 @@
  visibility="public"
 >
 </field>
+<field name="STORAGE"
+ type="java.lang.String"
+ transient="false"
+ volatile="false"
+ value="&quot;android.permission-group.STORAGE&quot;"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
 <field name="SYSTEM_TOOLS"
  type="java.lang.String"
  transient="false"
@@ -28357,6 +28379,28 @@
  visibility="public"
 >
 </field>
+<field name="ACTION_POWER_CONNECTED"
+ type="java.lang.String"
+ transient="false"
+ volatile="false"
+ value="&quot;android.intent.action.ACTION_POWER_CONNECTED&quot;"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="ACTION_POWER_DISCONNECTED"
+ type="java.lang.String"
+ transient="false"
+ volatile="false"
+ value="&quot;android.intent.action.ACTION_POWER_DISCONNECTED&quot;"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
 <field name="ACTION_PROVIDER_CHANGED"
  type="java.lang.String"
  transient="false"
@@ -58036,7 +58080,7 @@
  type="float"
  transient="false"
  volatile="false"
- value="0.001f"
+ value="0.0010f"
  static="true"
  final="true"
  deprecated="not deprecated"
@@ -73248,6 +73292,10412 @@
 >
 </field>
 </class>
+<class name="GLES10"
+ extends="java.lang.Object"
+ abstract="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<constructor name="GLES10"
+ type="android.opengl.GLES10"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</constructor>
+<method name="glActiveTexture"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="texture" type="int">
+</parameter>
+</method>
+<method name="glAlphaFunc"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="func" type="int">
+</parameter>
+<parameter name="ref" type="float">
+</parameter>
+</method>
+<method name="glAlphaFuncx"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="func" type="int">
+</parameter>
+<parameter name="ref" type="int">
+</parameter>
+</method>
+<method name="glBindTexture"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="target" type="int">
+</parameter>
+<parameter name="texture" type="int">
+</parameter>
+</method>
+<method name="glBlendFunc"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="sfactor" type="int">
+</parameter>
+<parameter name="dfactor" type="int">
+</parameter>
+</method>
+<method name="glClear"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="mask" type="int">
+</parameter>
+</method>
+<method name="glClearColor"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="red" type="float">
+</parameter>
+<parameter name="green" type="float">
+</parameter>
+<parameter name="blue" type="float">
+</parameter>
+<parameter name="alpha" type="float">
+</parameter>
+</method>
+<method name="glClearColorx"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="red" type="int">
+</parameter>
+<parameter name="green" type="int">
+</parameter>
+<parameter name="blue" type="int">
+</parameter>
+<parameter name="alpha" type="int">
+</parameter>
+</method>
+<method name="glClearDepthf"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="depth" type="float">
+</parameter>
+</method>
+<method name="glClearDepthx"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="depth" type="int">
+</parameter>
+</method>
+<method name="glClearStencil"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="s" type="int">
+</parameter>
+</method>
+<method name="glClientActiveTexture"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="texture" type="int">
+</parameter>
+</method>
+<method name="glColor4f"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="red" type="float">
+</parameter>
+<parameter name="green" type="float">
+</parameter>
+<parameter name="blue" type="float">
+</parameter>
+<parameter name="alpha" type="float">
+</parameter>
+</method>
+<method name="glColor4x"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="red" type="int">
+</parameter>
+<parameter name="green" type="int">
+</parameter>
+<parameter name="blue" type="int">
+</parameter>
+<parameter name="alpha" type="int">
+</parameter>
+</method>
+<method name="glColorMask"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="red" type="boolean">
+</parameter>
+<parameter name="green" type="boolean">
+</parameter>
+<parameter name="blue" type="boolean">
+</parameter>
+<parameter name="alpha" type="boolean">
+</parameter>
+</method>
+<method name="glColorPointer"
+ return="void"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="size" type="int">
+</parameter>
+<parameter name="type" type="int">
+</parameter>
+<parameter name="stride" type="int">
+</parameter>
+<parameter name="pointer" type="java.nio.Buffer">
+</parameter>
+</method>
+<method name="glCompressedTexImage2D"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="target" type="int">
+</parameter>
+<parameter name="level" type="int">
+</parameter>
+<parameter name="internalformat" type="int">
+</parameter>
+<parameter name="width" type="int">
+</parameter>
+<parameter name="height" type="int">
+</parameter>
+<parameter name="border" type="int">
+</parameter>
+<parameter name="imageSize" type="int">
+</parameter>
+<parameter name="data" type="java.nio.Buffer">
+</parameter>
+</method>
+<method name="glCompressedTexSubImage2D"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="target" type="int">
+</parameter>
+<parameter name="level" type="int">
+</parameter>
+<parameter name="xoffset" type="int">
+</parameter>
+<parameter name="yoffset" type="int">
+</parameter>
+<parameter name="width" type="int">
+</parameter>
+<parameter name="height" type="int">
+</parameter>
+<parameter name="format" type="int">
+</parameter>
+<parameter name="imageSize" type="int">
+</parameter>
+<parameter name="data" type="java.nio.Buffer">
+</parameter>
+</method>
+<method name="glCopyTexImage2D"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="target" type="int">
+</parameter>
+<parameter name="level" type="int">
+</parameter>
+<parameter name="internalformat" type="int">
+</parameter>
+<parameter name="x" type="int">
+</parameter>
+<parameter name="y" type="int">
+</parameter>
+<parameter name="width" type="int">
+</parameter>
+<parameter name="height" type="int">
+</parameter>
+<parameter name="border" type="int">
+</parameter>
+</method>
+<method name="glCopyTexSubImage2D"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="target" type="int">
+</parameter>
+<parameter name="level" type="int">
+</parameter>
+<parameter name="xoffset" type="int">
+</parameter>
+<parameter name="yoffset" type="int">
+</parameter>
+<parameter name="x" type="int">
+</parameter>
+<parameter name="y" type="int">
+</parameter>
+<parameter name="width" type="int">
+</parameter>
+<parameter name="height" type="int">
+</parameter>
+</method>
+<method name="glCullFace"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="mode" type="int">
+</parameter>
+</method>
+<method name="glDeleteTextures"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="n" type="int">
+</parameter>
+<parameter name="textures" type="int[]">
+</parameter>
+<parameter name="offset" type="int">
+</parameter>
+</method>
+<method name="glDeleteTextures"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="n" type="int">
+</parameter>
+<parameter name="textures" type="java.nio.IntBuffer">
+</parameter>
+</method>
+<method name="glDepthFunc"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="func" type="int">
+</parameter>
+</method>
+<method name="glDepthMask"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="flag" type="boolean">
+</parameter>
+</method>
+<method name="glDepthRangef"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="zNear" type="float">
+</parameter>
+<parameter name="zFar" type="float">
+</parameter>
+</method>
+<method name="glDepthRangex"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="zNear" type="int">
+</parameter>
+<parameter name="zFar" type="int">
+</parameter>
+</method>
+<method name="glDisable"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="cap" type="int">
+</parameter>
+</method>
+<method name="glDisableClientState"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="array" type="int">
+</parameter>
+</method>
+<method name="glDrawArrays"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="mode" type="int">
+</parameter>
+<parameter name="first" type="int">
+</parameter>
+<parameter name="count" type="int">
+</parameter>
+</method>
+<method name="glDrawElements"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="mode" type="int">
+</parameter>
+<parameter name="count" type="int">
+</parameter>
+<parameter name="type" type="int">
+</parameter>
+<parameter name="indices" type="java.nio.Buffer">
+</parameter>
+</method>
+<method name="glEnable"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="cap" type="int">
+</parameter>
+</method>
+<method name="glEnableClientState"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="array" type="int">
+</parameter>
+</method>
+<method name="glFinish"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
+<method name="glFlush"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
+<method name="glFogf"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="pname" type="int">
+</parameter>
+<parameter name="param" type="float">
+</parameter>
+</method>
+<method name="glFogfv"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="pname" type="int">
+</parameter>
+<parameter name="params" type="float[]">
+</parameter>
+<parameter name="offset" type="int">
+</parameter>
+</method>
+<method name="glFogfv"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="pname" type="int">
+</parameter>
+<parameter name="params" type="java.nio.FloatBuffer">
+</parameter>
+</method>
+<method name="glFogx"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="pname" type="int">
+</parameter>
+<parameter name="param" type="int">
+</parameter>
+</method>
+<method name="glFogxv"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="pname" type="int">
+</parameter>
+<parameter name="params" type="int[]">
+</parameter>
+<parameter name="offset" type="int">
+</parameter>
+</method>
+<method name="glFogxv"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="pname" type="int">
+</parameter>
+<parameter name="params" type="java.nio.IntBuffer">
+</parameter>
+</method>
+<method name="glFrontFace"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="mode" type="int">
+</parameter>
+</method>
+<method name="glFrustumf"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="left" type="float">
+</parameter>
+<parameter name="right" type="float">
+</parameter>
+<parameter name="bottom" type="float">
+</parameter>
+<parameter name="top" type="float">
+</parameter>
+<parameter name="zNear" type="float">
+</parameter>
+<parameter name="zFar" type="float">
+</parameter>
+</method>
+<method name="glFrustumx"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="left" type="int">
+</parameter>
+<parameter name="right" type="int">
+</parameter>
+<parameter name="bottom" type="int">
+</parameter>
+<parameter name="top" type="int">
+</parameter>
+<parameter name="zNear" type="int">
+</parameter>
+<parameter name="zFar" type="int">
+</parameter>
+</method>
+<method name="glGenTextures"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="n" type="int">
+</parameter>
+<parameter name="textures" type="int[]">
+</parameter>
+<parameter name="offset" type="int">
+</parameter>
+</method>
+<method name="glGenTextures"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="n" type="int">
+</parameter>
+<parameter name="textures" type="java.nio.IntBuffer">
+</parameter>
+</method>
+<method name="glGetError"
+ return="int"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
+<method name="glGetIntegerv"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="pname" type="int">
+</parameter>
+<parameter name="params" type="int[]">
+</parameter>
+<parameter name="offset" type="int">
+</parameter>
+</method>
+<method name="glGetIntegerv"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="pname" type="int">
+</parameter>
+<parameter name="params" type="java.nio.IntBuffer">
+</parameter>
+</method>
+<method name="glGetString"
+ return="java.lang.String"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="name" type="int">
+</parameter>
+</method>
+<method name="glHint"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="target" type="int">
+</parameter>
+<parameter name="mode" type="int">
+</parameter>
+</method>
+<method name="glLightModelf"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="pname" type="int">
+</parameter>
+<parameter name="param" type="float">
+</parameter>
+</method>
+<method name="glLightModelfv"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="pname" type="int">
+</parameter>
+<parameter name="params" type="float[]">
+</parameter>
+<parameter name="offset" type="int">
+</parameter>
+</method>
+<method name="glLightModelfv"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="pname" type="int">
+</parameter>
+<parameter name="params" type="java.nio.FloatBuffer">
+</parameter>
+</method>
+<method name="glLightModelx"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="pname" type="int">
+</parameter>
+<parameter name="param" type="int">
+</parameter>
+</method>
+<method name="glLightModelxv"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="pname" type="int">
+</parameter>
+<parameter name="params" type="int[]">
+</parameter>
+<parameter name="offset" type="int">
+</parameter>
+</method>
+<method name="glLightModelxv"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="pname" type="int">
+</parameter>
+<parameter name="params" type="java.nio.IntBuffer">
+</parameter>
+</method>
+<method name="glLightf"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="light" type="int">
+</parameter>
+<parameter name="pname" type="int">
+</parameter>
+<parameter name="param" type="float">
+</parameter>
+</method>
+<method name="glLightfv"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="light" type="int">
+</parameter>
+<parameter name="pname" type="int">
+</parameter>
+<parameter name="params" type="float[]">
+</parameter>
+<parameter name="offset" type="int">
+</parameter>
+</method>
+<method name="glLightfv"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="light" type="int">
+</parameter>
+<parameter name="pname" type="int">
+</parameter>
+<parameter name="params" type="java.nio.FloatBuffer">
+</parameter>
+</method>
+<method name="glLightx"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="light" type="int">
+</parameter>
+<parameter name="pname" type="int">
+</parameter>
+<parameter name="param" type="int">
+</parameter>
+</method>
+<method name="glLightxv"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="light" type="int">
+</parameter>
+<parameter name="pname" type="int">
+</parameter>
+<parameter name="params" type="int[]">
+</parameter>
+<parameter name="offset" type="int">
+</parameter>
+</method>
+<method name="glLightxv"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="light" type="int">
+</parameter>
+<parameter name="pname" type="int">
+</parameter>
+<parameter name="params" type="java.nio.IntBuffer">
+</parameter>
+</method>
+<method name="glLineWidth"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="width" type="float">
+</parameter>
+</method>
+<method name="glLineWidthx"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="width" type="int">
+</parameter>
+</method>
+<method name="glLoadIdentity"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
+<method name="glLoadMatrixf"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="m" type="float[]">
+</parameter>
+<parameter name="offset" type="int">
+</parameter>
+</method>
+<method name="glLoadMatrixf"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="m" type="java.nio.FloatBuffer">
+</parameter>
+</method>
+<method name="glLoadMatrixx"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="m" type="int[]">
+</parameter>
+<parameter name="offset" type="int">
+</parameter>
+</method>
+<method name="glLoadMatrixx"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="m" type="java.nio.IntBuffer">
+</parameter>
+</method>
+<method name="glLogicOp"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="opcode" type="int">
+</parameter>
+</method>
+<method name="glMaterialf"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="face" type="int">
+</parameter>
+<parameter name="pname" type="int">
+</parameter>
+<parameter name="param" type="float">
+</parameter>
+</method>
+<method name="glMaterialfv"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="face" type="int">
+</parameter>
+<parameter name="pname" type="int">
+</parameter>
+<parameter name="params" type="float[]">
+</parameter>
+<parameter name="offset" type="int">
+</parameter>
+</method>
+<method name="glMaterialfv"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="face" type="int">
+</parameter>
+<parameter name="pname" type="int">
+</parameter>
+<parameter name="params" type="java.nio.FloatBuffer">
+</parameter>
+</method>
+<method name="glMaterialx"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="face" type="int">
+</parameter>
+<parameter name="pname" type="int">
+</parameter>
+<parameter name="param" type="int">
+</parameter>
+</method>
+<method name="glMaterialxv"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="face" type="int">
+</parameter>
+<parameter name="pname" type="int">
+</parameter>
+<parameter name="params" type="int[]">
+</parameter>
+<parameter name="offset" type="int">
+</parameter>
+</method>
+<method name="glMaterialxv"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="face" type="int">
+</parameter>
+<parameter name="pname" type="int">
+</parameter>
+<parameter name="params" type="java.nio.IntBuffer">
+</parameter>
+</method>
+<method name="glMatrixMode"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="mode" type="int">
+</parameter>
+</method>
+<method name="glMultMatrixf"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="m" type="float[]">
+</parameter>
+<parameter name="offset" type="int">
+</parameter>
+</method>
+<method name="glMultMatrixf"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="m" type="java.nio.FloatBuffer">
+</parameter>
+</method>
+<method name="glMultMatrixx"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="m" type="int[]">
+</parameter>
+<parameter name="offset" type="int">
+</parameter>
+</method>
+<method name="glMultMatrixx"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="m" type="java.nio.IntBuffer">
+</parameter>
+</method>
+<method name="glMultiTexCoord4f"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="target" type="int">
+</parameter>
+<parameter name="s" type="float">
+</parameter>
+<parameter name="t" type="float">
+</parameter>
+<parameter name="r" type="float">
+</parameter>
+<parameter name="q" type="float">
+</parameter>
+</method>
+<method name="glMultiTexCoord4x"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="target" type="int">
+</parameter>
+<parameter name="s" type="int">
+</parameter>
+<parameter name="t" type="int">
+</parameter>
+<parameter name="r" type="int">
+</parameter>
+<parameter name="q" type="int">
+</parameter>
+</method>
+<method name="glNormal3f"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="nx" type="float">
+</parameter>
+<parameter name="ny" type="float">
+</parameter>
+<parameter name="nz" type="float">
+</parameter>
+</method>
+<method name="glNormal3x"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="nx" type="int">
+</parameter>
+<parameter name="ny" type="int">
+</parameter>
+<parameter name="nz" type="int">
+</parameter>
+</method>
+<method name="glNormalPointer"
+ return="void"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="type" type="int">
+</parameter>
+<parameter name="stride" type="int">
+</parameter>
+<parameter name="pointer" type="java.nio.Buffer">
+</parameter>
+</method>
+<method name="glOrthof"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="left" type="float">
+</parameter>
+<parameter name="right" type="float">
+</parameter>
+<parameter name="bottom" type="float">
+</parameter>
+<parameter name="top" type="float">
+</parameter>
+<parameter name="zNear" type="float">
+</parameter>
+<parameter name="zFar" type="float">
+</parameter>
+</method>
+<method name="glOrthox"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="left" type="int">
+</parameter>
+<parameter name="right" type="int">
+</parameter>
+<parameter name="bottom" type="int">
+</parameter>
+<parameter name="top" type="int">
+</parameter>
+<parameter name="zNear" type="int">
+</parameter>
+<parameter name="zFar" type="int">
+</parameter>
+</method>
+<method name="glPixelStorei"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="pname" type="int">
+</parameter>
+<parameter name="param" type="int">
+</parameter>
+</method>
+<method name="glPointSize"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="size" type="float">
+</parameter>
+</method>
+<method name="glPointSizex"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="size" type="int">
+</parameter>
+</method>
+<method name="glPolygonOffset"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="factor" type="float">
+</parameter>
+<parameter name="units" type="float">
+</parameter>
+</method>
+<method name="glPolygonOffsetx"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="factor" type="int">
+</parameter>
+<parameter name="units" type="int">
+</parameter>
+</method>
+<method name="glPopMatrix"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
+<method name="glPushMatrix"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
+<method name="glReadPixels"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="x" type="int">
+</parameter>
+<parameter name="y" type="int">
+</parameter>
+<parameter name="width" type="int">
+</parameter>
+<parameter name="height" type="int">
+</parameter>
+<parameter name="format" type="int">
+</parameter>
+<parameter name="type" type="int">
+</parameter>
+<parameter name="pixels" type="java.nio.Buffer">
+</parameter>
+</method>
+<method name="glRotatef"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="angle" type="float">
+</parameter>
+<parameter name="x" type="float">
+</parameter>
+<parameter name="y" type="float">
+</parameter>
+<parameter name="z" type="float">
+</parameter>
+</method>
+<method name="glRotatex"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="angle" type="int">
+</parameter>
+<parameter name="x" type="int">
+</parameter>
+<parameter name="y" type="int">
+</parameter>
+<parameter name="z" type="int">
+</parameter>
+</method>
+<method name="glSampleCoverage"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="value" type="float">
+</parameter>
+<parameter name="invert" type="boolean">
+</parameter>
+</method>
+<method name="glSampleCoveragex"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="value" type="int">
+</parameter>
+<parameter name="invert" type="boolean">
+</parameter>
+</method>
+<method name="glScalef"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="x" type="float">
+</parameter>
+<parameter name="y" type="float">
+</parameter>
+<parameter name="z" type="float">
+</parameter>
+</method>
+<method name="glScalex"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="x" type="int">
+</parameter>
+<parameter name="y" type="int">
+</parameter>
+<parameter name="z" type="int">
+</parameter>
+</method>
+<method name="glScissor"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="x" type="int">
+</parameter>
+<parameter name="y" type="int">
+</parameter>
+<parameter name="width" type="int">
+</parameter>
+<parameter name="height" type="int">
+</parameter>
+</method>
+<method name="glShadeModel"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="mode" type="int">
+</parameter>
+</method>
+<method name="glStencilFunc"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="func" type="int">
+</parameter>
+<parameter name="ref" type="int">
+</parameter>
+<parameter name="mask" type="int">
+</parameter>
+</method>
+<method name="glStencilMask"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="mask" type="int">
+</parameter>
+</method>
+<method name="glStencilOp"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="fail" type="int">
+</parameter>
+<parameter name="zfail" type="int">
+</parameter>
+<parameter name="zpass" type="int">
+</parameter>
+</method>
+<method name="glTexCoordPointer"
+ return="void"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="size" type="int">
+</parameter>
+<parameter name="type" type="int">
+</parameter>
+<parameter name="stride" type="int">
+</parameter>
+<parameter name="pointer" type="java.nio.Buffer">
+</parameter>
+</method>
+<method name="glTexEnvf"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="target" type="int">
+</parameter>
+<parameter name="pname" type="int">
+</parameter>
+<parameter name="param" type="float">
+</parameter>
+</method>
+<method name="glTexEnvfv"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="target" type="int">
+</parameter>
+<parameter name="pname" type="int">
+</parameter>
+<parameter name="params" type="float[]">
+</parameter>
+<parameter name="offset" type="int">
+</parameter>
+</method>
+<method name="glTexEnvfv"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="target" type="int">
+</parameter>
+<parameter name="pname" type="int">
+</parameter>
+<parameter name="params" type="java.nio.FloatBuffer">
+</parameter>
+</method>
+<method name="glTexEnvx"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="target" type="int">
+</parameter>
+<parameter name="pname" type="int">
+</parameter>
+<parameter name="param" type="int">
+</parameter>
+</method>
+<method name="glTexEnvxv"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="target" type="int">
+</parameter>
+<parameter name="pname" type="int">
+</parameter>
+<parameter name="params" type="int[]">
+</parameter>
+<parameter name="offset" type="int">
+</parameter>
+</method>
+<method name="glTexEnvxv"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="target" type="int">
+</parameter>
+<parameter name="pname" type="int">
+</parameter>
+<parameter name="params" type="java.nio.IntBuffer">
+</parameter>
+</method>
+<method name="glTexImage2D"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="target" type="int">
+</parameter>
+<parameter name="level" type="int">
+</parameter>
+<parameter name="internalformat" type="int">
+</parameter>
+<parameter name="width" type="int">
+</parameter>
+<parameter name="height" type="int">
+</parameter>
+<parameter name="border" type="int">
+</parameter>
+<parameter name="format" type="int">
+</parameter>
+<parameter name="type" type="int">
+</parameter>
+<parameter name="pixels" type="java.nio.Buffer">
+</parameter>
+</method>
+<method name="glTexParameterf"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="target" type="int">
+</parameter>
+<parameter name="pname" type="int">
+</parameter>
+<parameter name="param" type="float">
+</parameter>
+</method>
+<method name="glTexParameterx"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="target" type="int">
+</parameter>
+<parameter name="pname" type="int">
+</parameter>
+<parameter name="param" type="int">
+</parameter>
+</method>
+<method name="glTexSubImage2D"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="target" type="int">
+</parameter>
+<parameter name="level" type="int">
+</parameter>
+<parameter name="xoffset" type="int">
+</parameter>
+<parameter name="yoffset" type="int">
+</parameter>
+<parameter name="width" type="int">
+</parameter>
+<parameter name="height" type="int">
+</parameter>
+<parameter name="format" type="int">
+</parameter>
+<parameter name="type" type="int">
+</parameter>
+<parameter name="pixels" type="java.nio.Buffer">
+</parameter>
+</method>
+<method name="glTranslatef"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="x" type="float">
+</parameter>
+<parameter name="y" type="float">
+</parameter>
+<parameter name="z" type="float">
+</parameter>
+</method>
+<method name="glTranslatex"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="x" type="int">
+</parameter>
+<parameter name="y" type="int">
+</parameter>
+<parameter name="z" type="int">
+</parameter>
+</method>
+<method name="glVertexPointer"
+ return="void"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="size" type="int">
+</parameter>
+<parameter name="type" type="int">
+</parameter>
+<parameter name="stride" type="int">
+</parameter>
+<parameter name="pointer" type="java.nio.Buffer">
+</parameter>
+</method>
+<method name="glViewport"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="x" type="int">
+</parameter>
+<parameter name="y" type="int">
+</parameter>
+<parameter name="width" type="int">
+</parameter>
+<parameter name="height" type="int">
+</parameter>
+</method>
+<field name="GL_ADD"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="260"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_ALIASED_LINE_WIDTH_RANGE"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="33902"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_ALIASED_POINT_SIZE_RANGE"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="33901"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_ALPHA"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="6406"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_ALPHA_BITS"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="3413"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_ALPHA_TEST"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="3008"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_ALWAYS"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="519"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_AMBIENT"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="4608"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_AMBIENT_AND_DIFFUSE"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="5634"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_AND"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="5377"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_AND_INVERTED"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="5380"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_AND_REVERSE"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="5378"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_BACK"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="1029"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_BLEND"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="3042"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_BLUE_BITS"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="3412"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_BYTE"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="5120"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_CCW"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="2305"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_CLAMP_TO_EDGE"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="33071"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_CLEAR"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="5376"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_COLOR_ARRAY"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="32886"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_COLOR_BUFFER_BIT"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="16384"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_COLOR_LOGIC_OP"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="3058"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_COLOR_MATERIAL"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="2903"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_COMPRESSED_TEXTURE_FORMATS"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="34467"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_CONSTANT_ATTENUATION"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="4615"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_COPY"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="5379"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_COPY_INVERTED"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="5388"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_CULL_FACE"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="2884"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_CW"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="2304"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_DECAL"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="8449"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_DECR"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="7683"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_DEPTH_BITS"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="3414"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_DEPTH_BUFFER_BIT"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="256"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_DEPTH_TEST"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="2929"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_DIFFUSE"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="4609"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_DITHER"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="3024"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_DONT_CARE"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="4352"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_DST_ALPHA"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="772"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_DST_COLOR"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="774"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_EMISSION"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="5632"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_EQUAL"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="514"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_EQUIV"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="5385"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_EXP"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="2048"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_EXP2"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="2049"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_EXTENSIONS"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="7939"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_FALSE"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="0"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_FASTEST"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="4353"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_FIXED"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="5132"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_FLAT"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="7424"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_FLOAT"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="5126"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_FOG"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="2912"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_FOG_COLOR"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="2918"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_FOG_DENSITY"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="2914"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_FOG_END"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="2916"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_FOG_HINT"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="3156"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_FOG_MODE"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="2917"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_FOG_START"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="2915"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_FRONT"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="1028"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_FRONT_AND_BACK"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="1032"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_GEQUAL"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="518"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_GREATER"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="516"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_GREEN_BITS"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="3411"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="35739"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_IMPLEMENTATION_COLOR_READ_TYPE_OES"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="35738"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_INCR"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="7682"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_INVALID_ENUM"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="1280"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_INVALID_OPERATION"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="1282"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_INVALID_VALUE"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="1281"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_INVERT"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="5386"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_KEEP"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="7680"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_LEQUAL"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="515"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_LESS"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="513"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_LIGHT0"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="16384"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_LIGHT1"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="16385"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_LIGHT2"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="16386"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_LIGHT3"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="16387"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_LIGHT4"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="16388"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_LIGHT5"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="16389"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_LIGHT6"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="16390"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_LIGHT7"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="16391"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_LIGHTING"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="2896"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_LIGHT_MODEL_AMBIENT"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="2899"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_LIGHT_MODEL_TWO_SIDE"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="2898"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_LINEAR"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="9729"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_LINEAR_ATTENUATION"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="4616"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_LINEAR_MIPMAP_LINEAR"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="9987"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_LINEAR_MIPMAP_NEAREST"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="9985"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_LINES"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="1"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_LINE_LOOP"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="2"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_LINE_SMOOTH"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="2848"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_LINE_SMOOTH_HINT"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="3154"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_LINE_STRIP"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="3"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_LUMINANCE"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="6409"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_LUMINANCE_ALPHA"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="6410"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_MAX_ELEMENTS_INDICES"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="33001"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_MAX_ELEMENTS_VERTICES"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="33000"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_MAX_LIGHTS"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="3377"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_MAX_MODELVIEW_STACK_DEPTH"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="3382"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_MAX_PROJECTION_STACK_DEPTH"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="3384"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_MAX_TEXTURE_SIZE"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="3379"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_MAX_TEXTURE_STACK_DEPTH"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="3385"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_MAX_TEXTURE_UNITS"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="34018"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_MAX_VIEWPORT_DIMS"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="3386"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_MODELVIEW"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="5888"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_MODULATE"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="8448"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_MULTISAMPLE"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="32925"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_NAND"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="5390"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_NEAREST"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="9728"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_NEAREST_MIPMAP_LINEAR"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="9986"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_NEAREST_MIPMAP_NEAREST"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="9984"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_NEVER"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="512"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_NICEST"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="4354"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_NOOP"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="5381"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_NOR"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="5384"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_NORMALIZE"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="2977"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_NORMAL_ARRAY"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="32885"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_NOTEQUAL"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="517"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_NO_ERROR"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="0"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_NUM_COMPRESSED_TEXTURE_FORMATS"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="34466"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_ONE"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="1"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_ONE_MINUS_DST_ALPHA"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="773"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_ONE_MINUS_DST_COLOR"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="775"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_ONE_MINUS_SRC_ALPHA"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="771"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_ONE_MINUS_SRC_COLOR"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="769"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_OR"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="5383"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_OR_INVERTED"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="5389"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_OR_REVERSE"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="5387"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_OUT_OF_MEMORY"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="1285"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_PACK_ALIGNMENT"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="3333"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_PALETTE4_R5_G6_B5_OES"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="35730"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_PALETTE4_RGB5_A1_OES"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="35732"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_PALETTE4_RGB8_OES"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="35728"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_PALETTE4_RGBA4_OES"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="35731"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_PALETTE4_RGBA8_OES"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="35729"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_PALETTE8_R5_G6_B5_OES"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="35735"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_PALETTE8_RGB5_A1_OES"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="35737"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_PALETTE8_RGB8_OES"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="35733"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_PALETTE8_RGBA4_OES"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="35736"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_PALETTE8_RGBA8_OES"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="35734"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_PERSPECTIVE_CORRECTION_HINT"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="3152"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_POINTS"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="0"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_POINT_FADE_THRESHOLD_SIZE"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="33064"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_POINT_SIZE"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="2833"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_POINT_SMOOTH"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="2832"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_POINT_SMOOTH_HINT"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="3153"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_POLYGON_OFFSET_FILL"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="32823"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_POLYGON_SMOOTH_HINT"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="3155"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_POSITION"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="4611"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_PROJECTION"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="5889"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_QUADRATIC_ATTENUATION"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="4617"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_RED_BITS"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="3410"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_RENDERER"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="7937"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_REPEAT"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="10497"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_REPLACE"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="7681"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_RESCALE_NORMAL"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="32826"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_RGB"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="6407"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_RGBA"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="6408"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_SAMPLE_ALPHA_TO_COVERAGE"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="32926"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_SAMPLE_ALPHA_TO_ONE"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="32927"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_SAMPLE_COVERAGE"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="32928"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_SCISSOR_TEST"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="3089"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_SET"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="5391"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_SHININESS"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="5633"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_SHORT"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="5122"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_SMOOTH"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="7425"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_SMOOTH_LINE_WIDTH_RANGE"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="2850"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_SMOOTH_POINT_SIZE_RANGE"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="2834"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_SPECULAR"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="4610"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_SPOT_CUTOFF"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="4614"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_SPOT_DIRECTION"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="4612"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_SPOT_EXPONENT"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="4613"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_SRC_ALPHA"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="770"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_SRC_ALPHA_SATURATE"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="776"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_SRC_COLOR"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="768"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_STACK_OVERFLOW"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="1283"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_STACK_UNDERFLOW"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="1284"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_STENCIL_BITS"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="3415"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_STENCIL_BUFFER_BIT"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="1024"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_STENCIL_TEST"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="2960"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_SUBPIXEL_BITS"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="3408"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_TEXTURE"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="5890"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_TEXTURE0"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="33984"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_TEXTURE1"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="33985"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_TEXTURE10"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="33994"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_TEXTURE11"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="33995"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_TEXTURE12"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="33996"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_TEXTURE13"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="33997"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_TEXTURE14"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="33998"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_TEXTURE15"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="33999"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_TEXTURE16"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="34000"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_TEXTURE17"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="34001"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_TEXTURE18"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="34002"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_TEXTURE19"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="34003"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_TEXTURE2"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="33986"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_TEXTURE20"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="34004"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_TEXTURE21"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="34005"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_TEXTURE22"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="34006"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_TEXTURE23"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="34007"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_TEXTURE24"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="34008"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_TEXTURE25"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="34009"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_TEXTURE26"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="34010"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_TEXTURE27"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="34011"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_TEXTURE28"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="34012"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_TEXTURE29"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="34013"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_TEXTURE3"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="33987"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_TEXTURE30"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="34014"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_TEXTURE31"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="34015"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_TEXTURE4"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="33988"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_TEXTURE5"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="33989"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_TEXTURE6"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="33990"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_TEXTURE7"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="33991"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_TEXTURE8"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="33992"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_TEXTURE9"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="33993"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_TEXTURE_2D"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="3553"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_TEXTURE_COORD_ARRAY"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="32888"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_TEXTURE_ENV"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="8960"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_TEXTURE_ENV_COLOR"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="8705"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_TEXTURE_ENV_MODE"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="8704"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_TEXTURE_MAG_FILTER"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="10240"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_TEXTURE_MIN_FILTER"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="10241"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_TEXTURE_WRAP_S"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="10242"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_TEXTURE_WRAP_T"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="10243"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_TRIANGLES"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="4"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_TRIANGLE_FAN"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="6"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_TRIANGLE_STRIP"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="5"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_TRUE"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="1"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_UNPACK_ALIGNMENT"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="3317"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_UNSIGNED_BYTE"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="5121"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_UNSIGNED_SHORT"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="5123"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_UNSIGNED_SHORT_4_4_4_4"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="32819"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_UNSIGNED_SHORT_5_5_5_1"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="32820"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_UNSIGNED_SHORT_5_6_5"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="33635"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_VENDOR"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="7936"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_VERSION"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="7938"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_VERTEX_ARRAY"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="32884"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_XOR"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="5382"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_ZERO"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="0"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+</class>
+<class name="GLES10Ext"
+ extends="java.lang.Object"
+ abstract="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<constructor name="GLES10Ext"
+ type="android.opengl.GLES10Ext"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</constructor>
+<method name="glQueryMatrixxOES"
+ return="int"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="mantissa" type="int[]">
+</parameter>
+<parameter name="mantissaOffset" type="int">
+</parameter>
+<parameter name="exponent" type="int[]">
+</parameter>
+<parameter name="exponentOffset" type="int">
+</parameter>
+</method>
+<method name="glQueryMatrixxOES"
+ return="int"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="mantissa" type="java.nio.IntBuffer">
+</parameter>
+<parameter name="exponent" type="java.nio.IntBuffer">
+</parameter>
+</method>
+</class>
+<class name="GLES11"
+ extends="android.opengl.GLES10"
+ abstract="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<constructor name="GLES11"
+ type="android.opengl.GLES11"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</constructor>
+<method name="glBindBuffer"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="target" type="int">
+</parameter>
+<parameter name="buffer" type="int">
+</parameter>
+</method>
+<method name="glBufferData"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="target" type="int">
+</parameter>
+<parameter name="size" type="int">
+</parameter>
+<parameter name="data" type="java.nio.Buffer">
+</parameter>
+<parameter name="usage" type="int">
+</parameter>
+</method>
+<method name="glBufferSubData"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="target" type="int">
+</parameter>
+<parameter name="offset" type="int">
+</parameter>
+<parameter name="size" type="int">
+</parameter>
+<parameter name="data" type="java.nio.Buffer">
+</parameter>
+</method>
+<method name="glClipPlanef"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="plane" type="int">
+</parameter>
+<parameter name="equation" type="float[]">
+</parameter>
+<parameter name="offset" type="int">
+</parameter>
+</method>
+<method name="glClipPlanef"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="plane" type="int">
+</parameter>
+<parameter name="equation" type="java.nio.FloatBuffer">
+</parameter>
+</method>
+<method name="glClipPlanex"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="plane" type="int">
+</parameter>
+<parameter name="equation" type="int[]">
+</parameter>
+<parameter name="offset" type="int">
+</parameter>
+</method>
+<method name="glClipPlanex"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="plane" type="int">
+</parameter>
+<parameter name="equation" type="java.nio.IntBuffer">
+</parameter>
+</method>
+<method name="glColor4ub"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="red" type="byte">
+</parameter>
+<parameter name="green" type="byte">
+</parameter>
+<parameter name="blue" type="byte">
+</parameter>
+<parameter name="alpha" type="byte">
+</parameter>
+</method>
+<method name="glColorPointer"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="size" type="int">
+</parameter>
+<parameter name="type" type="int">
+</parameter>
+<parameter name="stride" type="int">
+</parameter>
+<parameter name="offset" type="int">
+</parameter>
+</method>
+<method name="glDeleteBuffers"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="n" type="int">
+</parameter>
+<parameter name="buffers" type="int[]">
+</parameter>
+<parameter name="offset" type="int">
+</parameter>
+</method>
+<method name="glDeleteBuffers"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="n" type="int">
+</parameter>
+<parameter name="buffers" type="java.nio.IntBuffer">
+</parameter>
+</method>
+<method name="glDrawElements"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="mode" type="int">
+</parameter>
+<parameter name="count" type="int">
+</parameter>
+<parameter name="type" type="int">
+</parameter>
+<parameter name="offset" type="int">
+</parameter>
+</method>
+<method name="glGenBuffers"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="n" type="int">
+</parameter>
+<parameter name="buffers" type="int[]">
+</parameter>
+<parameter name="offset" type="int">
+</parameter>
+</method>
+<method name="glGenBuffers"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="n" type="int">
+</parameter>
+<parameter name="buffers" type="java.nio.IntBuffer">
+</parameter>
+</method>
+<method name="glGetBooleanv"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="pname" type="int">
+</parameter>
+<parameter name="params" type="boolean[]">
+</parameter>
+<parameter name="offset" type="int">
+</parameter>
+</method>
+<method name="glGetBooleanv"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="pname" type="int">
+</parameter>
+<parameter name="params" type="java.nio.IntBuffer">
+</parameter>
+</method>
+<method name="glGetBufferParameteriv"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="target" type="int">
+</parameter>
+<parameter name="pname" type="int">
+</parameter>
+<parameter name="params" type="int[]">
+</parameter>
+<parameter name="offset" type="int">
+</parameter>
+</method>
+<method name="glGetBufferParameteriv"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="target" type="int">
+</parameter>
+<parameter name="pname" type="int">
+</parameter>
+<parameter name="params" type="java.nio.IntBuffer">
+</parameter>
+</method>
+<method name="glGetClipPlanef"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="pname" type="int">
+</parameter>
+<parameter name="eqn" type="float[]">
+</parameter>
+<parameter name="offset" type="int">
+</parameter>
+</method>
+<method name="glGetClipPlanef"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="pname" type="int">
+</parameter>
+<parameter name="eqn" type="java.nio.FloatBuffer">
+</parameter>
+</method>
+<method name="glGetClipPlanex"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="pname" type="int">
+</parameter>
+<parameter name="eqn" type="int[]">
+</parameter>
+<parameter name="offset" type="int">
+</parameter>
+</method>
+<method name="glGetClipPlanex"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="pname" type="int">
+</parameter>
+<parameter name="eqn" type="java.nio.IntBuffer">
+</parameter>
+</method>
+<method name="glGetFixedv"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="pname" type="int">
+</parameter>
+<parameter name="params" type="int[]">
+</parameter>
+<parameter name="offset" type="int">
+</parameter>
+</method>
+<method name="glGetFixedv"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="pname" type="int">
+</parameter>
+<parameter name="params" type="java.nio.IntBuffer">
+</parameter>
+</method>
+<method name="glGetFloatv"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="pname" type="int">
+</parameter>
+<parameter name="params" type="float[]">
+</parameter>
+<parameter name="offset" type="int">
+</parameter>
+</method>
+<method name="glGetFloatv"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="pname" type="int">
+</parameter>
+<parameter name="params" type="java.nio.FloatBuffer">
+</parameter>
+</method>
+<method name="glGetLightfv"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="light" type="int">
+</parameter>
+<parameter name="pname" type="int">
+</parameter>
+<parameter name="params" type="float[]">
+</parameter>
+<parameter name="offset" type="int">
+</parameter>
+</method>
+<method name="glGetLightfv"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="light" type="int">
+</parameter>
+<parameter name="pname" type="int">
+</parameter>
+<parameter name="params" type="java.nio.FloatBuffer">
+</parameter>
+</method>
+<method name="glGetLightxv"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="light" type="int">
+</parameter>
+<parameter name="pname" type="int">
+</parameter>
+<parameter name="params" type="int[]">
+</parameter>
+<parameter name="offset" type="int">
+</parameter>
+</method>
+<method name="glGetLightxv"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="light" type="int">
+</parameter>
+<parameter name="pname" type="int">
+</parameter>
+<parameter name="params" type="java.nio.IntBuffer">
+</parameter>
+</method>
+<method name="glGetMaterialfv"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="face" type="int">
+</parameter>
+<parameter name="pname" type="int">
+</parameter>
+<parameter name="params" type="float[]">
+</parameter>
+<parameter name="offset" type="int">
+</parameter>
+</method>
+<method name="glGetMaterialfv"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="face" type="int">
+</parameter>
+<parameter name="pname" type="int">
+</parameter>
+<parameter name="params" type="java.nio.FloatBuffer">
+</parameter>
+</method>
+<method name="glGetMaterialxv"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="face" type="int">
+</parameter>
+<parameter name="pname" type="int">
+</parameter>
+<parameter name="params" type="int[]">
+</parameter>
+<parameter name="offset" type="int">
+</parameter>
+</method>
+<method name="glGetMaterialxv"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="face" type="int">
+</parameter>
+<parameter name="pname" type="int">
+</parameter>
+<parameter name="params" type="java.nio.IntBuffer">
+</parameter>
+</method>
+<method name="glGetTexEnvfv"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="env" type="int">
+</parameter>
+<parameter name="pname" type="int">
+</parameter>
+<parameter name="params" type="float[]">
+</parameter>
+<parameter name="offset" type="int">
+</parameter>
+</method>
+<method name="glGetTexEnvfv"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="env" type="int">
+</parameter>
+<parameter name="pname" type="int">
+</parameter>
+<parameter name="params" type="java.nio.FloatBuffer">
+</parameter>
+</method>
+<method name="glGetTexEnviv"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="env" type="int">
+</parameter>
+<parameter name="pname" type="int">
+</parameter>
+<parameter name="params" type="int[]">
+</parameter>
+<parameter name="offset" type="int">
+</parameter>
+</method>
+<method name="glGetTexEnviv"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="env" type="int">
+</parameter>
+<parameter name="pname" type="int">
+</parameter>
+<parameter name="params" type="java.nio.IntBuffer">
+</parameter>
+</method>
+<method name="glGetTexEnvxv"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="env" type="int">
+</parameter>
+<parameter name="pname" type="int">
+</parameter>
+<parameter name="params" type="int[]">
+</parameter>
+<parameter name="offset" type="int">
+</parameter>
+</method>
+<method name="glGetTexEnvxv"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="env" type="int">
+</parameter>
+<parameter name="pname" type="int">
+</parameter>
+<parameter name="params" type="java.nio.IntBuffer">
+</parameter>
+</method>
+<method name="glGetTexParameterfv"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="target" type="int">
+</parameter>
+<parameter name="pname" type="int">
+</parameter>
+<parameter name="params" type="float[]">
+</parameter>
+<parameter name="offset" type="int">
+</parameter>
+</method>
+<method name="glGetTexParameterfv"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="target" type="int">
+</parameter>
+<parameter name="pname" type="int">
+</parameter>
+<parameter name="params" type="java.nio.FloatBuffer">
+</parameter>
+</method>
+<method name="glGetTexParameteriv"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="target" type="int">
+</parameter>
+<parameter name="pname" type="int">
+</parameter>
+<parameter name="params" type="int[]">
+</parameter>
+<parameter name="offset" type="int">
+</parameter>
+</method>
+<method name="glGetTexParameteriv"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="target" type="int">
+</parameter>
+<parameter name="pname" type="int">
+</parameter>
+<parameter name="params" type="java.nio.IntBuffer">
+</parameter>
+</method>
+<method name="glGetTexParameterxv"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="target" type="int">
+</parameter>
+<parameter name="pname" type="int">
+</parameter>
+<parameter name="params" type="int[]">
+</parameter>
+<parameter name="offset" type="int">
+</parameter>
+</method>
+<method name="glGetTexParameterxv"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="target" type="int">
+</parameter>
+<parameter name="pname" type="int">
+</parameter>
+<parameter name="params" type="java.nio.IntBuffer">
+</parameter>
+</method>
+<method name="glIsBuffer"
+ return="boolean"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="buffer" type="int">
+</parameter>
+</method>
+<method name="glIsEnabled"
+ return="boolean"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="cap" type="int">
+</parameter>
+</method>
+<method name="glIsTexture"
+ return="boolean"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="texture" type="int">
+</parameter>
+</method>
+<method name="glNormalPointer"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="type" type="int">
+</parameter>
+<parameter name="stride" type="int">
+</parameter>
+<parameter name="offset" type="int">
+</parameter>
+</method>
+<method name="glPointParameterf"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="pname" type="int">
+</parameter>
+<parameter name="param" type="float">
+</parameter>
+</method>
+<method name="glPointParameterfv"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="pname" type="int">
+</parameter>
+<parameter name="params" type="float[]">
+</parameter>
+<parameter name="offset" type="int">
+</parameter>
+</method>
+<method name="glPointParameterfv"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="pname" type="int">
+</parameter>
+<parameter name="params" type="java.nio.FloatBuffer">
+</parameter>
+</method>
+<method name="glPointParameterx"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="pname" type="int">
+</parameter>
+<parameter name="param" type="int">
+</parameter>
+</method>
+<method name="glPointParameterxv"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="pname" type="int">
+</parameter>
+<parameter name="params" type="int[]">
+</parameter>
+<parameter name="offset" type="int">
+</parameter>
+</method>
+<method name="glPointParameterxv"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="pname" type="int">
+</parameter>
+<parameter name="params" type="java.nio.IntBuffer">
+</parameter>
+</method>
+<method name="glPointSizePointerOES"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="type" type="int">
+</parameter>
+<parameter name="stride" type="int">
+</parameter>
+<parameter name="pointer" type="java.nio.Buffer">
+</parameter>
+</method>
+<method name="glTexCoordPointer"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="size" type="int">
+</parameter>
+<parameter name="type" type="int">
+</parameter>
+<parameter name="stride" type="int">
+</parameter>
+<parameter name="offset" type="int">
+</parameter>
+</method>
+<method name="glTexEnvi"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="target" type="int">
+</parameter>
+<parameter name="pname" type="int">
+</parameter>
+<parameter name="param" type="int">
+</parameter>
+</method>
+<method name="glTexEnviv"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="target" type="int">
+</parameter>
+<parameter name="pname" type="int">
+</parameter>
+<parameter name="params" type="int[]">
+</parameter>
+<parameter name="offset" type="int">
+</parameter>
+</method>
+<method name="glTexEnviv"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="target" type="int">
+</parameter>
+<parameter name="pname" type="int">
+</parameter>
+<parameter name="params" type="java.nio.IntBuffer">
+</parameter>
+</method>
+<method name="glTexParameterfv"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="target" type="int">
+</parameter>
+<parameter name="pname" type="int">
+</parameter>
+<parameter name="params" type="float[]">
+</parameter>
+<parameter name="offset" type="int">
+</parameter>
+</method>
+<method name="glTexParameterfv"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="target" type="int">
+</parameter>
+<parameter name="pname" type="int">
+</parameter>
+<parameter name="params" type="java.nio.FloatBuffer">
+</parameter>
+</method>
+<method name="glTexParameteri"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="target" type="int">
+</parameter>
+<parameter name="pname" type="int">
+</parameter>
+<parameter name="param" type="int">
+</parameter>
+</method>
+<method name="glTexParameteriv"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="target" type="int">
+</parameter>
+<parameter name="pname" type="int">
+</parameter>
+<parameter name="params" type="int[]">
+</parameter>
+<parameter name="offset" type="int">
+</parameter>
+</method>
+<method name="glTexParameteriv"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="target" type="int">
+</parameter>
+<parameter name="pname" type="int">
+</parameter>
+<parameter name="params" type="java.nio.IntBuffer">
+</parameter>
+</method>
+<method name="glTexParameterxv"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="target" type="int">
+</parameter>
+<parameter name="pname" type="int">
+</parameter>
+<parameter name="params" type="int[]">
+</parameter>
+<parameter name="offset" type="int">
+</parameter>
+</method>
+<method name="glTexParameterxv"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="target" type="int">
+</parameter>
+<parameter name="pname" type="int">
+</parameter>
+<parameter name="params" type="java.nio.IntBuffer">
+</parameter>
+</method>
+<method name="glVertexPointer"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="size" type="int">
+</parameter>
+<parameter name="type" type="int">
+</parameter>
+<parameter name="stride" type="int">
+</parameter>
+<parameter name="offset" type="int">
+</parameter>
+</method>
+<field name="GL_ACTIVE_TEXTURE"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="34016"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_ADD_SIGNED"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="34164"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_ALPHA_SCALE"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="3356"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_ALPHA_TEST_FUNC"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="3009"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_ALPHA_TEST_REF"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="3010"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_ARRAY_BUFFER"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="34962"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_ARRAY_BUFFER_BINDING"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="34964"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_BLEND_DST"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="3040"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_BLEND_SRC"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="3041"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_BUFFER_ACCESS"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="35003"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_BUFFER_SIZE"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="34660"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_BUFFER_USAGE"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="34661"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_CLIENT_ACTIVE_TEXTURE"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="34017"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_CLIP_PLANE0"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="12288"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_CLIP_PLANE1"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="12289"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_CLIP_PLANE2"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="12290"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_CLIP_PLANE3"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="12291"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_CLIP_PLANE4"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="12292"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_CLIP_PLANE5"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="12293"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_COLOR_ARRAY_BUFFER_BINDING"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="34968"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_COLOR_ARRAY_POINTER"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="32912"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_COLOR_ARRAY_SIZE"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="32897"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_COLOR_ARRAY_STRIDE"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="32899"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_COLOR_ARRAY_TYPE"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="32898"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_COLOR_CLEAR_VALUE"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="3106"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_COLOR_WRITEMASK"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="3107"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_COMBINE"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="34160"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_COMBINE_ALPHA"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="34162"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_COMBINE_RGB"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="34161"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_CONSTANT"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="34166"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_COORD_REPLACE_OES"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="34914"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_CULL_FACE_MODE"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="2885"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_CURRENT_COLOR"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="2816"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_CURRENT_NORMAL"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="2818"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_CURRENT_TEXTURE_COORDS"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="2819"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_DEPTH_CLEAR_VALUE"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="2931"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_DEPTH_FUNC"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="2932"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_DEPTH_RANGE"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="2928"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_DEPTH_WRITEMASK"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="2930"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_DOT3_RGB"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="34478"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_DOT3_RGBA"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="34479"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_DYNAMIC_DRAW"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="35048"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_ELEMENT_ARRAY_BUFFER"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="34963"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_ELEMENT_ARRAY_BUFFER_BINDING"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="34965"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_FRONT_FACE"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="2886"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_GENERATE_MIPMAP"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="33169"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_GENERATE_MIPMAP_HINT"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="33170"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_INTERPOLATE"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="34165"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_LINE_WIDTH"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="2849"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_LOGIC_OP_MODE"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="3056"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_MATRIX_MODE"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="2976"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_MAX_CLIP_PLANES"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="3378"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_MODELVIEW_MATRIX"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="2982"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_MODELVIEW_MATRIX_FLOAT_AS_INT_BITS_OES"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="35213"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_MODELVIEW_STACK_DEPTH"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="2979"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_NORMAL_ARRAY_BUFFER_BINDING"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="34967"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_NORMAL_ARRAY_POINTER"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="32911"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_NORMAL_ARRAY_STRIDE"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="32895"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_NORMAL_ARRAY_TYPE"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="32894"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_OPERAND0_ALPHA"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="34200"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_OPERAND0_RGB"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="34192"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_OPERAND1_ALPHA"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="34201"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_OPERAND1_RGB"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="34193"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_OPERAND2_ALPHA"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="34202"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_OPERAND2_RGB"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="34194"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_POINT_DISTANCE_ATTENUATION"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="33065"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_POINT_FADE_THRESHOLD_SIZE"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="33064"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_POINT_SIZE"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="2833"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_POINT_SIZE_ARRAY_BUFFER_BINDING_OES"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="35743"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_POINT_SIZE_ARRAY_OES"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="35740"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_POINT_SIZE_ARRAY_POINTER_OES"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="35212"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_POINT_SIZE_ARRAY_STRIDE_OES"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="35211"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_POINT_SIZE_ARRAY_TYPE_OES"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="35210"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_POINT_SIZE_MAX"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="33063"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_POINT_SIZE_MIN"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="33062"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_POINT_SPRITE_OES"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="34913"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_POLYGON_OFFSET_FACTOR"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="32824"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_POLYGON_OFFSET_UNITS"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="10752"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_PREVIOUS"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="34168"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_PRIMARY_COLOR"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="34167"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_PROJECTION_MATRIX"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="2983"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_PROJECTION_MATRIX_FLOAT_AS_INT_BITS_OES"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="35214"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_PROJECTION_STACK_DEPTH"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="2980"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_RGB_SCALE"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="34163"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_SAMPLES"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="32937"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_SAMPLE_BUFFERS"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="32936"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_SAMPLE_COVERAGE_INVERT"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="32939"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_SAMPLE_COVERAGE_VALUE"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="32938"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_SCISSOR_BOX"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="3088"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_SHADE_MODEL"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="2900"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_SRC0_ALPHA"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="34184"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_SRC0_RGB"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="34176"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_SRC1_ALPHA"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="34185"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_SRC1_RGB"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="34177"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_SRC2_ALPHA"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="34186"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_SRC2_RGB"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="34178"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_STATIC_DRAW"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="35044"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_STENCIL_CLEAR_VALUE"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="2961"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_STENCIL_FAIL"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="2964"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_STENCIL_FUNC"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="2962"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_STENCIL_PASS_DEPTH_FAIL"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="2965"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_STENCIL_PASS_DEPTH_PASS"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="2966"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_STENCIL_REF"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="2967"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_STENCIL_VALUE_MASK"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="2963"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_STENCIL_WRITEMASK"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="2968"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_SUBTRACT"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="34023"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_TEXTURE_BINDING_2D"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="32873"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="34970"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_TEXTURE_COORD_ARRAY_POINTER"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="32914"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_TEXTURE_COORD_ARRAY_SIZE"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="32904"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_TEXTURE_COORD_ARRAY_STRIDE"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="32906"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_TEXTURE_COORD_ARRAY_TYPE"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="32905"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_TEXTURE_MATRIX"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="2984"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_TEXTURE_MATRIX_FLOAT_AS_INT_BITS_OES"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="35215"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_TEXTURE_STACK_DEPTH"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="2981"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_VERTEX_ARRAY_BUFFER_BINDING"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="34966"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_VERTEX_ARRAY_POINTER"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="32910"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_VERTEX_ARRAY_SIZE"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="32890"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_VERTEX_ARRAY_STRIDE"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="32892"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_VERTEX_ARRAY_TYPE"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="32891"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_VIEWPORT"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="2978"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_WRITE_ONLY"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="35001"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+</class>
+<class name="GLES11Ext"
+ extends="java.lang.Object"
+ abstract="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<constructor name="GLES11Ext"
+ type="android.opengl.GLES11Ext"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</constructor>
+<method name="glAlphaFuncxOES"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="func" type="int">
+</parameter>
+<parameter name="ref" type="int">
+</parameter>
+</method>
+<method name="glBindFramebufferOES"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="target" type="int">
+</parameter>
+<parameter name="framebuffer" type="int">
+</parameter>
+</method>
+<method name="glBindRenderbufferOES"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="target" type="int">
+</parameter>
+<parameter name="renderbuffer" type="int">
+</parameter>
+</method>
+<method name="glBlendEquationOES"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="mode" type="int">
+</parameter>
+</method>
+<method name="glBlendEquationSeparateOES"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="modeRGB" type="int">
+</parameter>
+<parameter name="modeAlpha" type="int">
+</parameter>
+</method>
+<method name="glBlendFuncSeparateOES"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="srcRGB" type="int">
+</parameter>
+<parameter name="dstRGB" type="int">
+</parameter>
+<parameter name="srcAlpha" type="int">
+</parameter>
+<parameter name="dstAlpha" type="int">
+</parameter>
+</method>
+<method name="glCheckFramebufferStatusOES"
+ return="int"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="target" type="int">
+</parameter>
+</method>
+<method name="glClearColorxOES"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="red" type="int">
+</parameter>
+<parameter name="green" type="int">
+</parameter>
+<parameter name="blue" type="int">
+</parameter>
+<parameter name="alpha" type="int">
+</parameter>
+</method>
+<method name="glClearDepthfOES"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="depth" type="float">
+</parameter>
+</method>
+<method name="glClearDepthxOES"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="depth" type="int">
+</parameter>
+</method>
+<method name="glClipPlanefOES"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="plane" type="int">
+</parameter>
+<parameter name="equation" type="float[]">
+</parameter>
+<parameter name="offset" type="int">
+</parameter>
+</method>
+<method name="glClipPlanefOES"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="plane" type="int">
+</parameter>
+<parameter name="equation" type="java.nio.FloatBuffer">
+</parameter>
+</method>
+<method name="glClipPlanexOES"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="plane" type="int">
+</parameter>
+<parameter name="equation" type="int[]">
+</parameter>
+<parameter name="offset" type="int">
+</parameter>
+</method>
+<method name="glClipPlanexOES"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="plane" type="int">
+</parameter>
+<parameter name="equation" type="java.nio.IntBuffer">
+</parameter>
+</method>
+<method name="glColor4xOES"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="red" type="int">
+</parameter>
+<parameter name="green" type="int">
+</parameter>
+<parameter name="blue" type="int">
+</parameter>
+<parameter name="alpha" type="int">
+</parameter>
+</method>
+<method name="glCurrentPaletteMatrixOES"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="matrixpaletteindex" type="int">
+</parameter>
+</method>
+<method name="glDeleteFramebuffersOES"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="n" type="int">
+</parameter>
+<parameter name="framebuffers" type="int[]">
+</parameter>
+<parameter name="offset" type="int">
+</parameter>
+</method>
+<method name="glDeleteFramebuffersOES"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="n" type="int">
+</parameter>
+<parameter name="framebuffers" type="java.nio.IntBuffer">
+</parameter>
+</method>
+<method name="glDeleteRenderbuffersOES"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="n" type="int">
+</parameter>
+<parameter name="renderbuffers" type="int[]">
+</parameter>
+<parameter name="offset" type="int">
+</parameter>
+</method>
+<method name="glDeleteRenderbuffersOES"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="n" type="int">
+</parameter>
+<parameter name="renderbuffers" type="java.nio.IntBuffer">
+</parameter>
+</method>
+<method name="glDepthRangefOES"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="zNear" type="float">
+</parameter>
+<parameter name="zFar" type="float">
+</parameter>
+</method>
+<method name="glDepthRangexOES"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="zNear" type="int">
+</parameter>
+<parameter name="zFar" type="int">
+</parameter>
+</method>
+<method name="glDrawTexfOES"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="x" type="float">
+</parameter>
+<parameter name="y" type="float">
+</parameter>
+<parameter name="z" type="float">
+</parameter>
+<parameter name="width" type="float">
+</parameter>
+<parameter name="height" type="float">
+</parameter>
+</method>
+<method name="glDrawTexfvOES"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="coords" type="float[]">
+</parameter>
+<parameter name="offset" type="int">
+</parameter>
+</method>
+<method name="glDrawTexfvOES"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="coords" type="java.nio.FloatBuffer">
+</parameter>
+</method>
+<method name="glDrawTexiOES"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="x" type="int">
+</parameter>
+<parameter name="y" type="int">
+</parameter>
+<parameter name="z" type="int">
+</parameter>
+<parameter name="width" type="int">
+</parameter>
+<parameter name="height" type="int">
+</parameter>
+</method>
+<method name="glDrawTexivOES"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="coords" type="int[]">
+</parameter>
+<parameter name="offset" type="int">
+</parameter>
+</method>
+<method name="glDrawTexivOES"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="coords" type="java.nio.IntBuffer">
+</parameter>
+</method>
+<method name="glDrawTexsOES"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="x" type="short">
+</parameter>
+<parameter name="y" type="short">
+</parameter>
+<parameter name="z" type="short">
+</parameter>
+<parameter name="width" type="short">
+</parameter>
+<parameter name="height" type="short">
+</parameter>
+</method>
+<method name="glDrawTexsvOES"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="coords" type="short[]">
+</parameter>
+<parameter name="offset" type="int">
+</parameter>
+</method>
+<method name="glDrawTexsvOES"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="coords" type="java.nio.ShortBuffer">
+</parameter>
+</method>
+<method name="glDrawTexxOES"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="x" type="int">
+</parameter>
+<parameter name="y" type="int">
+</parameter>
+<parameter name="z" type="int">
+</parameter>
+<parameter name="width" type="int">
+</parameter>
+<parameter name="height" type="int">
+</parameter>
+</method>
+<method name="glDrawTexxvOES"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="coords" type="int[]">
+</parameter>
+<parameter name="offset" type="int">
+</parameter>
+</method>
+<method name="glDrawTexxvOES"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="coords" type="java.nio.IntBuffer">
+</parameter>
+</method>
+<method name="glEGLImageTargetRenderbufferStorageOES"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="target" type="int">
+</parameter>
+<parameter name="image" type="java.nio.Buffer">
+</parameter>
+</method>
+<method name="glEGLImageTargetTexture2DOES"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="target" type="int">
+</parameter>
+<parameter name="image" type="java.nio.Buffer">
+</parameter>
+</method>
+<method name="glFogxOES"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="pname" type="int">
+</parameter>
+<parameter name="param" type="int">
+</parameter>
+</method>
+<method name="glFogxvOES"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="pname" type="int">
+</parameter>
+<parameter name="params" type="int[]">
+</parameter>
+<parameter name="offset" type="int">
+</parameter>
+</method>
+<method name="glFogxvOES"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="pname" type="int">
+</parameter>
+<parameter name="params" type="java.nio.IntBuffer">
+</parameter>
+</method>
+<method name="glFramebufferRenderbufferOES"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="target" type="int">
+</parameter>
+<parameter name="attachment" type="int">
+</parameter>
+<parameter name="renderbuffertarget" type="int">
+</parameter>
+<parameter name="renderbuffer" type="int">
+</parameter>
+</method>
+<method name="glFramebufferTexture2DOES"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="target" type="int">
+</parameter>
+<parameter name="attachment" type="int">
+</parameter>
+<parameter name="textarget" type="int">
+</parameter>
+<parameter name="texture" type="int">
+</parameter>
+<parameter name="level" type="int">
+</parameter>
+</method>
+<method name="glFrustumfOES"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="left" type="float">
+</parameter>
+<parameter name="right" type="float">
+</parameter>
+<parameter name="bottom" type="float">
+</parameter>
+<parameter name="top" type="float">
+</parameter>
+<parameter name="zNear" type="float">
+</parameter>
+<parameter name="zFar" type="float">
+</parameter>
+</method>
+<method name="glFrustumxOES"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="left" type="int">
+</parameter>
+<parameter name="right" type="int">
+</parameter>
+<parameter name="bottom" type="int">
+</parameter>
+<parameter name="top" type="int">
+</parameter>
+<parameter name="zNear" type="int">
+</parameter>
+<parameter name="zFar" type="int">
+</parameter>
+</method>
+<method name="glGenFramebuffersOES"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="n" type="int">
+</parameter>
+<parameter name="framebuffers" type="int[]">
+</parameter>
+<parameter name="offset" type="int">
+</parameter>
+</method>
+<method name="glGenFramebuffersOES"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="n" type="int">
+</parameter>
+<parameter name="framebuffers" type="java.nio.IntBuffer">
+</parameter>
+</method>
+<method name="glGenRenderbuffersOES"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="n" type="int">
+</parameter>
+<parameter name="renderbuffers" type="int[]">
+</parameter>
+<parameter name="offset" type="int">
+</parameter>
+</method>
+<method name="glGenRenderbuffersOES"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="n" type="int">
+</parameter>
+<parameter name="renderbuffers" type="java.nio.IntBuffer">
+</parameter>
+</method>
+<method name="glGenerateMipmapOES"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="target" type="int">
+</parameter>
+</method>
+<method name="glGetClipPlanefOES"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="pname" type="int">
+</parameter>
+<parameter name="eqn" type="float[]">
+</parameter>
+<parameter name="offset" type="int">
+</parameter>
+</method>
+<method name="glGetClipPlanefOES"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="pname" type="int">
+</parameter>
+<parameter name="eqn" type="java.nio.FloatBuffer">
+</parameter>
+</method>
+<method name="glGetClipPlanexOES"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="pname" type="int">
+</parameter>
+<parameter name="eqn" type="int[]">
+</parameter>
+<parameter name="offset" type="int">
+</parameter>
+</method>
+<method name="glGetClipPlanexOES"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="pname" type="int">
+</parameter>
+<parameter name="eqn" type="java.nio.IntBuffer">
+</parameter>
+</method>
+<method name="glGetFixedvOES"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="pname" type="int">
+</parameter>
+<parameter name="params" type="int[]">
+</parameter>
+<parameter name="offset" type="int">
+</parameter>
+</method>
+<method name="glGetFixedvOES"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="pname" type="int">
+</parameter>
+<parameter name="params" type="java.nio.IntBuffer">
+</parameter>
+</method>
+<method name="glGetFramebufferAttachmentParameterivOES"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="target" type="int">
+</parameter>
+<parameter name="attachment" type="int">
+</parameter>
+<parameter name="pname" type="int">
+</parameter>
+<parameter name="params" type="int[]">
+</parameter>
+<parameter name="offset" type="int">
+</parameter>
+</method>
+<method name="glGetFramebufferAttachmentParameterivOES"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="target" type="int">
+</parameter>
+<parameter name="attachment" type="int">
+</parameter>
+<parameter name="pname" type="int">
+</parameter>
+<parameter name="params" type="java.nio.IntBuffer">
+</parameter>
+</method>
+<method name="glGetLightxvOES"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="light" type="int">
+</parameter>
+<parameter name="pname" type="int">
+</parameter>
+<parameter name="params" type="int[]">
+</parameter>
+<parameter name="offset" type="int">
+</parameter>
+</method>
+<method name="glGetLightxvOES"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="light" type="int">
+</parameter>
+<parameter name="pname" type="int">
+</parameter>
+<parameter name="params" type="java.nio.IntBuffer">
+</parameter>
+</method>
+<method name="glGetMaterialxvOES"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="face" type="int">
+</parameter>
+<parameter name="pname" type="int">
+</parameter>
+<parameter name="params" type="int[]">
+</parameter>
+<parameter name="offset" type="int">
+</parameter>
+</method>
+<method name="glGetMaterialxvOES"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="face" type="int">
+</parameter>
+<parameter name="pname" type="int">
+</parameter>
+<parameter name="params" type="java.nio.IntBuffer">
+</parameter>
+</method>
+<method name="glGetRenderbufferParameterivOES"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="target" type="int">
+</parameter>
+<parameter name="pname" type="int">
+</parameter>
+<parameter name="params" type="int[]">
+</parameter>
+<parameter name="offset" type="int">
+</parameter>
+</method>
+<method name="glGetRenderbufferParameterivOES"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="target" type="int">
+</parameter>
+<parameter name="pname" type="int">
+</parameter>
+<parameter name="params" type="java.nio.IntBuffer">
+</parameter>
+</method>
+<method name="glGetTexEnvxvOES"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="env" type="int">
+</parameter>
+<parameter name="pname" type="int">
+</parameter>
+<parameter name="params" type="int[]">
+</parameter>
+<parameter name="offset" type="int">
+</parameter>
+</method>
+<method name="glGetTexEnvxvOES"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="env" type="int">
+</parameter>
+<parameter name="pname" type="int">
+</parameter>
+<parameter name="params" type="java.nio.IntBuffer">
+</parameter>
+</method>
+<method name="glGetTexGenfvOES"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="coord" type="int">
+</parameter>
+<parameter name="pname" type="int">
+</parameter>
+<parameter name="params" type="float[]">
+</parameter>
+<parameter name="offset" type="int">
+</parameter>
+</method>
+<method name="glGetTexGenfvOES"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="coord" type="int">
+</parameter>
+<parameter name="pname" type="int">
+</parameter>
+<parameter name="params" type="java.nio.FloatBuffer">
+</parameter>
+</method>
+<method name="glGetTexGenivOES"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="coord" type="int">
+</parameter>
+<parameter name="pname" type="int">
+</parameter>
+<parameter name="params" type="int[]">
+</parameter>
+<parameter name="offset" type="int">
+</parameter>
+</method>
+<method name="glGetTexGenivOES"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="coord" type="int">
+</parameter>
+<parameter name="pname" type="int">
+</parameter>
+<parameter name="params" type="java.nio.IntBuffer">
+</parameter>
+</method>
+<method name="glGetTexGenxvOES"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="coord" type="int">
+</parameter>
+<parameter name="pname" type="int">
+</parameter>
+<parameter name="params" type="int[]">
+</parameter>
+<parameter name="offset" type="int">
+</parameter>
+</method>
+<method name="glGetTexGenxvOES"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="coord" type="int">
+</parameter>
+<parameter name="pname" type="int">
+</parameter>
+<parameter name="params" type="java.nio.IntBuffer">
+</parameter>
+</method>
+<method name="glGetTexParameterxvOES"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="target" type="int">
+</parameter>
+<parameter name="pname" type="int">
+</parameter>
+<parameter name="params" type="int[]">
+</parameter>
+<parameter name="offset" type="int">
+</parameter>
+</method>
+<method name="glGetTexParameterxvOES"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="target" type="int">
+</parameter>
+<parameter name="pname" type="int">
+</parameter>
+<parameter name="params" type="java.nio.IntBuffer">
+</parameter>
+</method>
+<method name="glIsFramebufferOES"
+ return="boolean"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="framebuffer" type="int">
+</parameter>
+</method>
+<method name="glIsRenderbufferOES"
+ return="boolean"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="renderbuffer" type="int">
+</parameter>
+</method>
+<method name="glLightModelxOES"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="pname" type="int">
+</parameter>
+<parameter name="param" type="int">
+</parameter>
+</method>
+<method name="glLightModelxvOES"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="pname" type="int">
+</parameter>
+<parameter name="params" type="int[]">
+</parameter>
+<parameter name="offset" type="int">
+</parameter>
+</method>
+<method name="glLightModelxvOES"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="pname" type="int">
+</parameter>
+<parameter name="params" type="java.nio.IntBuffer">
+</parameter>
+</method>
+<method name="glLightxOES"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="light" type="int">
+</parameter>
+<parameter name="pname" type="int">
+</parameter>
+<parameter name="param" type="int">
+</parameter>
+</method>
+<method name="glLightxvOES"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="light" type="int">
+</parameter>
+<parameter name="pname" type="int">
+</parameter>
+<parameter name="params" type="int[]">
+</parameter>
+<parameter name="offset" type="int">
+</parameter>
+</method>
+<method name="glLightxvOES"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="light" type="int">
+</parameter>
+<parameter name="pname" type="int">
+</parameter>
+<parameter name="params" type="java.nio.IntBuffer">
+</parameter>
+</method>
+<method name="glLineWidthxOES"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="width" type="int">
+</parameter>
+</method>
+<method name="glLoadMatrixxOES"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="m" type="int[]">
+</parameter>
+<parameter name="offset" type="int">
+</parameter>
+</method>
+<method name="glLoadMatrixxOES"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="m" type="java.nio.IntBuffer">
+</parameter>
+</method>
+<method name="glLoadPaletteFromModelViewMatrixOES"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
+<method name="glMaterialxOES"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="face" type="int">
+</parameter>
+<parameter name="pname" type="int">
+</parameter>
+<parameter name="param" type="int">
+</parameter>
+</method>
+<method name="glMaterialxvOES"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="face" type="int">
+</parameter>
+<parameter name="pname" type="int">
+</parameter>
+<parameter name="params" type="int[]">
+</parameter>
+<parameter name="offset" type="int">
+</parameter>
+</method>
+<method name="glMaterialxvOES"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="face" type="int">
+</parameter>
+<parameter name="pname" type="int">
+</parameter>
+<parameter name="params" type="java.nio.IntBuffer">
+</parameter>
+</method>
+<method name="glMatrixIndexPointerOES"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="size" type="int">
+</parameter>
+<parameter name="type" type="int">
+</parameter>
+<parameter name="stride" type="int">
+</parameter>
+<parameter name="pointer" type="java.nio.Buffer">
+</parameter>
+</method>
+<method name="glMultMatrixxOES"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="m" type="int[]">
+</parameter>
+<parameter name="offset" type="int">
+</parameter>
+</method>
+<method name="glMultMatrixxOES"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="m" type="java.nio.IntBuffer">
+</parameter>
+</method>
+<method name="glMultiTexCoord4xOES"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="target" type="int">
+</parameter>
+<parameter name="s" type="int">
+</parameter>
+<parameter name="t" type="int">
+</parameter>
+<parameter name="r" type="int">
+</parameter>
+<parameter name="q" type="int">
+</parameter>
+</method>
+<method name="glNormal3xOES"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="nx" type="int">
+</parameter>
+<parameter name="ny" type="int">
+</parameter>
+<parameter name="nz" type="int">
+</parameter>
+</method>
+<method name="glOrthofOES"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="left" type="float">
+</parameter>
+<parameter name="right" type="float">
+</parameter>
+<parameter name="bottom" type="float">
+</parameter>
+<parameter name="top" type="float">
+</parameter>
+<parameter name="zNear" type="float">
+</parameter>
+<parameter name="zFar" type="float">
+</parameter>
+</method>
+<method name="glOrthoxOES"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="left" type="int">
+</parameter>
+<parameter name="right" type="int">
+</parameter>
+<parameter name="bottom" type="int">
+</parameter>
+<parameter name="top" type="int">
+</parameter>
+<parameter name="zNear" type="int">
+</parameter>
+<parameter name="zFar" type="int">
+</parameter>
+</method>
+<method name="glPointParameterxOES"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="pname" type="int">
+</parameter>
+<parameter name="param" type="int">
+</parameter>
+</method>
+<method name="glPointParameterxvOES"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="pname" type="int">
+</parameter>
+<parameter name="params" type="int[]">
+</parameter>
+<parameter name="offset" type="int">
+</parameter>
+</method>
+<method name="glPointParameterxvOES"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="pname" type="int">
+</parameter>
+<parameter name="params" type="java.nio.IntBuffer">
+</parameter>
+</method>
+<method name="glPointSizexOES"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="size" type="int">
+</parameter>
+</method>
+<method name="glPolygonOffsetxOES"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="factor" type="int">
+</parameter>
+<parameter name="units" type="int">
+</parameter>
+</method>
+<method name="glRenderbufferStorageOES"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="target" type="int">
+</parameter>
+<parameter name="internalformat" type="int">
+</parameter>
+<parameter name="width" type="int">
+</parameter>
+<parameter name="height" type="int">
+</parameter>
+</method>
+<method name="glRotatexOES"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="angle" type="int">
+</parameter>
+<parameter name="x" type="int">
+</parameter>
+<parameter name="y" type="int">
+</parameter>
+<parameter name="z" type="int">
+</parameter>
+</method>
+<method name="glSampleCoveragexOES"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="value" type="int">
+</parameter>
+<parameter name="invert" type="boolean">
+</parameter>
+</method>
+<method name="glScalexOES"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="x" type="int">
+</parameter>
+<parameter name="y" type="int">
+</parameter>
+<parameter name="z" type="int">
+</parameter>
+</method>
+<method name="glTexEnvxOES"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="target" type="int">
+</parameter>
+<parameter name="pname" type="int">
+</parameter>
+<parameter name="param" type="int">
+</parameter>
+</method>
+<method name="glTexEnvxvOES"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="target" type="int">
+</parameter>
+<parameter name="pname" type="int">
+</parameter>
+<parameter name="params" type="int[]">
+</parameter>
+<parameter name="offset" type="int">
+</parameter>
+</method>
+<method name="glTexEnvxvOES"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="target" type="int">
+</parameter>
+<parameter name="pname" type="int">
+</parameter>
+<parameter name="params" type="java.nio.IntBuffer">
+</parameter>
+</method>
+<method name="glTexGenfOES"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="coord" type="int">
+</parameter>
+<parameter name="pname" type="int">
+</parameter>
+<parameter name="param" type="float">
+</parameter>
+</method>
+<method name="glTexGenfvOES"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="coord" type="int">
+</parameter>
+<parameter name="pname" type="int">
+</parameter>
+<parameter name="params" type="float[]">
+</parameter>
+<parameter name="offset" type="int">
+</parameter>
+</method>
+<method name="glTexGenfvOES"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="coord" type="int">
+</parameter>
+<parameter name="pname" type="int">
+</parameter>
+<parameter name="params" type="java.nio.FloatBuffer">
+</parameter>
+</method>
+<method name="glTexGeniOES"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="coord" type="int">
+</parameter>
+<parameter name="pname" type="int">
+</parameter>
+<parameter name="param" type="int">
+</parameter>
+</method>
+<method name="glTexGenivOES"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="coord" type="int">
+</parameter>
+<parameter name="pname" type="int">
+</parameter>
+<parameter name="params" type="int[]">
+</parameter>
+<parameter name="offset" type="int">
+</parameter>
+</method>
+<method name="glTexGenivOES"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="coord" type="int">
+</parameter>
+<parameter name="pname" type="int">
+</parameter>
+<parameter name="params" type="java.nio.IntBuffer">
+</parameter>
+</method>
+<method name="glTexGenxOES"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="coord" type="int">
+</parameter>
+<parameter name="pname" type="int">
+</parameter>
+<parameter name="param" type="int">
+</parameter>
+</method>
+<method name="glTexGenxvOES"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="coord" type="int">
+</parameter>
+<parameter name="pname" type="int">
+</parameter>
+<parameter name="params" type="int[]">
+</parameter>
+<parameter name="offset" type="int">
+</parameter>
+</method>
+<method name="glTexGenxvOES"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="coord" type="int">
+</parameter>
+<parameter name="pname" type="int">
+</parameter>
+<parameter name="params" type="java.nio.IntBuffer">
+</parameter>
+</method>
+<method name="glTexParameterxOES"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="target" type="int">
+</parameter>
+<parameter name="pname" type="int">
+</parameter>
+<parameter name="param" type="int">
+</parameter>
+</method>
+<method name="glTexParameterxvOES"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="target" type="int">
+</parameter>
+<parameter name="pname" type="int">
+</parameter>
+<parameter name="params" type="int[]">
+</parameter>
+<parameter name="offset" type="int">
+</parameter>
+</method>
+<method name="glTexParameterxvOES"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="target" type="int">
+</parameter>
+<parameter name="pname" type="int">
+</parameter>
+<parameter name="params" type="java.nio.IntBuffer">
+</parameter>
+</method>
+<method name="glTranslatexOES"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="x" type="int">
+</parameter>
+<parameter name="y" type="int">
+</parameter>
+<parameter name="z" type="int">
+</parameter>
+</method>
+<method name="glWeightPointerOES"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="size" type="int">
+</parameter>
+<parameter name="type" type="int">
+</parameter>
+<parameter name="stride" type="int">
+</parameter>
+<parameter name="pointer" type="java.nio.Buffer">
+</parameter>
+</method>
+<field name="GL_3DC_XY_AMD"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="34810"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_3DC_X_AMD"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="34809"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_ATC_RGBA_EXPLICIT_ALPHA_AMD"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="35987"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_ATC_RGBA_INTERPOLATED_ALPHA_AMD"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="34798"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_ATC_RGB_AMD"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="35986"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_BGRA"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="32993"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_BLEND_DST_ALPHA_OES"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="32970"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_BLEND_DST_RGB_OES"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="32968"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_BLEND_EQUATION_ALPHA_OES"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="34877"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_BLEND_EQUATION_OES"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="32777"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_BLEND_EQUATION_RGB_OES"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="32777"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_BLEND_SRC_ALPHA_OES"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="32971"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_BLEND_SRC_RGB_OES"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="32969"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_BUFFER_ACCESS_OES"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="35003"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_BUFFER_MAPPED_OES"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="35004"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_BUFFER_MAP_POINTER_OES"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="35005"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_COLOR_ATTACHMENT0_OES"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="36064"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_CURRENT_PALETTE_MATRIX_OES"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="34883"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_DECR_WRAP_OES"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="34056"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_DEPTH24_STENCIL8_OES"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="35056"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_DEPTH_ATTACHMENT_OES"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="36096"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_DEPTH_COMPONENT16_OES"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="33189"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_DEPTH_COMPONENT24_OES"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="33190"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_DEPTH_COMPONENT32_OES"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="33191"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_DEPTH_STENCIL_OES"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="34041"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_ETC1_RGB8_OES"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="36196"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_FIXED_OES"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="5132"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME_OES"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="36049"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE_OES"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="36048"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE_OES"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="36051"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL_OES"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="36050"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_FRAMEBUFFER_BINDING_OES"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="36006"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_FRAMEBUFFER_COMPLETE_OES"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="36053"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_OES"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="36054"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_OES"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="36057"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_FRAMEBUFFER_INCOMPLETE_FORMATS_OES"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="36058"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_OES"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="36055"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_FRAMEBUFFER_OES"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="36160"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_FRAMEBUFFER_UNSUPPORTED_OES"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="36061"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_FUNC_ADD_OES"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="32774"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_FUNC_REVERSE_SUBTRACT_OES"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="32779"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_FUNC_SUBTRACT_OES"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="32778"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_INCR_WRAP_OES"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="34055"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_INVALID_FRAMEBUFFER_OPERATION_OES"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="1286"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_MATRIX_INDEX_ARRAY_BUFFER_BINDING_OES"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="35742"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_MATRIX_INDEX_ARRAY_OES"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="34884"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_MATRIX_INDEX_ARRAY_POINTER_OES"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="34889"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_MATRIX_INDEX_ARRAY_SIZE_OES"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="34886"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_MATRIX_INDEX_ARRAY_STRIDE_OES"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="34888"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_MATRIX_INDEX_ARRAY_TYPE_OES"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="34887"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_MATRIX_PALETTE_OES"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="34880"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_MAX_CUBE_MAP_TEXTURE_SIZE_OES"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="34076"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_MAX_PALETTE_MATRICES_OES"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="34882"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_MAX_RENDERBUFFER_SIZE_OES"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="34024"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="34047"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_MAX_VERTEX_UNITS_OES"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="34468"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_MIRRORED_REPEAT_OES"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="33648"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_MODELVIEW_MATRIX_FLOAT_AS_INT_BITS_OES"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="35213"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_NONE_OES"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="0"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_NORMAL_MAP_OES"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="34065"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_PROJECTION_MATRIX_FLOAT_AS_INT_BITS_OES"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="35214"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_REFLECTION_MAP_OES"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="34066"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_RENDERBUFFER_ALPHA_SIZE_OES"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="36179"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_RENDERBUFFER_BINDING_OES"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="36007"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_RENDERBUFFER_BLUE_SIZE_OES"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="36178"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_RENDERBUFFER_DEPTH_SIZE_OES"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="36180"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_RENDERBUFFER_GREEN_SIZE_OES"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="36177"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_RENDERBUFFER_HEIGHT_OES"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="36163"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_RENDERBUFFER_INTERNAL_FORMAT_OES"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="36164"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_RENDERBUFFER_OES"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="36161"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_RENDERBUFFER_RED_SIZE_OES"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="36176"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_RENDERBUFFER_STENCIL_SIZE_OES"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="36181"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_RENDERBUFFER_WIDTH_OES"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="36162"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_RGB565_OES"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="36194"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_RGB5_A1_OES"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="32855"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_RGB8_OES"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="32849"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_RGBA4_OES"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="32854"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_RGBA8_OES"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="32856"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_STENCIL_ATTACHMENT_OES"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="36128"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_STENCIL_INDEX1_OES"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="36166"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_STENCIL_INDEX4_OES"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="36167"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_STENCIL_INDEX8_OES"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="36168"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_TEXTURE_BINDING_CUBE_MAP_OES"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="34068"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_TEXTURE_CROP_RECT_OES"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="35741"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_TEXTURE_CUBE_MAP_NEGATIVE_X_OES"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="34070"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_OES"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="34072"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_OES"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="34074"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_TEXTURE_CUBE_MAP_OES"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="34067"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_TEXTURE_CUBE_MAP_POSITIVE_X_OES"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="34069"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_TEXTURE_CUBE_MAP_POSITIVE_Y_OES"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="34071"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_TEXTURE_CUBE_MAP_POSITIVE_Z_OES"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="34073"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_TEXTURE_GEN_MODE_OES"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="9472"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_TEXTURE_GEN_STR_OES"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="36192"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_TEXTURE_MATRIX_FLOAT_AS_INT_BITS_OES"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="35215"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_TEXTURE_MAX_ANISOTROPY_EXT"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="34046"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_UNSIGNED_INT_24_8_OES"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="34042"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_WEIGHT_ARRAY_BUFFER_BINDING_OES"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="34974"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_WEIGHT_ARRAY_OES"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="34477"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_WEIGHT_ARRAY_POINTER_OES"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="34476"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_WEIGHT_ARRAY_SIZE_OES"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="34475"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_WEIGHT_ARRAY_STRIDE_OES"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="34474"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_WEIGHT_ARRAY_TYPE_OES"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="34473"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GL_WRITE_ONLY_OES"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="35001"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+</class>
 <class name="GLException"
  extends="java.lang.RuntimeException"
  abstract="false"
diff --git a/camera/libcameraservice/CameraService.cpp b/camera/libcameraservice/CameraService.cpp
index cb8ab588..96ee502 100644
--- a/camera/libcameraservice/CameraService.cpp
+++ b/camera/libcameraservice/CameraService.cpp
@@ -217,7 +217,13 @@
     // allow anyone to use camera
     LOGV("unlock (%p)", getCameraClient()->asBinder().get());
     status_t result = checkPid();
-    if (result == NO_ERROR) mClientPid = 0;
+    if (result == NO_ERROR) {
+        mClientPid = 0;
+
+        // we need to remove the reference so that when app goes
+        // away, the reference count goes to 0.
+        mCameraClient.clear();
+    }
     return result;
 }
 
@@ -894,8 +900,6 @@
 // get preview/capture parameters - key/value pairs
 String8 CameraService::Client::getParameters() const
 {
-    LOGD("getParameters");
-
     Mutex::Autolock lock(mLock);
 
     if (mHardware == 0) {
@@ -903,7 +907,9 @@
         return String8();
     }
 
-    return mHardware->getParameters().flatten();
+    String8 params(mHardware->getParameters().flatten());
+    LOGD("getParameters(%s)", params.string());
+    return params;
 }
 
 void CameraService::Client::postAutoFocus(bool focused)
diff --git a/core/java/android/app/Activity.java b/core/java/android/app/Activity.java
index 849a37d..9b1f0f9 100644
--- a/core/java/android/app/Activity.java
+++ b/core/java/android/app/Activity.java
@@ -611,7 +611,7 @@
     private IBinder mToken;
     /*package*/ String mEmbeddedID;
     private Application mApplication;
-    private Intent mIntent;
+    /*package*/ Intent mIntent;
     private ComponentName mComponent;
     /*package*/ ActivityInfo mActivityInfo;
     /*package*/ ActivityThread mMainThread;
diff --git a/core/java/android/app/ActivityThread.java b/core/java/android/app/ActivityThread.java
index b7cd080..dfa3fa8 100644
--- a/core/java/android/app/ActivityThread.java
+++ b/core/java/android/app/ActivityThread.java
@@ -1755,7 +1755,7 @@
 
                     r.packageInfo = getPackageInfoNoCheck(
                             r.activityInfo.applicationInfo);
-                    handleLaunchActivity(r);
+                    handleLaunchActivity(r, null);
                 } break;
                 case RELAUNCH_ACTIVITY: {
                     ActivityRecord r = (ActivityRecord)msg.obj;
@@ -2175,7 +2175,7 @@
                     + ", comp=" + name
                     + ", token=" + token);
         }
-        return performLaunchActivity(r);
+        return performLaunchActivity(r, null);
     }
 
     public final Activity getActivity(IBinder token) {
@@ -2225,7 +2225,7 @@
         queueOrSendMessage(H.CLEAN_UP_CONTEXT, cci);
     }
 
-    private final Activity performLaunchActivity(ActivityRecord r) {
+    private final Activity performLaunchActivity(ActivityRecord r, Intent customIntent) {
         // System.out.println("##### [" + System.currentTimeMillis() + "] ActivityThread.performLaunchActivity(" + r + ")");
 
         ActivityInfo aInfo = r.activityInfo;
@@ -2285,6 +2285,9 @@
                         r.lastNonConfigurationInstance, r.lastNonConfigurationChildInstances,
                         config);
                 
+                if (customIntent != null) {
+                    activity.mIntent = customIntent;
+                }
                 r.lastNonConfigurationInstance = null;
                 r.lastNonConfigurationChildInstances = null;
                 activity.mStartedActivity = false;
@@ -2340,14 +2343,14 @@
         return activity;
     }
 
-    private final void handleLaunchActivity(ActivityRecord r) {
+    private final void handleLaunchActivity(ActivityRecord r, Intent customIntent) {
         // If we are getting ready to gc after going to the background, well
         // we are back active so skip it.
         unscheduleGcIdler();
 
         if (localLOGV) Log.v(
             TAG, "Handling launch of " + r);
-        Activity a = performLaunchActivity(r);
+        Activity a = performLaunchActivity(r, customIntent);
 
         if (a != null) {
             handleResumeActivity(r.token, false, r.isForward);
@@ -3309,6 +3312,7 @@
         }
         
         r.activity.mConfigChangeFlags |= configChanges;
+        Intent currentIntent = r.activity.mIntent;
         
         Bundle savedState = null;
         if (!r.paused) {
@@ -3341,7 +3345,7 @@
             r.state = savedState;
         }
         
-        handleLaunchActivity(r);
+        handleLaunchActivity(r, currentIntent);
     }
 
     private final void handleRequestThumbnail(IBinder token) {
@@ -3558,6 +3562,9 @@
             int sqliteReleased = SQLiteDatabase.releaseMemory();
             EventLog.writeEvent(SQLITE_MEM_RELEASED_EVENT_LOG_TAG, sqliteReleased);
         }
+        
+        // Ask graphics to free up as much as possible (font/image caches)
+        Canvas.freeCaches();
 
         BinderInternal.forceGc("mem");
     }
diff --git a/core/java/android/app/PendingIntent.java b/core/java/android/app/PendingIntent.java
index 1bed706..cb660c7 100644
--- a/core/java/android/app/PendingIntent.java
+++ b/core/java/android/app/PendingIntent.java
@@ -440,9 +440,13 @@
 
     @Override
     public String toString() {
-        return "PendingIntent{"
-                + Integer.toHexString(System.identityHashCode(this))
-                + " target " + (mTarget != null ? mTarget.asBinder() : null) + "}";
+        StringBuilder sb = new StringBuilder(128);
+        sb.append("PendingIntent{");
+        sb.append(Integer.toHexString(System.identityHashCode(this)));
+        sb.append(": ");
+        sb.append(mTarget != null ? mTarget.asBinder() : null);
+        sb.append('}');
+        return sb.toString();
     }
     
     public int describeContents() {
diff --git a/core/java/android/app/SearchDialog.java b/core/java/android/app/SearchDialog.java
index 3d89ad7..2d2e710 100644
--- a/core/java/android/app/SearchDialog.java
+++ b/core/java/android/app/SearchDialog.java
@@ -17,7 +17,6 @@
 package android.app;
 
 import static android.app.SuggestionsAdapter.getColumnString;
-
 import android.content.ActivityNotFoundException;
 import android.content.BroadcastReceiver;
 import android.content.ComponentName;
@@ -26,8 +25,8 @@
 import android.content.IntentFilter;
 import android.content.pm.ActivityInfo;
 import android.content.pm.PackageManager;
-import android.content.pm.ResolveInfo;
 import android.content.pm.PackageManager.NameNotFoundException;
+import android.content.pm.ResolveInfo;
 import android.content.res.Configuration;
 import android.content.res.Resources;
 import android.database.Cursor;
@@ -54,13 +53,14 @@
 import android.view.WindowManager;
 import android.view.inputmethod.InputMethodManager;
 import android.widget.AdapterView;
+import android.widget.AdapterView.OnItemClickListener;
+import android.widget.AdapterView.OnItemSelectedListener;
 import android.widget.AutoCompleteTextView;
 import android.widget.Button;
 import android.widget.ImageButton;
+import android.widget.ImageView;
 import android.widget.ListView;
 import android.widget.TextView;
-import android.widget.AdapterView.OnItemClickListener;
-import android.widget.AdapterView.OnItemSelectedListener;
 
 import java.util.ArrayList;
 import java.util.WeakHashMap;
@@ -89,12 +89,16 @@
     private static final int INSTANCE_SELECTED_BUTTON = -2;
     private static final int INSTANCE_SELECTED_QUERY = -1;
     
+    private static final int SEARCH_PLATE_LEFT_PADDING_GLOBAL = 12;
+    private static final int SEARCH_PLATE_LEFT_PADDING_NON_GLOBAL = 7;
+    
     // interaction with runtime
     private IntentFilter mCloseDialogsFilter;
     private IntentFilter mPackageFilter;
     
     // views & widgets
     private TextView mBadgeLabel;
+    private ImageView mAppIcon;
     private SearchAutoComplete mSearchAutoComplete;
     private Button mGoButton;
     private ImageButton mVoiceButton;
@@ -158,7 +162,10 @@
         setContentView(com.android.internal.R.layout.search_bar);
 
         theWindow.setLayout(ViewGroup.LayoutParams.FILL_PARENT,
-                ViewGroup.LayoutParams.WRAP_CONTENT);
+                // taking up the whole window (even when transparent) is less than ideal,
+                // but necessary to show the popup window until the window manager supports
+                // having windows anchored by their parent but not clipped by them.
+                ViewGroup.LayoutParams.FILL_PARENT);
         WindowManager.LayoutParams lp = theWindow.getAttributes();
         lp.softInputMode = WindowManager.LayoutParams.SOFT_INPUT_STATE_VISIBLE;
         theWindow.setAttributes(lp);
@@ -167,6 +174,7 @@
         mBadgeLabel = (TextView) findViewById(com.android.internal.R.id.search_badge);
         mSearchAutoComplete = (SearchAutoComplete)
                 findViewById(com.android.internal.R.id.search_src_text);
+        mAppIcon = (ImageView) findViewById(com.android.internal.R.id.search_app_icon);
         mGoButton = (Button) findViewById(com.android.internal.R.id.search_go_btn);
         mVoiceButton = (ImageButton) findViewById(com.android.internal.R.id.search_voice_btn);
         mSearchPlate = findViewById(com.android.internal.R.id.search_plate);
@@ -417,6 +425,7 @@
         if (isShowing()) {
             // Redraw (resources may have changed)
             updateSearchButton();
+            updateSearchAppIcon();
             updateSearchBadge();
             updateQueryHint();
         } 
@@ -429,6 +438,7 @@
         if (mSearchable != null) {
             updateSearchAutoComplete();
             updateSearchButton();
+            updateSearchAppIcon();
             updateSearchBadge();
             updateQueryHint();
             updateVoiceButton();
@@ -499,6 +509,34 @@
         mGoButton.setCompoundDrawablesWithIntrinsicBounds(iconLabel, null, null, null);
     }
     
+    private void updateSearchAppIcon() {
+        if (mGlobalSearchMode) {
+            mAppIcon.setImageResource(0);
+            mAppIcon.setVisibility(View.GONE);
+            mSearchPlate.setPadding(SEARCH_PLATE_LEFT_PADDING_GLOBAL,
+                    mSearchPlate.getPaddingTop(),
+                    mSearchPlate.getPaddingRight(),
+                    mSearchPlate.getPaddingBottom());
+        } else {
+            PackageManager pm = getContext().getPackageManager();
+            Drawable icon = null;
+            try {
+                ActivityInfo info = pm.getActivityInfo(mLaunchComponent, 0);
+                icon = pm.getApplicationIcon(info.applicationInfo);
+                if (DBG) Log.d(LOG_TAG, "Using app-specific icon");
+            } catch (NameNotFoundException e) {
+                icon = pm.getDefaultActivityIcon();
+                Log.w(LOG_TAG, mLaunchComponent + " not found, using generic app icon");
+            }
+            mAppIcon.setImageDrawable(icon);
+            mAppIcon.setVisibility(View.VISIBLE);
+            mSearchPlate.setPadding(SEARCH_PLATE_LEFT_PADDING_NON_GLOBAL,
+                    mSearchPlate.getPaddingTop(),
+                    mSearchPlate.getPaddingRight(),
+                    mSearchPlate.getPaddingBottom());
+        }
+    }
+
     /**
      * Setup the search "Badge" if requested by mode flags.
      */
@@ -517,18 +555,6 @@
             text = mActivityContext.getResources().getText(mSearchable.getLabelId()).toString();
             visibility = View.VISIBLE;
             if (DBG) Log.d(LOG_TAG, "Using badge label: " + mSearchable.getLabelId());
-        } else if (!mGlobalSearchMode) {
-            // Get the localized name of the application which we are doing search in.
-            try {
-                PackageManager pm = getContext().getPackageManager();
-                ActivityInfo info = pm.getActivityInfo(mLaunchComponent, 0);
-                text = pm.getApplicationLabel(info.applicationInfo);
-                visibility = View.VISIBLE;
-                if (DBG) Log.d(LOG_TAG, "Using application label: " + text);
-            } catch (NameNotFoundException e) {
-                // app not found, fine, don't use its name for the label
-                Log.w(LOG_TAG, mLaunchComponent + " not found.");
-            }
         }
         
         mBadgeLabel.setCompoundDrawablesWithIntrinsicBounds(icon, null, null, null);
@@ -1343,27 +1369,28 @@
         public boolean enoughToFilter() {
             return mThreshold <= 0 || super.enoughToFilter();
         }
-        
+
         /**
          * {@link AutoCompleteTextView#onKeyPreIme(int, KeyEvent)}) dismisses the drop-down on BACK,
          * so we must override this method to modify the BACK behavior.
          */
         @Override
         public boolean onKeyPreIme(int keyCode, KeyEvent event) {
-            return mSearchDialog.handleBackKey(keyCode, event);
+            if (keyCode == KeyEvent.KEYCODE_BACK && event.getAction() == KeyEvent.ACTION_DOWN) {
+                if (mSearchDialog.backToPreviousComponent()) {
+                    return true;
+                }
+                return false; // will dismiss soft keyboard if necessary
+            }
+            return false;
         }
     }
     
     protected boolean handleBackKey(int keyCode, KeyEvent event) {
         if (keyCode == KeyEvent.KEYCODE_BACK && event.getAction() == KeyEvent.ACTION_DOWN) {
-            mSearchAutoComplete.dismissDropDown();
             if (backToPreviousComponent()) {
                 return true;
             }
-            if (!mSearchAutoComplete.isEmpty()) {
-                mSearchAutoComplete.clear();
-                return true;
-            }
             cancel();
             return true;
         }
diff --git a/core/java/android/content/Intent.java b/core/java/android/content/Intent.java
index 99cf34c..b3e81d7 100644
--- a/core/java/android/content/Intent.java
+++ b/core/java/android/content/Intent.java
@@ -508,6 +508,8 @@
  *     <li> {@link #ACTION_PACKAGE_DATA_CLEARED}
  *     <li> {@link #ACTION_UID_REMOVED}
  *     <li> {@link #ACTION_BATTERY_CHANGED}
+ *     <li> {@link #ACTION_POWER_CONNECTED}
+ *     <li> {@link #ACTION_POWER_DISCONNECTED} 
  * </ul>
  *
  * <h3>Standard Categories</h3>
@@ -1250,6 +1252,24 @@
     @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
     public static final String ACTION_BATTERY_LOW = "android.intent.action.BATTERY_LOW";
     /**
+     * Broadcast Action:  External power has been connected to the device.
+     * This is intended for applications that wish to register specifically to this notification.
+     * Unlike ACTION_BATTERY_CHANGED, applications will be woken for this and so do not have to
+     * stay active to receive this notification.  This action can be used to implement actions
+     * that wait until power is available to trigger.
+     */
+    @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
+    public static final String ACTION_POWER_CONNECTED = "android.intent.action.ACTION_POWER_CONNECTED";
+    /**
+     * Broadcast Action:  External power has been removed from the device.
+     * This is intended for applications that wish to register specifically to this notification.
+     * Unlike ACTION_BATTERY_CHANGED, applications will be woken for this and so do not have to
+     * stay active to receive this notification.  This action can be used to implement actions
+     * that wait until power is available to trigger. 
+     */
+    @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
+    public static final String ACTION_POWER_DISCONNECTED = "android.intent.action.ACTION_POWER_DISCONNECTED";    
+    /**
      * Broadcast Action:  Indicates low memory condition on the device
      */
     @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
@@ -4370,12 +4390,35 @@
 
     @Override
     public String toString() {
-        StringBuilder   b = new StringBuilder();
+        StringBuilder   b = new StringBuilder(128);
 
-        b.append("Intent {");
-        if (mAction != null) b.append(" action=").append(mAction);
+        b.append("Intent { ");
+        toShortString(b, true, true);
+        b.append(" }");
+
+        return b.toString();
+    }
+
+    /** @hide */
+    public String toShortString(boolean comp, boolean extras) {
+        StringBuilder   b = new StringBuilder(128);
+        toShortString(b, comp, extras);
+        return b.toString();
+    }
+    
+    /** @hide */
+    public void toShortString(StringBuilder b, boolean comp, boolean extras) {
+        boolean first = true;
+        if (mAction != null) {
+            b.append("act=").append(mAction);
+            first = false;
+        }
         if (mCategories != null) {
-            b.append(" categories={");
+            if (!first) {
+                b.append(' ');
+            }
+            first = false;
+            b.append("cat=[");
             Iterator<String> i = mCategories.iterator();
             boolean didone = false;
             while (i.hasNext()) {
@@ -4383,20 +4426,48 @@
                 didone = true;
                 b.append(i.next());
             }
-            b.append("}");
+            b.append("]");
         }
-        if (mData != null) b.append(" data=").append(mData);
-        if (mType != null) b.append(" type=").append(mType);
-        if (mFlags != 0) b.append(" flags=0x").append(Integer.toHexString(mFlags));
-        if (mComponent != null) b.append(" comp=").append(mComponent.toShortString());
-        if (mExtras != null) b.append(" (has extras)");
-        b.append(" }");
-
-        return b.toString();
+        if (mData != null) {
+            if (!first) {
+                b.append(' ');
+            }
+            first = false;
+            b.append("dat=").append(mData);
+        }
+        if (mType != null) {
+            if (!first) {
+                b.append(' ');
+            }
+            first = false;
+            b.append("typ=").append(mType);
+        }
+        if (mFlags != 0) {
+            if (!first) {
+                b.append(' ');
+            }
+            first = false;
+            b.append("flg=0x").append(Integer.toHexString(mFlags));
+        }
+        if (comp && mComponent != null) {
+            if (!first) {
+                b.append(' ');
+            }
+            first = false;
+            b.append("cmp=").append(mComponent.flattenToShortString());
+        }
+        if (extras && mExtras != null) {
+            if (!first) {
+                b.append(' ');
+            }
+            first = false;
+            b.append("(has extras)");
+        }
     }
 
     public String toURI() {
-        StringBuilder uri = new StringBuilder(mData != null ? mData.toString() : "");
+        StringBuilder uri = new StringBuilder(128);
+        if (mData != null) uri.append(mData.toString());
 
         uri.append("#Intent;");
 
diff --git a/core/java/android/content/IntentFilter.java b/core/java/android/content/IntentFilter.java
index 9b190df..e5c5dc8 100644
--- a/core/java/android/content/IntentFilter.java
+++ b/core/java/android/content/IntentFilter.java
@@ -1254,47 +1254,71 @@
     }
 
     public void dump(Printer du, String prefix) {
+        StringBuilder sb = new StringBuilder(256);
         if (mActions.size() > 0) {
             Iterator<String> it = mActions.iterator();
             while (it.hasNext()) {
-               du.println(prefix + "Action: \"" + it.next() + "\"");
+                sb.setLength(0);
+                sb.append(prefix); sb.append("Action: \"");
+                        sb.append(it.next()); sb.append("\"");
+                du.println(sb.toString());
             }
         }
         if (mCategories != null) {
             Iterator<String> it = mCategories.iterator();
             while (it.hasNext()) {
-                du.println(prefix + "Category: \"" + it.next() + "\"");
+                sb.setLength(0);
+                sb.append(prefix); sb.append("Category: \"");
+                        sb.append(it.next()); sb.append("\"");
+                du.println(sb.toString());
             }
         }
         if (mDataSchemes != null) {
             Iterator<String> it = mDataSchemes.iterator();
             while (it.hasNext()) {
-                du.println(prefix + "Data Scheme: \"" + it.next() + "\"");
+                sb.setLength(0);
+                sb.append(prefix); sb.append("Scheme: \"");
+                        sb.append(it.next()); sb.append("\"");
+                du.println(sb.toString());
             }
         }
         if (mDataAuthorities != null) {
             Iterator<AuthorityEntry> it = mDataAuthorities.iterator();
             while (it.hasNext()) {
                 AuthorityEntry ae = it.next();
-                du.println(prefix + "Data Authority: \"" + ae.mHost + "\":"
-                        + ae.mPort + (ae.mWild ? " WILD" : ""));
+                sb.setLength(0);
+                sb.append(prefix); sb.append("Authority: \"");
+                        sb.append(ae.mHost); sb.append("\": ");
+                        sb.append(ae.mPort);
+                if (ae.mWild) sb.append(" WILD");
+                du.println(sb.toString());
             }
         }
         if (mDataPaths != null) {
             Iterator<PatternMatcher> it = mDataPaths.iterator();
             while (it.hasNext()) {
                 PatternMatcher pe = it.next();
-                du.println(prefix + "Data Path: \"" + pe + "\"");
+                sb.setLength(0);
+                sb.append(prefix); sb.append("Path: \"");
+                        sb.append(pe); sb.append("\"");
+                du.println(sb.toString());
             }
         }
         if (mDataTypes != null) {
             Iterator<String> it = mDataTypes.iterator();
             while (it.hasNext()) {
-                du.println(prefix + "Data Type: \"" + it.next() + "\"");
+                sb.setLength(0);
+                sb.append(prefix); sb.append("Type: \"");
+                        sb.append(it.next()); sb.append("\"");
+                du.println(sb.toString());
             }
         }
-        du.println(prefix + "mPriority=" + mPriority
-                + ", mHasPartialTypes=" + mHasPartialTypes);
+        if (mPriority != 0 || mHasPartialTypes) {
+            sb.setLength(0);
+            sb.append(prefix); sb.append("mPriority="); sb.append(mPriority);
+                    sb.append(", mHasPartialTypes="); sb.append(mHasPartialTypes);
+            du.println(sb.toString());
+        }
     }
 
     public static final Parcelable.Creator<IntentFilter> CREATOR
diff --git a/core/java/android/content/pm/PackageParser.java b/core/java/android/content/pm/PackageParser.java
index 7a873f8..f9c4984 100644
--- a/core/java/android/content/pm/PackageParser.java
+++ b/core/java/android/content/pm/PackageParser.java
@@ -65,6 +65,48 @@
     private static final Object mSync = new Object();
     private static WeakReference<byte[]> mReadBuffer;
 
+    static class ParsePackageItemArgs {
+        final Package owner;
+        final String[] outError;
+        final int nameRes;
+        final int labelRes;
+        final int iconRes;
+        
+        String tag;
+        TypedArray sa;
+        
+        ParsePackageItemArgs(Package _owner, String[] _outError,
+                int _nameRes, int _labelRes, int _iconRes) {
+            owner = _owner;
+            outError = _outError;
+            nameRes = _nameRes;
+            labelRes = _labelRes;
+            iconRes = _iconRes;
+        }
+    }
+    
+    static class ParseComponentArgs extends ParsePackageItemArgs {
+        final String[] sepProcesses;
+        final int processRes;
+        final int enabledRes;
+        int flags;
+        
+        ParseComponentArgs(Package _owner, String[] _outError,
+                int _nameRes, int _labelRes, int _iconRes,
+                String[] _sepProcesses, int _processRes,int _enabledRes) {
+            super(_owner, _outError, _nameRes, _labelRes, _iconRes);
+            sepProcesses = _sepProcesses;
+            processRes = _processRes;
+            enabledRes = _enabledRes;
+        }
+    }
+    
+    private ParsePackageItemArgs mParseInstrumentationArgs;
+    private ParseComponentArgs mParseActivityArgs;
+    private ParseComponentArgs mParseActivityAliasArgs;
+    private ParseComponentArgs mParseServiceArgs;
+    private ParseComponentArgs mParseProviderArgs;
+    
     /** If set to true, we will only allow package files that exactly match
      *  the DTD.  Otherwise, we try to get as much from the package as we
      *  can without failing.  This should normally be set to false, to
@@ -558,6 +600,11 @@
         throws XmlPullParserException, IOException {
         AttributeSet attrs = parser;
 
+        mParseInstrumentationArgs = null;
+        mParseActivityArgs = null;
+        mParseServiceArgs = null;
+        mParseProviderArgs = null;
+        
         String pkgName = parsePackageName(parser, attrs, flags, outError);
         if (pkgName == null) {
             mParseError = PackageManager.INSTALL_PARSE_FAILED_BAD_PACKAGE_NAME;
@@ -594,8 +641,6 @@
         }
         sa.recycle();
 
-        final int innerDepth = parser.getDepth();
-
         int outerDepth = parser.getDepth();
         while ((type=parser.next()) != parser.END_DOCUMENT
                && (type != parser.END_TAG || parser.getDepth() > outerDepth)) {
@@ -959,20 +1004,24 @@
         TypedArray sa = res.obtainAttributes(attrs,
                 com.android.internal.R.styleable.AndroidManifestInstrumentation);
 
-        Instrumentation a = new Instrumentation(owner);
-
-        if (!parsePackageItemInfo(owner, a.info, outError, "<instrumentation>", sa,
-                com.android.internal.R.styleable.AndroidManifestInstrumentation_name,
-                com.android.internal.R.styleable.AndroidManifestInstrumentation_label,
-                com.android.internal.R.styleable.AndroidManifestInstrumentation_icon)) {
+        if (mParseInstrumentationArgs == null) {
+            mParseInstrumentationArgs = new ParsePackageItemArgs(owner, outError,
+                    com.android.internal.R.styleable.AndroidManifestInstrumentation_name,
+                    com.android.internal.R.styleable.AndroidManifestInstrumentation_label,
+                    com.android.internal.R.styleable.AndroidManifestInstrumentation_icon);
+            mParseInstrumentationArgs.tag = "<instrumentation>";
+        }
+        
+        mParseInstrumentationArgs.sa = sa;
+        
+        Instrumentation a = new Instrumentation(mParseInstrumentationArgs,
+                new InstrumentationInfo());
+        if (outError[0] != null) {
             sa.recycle();
             mParseError = PackageManager.INSTALL_PARSE_FAILED_MANIFEST_MALFORMED;
             return null;
         }
 
-        a.component = new ComponentName(owner.applicationInfo.packageName,
-                a.info.name);
-
         String str;
         str = sa.getNonResourceString(
                 com.android.internal.R.styleable.AndroidManifestInstrumentation_targetPackage);
@@ -1149,7 +1198,7 @@
                 owner.providers.add(p);
 
             } else if (tagName.equals("activity-alias")) {
-                Activity a = parseActivityAlias(owner, res, parser, attrs, flags, outError, false);
+                Activity a = parseActivityAlias(owner, res, parser, attrs, flags, outError);
                 if (a == null) {
                     mParseError = PackageManager.INSTALL_PARSE_FAILED_MANIFEST_MALFORMED;
                     return false;
@@ -1263,22 +1312,29 @@
 
         return outError[0] == null;
     }
-
+    
     private Activity parseActivity(Package owner, Resources res,
             XmlPullParser parser, AttributeSet attrs, int flags, String[] outError,
             boolean receiver) throws XmlPullParserException, IOException {
         TypedArray sa = res.obtainAttributes(attrs,
                 com.android.internal.R.styleable.AndroidManifestActivity);
 
-        Activity a = new Activity(owner);
-
-        if (!parseComponentInfo(owner, flags, a.info, outError,
-                receiver ? "<receiver>" : "<activity>", sa,
-                com.android.internal.R.styleable.AndroidManifestActivity_name,
-                com.android.internal.R.styleable.AndroidManifestActivity_label,
-                com.android.internal.R.styleable.AndroidManifestActivity_icon,
-                com.android.internal.R.styleable.AndroidManifestActivity_process,
-                com.android.internal.R.styleable.AndroidManifestActivity_enabled)) {
+        if (mParseActivityArgs == null) {
+            mParseActivityArgs = new ParseComponentArgs(owner, outError,
+                    com.android.internal.R.styleable.AndroidManifestActivity_name,
+                    com.android.internal.R.styleable.AndroidManifestActivity_label,
+                    com.android.internal.R.styleable.AndroidManifestActivity_icon,
+                    mSeparateProcesses,
+                    com.android.internal.R.styleable.AndroidManifestActivity_process,
+                    com.android.internal.R.styleable.AndroidManifestActivity_enabled);
+        }
+        
+        mParseActivityArgs.tag = receiver ? "<receiver>" : "<activity>";
+        mParseActivityArgs.sa = sa;
+        mParseActivityArgs.flags = flags;
+        
+        Activity a = new Activity(mParseActivityArgs, new ActivityInfo());
+        if (outError[0] != null) {
             sa.recycle();
             return null;
         }
@@ -1290,9 +1346,6 @@
                     com.android.internal.R.styleable.AndroidManifestActivity_exported, false);
         }
 
-        a.component = new ComponentName(owner.applicationInfo.packageName,
-                a.info.name);
-
         a.info.theme = sa.getResourceId(
                 com.android.internal.R.styleable.AndroidManifestActivity_theme, 0);
 
@@ -1436,8 +1489,8 @@
     }
 
     private Activity parseActivityAlias(Package owner, Resources res,
-            XmlPullParser parser, AttributeSet attrs, int flags, String[] outError,
-            boolean receiver) throws XmlPullParserException, IOException {
+            XmlPullParser parser, AttributeSet attrs, int flags, String[] outError)
+            throws XmlPullParserException, IOException {
         TypedArray sa = res.obtainAttributes(attrs,
                 com.android.internal.R.styleable.AndroidManifestActivityAlias);
 
@@ -1456,7 +1509,20 @@
             return null;
         }
 
-        Activity a = new Activity(owner);
+        if (mParseActivityAliasArgs == null) {
+            mParseActivityAliasArgs = new ParseComponentArgs(owner, outError,
+                    com.android.internal.R.styleable.AndroidManifestActivityAlias_name,
+                    com.android.internal.R.styleable.AndroidManifestActivityAlias_label,
+                    com.android.internal.R.styleable.AndroidManifestActivityAlias_icon,
+                    mSeparateProcesses,
+                    0,
+                    com.android.internal.R.styleable.AndroidManifestActivityAlias_enabled);
+            mParseActivityAliasArgs.tag = "<activity-alias>";
+        }
+        
+        mParseActivityAliasArgs.sa = sa;
+        mParseActivityAliasArgs.flags = flags;
+        
         Activity target = null;
 
         final int NA = owner.activities.size();
@@ -1475,26 +1541,21 @@
             return null;
         }
 
-        a.info.targetActivity = targetActivity;
-
-        a.info.configChanges = target.info.configChanges;
-        a.info.flags = target.info.flags;
-        a.info.icon = target.info.icon;
-        a.info.labelRes = target.info.labelRes;
-        a.info.launchMode = target.info.launchMode;
-        a.info.nonLocalizedLabel = target.info.nonLocalizedLabel;
-        a.info.processName = target.info.processName;
-        a.info.screenOrientation = target.info.screenOrientation;
-        a.info.taskAffinity = target.info.taskAffinity;
-        a.info.theme = target.info.theme;
-
-        if (!parseComponentInfo(owner, flags, a.info, outError,
-                receiver ? "<receiver>" : "<activity>", sa,
-                com.android.internal.R.styleable.AndroidManifestActivityAlias_name,
-                com.android.internal.R.styleable.AndroidManifestActivityAlias_label,
-                com.android.internal.R.styleable.AndroidManifestActivityAlias_icon,
-                0,
-                com.android.internal.R.styleable.AndroidManifestActivityAlias_enabled)) {
+        ActivityInfo info = new ActivityInfo();
+        info.targetActivity = targetActivity;
+        info.configChanges = target.info.configChanges;
+        info.flags = target.info.flags;
+        info.icon = target.info.icon;
+        info.labelRes = target.info.labelRes;
+        info.nonLocalizedLabel = target.info.nonLocalizedLabel;
+        info.launchMode = target.info.launchMode;
+        info.processName = target.info.processName;
+        info.screenOrientation = target.info.screenOrientation;
+        info.taskAffinity = target.info.taskAffinity;
+        info.theme = target.info.theme;
+        
+        Activity a = new Activity(mParseActivityAliasArgs, info);
+        if (outError[0] != null) {
             sa.recycle();
             return null;
         }
@@ -1506,9 +1567,6 @@
                     com.android.internal.R.styleable.AndroidManifestActivityAlias_exported, false);
         }
 
-        a.component = new ComponentName(owner.applicationInfo.packageName,
-                a.info.name);
-
         String str;
         str = sa.getNonResourceString(
                 com.android.internal.R.styleable.AndroidManifestActivityAlias_permission);
@@ -1572,14 +1630,22 @@
         TypedArray sa = res.obtainAttributes(attrs,
                 com.android.internal.R.styleable.AndroidManifestProvider);
 
-        Provider p = new Provider(owner);
-
-        if (!parseComponentInfo(owner, flags, p.info, outError, "<provider>", sa,
-                com.android.internal.R.styleable.AndroidManifestProvider_name,
-                com.android.internal.R.styleable.AndroidManifestProvider_label,
-                com.android.internal.R.styleable.AndroidManifestProvider_icon,
-                com.android.internal.R.styleable.AndroidManifestProvider_process,
-                com.android.internal.R.styleable.AndroidManifestProvider_enabled)) {
+        if (mParseProviderArgs == null) {
+            mParseProviderArgs = new ParseComponentArgs(owner, outError,
+                    com.android.internal.R.styleable.AndroidManifestProvider_name,
+                    com.android.internal.R.styleable.AndroidManifestProvider_label,
+                    com.android.internal.R.styleable.AndroidManifestProvider_icon,
+                    mSeparateProcesses,
+                    com.android.internal.R.styleable.AndroidManifestProvider_process,
+                    com.android.internal.R.styleable.AndroidManifestProvider_enabled);
+            mParseProviderArgs.tag = "<provider>";
+        }
+        
+        mParseProviderArgs.sa = sa;
+        mParseProviderArgs.flags = flags;
+        
+        Provider p = new Provider(mParseProviderArgs, new ProviderInfo());
+        if (outError[0] != null) {
             sa.recycle();
             return null;
         }
@@ -1587,9 +1653,6 @@
         p.info.exported = sa.getBoolean(
                 com.android.internal.R.styleable.AndroidManifestProvider_exported, true);
 
-        p.component = new ComponentName(owner.applicationInfo.packageName,
-                p.info.name);
-
         String cpname = sa.getNonResourceString(
                 com.android.internal.R.styleable.AndroidManifestProvider_authorities);
 
@@ -1730,14 +1793,22 @@
         TypedArray sa = res.obtainAttributes(attrs,
                 com.android.internal.R.styleable.AndroidManifestService);
 
-        Service s = new Service(owner);
-
-        if (!parseComponentInfo(owner, flags, s.info, outError, "<service>", sa,
-                com.android.internal.R.styleable.AndroidManifestService_name,
-                com.android.internal.R.styleable.AndroidManifestService_label,
-                com.android.internal.R.styleable.AndroidManifestService_icon,
-                com.android.internal.R.styleable.AndroidManifestService_process,
-                com.android.internal.R.styleable.AndroidManifestService_enabled)) {
+        if (mParseServiceArgs == null) {
+            mParseServiceArgs = new ParseComponentArgs(owner, outError,
+                    com.android.internal.R.styleable.AndroidManifestService_name,
+                    com.android.internal.R.styleable.AndroidManifestService_label,
+                    com.android.internal.R.styleable.AndroidManifestService_icon,
+                    mSeparateProcesses,
+                    com.android.internal.R.styleable.AndroidManifestService_process,
+                    com.android.internal.R.styleable.AndroidManifestService_enabled);
+            mParseServiceArgs.tag = "<service>";
+        }
+        
+        mParseServiceArgs.sa = sa;
+        mParseServiceArgs.flags = flags;
+        
+        Service s = new Service(mParseServiceArgs, new ServiceInfo());
+        if (outError[0] != null) {
             sa.recycle();
             return null;
         }
@@ -1749,9 +1820,6 @@
                     com.android.internal.R.styleable.AndroidManifestService_exported, false);
         }
 
-        s.component = new ComponentName(owner.applicationInfo.packageName,
-                s.info.name);
-
         String str = sa.getNonResourceString(
                 com.android.internal.R.styleable.AndroidManifestService_permission);
         if (str == null) {
@@ -2111,16 +2179,75 @@
 
     public static class Component<II extends IntentInfo> {
         public final Package owner;
-        public final ArrayList<II> intents = new ArrayList<II>(0);
-        public ComponentName component;
+        public final ArrayList<II> intents;
+        public final ComponentName component;
+        public final String componentShortName;
         public Bundle metaData;
 
         public Component(Package _owner) {
             owner = _owner;
+            intents = null;
+            component = null;
+            componentShortName = null;
+        }
+
+        public Component(final ParsePackageItemArgs args, final PackageItemInfo outInfo) {
+            owner = args.owner;
+            intents = new ArrayList<II>(0);
+            String name = args.sa.getNonResourceString(args.nameRes);
+            if (name == null) {
+                component = null;
+                componentShortName = null;
+                args.outError[0] = args.tag + " does not specify android:name";
+                return;
+            }
+
+            outInfo.name
+                = buildClassName(owner.applicationInfo.packageName, name, args.outError);
+            if (outInfo.name == null) {
+                component = null;
+                componentShortName = null;
+                args.outError[0] = args.tag + " does not have valid android:name";
+                return;
+            }
+
+            component = new ComponentName(owner.applicationInfo.packageName,
+                    outInfo.name);
+            componentShortName = component.flattenToShortString();
+
+            int iconVal = args.sa.getResourceId(args.iconRes, 0);
+            if (iconVal != 0) {
+                outInfo.icon = iconVal;
+                outInfo.nonLocalizedLabel = null;
+            }
+
+            TypedValue v = args.sa.peekValue(args.labelRes);
+            if (v != null && (outInfo.labelRes=v.resourceId) == 0) {
+                outInfo.nonLocalizedLabel = v.coerceToString();
+            }
+
+            outInfo.packageName = owner.packageName;
+        }
+
+        public Component(final ParseComponentArgs args, final ComponentInfo outInfo) {
+            this(args, (PackageItemInfo)outInfo);
+            if (args.outError[0] != null) {
+                return;
+            }
+
+            if (args.processRes != 0) {
+                outInfo.processName = buildProcessName(owner.applicationInfo.packageName,
+                        owner.applicationInfo.processName, args.sa.getNonResourceString(args.processRes),
+                        args.flags, args.sepProcesses, args.outError);
+            }
+            outInfo.enabled = args.sa.getBoolean(args.enabledRes, true);
         }
 
         public Component(Component<II> clone) {
             owner = clone.owner;
+            intents = clone.intents;
+            component = clone.component;
+            componentShortName = clone.componentShortName;
             metaData = clone.metaData;
         }
     }
@@ -2226,14 +2353,14 @@
     }
 
     public final static class Activity extends Component<ActivityIntentInfo> {
-        public final ActivityInfo info =
-                new ActivityInfo();
+        public final ActivityInfo info;
 
-        public Activity(Package _owner) {
-            super(_owner);
-            info.applicationInfo = owner.applicationInfo;
+        public Activity(final ParseComponentArgs args, final ActivityInfo _info) {
+            super(args, _info);
+            info = _info;
+            info.applicationInfo = args.owner.applicationInfo;
         }
-
+        
         public String toString() {
             return "Activity{"
                 + Integer.toHexString(System.identityHashCode(this))
@@ -2255,14 +2382,14 @@
     }
 
     public final static class Service extends Component<ServiceIntentInfo> {
-        public final ServiceInfo info =
-                new ServiceInfo();
+        public final ServiceInfo info;
 
-        public Service(Package _owner) {
-            super(_owner);
-            info.applicationInfo = owner.applicationInfo;
+        public Service(final ParseComponentArgs args, final ServiceInfo _info) {
+            super(args, _info);
+            info = _info;
+            info.applicationInfo = args.owner.applicationInfo;
         }
-
+        
         public String toString() {
             return "Service{"
                 + Integer.toHexString(System.identityHashCode(this))
@@ -2286,13 +2413,13 @@
         public final ProviderInfo info;
         public boolean syncable;
 
-        public Provider(Package _owner) {
-            super(_owner);
-            info = new ProviderInfo();
-            info.applicationInfo = owner.applicationInfo;
+        public Provider(final ParseComponentArgs args, final ProviderInfo _info) {
+            super(args, _info);
+            info = _info;
+            info.applicationInfo = args.owner.applicationInfo;
             syncable = false;
         }
-
+        
         public Provider(Provider existingProvider) {
             super(existingProvider);
             this.info = existingProvider.info;
@@ -2325,13 +2452,13 @@
     }
 
     public final static class Instrumentation extends Component {
-        public final InstrumentationInfo info =
-                new InstrumentationInfo();
+        public final InstrumentationInfo info;
 
-        public Instrumentation(Package _owner) {
-            super(_owner);
+        public Instrumentation(final ParsePackageItemArgs args, final InstrumentationInfo _info) {
+            super(args, _info);
+            info = _info;
         }
-
+        
         public String toString() {
             return "Instrumentation{"
                 + Integer.toHexString(System.identityHashCode(this))
diff --git a/core/java/android/content/res/Configuration.java b/core/java/android/content/res/Configuration.java
index 956b15a..bb3486c 100644
--- a/core/java/android/content/res/Configuration.java
+++ b/core/java/android/content/res/Configuration.java
@@ -144,11 +144,29 @@
     }
 
     public String toString() {
-        return "{ scale=" + fontScale + " imsi=" + mcc + "/" + mnc
-                + " locale=" + locale
-                + " touch=" + touchscreen + " key=" + keyboard + "/"
-                + keyboardHidden + "/" + hardKeyboardHidden
-                + " nav=" + navigation + " orien=" + orientation + " }";
+        StringBuilder sb = new StringBuilder(128);
+        sb.append("{ scale=");
+        sb.append(fontScale);
+        sb.append(" imsi=");
+        sb.append(mcc);
+        sb.append("/");
+        sb.append(mnc);
+        sb.append(" loc=");
+        sb.append(locale);
+        sb.append(" touch=");
+        sb.append(touchscreen);
+        sb.append(" keys=");
+        sb.append(keyboard);
+        sb.append("/");
+        sb.append(keyboardHidden);
+        sb.append("/");
+        sb.append(hardKeyboardHidden);
+        sb.append(" nav=");
+        sb.append(navigation);
+        sb.append(" orien=");
+        sb.append(orientation);
+        sb.append('}');
+        return sb.toString();
     }
 
     /**
diff --git a/core/java/android/hardware/Camera.java b/core/java/android/hardware/Camera.java
index 106c920..ca579b6 100644
--- a/core/java/android/hardware/Camera.java
+++ b/core/java/android/hardware/Camera.java
@@ -405,8 +405,6 @@
      * @param params the Parameters to use for this Camera service
      */
     public void setParameters(Parameters params) {
-        Log.e(TAG, "setParameters()");
-        //params.dump();
         native_setParameters(params.flatten());
     }
 
@@ -416,7 +414,6 @@
     public Parameters getParameters() {
         Parameters p = new Parameters();
         String s = native_getParameters();
-        Log.e(TAG, "_getParameters: " + s);
         p.unflatten(s);
         return p;
     }
diff --git a/core/java/android/hardware/SensorManager.java b/core/java/android/hardware/SensorManager.java
index 0c88a2e..67df23b 100644
--- a/core/java/android/hardware/SensorManager.java
+++ b/core/java/android/hardware/SensorManager.java
@@ -43,7 +43,7 @@
  * class by calling {@link android.content.Context#getSystemService(java.lang.String)
  * Context.getSystemService()} with an argument of {@link android.content.Context#SENSOR_SERVICE}.
  */
-public class SensorManager extends IRotationWatcher.Stub
+public class SensorManager
 {
     private static final String TAG = "SensorManager";
     private static final float[] mTempMatrix = new float[16];
@@ -475,7 +475,13 @@
                     // if it's null we're running in the system process
                     // which won't get the rotated values
                     try {
-                        sRotation = sWindowManager.watchRotation(this);
+                        sRotation = sWindowManager.watchRotation(
+                            new IRotationWatcher.Stub() {
+                                public void onRotationChanged(int rotation) {
+                                    SensorManager.this.onRotationChanged(rotation);
+                                }
+                            }
+                        );
                     } catch (RemoteException e) {
                     }
                 }
@@ -1386,7 +1392,7 @@
             }
         }
     }
-
+    
     class LmsFilter {
         private static final int SENSORS_RATE_MS = 20;
         private static final int COUNT = 12;
@@ -1454,7 +1460,7 @@
         }
     }
 
-
+    
     private static native void nativeClassInit();
 
     private static native int sensors_module_init();
diff --git a/core/java/android/net/MobileDataStateTracker.java b/core/java/android/net/MobileDataStateTracker.java
index ed7c056..1064fb6 100644
--- a/core/java/android/net/MobileDataStateTracker.java
+++ b/core/java/android/net/MobileDataStateTracker.java
@@ -354,9 +354,10 @@
 
     /**
      * Tells the phone sub-system that the caller wants to
-     * begin using the named feature. The only supported feature at
-     * this time is {@code Phone.FEATURE_ENABLE_MMS}, which allows an application
-     * to specify that it wants to send and/or receive MMS data.
+     * begin using the named feature. The only supported features at
+     * this time are {@code Phone.FEATURE_ENABLE_MMS}, which allows an application
+     * to specify that it wants to send and/or receive MMS data, and
+     * {@code Phone.FEATURE_ENABLE_SUPL}, which is used for Assisted GPS.
      * @param feature the name of the feature to be used
      * @param callingPid the process ID of the process that is issuing this request
      * @param callingUid the user ID of the process that is issuing this request
@@ -376,6 +377,8 @@
         if (TextUtils.equals(feature, Phone.FEATURE_ENABLE_MMS)) {
             mLastCallingPid = callingPid;
             return setEnableApn(Phone.APN_TYPE_MMS, true);
+        } else if (TextUtils.equals(feature, Phone.FEATURE_ENABLE_SUPL)) {
+            return setEnableApn(Phone.APN_TYPE_SUPL, true);
         } else {
             return -1;
         }
@@ -396,6 +399,8 @@
     public int stopUsingNetworkFeature(String feature, int callingPid, int callingUid) {
         if (TextUtils.equals(feature, Phone.FEATURE_ENABLE_MMS)) {
             return setEnableApn(Phone.APN_TYPE_MMS, false);
+        } else if (TextUtils.equals(feature, Phone.FEATURE_ENABLE_SUPL)) {
+            return setEnableApn(Phone.APN_TYPE_SUPL, false);
         } else {
             return -1;
         }
diff --git a/core/java/android/net/Proxy.java b/core/java/android/net/Proxy.java
index 9f07c0a..66eefb2 100644
--- a/core/java/android/net/Proxy.java
+++ b/core/java/android/net/Proxy.java
@@ -30,6 +30,9 @@
  */
 final public class Proxy {
 
+    // Set to true to enable extra debugging.
+    static final private boolean DEBUG = false;
+
     static final public String PROXY_CHANGE_ACTION =
         "android.intent.action.PROXY_CHANGE";
 
@@ -49,7 +52,7 @@
         if (host != null) {
             int i = host.indexOf(':');
             if (i == -1) {
-                if (android.util.Config.DEBUG) {
+                if (DEBUG) {
                     Assert.assertTrue(host.length() == 0);
                 }
                 return null;
@@ -73,12 +76,12 @@
         if (host != null) {
             int i = host.indexOf(':');
             if (i == -1) {
-                if (android.util.Config.DEBUG) {
+                if (DEBUG) {
                     Assert.assertTrue(host.length() == 0);
                 }
                 return -1;
             }
-            if (android.util.Config.DEBUG) {
+            if (DEBUG) {
                 Assert.assertTrue(i < host.length());
             }
             return Integer.parseInt(host.substring(i+1));
diff --git a/core/java/android/os/BatteryStats.java b/core/java/android/os/BatteryStats.java
index 39d36de..333ba73 100644
--- a/core/java/android/os/BatteryStats.java
+++ b/core/java/android/os/BatteryStats.java
@@ -113,7 +113,7 @@
     private static final String DATA_CONNECTION_TIME_DATA = "dct";
     private static final String DATA_CONNECTION_COUNT_DATA = "dcc";
 
-    private final StringBuilder mFormatBuilder = new StringBuilder(8);
+    private final StringBuilder mFormatBuilder = new StringBuilder(32);
     private final Formatter mFormatter = new Formatter(mFormatBuilder);
 
     /**
@@ -522,7 +522,7 @@
     
     public abstract Map<String, ? extends Timer> getKernelWakelockStats();
 
-    private final static void formatTime(StringBuilder out, long seconds) {
+    private final static void formatTimeRaw(StringBuilder out, long seconds) {
         long days = seconds / (60 * 60 * 24);
         if (days != 0) {
             out.append(days);
@@ -550,22 +550,18 @@
         }
     }
 
-    private final static String formatTime(long time) {
+    private final static void formatTime(StringBuilder sb, long time) {
         long sec = time / 100;
-        StringBuilder sb = new StringBuilder();
-        formatTime(sb, sec);
+        formatTimeRaw(sb, sec);
         sb.append((time - (sec * 100)) * 10);
         sb.append("ms ");
-        return sb.toString();
     }
 
-    private final static String formatTimeMs(long time) {
+    private final static void formatTimeMs(StringBuilder sb, long time) {
         long sec = time / 1000;
-        StringBuilder sb = new StringBuilder();
-        formatTime(sb, sec);
+        formatTimeRaw(sb, sec);
         sb.append(time - (sec * 1000));
         sb.append("ms ");
-        return sb.toString();
     }
 
     private final String formatRatioLocked(long num, long den) {
@@ -616,8 +612,8 @@
             int count = timer.getCountLocked(which);
             if (totalTimeMillis != 0) {
                 sb.append(linePrefix);
-                sb.append(formatTimeMs(totalTimeMillis));
-                sb.append(name != null ? name : "");
+                formatTimeMs(sb, totalTimeMillis);
+                if (name != null) sb.append(name);
                 sb.append(' ');
                 sb.append('(');
                 sb.append(count);
@@ -916,7 +912,7 @@
     }
 
     @SuppressWarnings("unused")
-    private final void dumpLocked(Printer pw, String prefix, int which) {
+    private final void dumpLocked(PrintWriter pw, String prefix, int which) {
         final long rawUptime = SystemClock.uptimeMillis() * 1000;
         final long rawRealtime = SystemClock.elapsedRealtime() * 1000;
         final long batteryUptime = getBatteryUptime(rawUptime);
@@ -932,33 +928,41 @@
         SparseArray<? extends Uid> uidStats = getUidStats();
         final int NU = uidStats.size();
 
-        pw.println(prefix
-                + "  Time on battery: "
-                + formatTimeMs(whichBatteryRealtime / 1000) + "("
-                + formatRatioLocked(whichBatteryRealtime, totalRealtime)
-                + ") realtime, "
-                + formatTimeMs(whichBatteryUptime / 1000)
-                + "(" + formatRatioLocked(whichBatteryUptime, totalRealtime)
-                + ") uptime");
-        pw.println(prefix
-                + "  Total run time: "
-                + formatTimeMs(totalRealtime / 1000)
-                + "realtime, "
-                + formatTimeMs(totalUptime / 1000)
-                + "uptime, ");
+        sb.setLength(0);
+        sb.append(prefix);
+                sb.append("  Time on battery: ");
+                formatTimeMs(sb, whichBatteryRealtime / 1000); sb.append("(");
+                sb.append(formatRatioLocked(whichBatteryRealtime, totalRealtime));
+                sb.append(") realtime, ");
+                formatTimeMs(sb, whichBatteryUptime / 1000);
+                sb.append("("); sb.append(formatRatioLocked(whichBatteryUptime, totalRealtime));
+                sb.append(") uptime");
+        pw.println(sb.toString());
+        sb.setLength(0);
+        sb.append(prefix);
+                sb.append("  Total run time: ");
+                formatTimeMs(sb, totalRealtime / 1000);
+                sb.append("realtime, ");
+                formatTimeMs(sb, totalUptime / 1000);
+                sb.append("uptime, ");
+        pw.println(sb.toString());
         
         final long screenOnTime = getScreenOnTime(batteryRealtime, which);
         final long phoneOnTime = getPhoneOnTime(batteryRealtime, which);
         final long wifiRunningTime = getWifiRunningTime(batteryRealtime, which);
         final long wifiOnTime = getWifiOnTime(batteryRealtime, which);
         final long bluetoothOnTime = getBluetoothOnTime(batteryRealtime, which);
-        pw.println(prefix
-                + "  Screen on: " + formatTimeMs(screenOnTime / 1000)
-                + "(" + formatRatioLocked(screenOnTime, whichBatteryRealtime)
-                + "), Input events: " + getInputEventCount(which)
-                + ", Active phone call: " + formatTimeMs(phoneOnTime / 1000)
-                + "(" + formatRatioLocked(phoneOnTime, whichBatteryRealtime) + ")");
         sb.setLength(0);
+        sb.append(prefix);
+                sb.append("  Screen on: "); formatTimeMs(sb, screenOnTime / 1000);
+                sb.append("("); sb.append(formatRatioLocked(screenOnTime, whichBatteryRealtime));
+                sb.append("), Input events: "); sb.append(getInputEventCount(which));
+                sb.append(", Active phone call: "); formatTimeMs(sb, phoneOnTime / 1000);
+                sb.append("("); sb.append(formatRatioLocked(phoneOnTime, whichBatteryRealtime));
+                sb.append(")");
+        pw.println(sb.toString());
+        sb.setLength(0);
+        sb.append(prefix);
         sb.append("  Screen brightnesses: ");
         boolean didOne = false;
         for (int i=0; i<NUM_SCREEN_BRIGHTNESS_BINS; i++) {
@@ -970,7 +974,7 @@
             didOne = true;
             sb.append(SCREEN_BRIGHTNESS_NAMES[i]);
             sb.append(" ");
-            sb.append(formatTimeMs(time/1000));
+            formatTimeMs(sb, time/1000);
             sb.append("(");
             sb.append(formatRatioLocked(time, screenOnTime));
             sb.append(")");
@@ -1030,16 +1034,19 @@
             }
         }
         
-        pw.println(prefix
-                + "  Total received: " + formatBytesLocked(rxTotal)
-                + ", Total sent: " + formatBytesLocked(txTotal));
-        pw.println(prefix
-                + "  Total full wakelock time: " + formatTimeMs(
-                        (fullWakeLockTimeTotalMicros + 500) / 1000)
-                + ", Total partial waklock time: " + formatTimeMs(
-                        (partialWakeLockTimeTotalMicros + 500) / 1000));
+        pw.print(prefix);
+                pw.print("  Total received: "); pw.print(formatBytesLocked(rxTotal));
+                pw.print(", Total sent: "); pw.println(formatBytesLocked(txTotal));
+        sb.setLength(0);
+        sb.append(prefix);
+                sb.append("  Total full wakelock time: "); formatTimeMs(sb,
+                        (fullWakeLockTimeTotalMicros + 500) / 1000);
+                sb.append(", Total partial waklock time: "); formatTimeMs(sb,
+                        (partialWakeLockTimeTotalMicros + 500) / 1000);
+        pw.println(sb.toString());
         
         sb.setLength(0);
+        sb.append(prefix);
         sb.append("  Signal levels: ");
         didOne = false;
         for (int i=0; i<NUM_SIGNAL_STRENGTH_BINS; i++) {
@@ -1051,7 +1058,7 @@
             didOne = true;
             sb.append(SIGNAL_STRENGTH_NAMES[i]);
             sb.append(" ");
-            sb.append(formatTimeMs(time/1000));
+            formatTimeMs(sb, time/1000);
             sb.append("(");
             sb.append(formatRatioLocked(time, whichBatteryRealtime));
             sb.append(") ");
@@ -1062,6 +1069,7 @@
         pw.println(sb.toString());
         
         sb.setLength(0);
+        sb.append(prefix);
         sb.append("  Radio types: ");
         didOne = false;
         for (int i=0; i<NUM_DATA_CONNECTION_TYPES; i++) {
@@ -1073,7 +1081,7 @@
             didOne = true;
             sb.append(DATA_CONNECTION_NAMES[i]);
             sb.append(" ");
-            sb.append(formatTimeMs(time/1000));
+            formatTimeMs(sb, time/1000);
             sb.append("(");
             sb.append(formatRatioLocked(time, whichBatteryRealtime));
             sb.append(") ");
@@ -1083,29 +1091,32 @@
         if (!didOne) sb.append("No activity");
         pw.println(sb.toString());
         
-        pw.println(prefix
-                + "  Wifi on: " + formatTimeMs(wifiOnTime / 1000)
-                + "(" + formatRatioLocked(wifiOnTime, whichBatteryRealtime)
-                + "), Wifi running: " + formatTimeMs(wifiRunningTime / 1000)
-                + "(" + formatRatioLocked(wifiRunningTime, whichBatteryRealtime)
-                + "), Bluetooth on: " + formatTimeMs(bluetoothOnTime / 1000)
-                + "(" + formatRatioLocked(bluetoothOnTime, whichBatteryRealtime)+ ")");
+        sb.setLength(0);
+        sb.append(prefix);
+                sb.append("  Wifi on: "); formatTimeMs(sb, wifiOnTime / 1000);
+                sb.append("("); sb.append(formatRatioLocked(wifiOnTime, whichBatteryRealtime));
+                sb.append("), Wifi running: "); formatTimeMs(sb, wifiRunningTime / 1000);
+                sb.append("("); sb.append(formatRatioLocked(wifiRunningTime, whichBatteryRealtime));
+                sb.append("), Bluetooth on: "); formatTimeMs(sb, bluetoothOnTime / 1000);
+                sb.append("("); sb.append(formatRatioLocked(bluetoothOnTime, whichBatteryRealtime));
+                sb.append(")");
+        pw.println(sb.toString());
         
         pw.println(" ");
 
         if (which == STATS_UNPLUGGED) {
             if (getIsOnBattery()) {
-                pw.println(prefix + "  Device is currently unplugged");
-                pw.println(prefix + "    Discharge cycle start level: " + 
-                        getDischargeStartLevel());
-                pw.println(prefix + "    Discharge cycle current level: " +
-                        getDischargeCurrentLevel());
+                pw.print(prefix); pw.println("  Device is currently unplugged");
+                pw.print(prefix); pw.print("    Discharge cycle start level: "); 
+                        pw.println(getDischargeStartLevel());
+                pw.print(prefix); pw.print("    Discharge cycle current level: ");
+                        pw.println(getDischargeCurrentLevel());
             } else {
-                pw.println(prefix + "  Device is currently plugged into power");
-                pw.println(prefix + "    Last discharge cycle start level: " + 
-                        getDischargeStartLevel());
-                pw.println(prefix + "    Last discharge cycle end level: " + 
-                        getDischargeCurrentLevel());
+                pw.print(prefix); pw.println("  Device is currently plugged into power");
+                pw.print(prefix); pw.print("    Last discharge cycle start level: "); 
+                        pw.println(getDischargeStartLevel());
+                pw.print(prefix); pw.print("    Last discharge cycle end level: "); 
+                        pw.println(getDischargeCurrentLevel());
             }
             pw.println(" ");
         }
@@ -1124,8 +1135,9 @@
             long wifiTurnedOnTime = u.getWifiTurnedOnTime(batteryRealtime, which);
             
             if (tcpReceived != 0 || tcpSent != 0) {
-                pw.println(prefix + "    Network: " + formatBytesLocked(tcpReceived) + " received, "
-                        + formatBytesLocked(tcpSent) + " sent");
+                pw.print(prefix); pw.print("    Network: ");
+                        pw.print(formatBytesLocked(tcpReceived)); pw.print(" received, ");
+                        pw.print(formatBytesLocked(tcpSent)); pw.println(" sent");
             }
             
             if (u.hasUserActivity()) {
@@ -1152,18 +1164,20 @@
             
             if (fullWifiLockOnTime != 0 || scanWifiLockOnTime != 0
                     || wifiTurnedOnTime != 0) {
-                pw.println(prefix + "    Turned Wifi On Time: " 
-                        + formatTimeMs(wifiTurnedOnTime / 1000) 
-                        + "(" + formatRatioLocked(wifiTurnedOnTime, 
-                                whichBatteryRealtime)+ ")");
-                pw.println(prefix + "    Full Wifi Lock Time: " 
-                        + formatTimeMs(fullWifiLockOnTime / 1000) 
-                        + "(" + formatRatioLocked(fullWifiLockOnTime, 
-                                whichBatteryRealtime)+ ")");
-                pw.println(prefix + "    Scan Wifi Lock Time: " 
-                        + formatTimeMs(scanWifiLockOnTime / 1000)
-                        + "(" + formatRatioLocked(scanWifiLockOnTime, 
-                                whichBatteryRealtime)+ ")");
+                sb.setLength(0);
+                sb.append(prefix); sb.append("    Turned Wifi On: "); 
+                        formatTimeMs(sb, wifiTurnedOnTime / 1000); 
+                        sb.append("("); sb.append(formatRatioLocked(wifiTurnedOnTime, 
+                                whichBatteryRealtime)); sb.append(")\n");
+                sb.append(prefix); sb.append("    Full Wifi Lock: "); 
+                        formatTimeMs(sb, fullWifiLockOnTime / 1000); 
+                        sb.append("("); sb.append(formatRatioLocked(fullWifiLockOnTime, 
+                                whichBatteryRealtime)); sb.append(")\n");
+                sb.append(prefix); sb.append("    Scan Wifi Lock: "); 
+                        formatTimeMs(sb, scanWifiLockOnTime / 1000);
+                        sb.append("("); sb.append(formatRatioLocked(scanWifiLockOnTime, 
+                                whichBatteryRealtime)); sb.append(")");
+                pw.println(sb.toString());
             }
 
             Map<String, ? extends BatteryStats.Uid.Wakelock> wakelocks = u.getWakelockStats();
@@ -1217,7 +1231,7 @@
                         int count = timer.getCountLocked(which);
                         //timer.logState();
                         if (totalTime != 0) {
-                            sb.append(formatTimeMs(totalTime));
+                            formatTimeMs(sb, totalTime);
                             sb.append("realtime (");
                             sb.append(count);
                             sb.append(" times)");
@@ -1247,10 +1261,15 @@
                     starts = ps.getStarts(which);
 
                     if (userTime != 0 || systemTime != 0 || starts != 0) {
-                        pw.println(prefix + "    Proc " + ent.getKey() + ":");
-                        pw.println(prefix + "      CPU: " + formatTime(userTime) + "user + "
-                                + formatTime(systemTime) + "kernel");
-                        pw.println(prefix + "      " + starts + " process starts");
+                        sb.setLength(0);
+                        sb.append(prefix); sb.append("    Proc ");
+                                sb.append(ent.getKey()); sb.append(":\n");
+                        sb.append(prefix); sb.append("      CPU: ");
+                                formatTime(sb, userTime); sb.append("usr + ");
+                                formatTime(sb, systemTime); sb.append("krn\n");
+                        sb.append(prefix); sb.append("      "); sb.append(starts);
+                                sb.append(" proc starts");
+                        pw.println(sb.toString());
                         uidActivity = true;
                     }
                 }
@@ -1260,12 +1279,13 @@
             if (packageStats.size() > 0) {
                 for (Map.Entry<String, ? extends BatteryStats.Uid.Pkg> ent
                     : packageStats.entrySet()) {
-                    pw.println(prefix + "    Apk " + ent.getKey() + ":");
+                    pw.print(prefix); pw.print("    Apk "); pw.print(ent.getKey()); pw.println(":");
                     boolean apkActivity = false;
                     Uid.Pkg ps = ent.getValue();
                     int wakeups = ps.getWakeups(which);
                     if (wakeups != 0) {
-                        pw.println(prefix + "      " + wakeups + " wakeup alarms");
+                        pw.print(prefix); pw.print("      ");
+                                pw.print(wakeups); pw.println(" wakeup alarms");
                         apkActivity = true;
                     }
                     Map<String, ? extends  Uid.Pkg.Serv> serviceStats = ps.getServiceStats();
@@ -1277,24 +1297,28 @@
                             int starts = ss.getStarts(which);
                             int launches = ss.getLaunches(which);
                             if (startTime != 0 || starts != 0 || launches != 0) {
-                                pw.println(prefix + "      Service " + sent.getKey() + ":");
-                                pw.println(prefix + "        Created for: "
-                                        + formatTimeMs(startTime / 1000)
-                                        + " uptime");
-                                pw.println(prefix + "        Starts: " + starts
-                                        + ", launches: " + launches);
+                                sb.setLength(0);
+                                sb.append(prefix); sb.append("      Service ");
+                                        sb.append(sent.getKey()); sb.append(":\n");
+                                sb.append(prefix); sb.append("        Created for: ");
+                                        formatTimeMs(sb, startTime / 1000);
+                                        sb.append(" uptime\n");
+                                sb.append(prefix); sb.append("        Starts: ");
+                                        sb.append(starts);
+                                        sb.append(", launches: "); sb.append(launches);
+                                pw.println(sb.toString());
                                 apkActivity = true;
                             }
                         }
                     }
                     if (!apkActivity) {
-                        pw.println(prefix + "      (nothing executed)");
+                        pw.print(prefix); pw.println("      (nothing executed)");
                     }
                     uidActivity = true;
                 }
             }
             if (!uidActivity) {
-                pw.println(prefix + "    (nothing executed)");
+                pw.print(prefix); pw.println("    (nothing executed)");
             }
         }
     }
@@ -1305,7 +1329,7 @@
      * @param pw a Printer to receive the dump output.
      */
     @SuppressWarnings("unused")
-    public void dumpLocked(Printer pw) {
+    public void dumpLocked(PrintWriter pw) {
         pw.println("Total Statistics (Current and Historic):");
         pw.println("  System starts: " + getStartCount()
                 + ", currently on battery: " + getIsOnBattery());
diff --git a/core/java/android/os/Process.java b/core/java/android/os/Process.java
index e4412a3..30acef9 100644
--- a/core/java/android/os/Process.java
+++ b/core/java/android/os/Process.java
@@ -176,6 +176,26 @@
      */
     public static final int THREAD_PRIORITY_LESS_FAVORABLE = +1;
 
+    /**
+     * Default thread group - gets a 'normal' share of the CPU
+     * @hide
+     */
+    public static final int THREAD_GROUP_DEFAULT = 0;
+
+    /**
+     * Background non-interactive thread group - All threads in
+     * this group are scheduled with a reduced share of the CPU.
+     * @hide
+     */
+    public static final int THREAD_GROUP_BG_NONINTERACTIVE = 1;
+
+    /**
+     * Foreground 'boost' thread group - All threads in
+     * this group are scheduled with an increased share of the CPU
+     * @hide
+     **/
+    public static final int THREAD_GROUP_FG_BOOST = 2;
+
     public static final int SIGNAL_QUIT = 3;
     public static final int SIGNAL_KILL = 9;
     public static final int SIGNAL_USR1 = 10;
@@ -569,6 +589,21 @@
      */
     public static final native void setThreadPriority(int tid, int priority)
             throws IllegalArgumentException, SecurityException;
+
+    /**
+     * Sets the scheduling group for a thread.
+     * @hide
+     * @param tid The indentifier of the thread/process to change.
+     * @param group The target group for this thread/process.
+     * 
+     * @throws IllegalArgumentException Throws IllegalArgumentException if
+     * <var>tid</var> does not exist.
+     * @throws SecurityException Throws SecurityException if your process does
+     * not have permission to modify the given thread, or to use the given
+     * priority.
+     */
+    public static final native void setThreadGroup(int tid, int group)
+            throws IllegalArgumentException, SecurityException;
     
     /**
      * Set the priority of the calling thread, based on Linux priorities.  See
diff --git a/core/java/android/provider/Gmail.java b/core/java/android/provider/Gmail.java
index cc03968..c4b29ae 100644
--- a/core/java/android/provider/Gmail.java
+++ b/core/java/android/provider/Gmail.java
@@ -38,7 +38,6 @@
 import android.text.TextUtils.SimpleStringSplitter;
 import android.text.style.CharacterStyle;
 import android.text.util.Regex;
-import android.util.Config;
 import android.util.Log;
 
 import java.io.UnsupportedEncodingException;
@@ -61,6 +60,9 @@
  * @hide
  */
 public final class Gmail {
+    // Set to true to enable extra debugging.
+    private static final boolean DEBUG = false;
+
     public static final String GMAIL_AUTH_SERVICE = "mail";
     // These constants come from google3/java/com/google/caribou/backend/MailLabel.java.
     public static final String LABEL_SENT = "^f";
@@ -1195,7 +1197,7 @@
 
         @Override
         public void onChange(boolean selfChange) {
-            if (Config.DEBUG) {
+            if (DEBUG) {
                 Log.d(TAG, "MailCursor is notifying " + mObservers.size() + " observers");
             }
             for (MailCursorObserver o: mObservers) {
diff --git a/core/java/android/text/Layout.java b/core/java/android/text/Layout.java
index a6ed922..29dc2ea52 100644
--- a/core/java/android/text/Layout.java
+++ b/core/java/android/text/Layout.java
@@ -24,7 +24,6 @@
 import android.graphics.RectF;
 import android.graphics.Path;
 import com.android.internal.util.ArrayUtils;
-import android.util.Config;
 
 import junit.framework.Assert;
 import android.text.style.*;
@@ -39,6 +38,8 @@
  * For text that will not change, use a {@link StaticLayout}.
  */
 public abstract class Layout {
+    private static final boolean DEBUG = false;
+
     /* package */ static final EmojiFactory EMOJI_FACTORY =
         EmojiFactory.newAvailableInstance();
     /* package */ static final int MIN_EMOJI, MAX_EMOJI;
@@ -330,7 +331,7 @@
             boolean hasTab = getLineContainsTab(i);
             if (directions == DIRS_ALL_LEFT_TO_RIGHT &&
                     !spannedText && !hasTab) {
-                if (Config.DEBUG) {
+                if (DEBUG) {
                     Assert.assertTrue(dir == DIR_LEFT_TO_RIGHT);
                     Assert.assertNotNull(c);
                 }
@@ -797,7 +798,7 @@
     }
     
     private int getLineVisibleEnd(int line, int start, int end) {
-        if (Config.DEBUG) {
+        if (DEBUG) {
             Assert.assertTrue(getLineStart(line) == start && getLineStart(line+1) == end);
         }
 
@@ -1340,7 +1341,7 @@
         char[] buf;
         if (!hasTabs) {
             if (directions == DIRS_ALL_LEFT_TO_RIGHT) {
-                if (Config.DEBUG) {
+                if (DEBUG) {
                     Assert.assertTrue(DIR_LEFT_TO_RIGHT == dir);
                 }
                 Styled.drawText(canvas, text, start, end, dir, false, x, top, y, bottom, paint, workPaint, false);
diff --git a/core/java/android/util/DebugUtils.java b/core/java/android/util/DebugUtils.java
index 1c5d669..56f389c 100644
--- a/core/java/android/util/DebugUtils.java
+++ b/core/java/android/util/DebugUtils.java
@@ -43,8 +43,8 @@
      *
      * <p>This class is useful for debugging and logging purpose:</p>
      * <pre>
-     * if (Config.DEBUG) {
-     *   if (DebugUtils.isObjectSelected(childView) && Config.LOGV) {
+     * if (DEBUG) {
+     *   if (DebugUtils.isObjectSelected(childView) && LOGV_ENABLED) {
      *     Log.v(TAG, "Object " + childView + " logged!");
      *   }
      * }
diff --git a/core/java/android/view/animation/Transformation.java b/core/java/android/view/animation/Transformation.java
index f9e85bf..cf210c8 100644
--- a/core/java/android/view/animation/Transformation.java
+++ b/core/java/android/view/animation/Transformation.java
@@ -18,6 +18,8 @@
 
 import android.graphics.Matrix;
 
+import java.io.PrintWriter;
+
 /**
  * Defines the transformation to be applied at
  * one point in time of an Animation.
@@ -134,14 +136,38 @@
     
     @Override
     public String toString() {
-        return "Transformation{alpha=" + mAlpha + " matrix="
-                + mMatrix.toShortString() + "}";
+        StringBuilder sb = new StringBuilder(64);
+        sb.append("Transformation");
+        toShortString(sb);
+        return sb.toString();
     }
     
     /**
      * Return a string representation of the transformation in a compact form.
      */
     public String toShortString() {
-        return "{alpha=" + mAlpha + " matrix=" + mMatrix.toShortString() + "}";
+        StringBuilder sb = new StringBuilder(64);
+        toShortString(sb);
+        return sb.toString();
+    }
+    
+    /**
+     * @hide
+     */
+    public void toShortString(StringBuilder sb) {
+        sb.append("{alpha="); sb.append(mAlpha);
+        sb.append(" matrix="); mMatrix.toShortString(sb);
+        sb.append('}');
+    }
+    
+    /**
+     * Print short string, to optimize dumping.
+     * @hide
+     */
+    public void printShortString(PrintWriter pw) {
+        pw.print("{alpha="); pw.print(mAlpha);
+        pw.print(" matrix=");
+        mMatrix.printShortString(pw);
+        pw.print('}');
     }
 }
diff --git a/core/java/android/webkit/BrowserFrame.java b/core/java/android/webkit/BrowserFrame.java
index 5401a6e..ba3f78c 100644
--- a/core/java/android/webkit/BrowserFrame.java
+++ b/core/java/android/webkit/BrowserFrame.java
@@ -24,7 +24,6 @@
 import android.net.http.SslCertificate;
 import android.os.Handler;
 import android.os.Message;
-import android.util.Config;
 import android.util.Log;
 import android.util.TypedValue;
 
@@ -120,7 +119,7 @@
         mDatabase = WebViewDatabase.getInstance(context);
         mWebViewCore = w;
 
-        if (Config.LOGV) {
+        if (WebView.LOGV_ENABLED) {
             Log.v(LOGTAG, "BrowserFrame constructor: this=" + this);
         }
     }
@@ -331,7 +330,7 @@
         switch (msg.what) {
             case FRAME_COMPLETED: {
                 if (mSettings.getSavePassword() && hasPasswordField()) {
-                    if (Config.DEBUG) {
+                    if (WebView.DEBUG) {
                         Assert.assertNotNull(mCallbackProxy.getBackForwardList()
                                 .getCurrentItem());
                     }
@@ -480,7 +479,7 @@
             }
             if (mSettings.getSavePassword() && hasPasswordField()) {
                 try {
-                    if (Config.DEBUG) {
+                    if (WebView.DEBUG) {
                         Assert.assertNotNull(mCallbackProxy.getBackForwardList()
                                 .getCurrentItem());
                     }
@@ -528,7 +527,7 @@
         // is this resource the main-frame top-level page?
         boolean isMainFramePage = mIsMainFrame;
 
-        if (Config.LOGV) {
+        if (WebView.LOGV_ENABLED) {
             Log.v(LOGTAG, "startLoadingResource: url=" + url + ", method="
                     + method + ", postData=" + postData + ", isHighPriority="
                     + isHighPriority + ", isMainFramePage=" + isMainFramePage);
diff --git a/core/java/android/webkit/CacheManager.java b/core/java/android/webkit/CacheManager.java
index 4528b73..7897435 100644
--- a/core/java/android/webkit/CacheManager.java
+++ b/core/java/android/webkit/CacheManager.java
@@ -19,7 +19,6 @@
 import android.content.Context;
 import android.net.http.Headers;
 import android.os.FileUtils;
-import android.util.Config;
 import android.util.Log;
 import java.io.File;
 import java.io.FileInputStream;
@@ -322,7 +321,7 @@
             }
         }
 
-        if (Config.LOGV) {
+        if (WebView.LOGV_ENABLED) {
             Log.v(LOGTAG, "getCacheFile for url " + url);
         }
 
@@ -416,7 +415,7 @@
 
         mDataBase.addCache(url, cacheRet);
 
-        if (Config.LOGV) {
+        if (WebView.LOGV_ENABLED) {
             Log.v(LOGTAG, "saveCacheFile for url " + url);
         }
     }
diff --git a/core/java/android/webkit/CallbackProxy.java b/core/java/android/webkit/CallbackProxy.java
index 0f9f29c..5f8acc8 100644
--- a/core/java/android/webkit/CallbackProxy.java
+++ b/core/java/android/webkit/CallbackProxy.java
@@ -30,7 +30,6 @@
 import android.os.Message;
 import android.os.SystemClock;
 import android.provider.Browser;
-import android.util.Config;
 import android.util.Log;
 import android.view.KeyEvent;
 import android.view.LayoutInflater;
@@ -822,7 +821,7 @@
             String password, Message resumeMsg) {
         // resumeMsg should be null at this point because we want to create it
         // within the CallbackProxy.
-        if (Config.DEBUG) {
+        if (WebView.DEBUG) {
             junit.framework.Assert.assertNull(resumeMsg);
         }
         resumeMsg = obtainMessage(NOTIFY);
diff --git a/core/java/android/webkit/CookieManager.java b/core/java/android/webkit/CookieManager.java
index d90a2fd..c0c6775 100644
--- a/core/java/android/webkit/CookieManager.java
+++ b/core/java/android/webkit/CookieManager.java
@@ -18,7 +18,6 @@
 
 import android.net.ParseException;
 import android.net.WebAddress;
-import android.util.Config;
 import android.util.Log;
 
 import java.util.ArrayList;
@@ -263,7 +262,7 @@
         if (!mAcceptCookie || uri == null) {
             return;
         }
-        if (Config.LOGV) {
+        if (WebView.LOGV_ENABLED) {
             Log.v(LOGTAG, "setCookie: uri: " + uri + " value: " + value);
         }
 
@@ -428,12 +427,12 @@
             }
         }
         if (ret.length() > 0) {
-            if (Config.LOGV) {
+            if (WebView.LOGV_ENABLED) {
                 Log.v(LOGTAG, "getCookie: uri: " + uri + " value: " + ret);
             }
             return ret.toString();
         } else {
-            if (Config.LOGV) {
+            if (WebView.LOGV_ENABLED) {
                 Log.v(LOGTAG, "getCookie: uri: " + uri
                         + " But can't find cookie.");
             }
@@ -589,7 +588,7 @@
             Iterator<ArrayList<Cookie>> listIter = cookieLists.iterator();
             while (listIter.hasNext() && count < MAX_RAM_COOKIES_COUNT) {
                 ArrayList<Cookie> list = listIter.next();
-                if (Config.DEBUG) {
+                if (WebView.DEBUG) {
                     Iterator<Cookie> iter = list.iterator();
                     while (iter.hasNext() && count < MAX_RAM_COOKIES_COUNT) {
                         Cookie cookie = iter.next();
@@ -609,7 +608,7 @@
 
         ArrayList<Cookie> retlist = new ArrayList<Cookie>();
         if (mapSize >= MAX_RAM_DOMAIN_COUNT || count >= MAX_RAM_COOKIES_COUNT) {
-            if (Config.DEBUG) {
+            if (WebView.DEBUG) {
                 Log.v(LOGTAG, count + " cookies used " + byteCount
                         + " bytes with " + mapSize + " domains");
             }
@@ -617,7 +616,7 @@
             int toGo = mapSize / 10 + 1;
             while (toGo-- > 0){
                 String domain = domains[toGo].toString();
-                if (Config.LOGV) {
+                if (WebView.LOGV_ENABLED) {
                     Log.v(LOGTAG, "delete domain: " + domain
                             + " from RAM cache");
                 }
diff --git a/core/java/android/webkit/CookieSyncManager.java b/core/java/android/webkit/CookieSyncManager.java
index f2511d8..8d66529 100644
--- a/core/java/android/webkit/CookieSyncManager.java
+++ b/core/java/android/webkit/CookieSyncManager.java
@@ -17,7 +17,6 @@
 package android.webkit;
 
 import android.content.Context;
-import android.util.Config;
 import android.util.Log;
 import android.webkit.CookieManager.Cookie;
 
@@ -162,7 +161,7 @@
     }
 
     protected void syncFromRamToFlash() {
-        if (Config.LOGV) {
+        if (WebView.LOGV_ENABLED) {
             Log.v(LOGTAG, "CookieSyncManager::syncFromRamToFlash STARTS");
         }
 
@@ -179,7 +178,7 @@
                 CookieManager.getInstance().deleteLRUDomain();
         syncFromRamToFlash(lruList);
 
-        if (Config.LOGV) {
+        if (WebView.LOGV_ENABLED) {
             Log.v(LOGTAG, "CookieSyncManager::syncFromRamToFlash DONE");
         }
     }
diff --git a/core/java/android/webkit/FrameLoader.java b/core/java/android/webkit/FrameLoader.java
index 42d03f0..6f1b160 100644
--- a/core/java/android/webkit/FrameLoader.java
+++ b/core/java/android/webkit/FrameLoader.java
@@ -18,7 +18,6 @@
 
 import android.net.http.EventHandler;
 import android.net.http.RequestHandle;
-import android.util.Config;
 import android.util.Log;
 import android.webkit.CacheManager.CacheResult;
 
@@ -121,7 +120,7 @@
         } else if (handleLocalFile(url, mListener, mSettings)) {
             return true;
         }
-        if (Config.LOGV) {
+        if (WebView.LOGV_ENABLED) {
             Log.v(LOGTAG, "FrameLoader.executeLoad: url protocol not supported:"
                     + mListener.url());
         }
@@ -181,7 +180,7 @@
             return true;
         }
 
-        if (Config.LOGV) {
+        if (WebView.LOGV_ENABLED) {
             Log.v(LOGTAG, "FrameLoader: http " + mMethod + " load for: "
                     + mListener.url());
         }
@@ -212,7 +211,7 @@
      * setup a load from the byte stream in a CacheResult.
      */
     private void startCacheLoad(CacheResult result) {
-        if (Config.LOGV) {
+        if (WebView.LOGV_ENABLED) {
             Log.v(LOGTAG, "FrameLoader: loading from cache: "
                   + mListener.url());
         }
@@ -286,7 +285,7 @@
             // of it's state. If it is not in the cache, then go to the 
             // network.
             case WebSettings.LOAD_CACHE_ELSE_NETWORK: {
-                if (Config.LOGV) {
+                if (WebView.LOGV_ENABLED) {
                     Log.v(LOGTAG, "FrameLoader: checking cache: "
                             + mListener.url());
                 }
diff --git a/core/java/android/webkit/JWebCoreJavaBridge.java b/core/java/android/webkit/JWebCoreJavaBridge.java
index a0049ac..2a84683 100644
--- a/core/java/android/webkit/JWebCoreJavaBridge.java
+++ b/core/java/android/webkit/JWebCoreJavaBridge.java
@@ -18,7 +18,6 @@
 
 import android.os.Handler;
 import android.os.Message;
-import android.util.Config;
 import android.util.Log;
 
 final class JWebCoreJavaBridge extends Handler {
@@ -156,7 +155,7 @@
      * @param timemillis The relative time when the timer should fire
      */
     private void setSharedTimer(long timemillis) {
-        if (Config.LOGV) Log.v(LOGTAG, "setSharedTimer " + timemillis);
+        if (WebView.LOGV_ENABLED) Log.v(LOGTAG, "setSharedTimer " + timemillis);
 
         if (timemillis <= 0) {
             // we don't accumulate the sharedTimer unless it is a delayed
@@ -180,7 +179,7 @@
      * Stop the shared timer.
      */
     private void stopSharedTimer() {
-        if (Config.LOGV) {
+        if (WebView.LOGV_ENABLED) {
             Log.v(LOGTAG, "stopSharedTimer removing all timers");
         }
         removeMessages(TIMER_MESSAGE);
diff --git a/core/java/android/webkit/LoadListener.java b/core/java/android/webkit/LoadListener.java
index c64200cd..d583eb1 100644
--- a/core/java/android/webkit/LoadListener.java
+++ b/core/java/android/webkit/LoadListener.java
@@ -29,7 +29,6 @@
 
 import android.os.Handler;
 import android.os.Message;
-import android.util.Config;
 import android.util.Log;
 import android.webkit.CacheManager.CacheResult;
 
@@ -134,7 +133,7 @@
 
     LoadListener(Context context, BrowserFrame frame, String url,
             int nativeLoader, boolean synchronous, boolean isMainPageLoader) {
-        if (Config.LOGV) {
+        if (WebView.LOGV_ENABLED) {
             Log.v(LOGTAG, "LoadListener constructor url=" + url);
         }
         mContext = context;
@@ -285,7 +284,7 @@
      * directly
      */
     public void headers(Headers headers) {
-        if (Config.LOGV) Log.v(LOGTAG, "LoadListener.headers");
+        if (WebView.LOGV_ENABLED) Log.v(LOGTAG, "LoadListener.headers");
         sendMessageInternal(obtainMessage(MSG_CONTENT_HEADERS, headers));
     }
 
@@ -432,7 +431,7 @@
      */
     public void status(int majorVersion, int minorVersion,
             int code, /* Status-Code value */ String reasonPhrase) {
-        if (Config.LOGV) {
+        if (WebView.LOGV_ENABLED) {
             Log.v(LOGTAG, "LoadListener: from: " + mUrl
                     + " major: " + majorVersion
                     + " minor: " + minorVersion
@@ -489,7 +488,7 @@
      * directly
      */
     public void error(int id, String description) {
-        if (Config.LOGV) {
+        if (WebView.LOGV_ENABLED) {
             Log.v(LOGTAG, "LoadListener.error url:" +
                     url() + " id:" + id + " description:" + description);
         }
@@ -517,7 +516,7 @@
      * mDataBuilder is a thread-safe structure.
      */
     public void data(byte[] data, int length) {
-        if (Config.LOGV) {
+        if (WebView.LOGV_ENABLED) {
             Log.v(LOGTAG, "LoadListener.data(): url: " + url());
         }
 
@@ -555,7 +554,7 @@
      * directly
      */
     public void endData() {
-        if (Config.LOGV) {
+        if (WebView.LOGV_ENABLED) {
             Log.v(LOGTAG, "LoadListener.endData(): url: " + url());
         }
         sendMessageInternal(obtainMessage(MSG_CONTENT_FINISHED));
@@ -608,7 +607,7 @@
                 // before calling it.
                 if (mCacheLoader != null) {
                     mCacheLoader.load();
-                    if (Config.LOGV) {
+                    if (WebView.LOGV_ENABLED) {
                         Log.v(LOGTAG, "LoadListener cache load url=" + url());
                     }
                     return;
@@ -658,7 +657,7 @@
                     CacheManager.HEADER_KEY_IFNONEMATCH) &&
                     !headers.containsKey(
                             CacheManager.HEADER_KEY_IFMODIFIEDSINCE)) {
-                if (Config.LOGV) {
+                if (WebView.LOGV_ENABLED) {
                     Log.v(LOGTAG, "FrameLoader: HTTP URL in cache " +
                             "and usable: " + url());
                 }
@@ -677,7 +676,7 @@
      * directly
      */
     public void handleSslErrorRequest(SslError error) {
-        if (Config.LOGV) {
+        if (WebView.LOGV_ENABLED) {
             Log.v(LOGTAG,
                     "LoadListener.handleSslErrorRequest(): url:" + url() +
                     " primary error: " + error.getPrimaryError() +
@@ -743,7 +742,7 @@
      * are null, cancel the request.
      */
     void handleAuthResponse(String username, String password) {
-        if (Config.LOGV) {
+        if (WebView.LOGV_ENABLED) {
             Log.v(LOGTAG, "LoadListener.handleAuthResponse: url: " + mUrl
                     + " username: " + username
                     + " password: " + password);
@@ -840,7 +839,7 @@
     }
 
     void attachRequestHandle(RequestHandle requestHandle) {
-        if (Config.LOGV) {
+        if (WebView.LOGV_ENABLED) {
             Log.v(LOGTAG, "LoadListener.attachRequestHandle(): " +
                     "requestHandle: " +  requestHandle);
         }
@@ -848,7 +847,7 @@
     }
 
     void detachRequestHandle() {
-        if (Config.LOGV) {
+        if (WebView.LOGV_ENABLED) {
             Log.v(LOGTAG, "LoadListener.detachRequestHandle(): " +
                     "requestHandle: " + mRequestHandle);
         }
@@ -887,7 +886,7 @@
      */
     static boolean willLoadFromCache(String url) {
         boolean inCache = CacheManager.getCacheFile(url, null) != null;
-        if (Config.LOGV) {
+        if (WebView.LOGV_ENABLED) {
             Log.v(LOGTAG, "willLoadFromCache: " + url + " in cache: " + 
                     inCache);
         }
@@ -1057,7 +1056,7 @@
      * EventHandler's method call.
      */
     public void cancel() {
-        if (Config.LOGV) {
+        if (WebView.LOGV_ENABLED) {
             if (mRequestHandle == null) {
                 Log.v(LOGTAG, "LoadListener.cancel(): no requestHandle");
             } else {
@@ -1189,7 +1188,7 @@
             tearDown();
         }
 
-        if (Config.LOGV) {
+        if (WebView.LOGV_ENABLED) {
             Log.v(LOGTAG, "LoadListener.onRedirect(): redirect to: " +
                     redirectTo);
         }
@@ -1203,7 +1202,7 @@
             Pattern.compile("^((?:[xX]-)?[a-zA-Z\\*]+/[\\w\\+\\*-]+[\\.[\\w\\+-]+]*)$");
 
     private void parseContentTypeHeader(String contentType) {
-        if (Config.LOGV) {
+        if (WebView.LOGV_ENABLED) {
             Log.v(LOGTAG, "LoadListener.parseContentTypeHeader: " +
                     "contentType: " + contentType);
         }
@@ -1390,7 +1389,7 @@
      */
     private String guessMimeTypeFromExtension() {
         // PENDING: need to normalize url
-        if (Config.LOGV) {
+        if (WebView.LOGV_ENABLED) {
             Log.v(LOGTAG, "guessMimeTypeFromExtension: mURL = " + mUrl);
         }
 
@@ -1425,7 +1424,7 @@
      * Cycle through our messages for synchronous loads.
      */
     /* package */ void loadSynchronousMessages() {
-        if (Config.DEBUG && !mSynchronous) {
+        if (WebView.DEBUG && !mSynchronous) {
             throw new AssertionError();
         }
         // Note: this can be called twice if it is a synchronous network load,
diff --git a/core/java/android/webkit/Network.java b/core/java/android/webkit/Network.java
index 6fa0775..c9b80ce 100644
--- a/core/java/android/webkit/Network.java
+++ b/core/java/android/webkit/Network.java
@@ -20,7 +20,6 @@
 import android.net.http.*;
 import android.os.*;
 import android.util.Log;
-import android.util.Config;
 
 import java.io.ByteArrayInputStream;
 import java.io.InputStream;
@@ -133,7 +132,7 @@
      * XXX: Must be created in the same thread as WebCore!!!!!
      */
     private Network(Context context) {
-        if (Config.DEBUG) {
+        if (WebView.DEBUG) {
             Assert.assertTrue(Thread.currentThread().
                     getName().equals(WebViewCore.THREAD_NAME));
         }
@@ -233,7 +232,7 @@
      * connecting through the proxy.
      */
     public synchronized void setProxyUsername(String proxyUsername) {
-        if (Config.DEBUG) {
+        if (WebView.DEBUG) {
             Assert.assertTrue(isValidProxySet());
         }
 
@@ -253,7 +252,7 @@
      * connecting through the proxy.
      */
     public synchronized void setProxyPassword(String proxyPassword) {
-        if (Config.DEBUG) {
+        if (WebView.DEBUG) {
             Assert.assertTrue(isValidProxySet());
         }
 
@@ -267,7 +266,7 @@
      * @return True iff succeeds.
      */
     public boolean saveState(Bundle outState) {
-        if (Config.LOGV) {
+        if (WebView.LOGV_ENABLED) {
             Log.v(LOGTAG, "Network.saveState()");
         }
 
@@ -281,7 +280,7 @@
      * @return True iff succeeds.
      */
     public boolean restoreState(Bundle inState) {
-        if (Config.LOGV) {
+        if (WebView.LOGV_ENABLED) {
             Log.v(LOGTAG, "Network.restoreState()");
         }
 
@@ -301,7 +300,7 @@
      * @param loader The loader that resulted in SSL errors.
      */
     public void handleSslErrorRequest(LoadListener loader) {
-        if (Config.DEBUG) Assert.assertNotNull(loader);
+        if (WebView.DEBUG) Assert.assertNotNull(loader);
         if (loader != null) {
             mSslErrorHandler.handleSslErrorRequest(loader);
         }
@@ -314,7 +313,7 @@
      * authentication request.
      */
     public void handleAuthRequest(LoadListener loader) {
-        if (Config.DEBUG) Assert.assertNotNull(loader);
+        if (WebView.DEBUG) Assert.assertNotNull(loader);
         if (loader != null) {
             mHttpAuthHandler.handleAuthRequest(loader);
         }
diff --git a/core/java/android/webkit/SslErrorHandler.java b/core/java/android/webkit/SslErrorHandler.java
index 2e2fa12..5f84bbe 100644
--- a/core/java/android/webkit/SslErrorHandler.java
+++ b/core/java/android/webkit/SslErrorHandler.java
@@ -22,7 +22,6 @@
 import android.os.Bundle;
 import android.os.Handler;
 import android.os.Message;
-import android.util.Config;
 import android.util.Log;
 
 import java.util.LinkedList;
@@ -121,7 +120,7 @@
      * Handles SSL error(s) on the way up to the user.
      */
     /* package */ synchronized void handleSslErrorRequest(LoadListener loader) {
-        if (Config.LOGV) {
+        if (WebView.LOGV_ENABLED) {
             Log.v(LOGTAG, "SslErrorHandler.handleSslErrorRequest(): " +
                   "url=" + loader.url());
         }
@@ -158,14 +157,14 @@
 
             SslError error = loader.sslError();
 
-            if (Config.DEBUG) {
+            if (WebView.DEBUG) {
                 Assert.assertNotNull(error);
             }
 
             int primary = error.getPrimaryError();
             String host = loader.host();
 
-            if (Config.DEBUG) {
+            if (WebView.DEBUG) {
                 Assert.assertTrue(host != null && primary != 0);
             }
 
@@ -206,11 +205,11 @@
      */
     /* package */ synchronized void handleSslErrorResponse(boolean proceed) {
         LoadListener loader = mLoaderQueue.poll();
-        if (Config.DEBUG) {
+        if (WebView.DEBUG) {
             Assert.assertNotNull(loader);
         }
 
-        if (Config.LOGV) {
+        if (WebView.LOGV_ENABLED) {
             Log.v(LOGTAG, "SslErrorHandler.handleSslErrorResponse():"
                   + " proceed: " + proceed
                   + " url:" + loader.url());
@@ -222,7 +221,7 @@
                 int primary = loader.sslError().getPrimaryError();
                 String host = loader.host();
 
-                if (Config.DEBUG) {
+                if (WebView.DEBUG) {
                     Assert.assertTrue(host != null && primary != 0);
                 }
                 boolean hasKey = mSslPrefTable.containsKey(host);
diff --git a/core/java/android/webkit/StreamLoader.java b/core/java/android/webkit/StreamLoader.java
index 9098307..705157c 100644
--- a/core/java/android/webkit/StreamLoader.java
+++ b/core/java/android/webkit/StreamLoader.java
@@ -20,7 +20,6 @@
 import android.net.http.Headers;
 import android.os.Handler;
 import android.os.Message;
-import android.util.Config;
 
 import java.io.IOException;
 import java.io.InputStream;
@@ -114,7 +113,7 @@
      * @see android.os.Handler#handleMessage(android.os.Message)
      */
     public void handleMessage(Message msg) {
-        if (Config.DEBUG && mHandler.isSynchronous()) {
+        if (WebView.DEBUG && mHandler.isSynchronous()) {
             throw new AssertionError();
         }
         switch(msg.what) {
diff --git a/core/java/android/webkit/URLUtil.java b/core/java/android/webkit/URLUtil.java
index 0e8144e..d6ac3e9 100644
--- a/core/java/android/webkit/URLUtil.java
+++ b/core/java/android/webkit/URLUtil.java
@@ -23,7 +23,6 @@
 import android.net.Uri;
 import android.net.ParseException;
 import android.net.WebAddress;
-import android.util.Config;
 import android.util.Log;
 
 public final class URLUtil {
@@ -62,7 +61,7 @@
             webAddress = new WebAddress(inUrl);
         } catch (ParseException ex) {
 
-            if (Config.LOGV) {
+            if (WebView.LOGV_ENABLED) {
                 Log.v(LOGTAG, "smartUrlFilter: failed to parse url = " + inUrl);
             }
             return retVal;
diff --git a/core/java/android/webkit/WebBackForwardList.java b/core/java/android/webkit/WebBackForwardList.java
index 9dea5ec..ffd6a11 100644
--- a/core/java/android/webkit/WebBackForwardList.java
+++ b/core/java/android/webkit/WebBackForwardList.java
@@ -16,7 +16,6 @@
 
 package android.webkit;
 
-import android.util.Config;
 import java.io.Serializable;
 import java.util.ArrayList;
 
@@ -138,7 +137,7 @@
         // when removing the first item, we can assert that the index is 0.
         // This lets us change the current index without having to query the
         // native BackForwardList.
-        if (Config.DEBUG && (index != 0)) {
+        if (WebView.DEBUG && (index != 0)) {
             throw new AssertionError();
         }
         final WebHistoryItem h = mArray.remove(index);
diff --git a/core/java/android/webkit/WebSettings.java b/core/java/android/webkit/WebSettings.java
index 025e6bb..105eacd 100644
--- a/core/java/android/webkit/WebSettings.java
+++ b/core/java/android/webkit/WebSettings.java
@@ -1097,7 +1097,7 @@
     /*package*/
     synchronized void syncSettingsAndCreateHandler(BrowserFrame frame) {
         mBrowserFrame = frame;
-        if (android.util.Config.DEBUG) {
+        if (WebView.DEBUG) {
             junit.framework.Assert.assertTrue(frame.mNativeFrame != 0);
         }
         nativeSync(frame.mNativeFrame);
diff --git a/core/java/android/webkit/WebSyncManager.java b/core/java/android/webkit/WebSyncManager.java
index e6e9994..ded17ed 100644
--- a/core/java/android/webkit/WebSyncManager.java
+++ b/core/java/android/webkit/WebSyncManager.java
@@ -21,7 +21,6 @@
 import android.os.Looper;
 import android.os.Message;
 import android.os.Process;
-import android.util.Config;
 import android.util.Log;
 
 abstract class WebSyncManager implements Runnable {
@@ -48,7 +47,7 @@
         @Override
         public void handleMessage(Message msg) {
             if (msg.what == SYNC_MESSAGE) {
-                if (Config.LOGV) {
+                if (WebView.LOGV_ENABLED) {
                     Log.v(LOGTAG, "*** WebSyncManager sync ***");
                 }
                 syncFromRamToFlash();
@@ -95,7 +94,7 @@
      * sync() forces sync manager to sync now
      */
     public void sync() {
-        if (Config.LOGV) {
+        if (WebView.LOGV_ENABLED) {
             Log.v(LOGTAG, "*** WebSyncManager sync ***");
         }
         if (mHandler == null) {
@@ -110,7 +109,7 @@
      * resetSync() resets sync manager's timer
      */
     public void resetSync() {
-        if (Config.LOGV) {
+        if (WebView.LOGV_ENABLED) {
             Log.v(LOGTAG, "*** WebSyncManager resetSync ***");
         }
         if (mHandler == null) {
@@ -125,7 +124,7 @@
      * startSync() requests sync manager to start sync
      */
     public void startSync() {
-        if (Config.LOGV) {
+        if (WebView.LOGV_ENABLED) {
             Log.v(LOGTAG, "***  WebSyncManager startSync ***, Ref count:" + 
                     mStartSyncRefCount);
         }
@@ -143,7 +142,7 @@
      * the queue to break the sync loop
      */
     public void stopSync() {
-        if (Config.LOGV) {
+        if (WebView.LOGV_ENABLED) {
             Log.v(LOGTAG, "*** WebSyncManager stopSync ***, Ref count:" + 
                     mStartSyncRefCount);
         }
diff --git a/core/java/android/webkit/WebView.java b/core/java/android/webkit/WebView.java
index a5846ed..a926355 100644
--- a/core/java/android/webkit/WebView.java
+++ b/core/java/android/webkit/WebView.java
@@ -42,7 +42,6 @@
 import android.text.Selection;
 import android.text.Spannable;
 import android.util.AttributeSet;
-import android.util.Config;
 import android.util.EventLog;
 import android.util.Log;
 import android.view.Gravity;
@@ -110,7 +109,7 @@
     // keep debugging parameters near the top of the file
     static final String LOGTAG = "webview";
     static final boolean DEBUG = false;
-    static final boolean LOGV_ENABLED = DEBUG ? Config.LOGD : Config.LOGV;
+    static final boolean LOGV_ENABLED = DEBUG;
 
     private class ExtendedZoomControls extends FrameLayout {
         public ExtendedZoomControls(Context context, AttributeSet attrs) {
diff --git a/core/java/android/webkit/WebViewCore.java b/core/java/android/webkit/WebViewCore.java
index 72b30f6..58d8ae7 100644
--- a/core/java/android/webkit/WebViewCore.java
+++ b/core/java/android/webkit/WebViewCore.java
@@ -29,7 +29,6 @@
 import android.os.Looper;
 import android.os.Message;
 import android.os.Process;
-import android.util.Config;
 import android.util.Log;
 import android.util.SparseBooleanArray;
 import android.view.KeyEvent;
@@ -43,7 +42,7 @@
 
     private static final String LOGTAG = "webcore";
     static final boolean DEBUG = false;
-    static final boolean LOGV_ENABLED = DEBUG ? Config.LOGD : Config.LOGV;
+    static final boolean LOGV_ENABLED = DEBUG;
 
     static {
         // Load libwebcore during static initialization. This happens in the
diff --git a/core/java/android/webkit/gears/AndroidWifiDataProvider.java b/core/java/android/webkit/gears/AndroidWifiDataProvider.java
index 7379f59..d2850b06 100644
--- a/core/java/android/webkit/gears/AndroidWifiDataProvider.java
+++ b/core/java/android/webkit/gears/AndroidWifiDataProvider.java
@@ -33,7 +33,6 @@
 import android.net.wifi.WifiManager;
 import android.os.Handler;
 import android.os.Looper;
-import android.util.Config;
 import android.util.Log;
 import android.webkit.WebView;
 import java.util.List;
@@ -48,6 +47,11 @@
    */
   private static final String TAG = "Gears-J-WifiProvider";
   /**
+   * Flag for guarding Log.v() calls.
+   * Set to true to enable extra debug logging.
+   */
+  private static final boolean LOGV_ENABLED = false;
+  /**
    * Our Wifi manager instance.
    */
   private WifiManager mWifiManager;
@@ -104,7 +108,7 @@
    */
   public void shutdown() {
     mContext.unregisterReceiver(this);
-    if (Config.LOGV) {
+    if (LOGV_ENABLED) {
       Log.v(TAG, "Wifi provider closed.");
     }
   }
@@ -118,7 +122,7 @@
   public void onReceive(Context context, Intent intent) {
     if (intent.getAction().equals(
             mWifiManager.SCAN_RESULTS_AVAILABLE_ACTION)) {
-      if (Config.LOGV) {
+      if (LOGV_ENABLED) {
         Log.v(TAG, "Wifi scan resulst available");
       }
       onUpdateAvailable(mWifiManager.getScanResults(), mNativeObject);
diff --git a/core/java/android/webkit/gears/ApacheHttpRequestAndroid.java b/core/java/android/webkit/gears/ApacheHttpRequestAndroid.java
index 529e666..74d27ed 100644
--- a/core/java/android/webkit/gears/ApacheHttpRequestAndroid.java
+++ b/core/java/android/webkit/gears/ApacheHttpRequestAndroid.java
@@ -29,7 +29,6 @@
 import android.os.Handler;
 import android.os.Looper;
 import android.os.Message;
-import android.util.Config;
 import android.util.Log;
 import android.webkit.CacheManager;
 import android.webkit.CacheManager.CacheResult;
@@ -88,6 +87,8 @@
 public final class ApacheHttpRequestAndroid {
     /** Debug logging tag. */
     private static final String LOG_TAG = "Gears-J";
+    /** Flag for guarding Log.v() calls. */
+    private static final boolean LOGV_ENABLED = false;
     /** HTTP response header line endings are CR-LF style. */
     private static final String HTTP_LINE_ENDING = "\r\n";
     /** Safe MIME type to use whenever it isn't specified. */
@@ -173,18 +174,18 @@
         public void run() {
             boolean problem = false;
             try {
-                if (Config.LOGV) {
+                if (LOGV_ENABLED) {
                     Log.i(LOG_TAG, "REQUEST : " + mMethod.getRequestLine());
                 }
                 mResponse = mClient.execute(mMethod);
                 if (mResponse != null) {
-                    if (Config.LOGV) {
+                    if (LOGV_ENABLED) {
                         Log.i(LOG_TAG, "response (status line): "
                               + mResponse.getStatusLine());
                     }
                     mResponseLine = "" + mResponse.getStatusLine();
                 } else {
-                    if (Config.LOGV) {
+                    if (LOGV_ENABLED) {
                         Log.i(LOG_TAG, "problem, response == null");
                     }
                     problem = true;
@@ -198,7 +199,7 @@
             }
 
             if (!problem) {
-                if (Config.LOGV) {
+                if (LOGV_ENABLED) {
                     Log.i(LOG_TAG, "Request complete ("
                           + mMethod.getRequestLine() + ")");
                 }
@@ -206,7 +207,7 @@
                 mConnectionFailedLock.lock();
                 mConnectionFailed = true;
                 mConnectionFailedLock.unlock();
-                if (Config.LOGV) {
+                if (LOGV_ENABLED) {
                     Log.i(LOG_TAG, "Request FAILED ("
                           + mMethod.getRequestLine() + ")");
                 }
@@ -233,7 +234,7 @@
                 try {
                     wait();
                 } catch (InterruptedException e) {
-                    if (Config.LOGV) {
+                    if (LOGV_ENABLED) {
                         Log.i(LOG_TAG, "InterruptedException while putting " +
                             "a DataPacket in the Buffer: " + e);
                     }
@@ -248,7 +249,7 @@
                 try {
                     wait();
                 } catch (InterruptedException e) {
-                    if (Config.LOGV) {
+                    if (LOGV_ENABLED) {
                       Log.i(LOG_TAG, "InterruptedException while getting " +
                           "a DataPacket in the Buffer: " + e);
                     }
@@ -271,7 +272,7 @@
                 try {
                     wait();
                 } catch (InterruptedException e) {
-                    if (Config.LOGV) {
+                    if (LOGV_ENABLED) {
                         Log.i(LOG_TAG, "InterruptedException while waiting " +
                             "until a DataPacket is consumed: " + e);
                     }
@@ -285,7 +286,7 @@
                 try {
                     wait();
                 } catch (InterruptedException e) {
-                    if (Config.LOGV) {
+                    if (LOGV_ENABLED) {
                         Log.i(LOG_TAG, "InterruptedException while indicating "
                               + "that the DataPacket has been consumed: " + e);
                     }
@@ -373,14 +374,14 @@
                 mSignal.packetConsumed();
                 mConnectionFailedLock.lock();
                 if (mConnectionFailed) {
-                    if (Config.LOGV) {
+                    if (LOGV_ENABLED) {
                         Log.i(LOG_TAG, "stopping loop on error");
                     }
                     finished = true;
                 }
                 mConnectionFailedLock.unlock();
             }
-            if (Config.LOGV) {
+            if (LOGV_ENABLED) {
                 Log.i(LOG_TAG, "flushing the outputstream...");
             }
             mOutputStream.flush();
@@ -399,7 +400,7 @@
         private void write(DataPacket packet) {
             try {
                 if (mOutputStream == null) {
-                    if (Config.LOGV) {
+                    if (LOGV_ENABLED) {
                         Log.i(LOG_TAG, "NO OUTPUT STREAM !!!");
                     }
                     return;
@@ -407,7 +408,7 @@
                 mOutputStream.write(packet.getBytes(), 0, packet.getLength());
                 mOutputStream.flush();
             } catch (IOException e) {
-                if (Config.LOGV) {
+                if (LOGV_ENABLED) {
                     Log.i(LOG_TAG, "exc: " + e);
                 }
                 mConnectionFailedLock.lock();
@@ -423,7 +424,7 @@
                     mStreamingReady.await();
                 }
             } catch (InterruptedException e) {
-                if (Config.LOGV) {
+                if (LOGV_ENABLED) {
                     Log.i(LOG_TAG, "InterruptedException in "
                           + "StreamEntity::isReady() : ", e);
                 }
@@ -468,7 +469,7 @@
      *                  False on failure.
      */
     public synchronized boolean open(String method, String url) {
-        if (Config.LOGV) {
+        if (LOGV_ENABLED) {
             Log.i(LOG_TAG, "open " + method + " " + url);
         }
         // Create the client
@@ -502,7 +503,7 @@
         } else if ("DELETE".equalsIgnoreCase(method)) {
             mMethod = new HttpDelete(url);
         } else {
-            if (Config.LOGV) {
+            if (LOGV_ENABLED) {
                 Log.i(LOG_TAG, "Method " + method + " not supported");
             }
             return false;
@@ -549,7 +550,7 @@
      * (unless already finished)
      */
     private void waitUntilConnectionFinished() {
-        if (Config.LOGV) {
+        if (LOGV_ENABLED) {
             Log.i(LOG_TAG, "waitUntilConnectionFinished("
                   + mConnectionFinished + ")");
         }
@@ -558,11 +559,11 @@
                 try {
                     mHttpThread.join();
                     mConnectionFinished = true;
-                    if (Config.LOGV) {
+                    if (LOGV_ENABLED) {
                         Log.i(LOG_TAG, "http thread joined");
                     }
                 } catch (InterruptedException e) {
-                    if (Config.LOGV) {
+                    if (LOGV_ENABLED) {
                         Log.i(LOG_TAG, "interrupted: " + e);
                     }
                 }
@@ -596,7 +597,7 @@
         Header[] headers = mResponse.getAllHeaders();
         for (int i = 0; i < headers.length; i++) {
             Header header = headers[i];
-            if (Config.LOGV) {
+            if (LOGV_ENABLED) {
                 Log.i(LOG_TAG, "header " + header.getName()
                       + " -> " + header.getValue());
             }
@@ -615,7 +616,7 @@
      */
     public synchronized void setRequestHeader(String name, String value) {
         String[] mapValue = { name, value };
-        if (Config.LOGV) {
+        if (LOGV_ENABLED) {
             Log.i(LOG_TAG, "setRequestHeader: " + name + " => " + value);
         }
         if (name.equalsIgnoreCase(KEY_CONTENT_LENGTH)) {
@@ -647,7 +648,7 @@
         while (it.hasNext()) {
             // Set the key case-sensitive.
             String[] entry = it.next();
-            if (Config.LOGV) {
+            if (LOGV_ENABLED) {
                 Log.i(LOG_TAG, "apply header " + entry[HEADERS_MAP_INDEX_KEY] +
                     " => " + entry[HEADERS_MAP_INDEX_VALUE]);
             }
@@ -671,7 +672,7 @@
                 return null;
             }
         } else {
-            if (Config.LOGV) {
+            if (LOGV_ENABLED) {
                 Log.i(LOG_TAG, "getResponseHeader() called but "
                       + "response not received");
             }
@@ -687,7 +688,7 @@
      */
     public synchronized String getAllResponseHeaders() {
         if (mResponseHeaders == null) {
-            if (Config.LOGV) {
+            if (LOGV_ENABLED) {
                 Log.i(LOG_TAG, "getAllResponseHeaders() called but "
                       + "response not received");
             }
@@ -715,7 +716,7 @@
      * @param value The associated value.
      */
     private void setResponseHeader(String name, String value) {
-        if (Config.LOGV) {
+        if (LOGV_ENABLED) {
             Log.i(LOG_TAG, "Set response header " + name + ": " + value);
         }
         String mapValue[] = { name, value };
@@ -766,7 +767,7 @@
         UrlInterceptHandlerGears.ServiceResponse serviceResponse =
             handler.getServiceResponse(url, mRequestHeaders);
         if (serviceResponse == null) {
-            if (Config.LOGV) {
+            if (LOGV_ENABLED) {
                 Log.i(LOG_TAG, "No response in LocalServer");
             }
             return false;
@@ -776,7 +777,7 @@
         mBodyInputStream = serviceResponse.getInputStream();
         mResponseLine = serviceResponse.getStatusLine();
         mResponseHeaders = serviceResponse.getResponseHeaders();
-        if (Config.LOGV) {
+        if (LOGV_ENABLED) {
             Log.i(LOG_TAG, "Got response from LocalServer: " + mResponseLine);
         }
         return true;
@@ -803,19 +804,19 @@
         CacheResult mCacheResult =
             CacheManager.getCacheFile(url, cacheRequestHeaders);
         if (mCacheResult == null) {
-            if (Config.LOGV) {
+            if (LOGV_ENABLED) {
                 Log.i(LOG_TAG, "No CacheResult for " + url);
             }
             return false;
         }
-        if (Config.LOGV) {
+        if (LOGV_ENABLED) {
             Log.i(LOG_TAG, "Got CacheResult from browser cache");
         }
         // Check for expiry. -1 is "never", otherwise milliseconds since 1970.
         // Can be compared to System.currentTimeMillis().
         long expires = mCacheResult.getExpires();
         if (expires >= 0 && System.currentTimeMillis() >= expires) {
-            if (Config.LOGV) {
+            if (LOGV_ENABLED) {
                 Log.i(LOG_TAG, "CacheResult expired "
                     + (System.currentTimeMillis() - expires)
                     + " milliseconds ago");
@@ -827,7 +828,7 @@
         mBodyInputStream = mCacheResult.getInputStream();
         if (mBodyInputStream == null) {
             // Cache result may have gone away.
-            if (Config.LOGV) {
+            if (LOGV_ENABLED) {
                 Log.i(LOG_TAG, "No mBodyInputStream for CacheResult " + url);
             }
             return false;
@@ -855,7 +856,7 @@
         }
         // Synthesize the response line.
         mResponseLine = "HTTP/1.1 " + statusCode + " " + statusMessage;
-        if (Config.LOGV) {
+        if (LOGV_ENABLED) {
             Log.i(LOG_TAG, "Synthesized " + mResponseLine);
         }
         // Synthesize the returned headers from cache.
@@ -914,7 +915,7 @@
      */
     public synchronized boolean createCacheResult(
         String url, int responseCode, String mimeType, String encoding) {
-        if (Config.LOGV) {
+        if (LOGV_ENABLED) {
             Log.i(LOG_TAG, "Making cache entry for " + url);
         }
         // Take the headers and parse them into a format needed by
@@ -935,14 +936,14 @@
         mCacheResult = CacheManager.createCacheFile(
             url, responseCode, cacheHeaders, mimeType, true);
         if (mCacheResult != null) {
-            if (Config.LOGV) {
+            if (LOGV_ENABLED) {
                 Log.i(LOG_TAG, "Saving into cache");
             }
             mCacheResult.setEncoding(encoding);
             mCacheResultUrl = url;
             return true;
         } else {
-            if (Config.LOGV) {
+            if (LOGV_ENABLED) {
                 Log.i(LOG_TAG, "Couldn't create mCacheResult");
             }
             return false;
@@ -960,7 +961,7 @@
      */
     public synchronized boolean appendCacheResult(byte[] data, int bytes) {
         if (mCacheResult == null) {
-            if (Config.LOGV) {
+            if (LOGV_ENABLED) {
                 Log.i(LOG_TAG, "appendCacheResult() called without a "
                       + "CacheResult initialized");
             }
@@ -969,7 +970,7 @@
         try {
             mCacheResult.getOutputStream().write(data, 0, bytes);
         } catch (IOException ex) {
-            if (Config.LOGV) {
+            if (LOGV_ENABLED) {
                 Log.i(LOG_TAG, "Got IOException writing cache data: " + ex);
             }
             return false;
@@ -984,14 +985,14 @@
      */
     public synchronized boolean saveCacheResult() {
         if (mCacheResult == null || mCacheResultUrl == null) {
-            if (Config.LOGV) {
+            if (LOGV_ENABLED) {
                 Log.i(LOG_TAG, "Tried to save cache result but "
                       + "createCacheResult not called");
             }
             return false;
         }
 
-        if (Config.LOGV) {
+        if (LOGV_ENABLED) {
             Log.i(LOG_TAG, "Saving cache result");
         }
         CacheManager.saveCacheFile(mCacheResultUrl, mCacheResult);
@@ -1006,7 +1007,7 @@
      * ability to receive a null packet for sendPostData().
      */
     public synchronized void abort() {
-        if (Config.LOGV) {
+        if (LOGV_ENABLED) {
             Log.i(LOG_TAG, "ABORT CALLED");
         }
         if (mMethod != null) {
@@ -1019,7 +1020,7 @@
      * thread to complete.
      */
     public synchronized void interrupt() {
-        if (Config.LOGV) {
+        if (LOGV_ENABLED) {
             Log.i(LOG_TAG, "INTERRUPT CALLED");
         }
         mConnectionFailedLock.lock();
@@ -1053,7 +1054,7 @@
                     mBodyInputStream = entity.getContent();
                 }
             } catch (IOException inputException) {
-                if (Config.LOGV) {
+                if (LOGV_ENABLED) {
                     Log.i(LOG_TAG, "Failed to connect InputStream: "
                           + inputException);
                 }
@@ -1062,7 +1063,7 @@
             }
             if (mBodyInputStream == null) {
                 // No error stream either. Treat as a 0 byte response.
-                if (Config.LOGV) {
+                if (LOGV_ENABLED) {
                     Log.i(LOG_TAG, "No InputStream");
                 }
                 return 0; // EOF.
@@ -1081,7 +1082,7 @@
             }
         } catch (IOException e) {
             // An abort() interrupts us by calling close() on our stream.
-            if (Config.LOGV) {
+            if (LOGV_ENABLED) {
                 Log.i(LOG_TAG, "Got IOException in mBodyInputStream.read(): ", e);
             }
             ret = -1;
diff --git a/core/java/android/widget/AutoCompleteTextView.java b/core/java/android/widget/AutoCompleteTextView.java
index e3186b0..1e122a7 100644
--- a/core/java/android/widget/AutoCompleteTextView.java
+++ b/core/java/android/widget/AutoCompleteTextView.java
@@ -127,6 +127,8 @@
     // The widget is attached to a window when mAttachCount > 0
     private int mAttachCount;
 
+    private AutoCompleteTextView.PassThroughClickListener mPassThroughClickListener;
+
     public AutoCompleteTextView(Context context) {
         this(context, null);
     }
@@ -186,6 +188,28 @@
         setFocusable(true);
 
         addTextChangedListener(new MyWatcher());
+
+        mPassThroughClickListener = new PassThroughClickListener();
+        super.setOnClickListener(mPassThroughClickListener);
+    }
+
+    @Override
+    public void setOnClickListener(OnClickListener listener) {
+        mPassThroughClickListener.mWrapped = listener;
+    }
+
+    /**
+     * Private hook into the on click event, dispatched from {@link PassThroughClickListener}
+     */
+    private void onClickImpl() {
+        // if drop down should always visible, bring it back in front of the soft
+        // keyboard when the user touches the text field
+        if (mDropDownAlwaysVisible
+                && mPopup.isShowing()
+                && mPopup.getInputMethodMode() == PopupWindow.INPUT_METHOD_NOT_NEEDED) {
+            mPopup.setInputMethodMode(PopupWindow.INPUT_METHOD_NEEDED);
+            mPopup.update();
+        }
     }
 
     /**
@@ -1050,7 +1074,10 @@
             }
             mPopup.setHeight(height);
             mPopup.setInputMethodMode(PopupWindow.INPUT_METHOD_NEEDED);
-            mPopup.setOutsideTouchable(true);
+            
+            // use outside touchable to dismiss drop down when touching outside of it, so
+            // only set this if the dropdown is not always visible
+            mPopup.setOutsideTouchable(!mDropDownAlwaysVisible);
             mPopup.setTouchInterceptor(new PopupTouchIntercepter());
             mPopup.showAsDropDown(getDropDownAnchorView(),
                     mDropDownHorizontalOffset, mDropDownVerticalOffset);
@@ -1367,4 +1394,21 @@
          */
         CharSequence fixText(CharSequence invalidText);
     }
+
+    /**
+     * Allows us a private hook into the on click event without preventing users from setting
+     * their own click listener.
+     */
+    private class PassThroughClickListener implements OnClickListener {
+
+        private View.OnClickListener mWrapped;
+
+        /** {@inheritDoc} */
+        public void onClick(View v) {
+            onClickImpl();
+
+            if (mWrapped != null) mWrapped.onClick(v);
+        }
+    }
+
 }
diff --git a/core/java/android/widget/MediaController.java b/core/java/android/widget/MediaController.java
index b162a0e..0c9d980 100644
--- a/core/java/android/widget/MediaController.java
+++ b/core/java/android/widget/MediaController.java
@@ -444,27 +444,55 @@
         updatePausePlay();
     }
 
+    // There are two scenarios that can trigger the seekbar listener to trigger:
+    //
+    // The first is the user using the touchpad to adjust the posititon of the
+    // seekbar's thumb. In this case onStartTrackingTouch is called followed by
+    // a number of onProgressChanged notifications, concluded by onStopTrackingTouch.
+    // We're setting the field "mDragging" to true for the duration of the dragging
+    // session to avoid jumps in the position in case of ongoing playback.
+    //
+    // The second scenario involves the user operating the scroll ball, in this
+    // case there WON'T BE onStartTrackingTouch/onStopTrackingTouch notifications,
+    // we will simply apply the updated position without suspending regular updates.
     private OnSeekBarChangeListener mSeekListener = new OnSeekBarChangeListener() {
-        long duration;
         public void onStartTrackingTouch(SeekBar bar) {
             show(3600000);
-            duration = mPlayer.getDuration();
+
+            mDragging = true;
+
+            // By removing these pending progress messages we make sure
+            // that a) we won't update the progress while the user adjusts
+            // the seekbar and b) once the user is done dragging the thumb
+            // we will post one of these messages to the queue again and
+            // this ensures that there will be exactly one message queued up.
+            mHandler.removeMessages(SHOW_PROGRESS);
         }
-        public void onProgressChanged(SeekBar bar, int progress, boolean fromtouch) {
-            if (fromtouch) {
-                mDragging = true;
-                duration = mPlayer.getDuration();
-                long newposition = (duration * progress) / 1000L;
-                mPlayer.seekTo( (int) newposition);
-                if (mCurrentTime != null)
-                    mCurrentTime.setText(stringForTime( (int) newposition));
+
+        public void onProgressChanged(SeekBar bar, int progress, boolean fromuser) {
+            if (!fromuser) {
+                // We're not interested in programmatically generated changes to
+                // the progress bar's position.
+                return;
             }
+
+            long duration = mPlayer.getDuration();
+            long newposition = (duration * progress) / 1000L;
+            mPlayer.seekTo( (int) newposition);
+            if (mCurrentTime != null)
+                mCurrentTime.setText(stringForTime( (int) newposition));
         }
+
         public void onStopTrackingTouch(SeekBar bar) {
             mDragging = false;
             setProgress();
             updatePausePlay();
             show(sDefaultTimeout);
+
+            // Ensure that progress is properly updated in the future,
+            // the call to show() does not guarantee this because it is a
+            // no-op if we are already showing.
+            mHandler.sendEmptyMessage(SHOW_PROGRESS);
         }
     };
 
diff --git a/core/java/com/android/internal/app/IUsageStats.aidl b/core/java/com/android/internal/app/IUsageStats.aidl
index 6b053d5..1ea7409 100755
--- a/core/java/com/android/internal/app/IUsageStats.aidl
+++ b/core/java/com/android/internal/app/IUsageStats.aidl
@@ -22,6 +22,7 @@
 interface IUsageStats {
     void noteResumeComponent(in ComponentName componentName);
     void notePauseComponent(in ComponentName componentName);
+    void noteLaunchTime(in ComponentName componentName, int millis);
     PkgUsageStats getPkgUsageStats(in ComponentName componentName);
     PkgUsageStats[] getAllPkgUsageStats();
 }
diff --git a/core/java/com/android/internal/os/BatteryStatsImpl.java b/core/java/com/android/internal/os/BatteryStatsImpl.java
index 58a9be85..77649f0 100644
--- a/core/java/com/android/internal/os/BatteryStatsImpl.java
+++ b/core/java/com/android/internal/os/BatteryStatsImpl.java
@@ -25,6 +25,7 @@
 import android.os.SystemClock;
 import android.telephony.TelephonyManager;
 import android.util.Log;
+import android.util.PrintWriterPrinter;
 import android.util.Printer;
 import android.util.SparseArray;
 
@@ -32,6 +33,7 @@
 import java.io.FileInputStream;
 import java.io.FileOutputStream;
 import java.io.IOException;
+import java.io.PrintWriter;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.HashSet;
@@ -3096,32 +3098,33 @@
         }
     };
     
-    public void dumpLocked(Printer pw) {
+    public void dumpLocked(PrintWriter pw) {
         if (DEBUG) {
-            pw.println("*** Screen timer:");
-            mScreenOnTimer.logState(pw, "  ");
+            Printer pr = new PrintWriterPrinter(pw);
+            pr.println("*** Screen timer:");
+            mScreenOnTimer.logState(pr, "  ");
             for (int i=0; i<NUM_SCREEN_BRIGHTNESS_BINS; i++) {
-                pw.println("*** Screen brightness #" + i + ":");
-                mScreenBrightnessTimer[i].logState(pw, "  ");
+                pr.println("*** Screen brightness #" + i + ":");
+                mScreenBrightnessTimer[i].logState(pr, "  ");
             }
-            pw.println("*** Input event counter:");
-            mInputEventCounter.logState(pw, "  ");
-            pw.println("*** Phone timer:");
-            mPhoneOnTimer.logState(pw, "  ");
+            pr.println("*** Input event counter:");
+            mInputEventCounter.logState(pr, "  ");
+            pr.println("*** Phone timer:");
+            mPhoneOnTimer.logState(pr, "  ");
             for (int i=0; i<NUM_SIGNAL_STRENGTH_BINS; i++) {
-                pw.println("*** Signal strength #" + i + ":");
-                mPhoneSignalStrengthsTimer[i].logState(pw, "  ");
+                pr.println("*** Signal strength #" + i + ":");
+                mPhoneSignalStrengthsTimer[i].logState(pr, "  ");
             }
             for (int i=0; i<NUM_DATA_CONNECTION_TYPES; i++) {
-                pw.println("*** Data connection type #" + i + ":");
-                mPhoneDataConnectionsTimer[i].logState(pw, "  ");
+                pr.println("*** Data connection type #" + i + ":");
+                mPhoneDataConnectionsTimer[i].logState(pr, "  ");
             }
-            pw.println("*** Wifi timer:");
-            mWifiOnTimer.logState(pw, "  ");
-            pw.println("*** WifiRunning timer:");
-            mWifiRunningTimer.logState(pw, "  ");
-            pw.println("*** Bluetooth timer:");
-            mBluetoothOnTimer.logState(pw, "  ");
+            pr.println("*** Wifi timer:");
+            mWifiOnTimer.logState(pr, "  ");
+            pr.println("*** WifiRunning timer:");
+            mWifiRunningTimer.logState(pr, "  ");
+            pr.println("*** Bluetooth timer:");
+            mBluetoothOnTimer.logState(pr, "  ");
         }
         super.dumpLocked(pw);
     }
diff --git a/core/java/com/android/internal/util/BitwiseInputStream.java b/core/java/com/android/internal/util/BitwiseInputStream.java
new file mode 100644
index 0000000..4757919
--- /dev/null
+++ b/core/java/com/android/internal/util/BitwiseInputStream.java
@@ -0,0 +1,116 @@
+/*
+ * Copyright (C) 2008 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.internal.util;
+
+/**
+ * An object that provides bitwise incremental read access to a byte array.
+ *
+ * This is useful, for example, when accessing a series of fields that
+ * may not be aligned on byte boundaries.
+ *
+ * NOTE -- This class is not threadsafe.
+ */
+public class BitwiseInputStream {
+
+    // The byte array being read from.
+    private byte[] mBuf;
+
+    // The current position offset, in bits, from the msb in byte 0.
+    private int mPos;
+
+    // The last valid bit offset.
+    private int mEnd;
+
+    /**
+     * An exception to report access problems.
+     */
+    public static class AccessException extends Exception {
+        public AccessException(String s) {
+            super("BitwiseInputStream access failed: " + s);
+        }
+    }
+
+    /**
+     * Create object from byte array.
+     *
+     * @param buf a byte array containing data
+     */
+    public BitwiseInputStream(byte buf[]) {
+        mBuf = buf;
+        mEnd = buf.length << 3;
+        mPos = 0;
+    }
+
+    /**
+     * Return the number of bit still available for reading.
+     */
+    public int available() {
+        return mEnd - mPos;
+    }
+
+    /**
+     * Read some data and increment the current position.
+     *
+     * @param bits the amount of data to read (gte 0, lte 8)
+     *
+     * @return byte of read data (possibly partially filled, from lsb)
+     */
+    public byte read(int bits) throws AccessException {
+        int index = mPos >>> 3;
+        int offset = 16 - (mPos & 0x07) - bits;  // &7==%8
+        if ((bits < 0) || (bits > 8) || ((mPos + bits) > mEnd)) {
+            throw new AccessException("illegal read " +
+                "(pos " + mPos + ", end " + mEnd + ", bits " + bits + ")");
+        }
+        int data = (mBuf[index] & 0x00FF) << 8;
+        if (offset < 8) data |= (mBuf[index + 1] & 0xFF);
+        data >>>= offset;
+        data &= (-1 >>> (32 - bits));
+        mPos += bits;
+        return (byte)data;
+    }
+
+    /**
+     * Read data in bulk into a byte array and increment the current position.
+     *
+     * @param bits the amount of data to read
+     *
+     * @return newly allocated byte array of read data
+     */
+    public byte[] readByteArray(int bits) throws AccessException {
+        int bytes = (bits >>> 3) + ((bits & 0x07) > 0 ? 1 : 0);  // &7==%8
+        byte[] arr = new byte[bytes];
+        for (int i = 0; i < bytes; i++) {
+            int increment = Math.min(8, bits - (i << 3));
+            arr[i] = (byte)(read(increment) << (8 - increment));
+        }
+        return arr;
+    }
+
+    /**
+     * Increment the current position and ignore contained data.
+     *
+     * @param bits the amount by which to increment the position
+     */
+    public void skip(int bits) throws AccessException {
+        if ((mPos + bits) > mEnd) {
+            throw new AccessException("illegal skip " +
+                "(pos " + mPos + ", end " + mEnd + ", bits " + bits + ")");
+        }
+        mPos += bits;
+    }
+}
diff --git a/core/java/com/android/internal/util/BitwiseOutputStream.java b/core/java/com/android/internal/util/BitwiseOutputStream.java
new file mode 100644
index 0000000..17f5c7c
--- /dev/null
+++ b/core/java/com/android/internal/util/BitwiseOutputStream.java
@@ -0,0 +1,126 @@
+/*
+ * Copyright (C) 2008 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.internal.util;
+
+/**
+ * An object that rovides bitwise incremental write access to a byte array.
+ *
+ * This is useful, for example, when writing a series of fields that
+ * may not be aligned on byte boundaries.
+ *
+ * NOTE -- This class is not threadsafe.
+ */
+public class BitwiseOutputStream {
+
+    // The byte array being written to, which will be grown as needed.
+    private byte[] mBuf;
+
+    // The current position offset, in bits, from the msb in byte 0.
+    private int mPos;
+
+    // The last bit offset, given the current buf length.
+    private int mEnd;
+
+    /**
+     * An exception to report access problems.
+     */
+    public static class AccessException extends Exception {
+        public AccessException(String s) {
+            super("BitwiseOutputStream access failed: " + s);
+        }
+    }
+
+    /**
+     * Create object from hint at desired size.
+     *
+     * @param startingLength initial internal byte array length in bytes
+     */
+    public BitwiseOutputStream(int startingLength) {
+        mBuf = new byte[startingLength];
+        mEnd = startingLength << 3;
+        mPos = 0;
+    }
+
+    /**
+     * Return byte array containing accumulated data, sized to just fit.
+     *
+     * @return newly allocated byte array
+     */
+    public byte[] toByteArray() {
+        int len = (mPos >>> 3) + ((mPos & 0x07) > 0 ? 1 : 0);  // &7==%8
+        byte[] newBuf = new byte[len];
+        System.arraycopy(mBuf, 0, newBuf, 0, len);
+        return newBuf;
+    }
+
+    /**
+     * Allocate a new internal buffer, if needed.
+     *
+     * @param bits additional bits to be accommodated
+     */
+    private void possExpand(int bits) {
+        if ((mPos + bits) < mEnd) return;
+        byte[] newBuf = new byte[(mPos + bits) >>> 2];
+        System.arraycopy(mBuf, 0, newBuf, 0, mEnd >>> 3);
+        mBuf = newBuf;
+    }
+
+    /**
+     * Write some data and increment the current position.
+     *
+     * @param bits the amount of data to write (gte 0, lte 8)
+     * @param data to write, will be masked to expose only bits param from lsb
+     */
+    public void write(int bits, int data) throws AccessException {
+        if ((bits < 0) || (bits > 8)) {
+            throw new AccessException("illegal write (" + bits + " bits)");
+        }
+        possExpand(bits);
+        data &= (-1 >>> (32 - bits));
+        int index = mPos >>> 3;
+        int offset = 16 - (mPos & 0x07) - bits;  // &7==%8
+        data <<= offset;
+        mPos += bits;
+        mBuf[index] |= (data >>> 8);
+        if (offset < 8) mBuf[index + 1] |= (data & 0x00FF);
+    }
+
+    /**
+     * Write data in bulk from a byte array and increment the current position.
+     *
+     * @param bits the amount of data to write
+     * @param arr the byte array containing data to be written
+     */
+    public void writeByteArray(int bits, byte[] arr) throws AccessException {
+        for (int i = 0; i < arr.length; i++) {
+            int increment = Math.min(8, bits - (i << 3));
+            if (increment > 0) {
+                write(increment, (byte)(arr[i] >>> (8 - increment)));
+            }
+        }
+    }
+
+    /**
+     * Increment the current position, implicitly writing zeros.
+     *
+     * @param bits the amount by which to increment the position
+     */
+    public void skip(int bits) {
+        possExpand(bits);
+        mPos += bits;
+    }
+}
diff --git a/core/java/com/android/internal/util/TypedProperties.java b/core/java/com/android/internal/util/TypedProperties.java
new file mode 100644
index 0000000..48479e3
--- /dev/null
+++ b/core/java/com/android/internal/util/TypedProperties.java
@@ -0,0 +1,692 @@
+/*
+ * Copyright (C) 2009 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.internal.util;
+
+import java.io.IOException;
+import java.io.Reader;
+import java.io.StreamTokenizer;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.regex.Pattern;
+
+/**
+ * A {@code Map} that publishes a set of typed properties, defined by
+ * zero or more {@code Reader}s containing textual definitions and assignments.
+ */
+public class TypedProperties extends HashMap<String, Object> {
+    /**
+     * Instantiates a {@link java.io.StreamTokenizer} and sets its syntax tables
+     * appropriately for the {@code TypedProperties} file format.
+     *
+     * @param r The {@code Reader} that the {@code StreamTokenizer} will read from
+     * @return a newly-created and initialized {@code StreamTokenizer}
+     */
+    static StreamTokenizer initTokenizer(Reader r) {
+        StreamTokenizer st = new StreamTokenizer(r);
+
+        // Treat everything we don't specify as "ordinary".
+        st.resetSyntax();
+
+        /* The only non-quoted-string words we'll be reading are:
+         * - property names: [._$a-zA-Z0-9]
+         * - type names (case insensitive): [a-zA-Z]
+         * - number literals: [-0-9.eExXA-Za-z]  ('x' for 0xNNN hex literals. "NaN", "Infinity")
+         * - "true" or "false" (case insensitive): [a-zA-Z]
+         */
+        st.wordChars('0', '9');
+        st.wordChars('A', 'Z');
+        st.wordChars('a', 'z');
+        st.wordChars('_', '_');
+        st.wordChars('$', '$');
+        st.wordChars('.', '.');
+        st.wordChars('-', '-');
+        st.wordChars('+', '+');
+
+        // Single-character tokens
+        st.ordinaryChar('=');
+
+        // Other special characters
+        st.whitespaceChars(' ', ' ');
+        st.whitespaceChars('\t', '\t');
+
+        st.quoteChar('"');
+
+        st.commentChar('#');
+
+        st.eolIsSignificant(true);
+
+        return st;
+    }
+
+
+    /**
+     * An unchecked exception that is thrown when encountering a syntax
+     * or semantic error in the input.
+     */
+    public static class ParseException extends IllegalArgumentException {
+        ParseException(StreamTokenizer state, String expected) {
+            super("expected " + expected + ", saw " + state.toString());
+        }
+    }
+
+    // A sentinel instance used to indicate a null string.
+    static final String NULL_STRING = new String("<TypedProperties:NULL_STRING>");
+
+    // Constants used to represent the supported types.
+    static final int TYPE_UNSET = 'x';
+    static final int TYPE_BOOLEAN = 'Z';
+    static final int TYPE_BYTE = 'I' | 1 << 8;
+    // TYPE_CHAR: character literal syntax not supported; use short.
+    static final int TYPE_SHORT = 'I' | 2 << 8;
+    static final int TYPE_INT = 'I' | 4 << 8;
+    static final int TYPE_LONG = 'I' | 8 << 8;
+    static final int TYPE_FLOAT = 'F' | 4 << 8;
+    static final int TYPE_DOUBLE = 'F' | 8 << 8;
+    static final int TYPE_STRING = 'L' | 's' << 8;
+    static final int TYPE_ERROR = -1;
+
+    /**
+     * Converts a case-insensitive string to an internal type constant.
+     *
+     * @param typeName the type name to convert
+     * @return the type constant that corresponds to {@code typeName},
+     *         or {@code TYPE_ERROR} if the type is unknown
+     */
+    static int interpretType(String typeName) {
+        if ("unset".equalsIgnoreCase(typeName)) {
+            return TYPE_UNSET;
+        } else if ("boolean".equalsIgnoreCase(typeName)) {
+            return TYPE_BOOLEAN;
+        } else if ("byte".equalsIgnoreCase(typeName)) {
+            return TYPE_BYTE;
+        } else if ("short".equalsIgnoreCase(typeName)) {
+            return TYPE_SHORT;
+        } else if ("int".equalsIgnoreCase(typeName)) {
+            return TYPE_INT;
+        } else if ("long".equalsIgnoreCase(typeName)) {
+            return TYPE_LONG;
+        } else if ("float".equalsIgnoreCase(typeName)) {
+            return TYPE_FLOAT;
+        } else if ("double".equalsIgnoreCase(typeName)) {
+            return TYPE_DOUBLE;
+        } else if ("string".equalsIgnoreCase(typeName)) {
+            return TYPE_STRING;
+        }
+        return TYPE_ERROR;
+    }
+
+    /**
+     * Consumes EOL tokens.
+     * Returns when a non-EOL token is found.
+     *
+     * @param st The {@code StreamTokenizer} to read tokens from
+     * @return &gt; 0 if an EOL token was seen, &lt; 0 if EOF was seen,
+     *         0 if no tokens were consumed
+     */
+    static int eatEols(StreamTokenizer st) throws IOException {
+        int token;
+        boolean eolSeen = false;
+        do {
+            token = st.nextToken();
+            if (token == StreamTokenizer.TT_EOF) {
+                return -1;
+            } else if (token == StreamTokenizer.TT_EOL) {
+                eolSeen = true;
+            }
+        } while (token == StreamTokenizer.TT_EOL);
+        st.pushBack();
+        return eolSeen ? 1 : 0;
+    }
+
+    /**
+     * Parses the data in the reader.
+     *
+     * @param r The {@code Reader} containing input data to parse
+     * @param map The {@code Map} to insert parameter values into
+     * @throws ParseException if the input data is malformed
+     * @throws IOException if there is a problem reading from the {@code Reader}
+     */
+    static void parse(Reader r, Map<String, Object> map) throws ParseException, IOException {
+        final StreamTokenizer st = initTokenizer(r);
+
+        /* A property name must be a valid fully-qualified class + package name.
+         * We don't support Unicode, though.
+         */
+        final String identifierPattern = "[a-zA-Z_$][0-9a-zA-Z_$]*";
+        final Pattern propertyNamePattern =
+            Pattern.compile("(" + identifierPattern + "\\.)*" + identifierPattern);
+
+
+        boolean eolNeeded = false;
+        while (true) {
+            int token;
+
+            // Eat one or more EOL, or quit on EOF.
+            int eolStatus = eatEols(st);
+            if (eolStatus < 0) {
+                // EOF occurred.
+                break;
+            } else if (eolNeeded && eolStatus == 0) {
+                throw new ParseException(st, "end of line or end of file");
+            }
+
+            // Read the property name.
+            token = st.nextToken();
+            if (token != StreamTokenizer.TT_WORD) {
+                throw new ParseException(st, "property name");
+            }
+            final String propertyName = st.sval;
+            if (!propertyNamePattern.matcher(propertyName).matches()) {
+                throw new ParseException(st, "valid property name");
+            }
+            st.sval = null;
+
+            // Read the type.
+            token = st.nextToken();
+            if (token != StreamTokenizer.TT_WORD) {
+                throw new ParseException(st, "type name");
+            }
+            final int type = interpretType(st.sval);
+            if (type == TYPE_ERROR) {
+                throw new ParseException(st, "valid type name");
+            }
+            st.sval = null;
+
+            if (type == TYPE_UNSET) {
+                map.remove(propertyName);
+            } else {
+                // Expect '='.
+                token = st.nextToken();
+                if (token != '=') {
+                    throw new ParseException(st, "'='");
+                }
+
+                // Read a value of the appropriate type, and insert into the map.
+                final Object value = parseValue(st, type);
+                final Object oldValue = map.remove(propertyName);
+                if (oldValue != null) {
+                    // TODO: catch the case where a string is set to null and then
+                    //       the same property is defined with a different type.
+                    if (value.getClass() != oldValue.getClass()) {
+                        throw new ParseException(st,
+                            "(property previously declared as a different type)");
+                    }
+                }
+                map.put(propertyName, value);
+            }
+
+            // Require that we see at least one EOL before the next token.
+            eolNeeded = true;
+        }
+    }
+
+    /**
+     * Parses the next token in the StreamTokenizer as the specified type.
+     *
+     * @param st The token source
+     * @param type The type to interpret next token as
+     * @return a Boolean, Number subclass, or String representing the value.
+     *         Null strings are represented by the String instance NULL_STRING
+     * @throws IOException if there is a problem reading from the {@code StreamTokenizer}
+     */
+    static Object parseValue(StreamTokenizer st, final int type) throws IOException {
+        final int token = st.nextToken();
+
+        if (type == TYPE_BOOLEAN) {
+            if (token != StreamTokenizer.TT_WORD) {
+                throw new ParseException(st, "boolean constant");
+            }
+
+            if ("true".equalsIgnoreCase(st.sval)) {
+                return Boolean.TRUE;
+            } else if ("false".equalsIgnoreCase(st.sval)) {
+                return Boolean.FALSE;
+            }
+
+            throw new ParseException(st, "boolean constant");
+        } else if ((type & 0xff) == 'I') {
+            if (token != StreamTokenizer.TT_WORD) {
+                throw new ParseException(st, "integer constant");
+            }
+
+            /* Parse the string.  Long.decode() handles C-style integer constants
+             * ("0x" -> hex, "0" -> octal).  It also treats numbers with a prefix of "#" as
+             * hex, but our syntax intentionally does not list '#' as a word character.
+             */
+            long value;
+            try {
+                value = Long.decode(st.sval);
+            } catch (NumberFormatException ex) {
+                throw new ParseException(st, "integer constant");
+            }
+
+            // Ensure that the type can hold this value, and return.
+            int width = (type >> 8) & 0xff;
+            switch (width) {
+            case 1:
+                if (value < Byte.MIN_VALUE || value > Byte.MAX_VALUE) {
+                    throw new ParseException(st, "8-bit integer constant");
+                }
+                return new Byte((byte)value);
+            case 2:
+                if (value < Short.MIN_VALUE || value > Short.MAX_VALUE) {
+                    throw new ParseException(st, "16-bit integer constant");
+                }
+                return new Short((short)value);
+            case 4:
+                if (value < Integer.MIN_VALUE || value > Integer.MAX_VALUE) {
+                    throw new ParseException(st, "32-bit integer constant");
+                }
+                return new Integer((int)value);
+            case 8:
+                if (value < Long.MIN_VALUE || value > Long.MAX_VALUE) {
+                    throw new ParseException(st, "64-bit integer constant");
+                }
+                return new Long(value);
+            default:
+                throw new IllegalStateException(
+                    "Internal error; unexpected integer type width " + width);
+            }
+        } else if ((type & 0xff) == 'F') {
+            if (token != StreamTokenizer.TT_WORD) {
+                throw new ParseException(st, "float constant");
+            }
+
+            // Parse the string.
+            /* TODO: Maybe just parse as float or double, losing precision if necessary.
+             *       Parsing as double and converting to float can change the value
+             *       compared to just parsing as float.
+             */
+            double value;
+            try {
+                /* TODO: detect if the string representation loses precision
+                 *       when being converted to a double.
+                 */
+                value = Double.parseDouble(st.sval);
+            } catch (NumberFormatException ex) {
+                throw new ParseException(st, "float constant");
+            }
+
+            // Ensure that the type can hold this value, and return.
+            if (((type >> 8) & 0xff) == 4) {
+                // This property is a float; make sure the value fits.
+                double absValue = Math.abs(value);
+                if (absValue != 0.0 && !Double.isInfinite(value) && !Double.isNaN(value)) {
+                    if (absValue < Float.MIN_VALUE || absValue > Float.MAX_VALUE) {
+                        throw new ParseException(st, "32-bit float constant");
+                    }
+                }
+                return new Float((float)value);
+            } else {
+                // This property is a double; no need to truncate.
+                return new Double(value);
+            }
+        } else if (type == TYPE_STRING) {
+            // Expect a quoted string or the word "null".
+            if (token == '"') {
+                return st.sval;
+            } else if (token == StreamTokenizer.TT_WORD && "null".equalsIgnoreCase(st.sval)) {
+                return NULL_STRING;
+            }
+            throw new ParseException(st, "double-quoted string or 'null'");
+        }
+
+        throw new IllegalStateException("Internal error; unknown type " + type);
+    }
+
+
+    /**
+     * Creates an empty TypedProperties instance.
+     */
+    public TypedProperties() {
+        super();
+    }
+
+    /**
+     * Loads zero or more properties from the specified Reader.
+     * Properties that have already been loaded are preserved unless
+     * the new Reader overrides or unsets earlier values for the
+     * same properties.
+     *
+     * File syntax:
+     *
+     *     &lt;property-name&gt; &lt;type&gt; = &lt;value&gt;
+     *     &lt;property-name&gt; unset
+     *
+     *     '#' is a comment character; it and anything appearing after it
+     *     on the line is ignored.
+     *
+     *     Blank lines are ignored.
+     *
+     *     The only required whitespace is between the property name
+     *     and the type.
+     *
+     *     Property assignments may not be split across multiple lines.
+     *
+     *     &lt;property-name&gt; is a valid fully-qualified class name
+     *     (one or more valid identifiers separated by dot characters).
+     *
+     *     &lt;type&gt; is one of {boolean, byte, short, int, long,
+     *     float, double, string}, and is case-insensitive.
+     *
+     *     &lt;value&gt; depends on the type:
+     *     - boolean: one of {true, false} (case-insensitive)
+     *     - byte, short, int, long: a valid Java integer constant
+     *       (including non-base-10 constants like 0xabc and 074)
+     *       whose value does not overflow the type.  NOTE: these are
+     *       interpreted as Java integer values, so they are all signed.
+     *     - float, double: a valid Java floating-point constant.
+     *       If the type is float, the value must fit in 32 bits.
+     *     - string: a double-quoted string value, or the word {@code null}.
+     *       NOTE: the contents of the string must be 7-bit clean ASCII;
+     *       C-style octal escapes are recognized, but Unicode escapes are not.
+     *
+     *
+     * @param r The Reader to load properties from
+     * @throws IOException if an error occurs when reading the data
+     * @throws IllegalArgumentException if the data is malformed
+     */
+    public void load(Reader r) throws IOException {
+        parse(r, this);
+    }
+
+    @Override
+    public Object get(Object key) {
+        Object value = super.get(key);
+        if (value == NULL_STRING) {
+            return null;
+        }
+        return value;
+    }
+
+    /*
+     * Getters with explicit defaults
+     */
+
+    /**
+     * An unchecked exception that is thrown if a {@code get&lt;TYPE&gt;()} method
+     * is used to retrieve a parameter whose type does not match the method name.
+     */
+    public static class TypeException extends IllegalArgumentException {
+        TypeException(String property, Object value, String requestedType) {
+            super(property + " has type " + value.getClass().getName() +
+                ", not " + requestedType);
+        }
+    }
+
+    /**
+     * Returns the value of a boolean property, or the default if the property
+     * has not been defined.
+     *
+     * @param property The name of the property to return
+     * @param def The default value to return if the property is not set
+     * @return the value of the property
+     * @throws TypeException if the property is set and is not a boolean
+     */
+    public boolean getBoolean(String property, boolean def) {
+        Object value = super.get(property);
+        if (value == null) {
+            return def;
+        }
+        if (value instanceof Boolean) {
+            return ((Boolean)value).booleanValue();
+        }
+        throw new TypeException(property, value, "boolean");
+    }
+
+    /**
+     * Returns the value of a byte property, or the default if the property
+     * has not been defined.
+     *
+     * @param property The name of the property to return
+     * @param def The default value to return if the property is not set
+     * @return the value of the property
+     * @throws TypeException if the property is set and is not a byte
+     */
+    public byte getByte(String property, byte def) {
+        Object value = super.get(property);
+        if (value == null) {
+            return def;
+        }
+        if (value instanceof Byte) {
+            return ((Byte)value).byteValue();
+        }
+        throw new TypeException(property, value, "byte");
+    }
+
+    /**
+     * Returns the value of a short property, or the default if the property
+     * has not been defined.
+     *
+     * @param property The name of the property to return
+     * @param def The default value to return if the property is not set
+     * @return the value of the property
+     * @throws TypeException if the property is set and is not a short
+     */
+    public short getShort(String property, short def) {
+        Object value = super.get(property);
+        if (value == null) {
+            return def;
+        }
+        if (value instanceof Short) {
+            return ((Short)value).shortValue();
+        }
+        throw new TypeException(property, value, "short");
+    }
+
+    /**
+     * Returns the value of an integer property, or the default if the property
+     * has not been defined.
+     *
+     * @param property The name of the property to return
+     * @param def The default value to return if the property is not set
+     * @return the value of the property
+     * @throws TypeException if the property is set and is not an integer
+     */
+    public int getInt(String property, int def) {
+        Object value = super.get(property);
+        if (value == null) {
+            return def;
+        }
+        if (value instanceof Integer) {
+            return ((Integer)value).intValue();
+        }
+        throw new TypeException(property, value, "int");
+    }
+
+    /**
+     * Returns the value of a long property, or the default if the property
+     * has not been defined.
+     *
+     * @param property The name of the property to return
+     * @param def The default value to return if the property is not set
+     * @return the value of the property
+     * @throws TypeException if the property is set and is not a long
+     */
+    public long getLong(String property, long def) {
+        Object value = super.get(property);
+        if (value == null) {
+            return def;
+        }
+        if (value instanceof Long) {
+            return ((Long)value).longValue();
+        }
+        throw new TypeException(property, value, "long");
+    }
+
+    /**
+     * Returns the value of a float property, or the default if the property
+     * has not been defined.
+     *
+     * @param property The name of the property to return
+     * @param def The default value to return if the property is not set
+     * @return the value of the property
+     * @throws TypeException if the property is set and is not a float
+     */
+    public float getFloat(String property, float def) {
+        Object value = super.get(property);
+        if (value == null) {
+            return def;
+        }
+        if (value instanceof Float) {
+            return ((Float)value).floatValue();
+        }
+        throw new TypeException(property, value, "float");
+    }
+
+    /**
+     * Returns the value of a double property, or the default if the property
+     * has not been defined.
+     *
+     * @param property The name of the property to return
+     * @param def The default value to return if the property is not set
+     * @return the value of the property
+     * @throws TypeException if the property is set and is not a double
+     */
+    public double getDouble(String property, double def) {
+        Object value = super.get(property);
+        if (value == null) {
+            return def;
+        }
+        if (value instanceof Double) {
+            return ((Double)value).doubleValue();
+        }
+        throw new TypeException(property, value, "double");
+    }
+
+    /**
+     * Returns the value of a string property, or the default if the property
+     * has not been defined.
+     *
+     * @param property The name of the property to return
+     * @param def The default value to return if the property is not set
+     * @return the value of the property
+     * @throws TypeException if the property is set and is not a string
+     */
+    public String getString(String property, String def) {
+        Object value = super.get(property);
+        if (value == null) {
+            return def;
+        }
+        if (value == NULL_STRING) {
+            return null;
+        } else if (value instanceof String) {
+            return (String)value;
+        }
+        throw new TypeException(property, value, "string");
+    }
+
+    /*
+     * Getters with implicit defaults
+     */
+
+    /**
+     * Returns the value of a boolean property, or false
+     * if the property has not been defined.
+     *
+     * @param property The name of the property to return
+     * @return the value of the property
+     * @throws TypeException if the property is set and is not a boolean
+     */
+    public boolean getBoolean(String property) {
+        return getBoolean(property, false);
+    }
+
+    /**
+     * Returns the value of a byte property, or 0
+     * if the property has not been defined.
+     *
+     * @param property The name of the property to return
+     * @return the value of the property
+     * @throws TypeException if the property is set and is not a byte
+     */
+    public byte getByte(String property) {
+        return getByte(property, (byte)0);
+    }
+
+    /**
+     * Returns the value of a short property, or 0
+     * if the property has not been defined.
+     *
+     * @param property The name of the property to return
+     * @return the value of the property
+     * @throws TypeException if the property is set and is not a short
+     */
+    public short getShort(String property) {
+        return getShort(property, (short)0);
+    }
+
+    /**
+     * Returns the value of an integer property, or 0
+     * if the property has not been defined.
+     *
+     * @param property The name of the property to return
+     * @return the value of the property
+     * @throws TypeException if the property is set and is not an integer
+     */
+    public int getInt(String property) {
+        return getInt(property, 0);
+    }
+
+    /**
+     * Returns the value of a long property, or 0
+     * if the property has not been defined.
+     *
+     * @param property The name of the property to return
+     * @return the value of the property
+     * @throws TypeException if the property is set and is not a long
+     */
+    public long getLong(String property) {
+        return getLong(property, 0L);
+    }
+
+    /**
+     * Returns the value of a float property, or 0.0
+     * if the property has not been defined.
+     *
+     * @param property The name of the property to return
+     * @return the value of the property
+     * @throws TypeException if the property is set and is not a float
+     */
+    public float getFloat(String property) {
+        return getFloat(property, 0.0f);
+    }
+
+    /**
+     * Returns the value of a double property, or 0.0
+     * if the property has not been defined.
+     *
+     * @param property The name of the property to return
+     * @return the value of the property
+     * @throws TypeException if the property is set and is not a double
+     */
+    public double getDouble(String property) {
+        return getDouble(property, 0.0);
+    }
+
+    /**
+     * Returns the value of a String property, or ""
+     * if the property has not been defined.
+     *
+     * @param property The name of the property to return
+     * @return the value of the property
+     * @throws TypeException if the property is set and is not a string
+     */
+    public String getString(String property) {
+        return getString(property, "");
+    }
+}
diff --git a/core/jni/Android.mk b/core/jni/Android.mk
index 18f2878..ac35459 100644
--- a/core/jni/Android.mk
+++ b/core/jni/Android.mk
@@ -21,6 +21,10 @@
 	CursorWindow.cpp \
 	com_google_android_gles_jni_EGLImpl.cpp \
 	com_google_android_gles_jni_GLImpl.cpp.arm \
+	android_opengl_GLES10.cpp \
+	android_opengl_GLES10Ext.cpp \
+	android_opengl_GLES11.cpp \
+	android_opengl_GLES11Ext.cpp \
 	android_database_CursorWindow.cpp \
 	android_database_SQLiteDebug.cpp \
 	android_database_SQLiteDatabase.cpp \
@@ -125,6 +129,7 @@
 	external/skia/include/core \
 	external/skia/include/effects \
 	external/skia/include/images \
+	external/skia/src/ports \
 	external/skia/include/utils \
 	external/sqlite/dist \
 	external/sqlite/android \
diff --git a/core/jni/AndroidRuntime.cpp b/core/jni/AndroidRuntime.cpp
index f4643f4..7c9f457 100644
--- a/core/jni/AndroidRuntime.cpp
+++ b/core/jni/AndroidRuntime.cpp
@@ -30,6 +30,7 @@
 
 #include <SkGraphics.h>
 #include <SkImageDecoder.h>
+#include <SkImageRef_GlobalPool.h>
 
 #include "jni.h"
 #include "JNIHelp.h"
@@ -66,6 +67,10 @@
 
 extern int register_com_google_android_gles_jni_EGLImpl(JNIEnv* env);
 extern int register_com_google_android_gles_jni_GLImpl(JNIEnv* env);
+extern int register_android_opengl_jni_GLES10(JNIEnv* env);
+extern int register_android_opengl_jni_GLES10Ext(JNIEnv* env);
+extern int register_android_opengl_jni_GLES11(JNIEnv* env);
+extern int register_android_opengl_jni_GLES11Ext(JNIEnv* env);
 
 extern int register_android_hardware_Camera(JNIEnv *env);
 
@@ -224,6 +229,13 @@
     // this sets our preference for 16bit images during decode
     // in case the src is opaque and 24bit
     SkImageDecoder::SetDeviceConfig(SkBitmap::kRGB_565_Config);
+    // This cache is shared between browser native images, and java "purgeable"
+    // bitmaps. This globalpool is for images that do not either use the java
+    // heap, or are not backed by ashmem. See BitmapFactory.cpp for the key
+    // java call site.
+    SkImageRef_GlobalPool::SetRAMBudget(512 * 1024);
+    // There is also a global font cache, but its budget is specified in code
+    // see SkFontHost_android.cpp
 
     // Pre-allocate enough space to hold a fair number of options.
     mOptions.setCapacity(20);
@@ -1042,6 +1054,10 @@
     REG_JNI(register_android_view_ViewRoot),
     REG_JNI(register_com_google_android_gles_jni_EGLImpl),
     REG_JNI(register_com_google_android_gles_jni_GLImpl),
+    REG_JNI(register_android_opengl_jni_GLES10),
+    REG_JNI(register_android_opengl_jni_GLES10Ext),
+    REG_JNI(register_android_opengl_jni_GLES11),
+    REG_JNI(register_android_opengl_jni_GLES11Ext),
 
     REG_JNI(register_android_graphics_Bitmap),
     REG_JNI(register_android_graphics_BitmapFactory),
diff --git a/core/jni/android/graphics/BitmapFactory.cpp b/core/jni/android/graphics/BitmapFactory.cpp
index 4ad2eb0..1fd15d6 100644
--- a/core/jni/android/graphics/BitmapFactory.cpp
+++ b/core/jni/android/graphics/BitmapFactory.cpp
@@ -1,6 +1,8 @@
 #define LOG_TAG "BitmapFactory"
 
 #include "SkImageDecoder.h"
+#include "SkImageRef_ashmem.h"
+#include "SkImageRef_GlobalPool.h"
 #include "SkPixelRef.h"
 #include "SkStream.h"
 #include "GraphicsJNI.h"
@@ -19,6 +21,8 @@
 static jfieldID gOptions_sampleSizeFieldID;
 static jfieldID gOptions_configFieldID;
 static jfieldID gOptions_ditherFieldID;
+static jfieldID gOptions_purgeableFieldID;
+static jfieldID gOptions_shareableFieldID;
 static jfieldID gOptions_widthFieldID;
 static jfieldID gOptions_heightFieldID;
 static jfieldID gOptions_mimeFieldID;
@@ -33,8 +37,6 @@
     #define TRACE_BITMAP(code)
 #endif
 
-//#define MIN_SIZE_TO_USE_MMAP    (4*1024)
-
 ///////////////////////////////////////////////////////////////////////////////
 
 class AutoDecoderCancel {
@@ -207,7 +209,11 @@
     
     virtual bool rewind() {
         off_t pos = fAsset->seek(0, SEEK_SET);
-        return pos != (off_t)-1;
+        if (pos == (off_t)-1) {
+            SkDebugf("----- fAsset->seek(rewind) failed\n");
+            return false;
+        }
+        return true;
     }
     
     virtual size_t read(void* buffer, size_t size) {
@@ -222,15 +228,20 @@
 
             off_t oldOffset = fAsset->seek(0, SEEK_CUR);
             if (-1 == oldOffset) {
+                SkDebugf("---- fAsset->seek(oldOffset) failed\n");
                 return 0;
             }
             off_t newOffset = fAsset->seek(size, SEEK_CUR);
             if (-1 == newOffset) {
+                SkDebugf("---- fAsset->seek(%d) failed\n", size);
                 return 0;
             }
             amount = newOffset - oldOffset;
         } else {
             amount = fAsset->read(buffer, size);
+            if (amount <= 0) {
+                SkDebugf("---- fAsset->read(%d) returned %d\n", size, amount);
+            }
         }
         
         if (amount < 0) {
@@ -279,13 +290,46 @@
     return jstr;
 }
 
-static jobject doDecode(JNIEnv* env, SkStream* stream, jobject padding,
-                        jobject options) {
+static bool optionsPurgeable(JNIEnv* env, jobject options) {
+    return options != NULL &&
+            env->GetBooleanField(options, gOptions_purgeableFieldID);
+}
 
+static bool optionsShareable(JNIEnv* env, jobject options) {
+    return options != NULL &&
+            env->GetBooleanField(options, gOptions_shareableFieldID);
+}
+
+static jobject nullObjectReturn(const char msg[]) {
+    if (msg) {
+        SkDebugf("--- %s\n", msg);
+    }
+    return NULL;
+}
+
+static SkPixelRef* installPixelRef(SkBitmap* bitmap, SkStream* stream,
+                                   int sampleSize) {
+    SkPixelRef* pr;
+    // only use ashmem for large images, since mmaps come at a price
+    if (bitmap->getSize() >= 32 * 65536) {
+        pr = new SkImageRef_ashmem(stream, bitmap->config(), sampleSize);
+    } else {
+        pr = new SkImageRef_GlobalPool(stream, bitmap->config(), sampleSize);
+    }
+    bitmap->setPixelRef(pr)->unref();
+    return pr;
+}
+
+// since we "may" create a purgeable imageref, we require the stream be ref'able
+// i.e. dynamically allocated, since its lifetime may exceed the current stack
+// frame.
+static jobject doDecode(JNIEnv* env, SkStream* stream, jobject padding,
+                        jobject options, bool allowPurgeable) {
     int sampleSize = 1;
     SkImageDecoder::Mode mode = SkImageDecoder::kDecodePixels_Mode;
     SkBitmap::Config prefConfig = SkBitmap::kNo_Config;
     bool doDither = true;
+    bool isPurgeable = allowPurgeable && optionsPurgeable(env, options);
     
     if (NULL != options) {
         sampleSize = env->GetIntField(options, gOptions_sampleSizeFieldID);
@@ -304,14 +348,14 @@
 
     SkImageDecoder* decoder = SkImageDecoder::Factory(stream);
     if (NULL == decoder) {
-        return NULL;
+        return nullObjectReturn("SkImageDecoder::Factory returned null");
     }
     
     decoder->setSampleSize(sampleSize);
     decoder->setDitherImage(doDither);
 
     NinePatchPeeker     peeker;
-    JavaPixelAllocator  allocator(env);
+    JavaPixelAllocator  javaAllocator(env);
     SkBitmap*           bitmap = new SkBitmap;
     Res_png_9patch      dummy9Patch;
 
@@ -319,23 +363,27 @@
     SkAutoTDelete<SkBitmap>         adb(bitmap);
 
     decoder->setPeeker(&peeker);
-    decoder->setAllocator(&allocator);
-    
+    if (!isPurgeable) {
+        decoder->setAllocator(&javaAllocator);
+    }
+
     AutoDecoderCancel   adc(options, decoder);
 
     // To fix the race condition in case "requestCancelDecode"
     // happens earlier than AutoDecoderCancel object is added
     // to the gAutoDecoderCancelMutex linked list.
-    if (NULL != options) {
-        if (env->GetBooleanField(options, gOptions_mCancelID)) {
-            return NULL;
-        }
+    if (NULL != options && env->GetBooleanField(options, gOptions_mCancelID)) {
+        return nullObjectReturn("gOptions_mCancelID");;
     }
 
-    if (!decoder->decode(stream, bitmap, prefConfig, mode)) {
-        return NULL;
+    SkImageDecoder::Mode decodeMode = mode;
+    if (isPurgeable) {
+        decodeMode = SkImageDecoder::kDecodeBounds_Mode;
     }
-    
+    if (!decoder->decode(stream, bitmap, prefConfig, decodeMode)) {
+        return nullObjectReturn("decoder->decode returned false");
+    }
+
     // update options (if any)
     if (NULL != options) {
         env->SetIntField(options, gOptions_widthFieldID, bitmap->width());
@@ -346,7 +394,7 @@
         env->SetObjectField(options, gOptions_mimeFieldID,
                             getMimeTypeString(env, decoder->getFormat()));
     }
-    
+
     // if we're in justBounds mode, return now (skip the java bitmap)
     if (SkImageDecoder::kDecodeBounds_Mode == mode) {
         return NULL;
@@ -357,12 +405,12 @@
         size_t ninePatchArraySize = peeker.fPatch->serializedSize();
         ninePatchChunk = env->NewByteArray(ninePatchArraySize);
         if (NULL == ninePatchChunk) {
-            return NULL;
+            return nullObjectReturn("ninePatchChunk == null");
         }
         jbyte* array = (jbyte*)env->GetPrimitiveArrayCritical(ninePatchChunk,
                                                               NULL);
         if (NULL == array) {
-            return NULL;
+            return nullObjectReturn("primitive array == null");
         }
         peeker.fPatch->serialize(array);
         env->ReleasePrimitiveArrayCritical(ninePatchChunk, array, 0);
@@ -382,12 +430,18 @@
             GraphicsJNI::set_jrect(env, padding, -1, -1, -1, -1);
         }
     }
-    
-    // promise we will never change our pixels (great for sharing and pictures)
-    SkPixelRef* ref = bitmap->pixelRef();
-    SkASSERT(ref);
-    ref->setImmutable();
 
+    SkPixelRef* pr;
+    if (isPurgeable) {
+        pr = installPixelRef(bitmap, stream, sampleSize);
+    } else {
+        // if we get here, we're in kDecodePixels_Mode and will therefore
+        // already have a pixelref installed.
+        pr = bitmap->pixelRef();
+    }
+    // promise we will never change our pixels (great for sharing and pictures)
+    pr->setImmutable();
+    // now create the java bitmap
     return GraphicsJNI::createBitmap(env, bitmap, false, ninePatchChunk);
 }
 
@@ -400,7 +454,8 @@
     SkStream* stream = CreateJavaInputStreamAdaptor(env, is, storage);
 
     if (stream) {
-        bitmap = doDecode(env, stream, padding, options);
+        // for now we don't allow purgeable with java inputstreams
+        bitmap = doDecode(env, stream, padding, options, false);
         stream->unref();
     }
     return bitmap;
@@ -441,52 +496,96 @@
 
     jint descriptor = env->GetIntField(fileDescriptor,
                                        gFileDescriptor_descriptor);
-    
-#ifdef MIN_SIZE_TO_USE_MMAP
-    // First try to use mmap
-    size_t size = getFDSize(descriptor);
-    if (size >= MIN_SIZE_TO_USE_MMAP) {
-        void* addr = mmap(NULL, size, PROT_READ, MAP_PRIVATE, descriptor, 0);
-//        SkDebugf("-------- mmap returned %p %d\n", addr, size);
-        if (MAP_FAILED != addr) {
-            SkMemoryStream strm(addr, size);
-            jobject obj = doDecode(env, &strm, padding, bitmapFactoryOptions);
-            munmap(addr, size);
-            return obj;
+
+    bool isPurgeable = optionsPurgeable(env, bitmapFactoryOptions);
+    bool isShareable = optionsShareable(env, bitmapFactoryOptions);
+    bool weOwnTheFD = false;
+    if (isPurgeable && isShareable) {
+        int newFD = ::dup(descriptor);
+        if (-1 != newFD) {
+            weOwnTheFD = true;
+            descriptor = newFD;
         }
     }
-#endif
 
-    // we pass false for closeWhenDone, since the caller owns the descriptor    
-    SkFDStream file(descriptor, false);
-    if (!file.isValid()) {
+    SkFDStream* stream = new SkFDStream(descriptor, weOwnTheFD);
+    SkAutoUnref aur(stream);
+    if (!stream->isValid()) {
         return NULL;
     }
-    
-    /* Restore our offset when we leave, so the caller doesn't have to.
-       This is a real feature, so we can be called more than once with the
-       same descriptor.
+
+    /* Restore our offset when we leave, so we can be called more than once
+       with the same descriptor. This is only required if we didn't dup the
+       file descriptor, but it is OK to do it all the time.
     */
     AutoFDSeek as(descriptor);
 
-    return doDecode(env, &file, padding, bitmapFactoryOptions);
+    return doDecode(env, stream, padding, bitmapFactoryOptions, true);
+}
+
+/*  make a deep copy of the asset, and return it as a stream, or NULL if there
+    was an error.
+ */
+static SkStream* copyAssetToStream(Asset* asset) {
+    // if we could "ref/reopen" the asset, we may not need to copy it here
+    off_t size = asset->seek(0, SEEK_SET);
+    if ((off_t)-1 == size) {
+        SkDebugf("---- copyAsset: asset rewind failed\n");
+        return NULL;
+    }
+
+    size = asset->getLength();
+    if (size <= 0) {
+        SkDebugf("---- copyAsset: asset->getLength() returned %d\n", size);
+        return NULL;
+    }
+
+    SkStream* stream = new SkMemoryStream(size);
+    void* data = const_cast<void*>(stream->getMemoryBase());
+    off_t len = asset->read(data, size);
+    if (len != size) {
+        SkDebugf("---- copyAsset: asset->read(%d) returned %d\n", size, len);
+        delete stream;
+        stream = NULL;
+    }
+    return stream;
 }
 
 static jobject nativeDecodeAsset(JNIEnv* env, jobject clazz,
                                  jint native_asset,    // Asset
                                  jobject padding,       // Rect
                                  jobject options) { // BitmapFactory$Options
-    AssetStreamAdaptor  mystream((Asset*)native_asset);
+    SkStream* stream;
+    Asset* asset = reinterpret_cast<Asset*>(native_asset);
 
-    return doDecode(env, &mystream, padding, options);
+    if (optionsPurgeable(env, options)) {
+        // if we could "ref/reopen" the asset, we may not need to copy it here
+        // and we could assume optionsShareable, since assets are always RO
+        stream = copyAssetToStream(asset);
+        if (NULL == stream) {
+            return NULL;
+        }
+    } else {
+        // since we know we'll be done with the asset when we return, we can
+        // just use a simple wrapper
+        stream = new AssetStreamAdaptor(asset);
+    }
+    SkAutoUnref aur(stream);
+    return doDecode(env, stream, padding, options, true);
 }
 
 static jobject nativeDecodeByteArray(JNIEnv* env, jobject, jbyteArray byteArray,
                                      int offset, int length, jobject options) {
-    AutoJavaByteArray   ar(env, byteArray);
-    SkMemoryStream  stream(ar.ptr() + offset, length);
-
-    return doDecode(env, &stream, NULL, options);
+    /*  If optionsShareable() we could decide to just wrap the java array and
+        share it, but that means adding a globalref to the java array object
+        and managing its lifetime. For now we just always copy the array's data
+        if optionsPurgeable().
+     */
+    AutoJavaByteArray ar(env, byteArray);
+    SkStream* stream = new SkMemoryStream(ar.ptr() + offset, length,
+                                          optionsPurgeable(env, options));
+    SkAutoUnref aur(stream);
+    return doDecode(env, stream, NULL, options, true);
 }
 
 static void nativeRequestCancel(JNIEnv*, jobject joptions) {
@@ -595,6 +694,8 @@
     gOptions_configFieldID = getFieldIDCheck(env, gOptions_class, "inPreferredConfig",
             "Landroid/graphics/Bitmap$Config;");
     gOptions_ditherFieldID = getFieldIDCheck(env, gOptions_class, "inDither", "Z");
+    gOptions_purgeableFieldID = getFieldIDCheck(env, gOptions_class, "inPurgeable", "Z");
+    gOptions_shareableFieldID = getFieldIDCheck(env, gOptions_class, "inInputShareable", "Z");
     gOptions_widthFieldID = getFieldIDCheck(env, gOptions_class, "outWidth", "I");
     gOptions_heightFieldID = getFieldIDCheck(env, gOptions_class, "outHeight", "I");
     gOptions_mimeFieldID = getFieldIDCheck(env, gOptions_class, "outMimeType", "Ljava/lang/String;");
diff --git a/core/jni/android/graphics/Canvas.cpp b/core/jni/android/graphics/Canvas.cpp
index 605e4b8..bd6fea8 100644
--- a/core/jni/android/graphics/Canvas.cpp
+++ b/core/jni/android/graphics/Canvas.cpp
@@ -21,6 +21,8 @@
 #include "SkCanvas.h"
 #include "SkDevice.h"
 #include "SkGLCanvas.h"
+#include "SkGraphics.h"
+#include "SkImageRef_GlobalPool.h"
 #include "SkShader.h"
 #include "SkTemplates.h"
 
@@ -58,8 +60,11 @@
         return new SkGLCanvas;
     }
     
-    static void freeGlCaches(JNIEnv* env, jobject) {
+    static void freeCaches(JNIEnv* env, jobject) {
+        // these are called in no particular order
         SkGLCanvas::DeleteAllTextures();
+        SkImageRef_GlobalPool::SetRAMUsed(0);
+        SkGraphics::SetFontCacheUsed(0);
     }
     
     static jboolean isOpaque(JNIEnv* env, jobject jcanvas) {
@@ -933,7 +938,7 @@
         (void*) SkCanvasGlue::drawTextOnPath__StringPathFFPaint},
     {"native_drawPicture", "(II)V", (void*) SkCanvasGlue::drawPicture},
 
-    {"freeGlCaches", "()V", (void*) SkCanvasGlue::freeGlCaches}
+    {"freeCaches", "()V", (void*) SkCanvasGlue::freeCaches}
 };
 
 #include <android_runtime/AndroidRuntime.h>
diff --git a/core/jni/android_location_GpsLocationProvider.cpp b/core/jni/android_location_GpsLocationProvider.cpp
index f0b35e9..bbde8d5 100644
--- a/core/jni/android_location_GpsLocationProvider.cpp
+++ b/core/jni/android_location_GpsLocationProvider.cpp
@@ -31,6 +31,7 @@
 static jmethodID method_reportLocation;
 static jmethodID method_reportStatus;
 static jmethodID method_reportSvStatus;
+static jmethodID method_reportSuplStatus;
 static jmethodID method_xtraDownloadRequest;
 
 static const GpsInterface* sGpsInterface = NULL;
@@ -41,19 +42,22 @@
 static GpsLocation  sGpsLocation;
 static GpsStatus    sGpsStatus;
 static GpsSvStatus  sGpsSvStatus;
+static GpsSuplStatus    sGpsSuplStatus;
 
 // a copy of the data shared by android_location_GpsLocationProvider_wait_for_event
 // and android_location_GpsLocationProvider_read_status
 static GpsLocation  sGpsLocationCopy;
 static GpsStatus    sGpsStatusCopy;
 static GpsSvStatus  sGpsSvStatusCopy;
+static GpsSuplStatus    sGpsSuplStatusCopy;
 
 enum CallbackType {
     kLocation = 1,
     kStatus = 2,
     kSvStatus = 4,
-    kXtraDownloadRequest = 8,
-    kDisableRequest = 16,
+    kSuplStatus = 8,
+    kXtraDownloadRequest = 16,
+    kDisableRequest = 32,
 }; 
 static int sPendingCallbacks;
 
@@ -92,6 +96,17 @@
     pthread_mutex_unlock(&sEventMutex);
 }
 
+static void supl_status_callback(GpsSuplStatus* supl_status)
+{
+    pthread_mutex_lock(&sEventMutex);
+
+    sPendingCallbacks |= kSuplStatus;
+    memcpy(&sGpsSuplStatus, supl_status, sizeof(GpsSuplStatus));
+
+    pthread_cond_signal(&sEventCond);
+    pthread_mutex_unlock(&sEventMutex);
+}
+
 GpsCallbacks sGpsCallbacks = {
     location_callback,
     status_callback,
@@ -111,11 +126,15 @@
     download_request_callback,
 };
 
+GpsSuplCallbacks sGpsSuplCallbacks = {
+    supl_status_callback,
+};
 
 static void android_location_GpsLocationProvider_class_init_native(JNIEnv* env, jclass clazz) {
     method_reportLocation = env->GetMethodID(clazz, "reportLocation", "(IDDDFFFJ)V");
     method_reportStatus = env->GetMethodID(clazz, "reportStatus", "(I)V");
     method_reportSvStatus = env->GetMethodID(clazz, "reportSvStatus", "()V");
+    method_reportSuplStatus = env->GetMethodID(clazz, "reportSuplStatus", "(I)V");
     method_xtraDownloadRequest = env->GetMethodID(clazz, "xtraDownloadRequest", "()V");
 }
 
@@ -129,7 +148,13 @@
 {
     if (!sGpsInterface)
         sGpsInterface = gps_get_interface();
-    return (sGpsInterface && sGpsInterface->init(&sGpsCallbacks) == 0);
+    if (!sGpsInterface || sGpsInterface->init(&sGpsCallbacks) != 0)
+        return false;
+
+    if (!sGpsSuplInterface)
+        sGpsSuplInterface = (const GpsSuplInterface*)sGpsInterface->get_extension(GPS_SUPL_INTERFACE);
+    if (sGpsSuplInterface)
+        sGpsSuplInterface->init(&sGpsSuplCallbacks);
 }
 
 static void android_location_GpsLocationProvider_disable(JNIEnv* env, jobject obj)
@@ -186,6 +211,7 @@
     memcpy(&sGpsLocationCopy, &sGpsLocation, sizeof(sGpsLocationCopy));
     memcpy(&sGpsStatusCopy, &sGpsStatus, sizeof(sGpsStatusCopy));
     memcpy(&sGpsSvStatusCopy, &sGpsSvStatus, sizeof(sGpsSvStatusCopy));
+    memcpy(&sGpsSuplStatusCopy, &sGpsSuplStatus, sizeof(sGpsSuplStatusCopy));
     pthread_mutex_unlock(&sEventMutex);   
 
     if (pendingCallbacks & kLocation) { 
@@ -201,6 +227,9 @@
     if (pendingCallbacks & kSvStatus) {
         env->CallVoidMethod(obj, method_reportSvStatus);
     }
+    if (pendingCallbacks & kSuplStatus) {
+        env->CallVoidMethod(obj, method_reportSuplStatus, sGpsSuplStatusCopy.status);
+    }  
     if (pendingCallbacks & kXtraDownloadRequest) {    
         env->CallVoidMethod(obj, method_xtraDownloadRequest);
     }
@@ -269,18 +298,7 @@
     env->ReleaseByteArrayElements(data, bytes, 0);
 }
 
-static void android_location_GpsLocationProvider_set_supl_server(JNIEnv* env, jobject obj,
-        jint addr, jint port)
-{
-    if (!sGpsSuplInterface) {
-        sGpsSuplInterface = (const GpsSuplInterface*)sGpsInterface->get_extension(GPS_SUPL_INTERFACE);
-    }
-    if (sGpsSuplInterface) {
-        sGpsSuplInterface->set_server(addr, port);
-    }
-}
-
-static void android_location_GpsLocationProvider_set_supl_apn(JNIEnv* env, jobject obj, jstring apn)
+static void android_location_GpsLocationProvider_supl_data_conn_open(JNIEnv* env, jobject obj, jstring apn)
 {
     if (!sGpsSuplInterface) {
         sGpsSuplInterface = (const GpsSuplInterface*)sGpsInterface->get_extension(GPS_SUPL_INTERFACE);
@@ -291,11 +309,42 @@
             return;
         }
         const char *apnStr = env->GetStringUTFChars(apn, NULL);
-        sGpsSuplInterface->set_apn(apnStr);
+        sGpsSuplInterface->data_conn_open(apnStr);
         env->ReleaseStringUTFChars(apn, apnStr);
     }
 }
 
+static void android_location_GpsLocationProvider_supl_data_conn_closed(JNIEnv* env, jobject obj)
+{
+    if (!sGpsSuplInterface) {
+        sGpsSuplInterface = (const GpsSuplInterface*)sGpsInterface->get_extension(GPS_SUPL_INTERFACE);
+    }
+    if (sGpsSuplInterface) {
+        sGpsSuplInterface->data_conn_closed();
+    }
+}
+
+static void android_location_GpsLocationProvider_supl_data_conn_failed(JNIEnv* env, jobject obj)
+{
+    if (!sGpsSuplInterface) {
+        sGpsSuplInterface = (const GpsSuplInterface*)sGpsInterface->get_extension(GPS_SUPL_INTERFACE);
+    }
+    if (sGpsSuplInterface) {
+        sGpsSuplInterface->data_conn_failed();
+    }
+}
+
+static void android_location_GpsLocationProvider_set_supl_server(JNIEnv* env, jobject obj,
+        jint addr, jint port)
+{
+    if (!sGpsSuplInterface) {
+        sGpsSuplInterface = (const GpsSuplInterface*)sGpsInterface->get_extension(GPS_SUPL_INTERFACE);
+    }
+    if (sGpsSuplInterface) {
+        sGpsSuplInterface->set_server(addr, port);
+    }
+}
+
 static JNINativeMethod sMethods[] = {
      /* name, signature, funcPtr */
     {"class_init_native", "()V", (void *)android_location_GpsLocationProvider_class_init_native},
@@ -312,8 +361,10 @@
 	{"native_inject_time", "(JJI)V", (void*)android_location_GpsLocationProvider_inject_time},
 	{"native_supports_xtra", "()Z", (void*)android_location_GpsLocationProvider_supports_xtra},
 	{"native_inject_xtra_data", "([BI)V", (void*)android_location_GpsLocationProvider_inject_xtra_data},
+ 	{"native_supl_data_conn_open", "(Ljava/lang/String;)V", (void*)android_location_GpsLocationProvider_supl_data_conn_open},
+ 	{"native_supl_data_conn_closed", "()V", (void*)android_location_GpsLocationProvider_supl_data_conn_closed},
+ 	{"native_supl_data_conn_failed", "()V", (void*)android_location_GpsLocationProvider_supl_data_conn_failed},
  	{"native_set_supl_server", "(II)V", (void*)android_location_GpsLocationProvider_set_supl_server},
- 	{"native_set_supl_apn", "(Ljava/lang/String;)V", (void*)android_location_GpsLocationProvider_set_supl_apn},
 };
 
 int register_android_location_GpsLocationProvider(JNIEnv* env)
diff --git a/core/jni/android_opengl_GLES10.cpp b/core/jni/android_opengl_GLES10.cpp
new file mode 100644
index 0000000..bc644d2
--- /dev/null
+++ b/core/jni/android_opengl_GLES10.cpp
@@ -0,0 +1,3518 @@
+/*
+**
+** Copyright 2009, The Android Open Source Project
+**
+** Licensed under the Apache License, Version 2.0 (the "License"); 
+** you may not use this file except in compliance with the License. 
+** You may obtain a copy of the License at 
+**
+**     http://www.apache.org/licenses/LICENSE-2.0 
+**
+** Unless required by applicable law or agreed to in writing, software 
+** distributed under the License is distributed on an "AS IS" BASIS, 
+** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+** See the License for the specific language governing permissions and 
+** limitations under the License.
+*/
+
+// This source file is automatically generated
+
+#include <android_runtime/AndroidRuntime.h>
+#include <utils/misc.h>
+
+#include <assert.h>
+#include <GLES/gl.h>
+
+#include <private/opengles/gl_context.h>
+
+#define _NUM_COMPRESSED_TEXTURE_FORMATS \
+        (::android::OGLES_NUM_COMPRESSED_TEXTURE_FORMATS)
+
+static int initialized = 0;
+
+static jclass nioAccessClass;
+static jclass bufferClass;
+static jclass OOMEClass;
+static jclass UOEClass;
+static jclass IAEClass;
+static jclass AIOOBEClass;
+static jmethodID getBasePointerID;
+static jmethodID getBaseArrayID;
+static jmethodID getBaseArrayOffsetID;
+static jfieldID positionID;
+static jfieldID limitID;
+static jfieldID elementSizeShiftID;
+
+/* Cache method IDs each time the class is loaded. */
+
+static void
+nativeClassInitBuffer(JNIEnv *_env)
+{
+    jclass nioAccessClassLocal = _env->FindClass("java/nio/NIOAccess");
+    nioAccessClass = (jclass) _env->NewGlobalRef(nioAccessClassLocal);
+
+    jclass bufferClassLocal = _env->FindClass("java/nio/Buffer");
+    bufferClass = (jclass) _env->NewGlobalRef(bufferClassLocal);
+
+    getBasePointerID = _env->GetStaticMethodID(nioAccessClass,
+            "getBasePointer", "(Ljava/nio/Buffer;)J");
+    getBaseArrayID = _env->GetStaticMethodID(nioAccessClass,
+            "getBaseArray", "(Ljava/nio/Buffer;)Ljava/lang/Object;");
+    getBaseArrayOffsetID = _env->GetStaticMethodID(nioAccessClass,
+            "getBaseArrayOffset", "(Ljava/nio/Buffer;)I");
+
+    positionID = _env->GetFieldID(bufferClass, "position", "I");
+    limitID = _env->GetFieldID(bufferClass, "limit", "I");
+    elementSizeShiftID =
+        _env->GetFieldID(bufferClass, "_elementSizeShift", "I");
+}
+
+
+static void
+nativeClassInit(JNIEnv *_env, jclass glImplClass)
+{
+    nativeClassInitBuffer(_env);
+
+    jclass IAEClassLocal =
+        _env->FindClass("java/lang/IllegalArgumentException");
+    jclass OOMEClassLocal =
+         _env->FindClass("java/lang/OutOfMemoryError");
+    jclass UOEClassLocal =
+         _env->FindClass("java/lang/UnsupportedOperationException");
+    jclass AIOOBEClassLocal =
+         _env->FindClass("java/lang/ArrayIndexOutOfBoundsException");
+
+    IAEClass = (jclass) _env->NewGlobalRef(IAEClassLocal);
+    OOMEClass = (jclass) _env->NewGlobalRef(OOMEClassLocal);
+    UOEClass = (jclass) _env->NewGlobalRef(UOEClassLocal);
+    AIOOBEClass = (jclass) _env->NewGlobalRef(AIOOBEClassLocal);
+}
+
+static void *
+getPointer(JNIEnv *_env, jobject buffer, jarray *array, jint *remaining)
+{
+    jint position;
+    jint limit;
+    jint elementSizeShift;
+    jlong pointer;
+    jint offset;
+    void *data;
+
+    position = _env->GetIntField(buffer, positionID);
+    limit = _env->GetIntField(buffer, limitID);
+    elementSizeShift = _env->GetIntField(buffer, elementSizeShiftID);
+    *remaining = (limit - position) << elementSizeShift;
+    pointer = _env->CallStaticLongMethod(nioAccessClass,
+            getBasePointerID, buffer);
+    if (pointer != 0L) {
+        *array = NULL;
+        return (void *) (jint) pointer;
+    }
+    
+    *array = (jarray) _env->CallStaticObjectMethod(nioAccessClass,
+            getBaseArrayID, buffer);
+    offset = _env->CallStaticIntMethod(nioAccessClass,
+            getBaseArrayOffsetID, buffer);
+    data = _env->GetPrimitiveArrayCritical(*array, (jboolean *) 0);
+    
+    return (void *) ((char *) data + offset);
+}
+
+
+static void
+releasePointer(JNIEnv *_env, jarray array, void *data, jboolean commit)
+{
+    _env->ReleasePrimitiveArrayCritical(array, data,
+					   commit ? 0 : JNI_ABORT);
+}
+
+// --------------------------------------------------------------------------
+
+/* void glActiveTexture ( GLenum texture ) */
+static void
+android_glActiveTexture__I
+  (JNIEnv *_env, jobject _this, jint texture) {
+    glActiveTexture(
+        (GLenum)texture
+    );
+}
+
+/* void glAlphaFunc ( GLenum func, GLclampf ref ) */
+static void
+android_glAlphaFunc__IF
+  (JNIEnv *_env, jobject _this, jint func, jfloat ref) {
+    glAlphaFunc(
+        (GLenum)func,
+        (GLclampf)ref
+    );
+}
+
+/* void glAlphaFuncx ( GLenum func, GLclampx ref ) */
+static void
+android_glAlphaFuncx__II
+  (JNIEnv *_env, jobject _this, jint func, jint ref) {
+    glAlphaFuncx(
+        (GLenum)func,
+        (GLclampx)ref
+    );
+}
+
+/* void glBindTexture ( GLenum target, GLuint texture ) */
+static void
+android_glBindTexture__II
+  (JNIEnv *_env, jobject _this, jint target, jint texture) {
+    glBindTexture(
+        (GLenum)target,
+        (GLuint)texture
+    );
+}
+
+/* void glBlendFunc ( GLenum sfactor, GLenum dfactor ) */
+static void
+android_glBlendFunc__II
+  (JNIEnv *_env, jobject _this, jint sfactor, jint dfactor) {
+    glBlendFunc(
+        (GLenum)sfactor,
+        (GLenum)dfactor
+    );
+}
+
+/* void glClear ( GLbitfield mask ) */
+static void
+android_glClear__I
+  (JNIEnv *_env, jobject _this, jint mask) {
+    glClear(
+        (GLbitfield)mask
+    );
+}
+
+/* void glClearColor ( GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha ) */
+static void
+android_glClearColor__FFFF
+  (JNIEnv *_env, jobject _this, jfloat red, jfloat green, jfloat blue, jfloat alpha) {
+    glClearColor(
+        (GLclampf)red,
+        (GLclampf)green,
+        (GLclampf)blue,
+        (GLclampf)alpha
+    );
+}
+
+/* void glClearColorx ( GLclampx red, GLclampx green, GLclampx blue, GLclampx alpha ) */
+static void
+android_glClearColorx__IIII
+  (JNIEnv *_env, jobject _this, jint red, jint green, jint blue, jint alpha) {
+    glClearColorx(
+        (GLclampx)red,
+        (GLclampx)green,
+        (GLclampx)blue,
+        (GLclampx)alpha
+    );
+}
+
+/* void glClearDepthf ( GLclampf depth ) */
+static void
+android_glClearDepthf__F
+  (JNIEnv *_env, jobject _this, jfloat depth) {
+    glClearDepthf(
+        (GLclampf)depth
+    );
+}
+
+/* void glClearDepthx ( GLclampx depth ) */
+static void
+android_glClearDepthx__I
+  (JNIEnv *_env, jobject _this, jint depth) {
+    glClearDepthx(
+        (GLclampx)depth
+    );
+}
+
+/* void glClearStencil ( GLint s ) */
+static void
+android_glClearStencil__I
+  (JNIEnv *_env, jobject _this, jint s) {
+    glClearStencil(
+        (GLint)s
+    );
+}
+
+/* void glClientActiveTexture ( GLenum texture ) */
+static void
+android_glClientActiveTexture__I
+  (JNIEnv *_env, jobject _this, jint texture) {
+    glClientActiveTexture(
+        (GLenum)texture
+    );
+}
+
+/* void glColor4f ( GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha ) */
+static void
+android_glColor4f__FFFF
+  (JNIEnv *_env, jobject _this, jfloat red, jfloat green, jfloat blue, jfloat alpha) {
+    glColor4f(
+        (GLfloat)red,
+        (GLfloat)green,
+        (GLfloat)blue,
+        (GLfloat)alpha
+    );
+}
+
+/* void glColor4x ( GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha ) */
+static void
+android_glColor4x__IIII
+  (JNIEnv *_env, jobject _this, jint red, jint green, jint blue, jint alpha) {
+    glColor4x(
+        (GLfixed)red,
+        (GLfixed)green,
+        (GLfixed)blue,
+        (GLfixed)alpha
+    );
+}
+
+/* void glColorMask ( GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha ) */
+static void
+android_glColorMask__ZZZZ
+  (JNIEnv *_env, jobject _this, jboolean red, jboolean green, jboolean blue, jboolean alpha) {
+    glColorMask(
+        (GLboolean)red,
+        (GLboolean)green,
+        (GLboolean)blue,
+        (GLboolean)alpha
+    );
+}
+
+/* void glColorPointer ( GLint size, GLenum type, GLsizei stride, const GLvoid *pointer ) */
+static void
+android_glColorPointerBounds__IIILjava_nio_Buffer_2I
+  (JNIEnv *_env, jobject _this, jint size, jint type, jint stride, jobject pointer_buf, jint remaining) {
+    jarray _array = (jarray) 0;
+    jint _remaining;
+    GLvoid *pointer = (GLvoid *) 0;
+
+    pointer = (GLvoid *)getPointer(_env, pointer_buf, &_array, &_remaining);
+    glColorPointerBounds(
+        (GLint)size,
+        (GLenum)type,
+        (GLsizei)stride,
+        (GLvoid *)pointer,
+        (GLsizei)remaining
+    );
+    if (_array) {
+        releasePointer(_env, _array, pointer, JNI_FALSE);
+    }
+}
+
+/* void glCompressedTexImage2D ( GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data ) */
+static void
+android_glCompressedTexImage2D__IIIIIIILjava_nio_Buffer_2
+  (JNIEnv *_env, jobject _this, jint target, jint level, jint internalformat, jint width, jint height, jint border, jint imageSize, jobject data_buf) {
+    jarray _array = (jarray) 0;
+    jint _remaining;
+    GLvoid *data = (GLvoid *) 0;
+
+    data = (GLvoid *)getPointer(_env, data_buf, &_array, &_remaining);
+    glCompressedTexImage2D(
+        (GLenum)target,
+        (GLint)level,
+        (GLenum)internalformat,
+        (GLsizei)width,
+        (GLsizei)height,
+        (GLint)border,
+        (GLsizei)imageSize,
+        (GLvoid *)data
+    );
+    if (_array) {
+        releasePointer(_env, _array, data, JNI_FALSE);
+    }
+}
+
+/* void glCompressedTexSubImage2D ( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data ) */
+static void
+android_glCompressedTexSubImage2D__IIIIIIIILjava_nio_Buffer_2
+  (JNIEnv *_env, jobject _this, jint target, jint level, jint xoffset, jint yoffset, jint width, jint height, jint format, jint imageSize, jobject data_buf) {
+    jarray _array = (jarray) 0;
+    jint _remaining;
+    GLvoid *data = (GLvoid *) 0;
+
+    data = (GLvoid *)getPointer(_env, data_buf, &_array, &_remaining);
+    glCompressedTexSubImage2D(
+        (GLenum)target,
+        (GLint)level,
+        (GLint)xoffset,
+        (GLint)yoffset,
+        (GLsizei)width,
+        (GLsizei)height,
+        (GLenum)format,
+        (GLsizei)imageSize,
+        (GLvoid *)data
+    );
+    if (_array) {
+        releasePointer(_env, _array, data, JNI_FALSE);
+    }
+}
+
+/* void glCopyTexImage2D ( GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border ) */
+static void
+android_glCopyTexImage2D__IIIIIIII
+  (JNIEnv *_env, jobject _this, jint target, jint level, jint internalformat, jint x, jint y, jint width, jint height, jint border) {
+    glCopyTexImage2D(
+        (GLenum)target,
+        (GLint)level,
+        (GLenum)internalformat,
+        (GLint)x,
+        (GLint)y,
+        (GLsizei)width,
+        (GLsizei)height,
+        (GLint)border
+    );
+}
+
+/* void glCopyTexSubImage2D ( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height ) */
+static void
+android_glCopyTexSubImage2D__IIIIIIII
+  (JNIEnv *_env, jobject _this, jint target, jint level, jint xoffset, jint yoffset, jint x, jint y, jint width, jint height) {
+    glCopyTexSubImage2D(
+        (GLenum)target,
+        (GLint)level,
+        (GLint)xoffset,
+        (GLint)yoffset,
+        (GLint)x,
+        (GLint)y,
+        (GLsizei)width,
+        (GLsizei)height
+    );
+}
+
+/* void glCullFace ( GLenum mode ) */
+static void
+android_glCullFace__I
+  (JNIEnv *_env, jobject _this, jint mode) {
+    glCullFace(
+        (GLenum)mode
+    );
+}
+
+/* void glDeleteTextures ( GLsizei n, const GLuint *textures ) */
+static void
+android_glDeleteTextures__I_3II
+  (JNIEnv *_env, jobject _this, jint n, jintArray textures_ref, jint offset) {
+    GLuint *textures_base = (GLuint *) 0;
+    jint _remaining;
+    GLuint *textures = (GLuint *) 0;
+
+    if (!textures_ref) {
+        _env->ThrowNew(IAEClass, "textures == null");
+        goto exit;
+    }
+    if (offset < 0) {
+        _env->ThrowNew(IAEClass, "offset < 0");
+        goto exit;
+    }
+    _remaining = _env->GetArrayLength(textures_ref) - offset;
+    if (_remaining < n) {
+        _env->ThrowNew(IAEClass, "length - offset < n");
+        goto exit;
+    }
+    textures_base = (GLuint *)
+        _env->GetPrimitiveArrayCritical(textures_ref, (jboolean *)0);
+    textures = textures_base + offset;
+
+    glDeleteTextures(
+        (GLsizei)n,
+        (GLuint *)textures
+    );
+
+exit:
+    if (textures_base) {
+        _env->ReleasePrimitiveArrayCritical(textures_ref, textures_base,
+            JNI_ABORT);
+    }
+}
+
+/* void glDeleteTextures ( GLsizei n, const GLuint *textures ) */
+static void
+android_glDeleteTextures__ILjava_nio_IntBuffer_2
+  (JNIEnv *_env, jobject _this, jint n, jobject textures_buf) {
+    jarray _array = (jarray) 0;
+    jint _remaining;
+    GLuint *textures = (GLuint *) 0;
+
+    textures = (GLuint *)getPointer(_env, textures_buf, &_array, &_remaining);
+    if (_remaining < n) {
+        _env->ThrowNew(IAEClass, "remaining() < n");
+        goto exit;
+    }
+    glDeleteTextures(
+        (GLsizei)n,
+        (GLuint *)textures
+    );
+
+exit:
+    if (_array) {
+        releasePointer(_env, _array, textures, JNI_FALSE);
+    }
+}
+
+/* void glDepthFunc ( GLenum func ) */
+static void
+android_glDepthFunc__I
+  (JNIEnv *_env, jobject _this, jint func) {
+    glDepthFunc(
+        (GLenum)func
+    );
+}
+
+/* void glDepthMask ( GLboolean flag ) */
+static void
+android_glDepthMask__Z
+  (JNIEnv *_env, jobject _this, jboolean flag) {
+    glDepthMask(
+        (GLboolean)flag
+    );
+}
+
+/* void glDepthRangef ( GLclampf zNear, GLclampf zFar ) */
+static void
+android_glDepthRangef__FF
+  (JNIEnv *_env, jobject _this, jfloat zNear, jfloat zFar) {
+    glDepthRangef(
+        (GLclampf)zNear,
+        (GLclampf)zFar
+    );
+}
+
+/* void glDepthRangex ( GLclampx zNear, GLclampx zFar ) */
+static void
+android_glDepthRangex__II
+  (JNIEnv *_env, jobject _this, jint zNear, jint zFar) {
+    glDepthRangex(
+        (GLclampx)zNear,
+        (GLclampx)zFar
+    );
+}
+
+/* void glDisable ( GLenum cap ) */
+static void
+android_glDisable__I
+  (JNIEnv *_env, jobject _this, jint cap) {
+    glDisable(
+        (GLenum)cap
+    );
+}
+
+/* void glDisableClientState ( GLenum array ) */
+static void
+android_glDisableClientState__I
+  (JNIEnv *_env, jobject _this, jint array) {
+    glDisableClientState(
+        (GLenum)array
+    );
+}
+
+/* void glDrawArrays ( GLenum mode, GLint first, GLsizei count ) */
+static void
+android_glDrawArrays__III
+  (JNIEnv *_env, jobject _this, jint mode, jint first, jint count) {
+    glDrawArrays(
+        (GLenum)mode,
+        (GLint)first,
+        (GLsizei)count
+    );
+}
+
+/* void glDrawElements ( GLenum mode, GLsizei count, GLenum type, const GLvoid *indices ) */
+static void
+android_glDrawElements__IIILjava_nio_Buffer_2
+  (JNIEnv *_env, jobject _this, jint mode, jint count, jint type, jobject indices_buf) {
+    jarray _array = (jarray) 0;
+    jint _remaining;
+    GLvoid *indices = (GLvoid *) 0;
+
+    indices = (GLvoid *)getPointer(_env, indices_buf, &_array, &_remaining);
+    if (_remaining < count) {
+        _env->ThrowNew(AIOOBEClass, "remaining() < count");
+        goto exit;
+    }
+    glDrawElements(
+        (GLenum)mode,
+        (GLsizei)count,
+        (GLenum)type,
+        (GLvoid *)indices
+    );
+
+exit:
+    if (_array) {
+        releasePointer(_env, _array, indices, JNI_FALSE);
+    }
+}
+
+/* void glEnable ( GLenum cap ) */
+static void
+android_glEnable__I
+  (JNIEnv *_env, jobject _this, jint cap) {
+    glEnable(
+        (GLenum)cap
+    );
+}
+
+/* void glEnableClientState ( GLenum array ) */
+static void
+android_glEnableClientState__I
+  (JNIEnv *_env, jobject _this, jint array) {
+    glEnableClientState(
+        (GLenum)array
+    );
+}
+
+/* void glFinish ( void ) */
+static void
+android_glFinish__
+  (JNIEnv *_env, jobject _this) {
+    glFinish();
+}
+
+/* void glFlush ( void ) */
+static void
+android_glFlush__
+  (JNIEnv *_env, jobject _this) {
+    glFlush();
+}
+
+/* void glFogf ( GLenum pname, GLfloat param ) */
+static void
+android_glFogf__IF
+  (JNIEnv *_env, jobject _this, jint pname, jfloat param) {
+    glFogf(
+        (GLenum)pname,
+        (GLfloat)param
+    );
+}
+
+/* void glFogfv ( GLenum pname, const GLfloat *params ) */
+static void
+android_glFogfv__I_3FI
+  (JNIEnv *_env, jobject _this, jint pname, jfloatArray params_ref, jint offset) {
+    GLfloat *params_base = (GLfloat *) 0;
+    jint _remaining;
+    GLfloat *params = (GLfloat *) 0;
+
+    if (!params_ref) {
+        _env->ThrowNew(IAEClass, "params == null");
+        goto exit;
+    }
+    if (offset < 0) {
+        _env->ThrowNew(IAEClass, "offset < 0");
+        goto exit;
+    }
+    _remaining = _env->GetArrayLength(params_ref) - offset;
+    int _needed;
+    switch (pname) {
+#if defined(GL_FOG_MODE)
+        case GL_FOG_MODE:
+#endif // defined(GL_FOG_MODE)
+#if defined(GL_FOG_DENSITY)
+        case GL_FOG_DENSITY:
+#endif // defined(GL_FOG_DENSITY)
+#if defined(GL_FOG_START)
+        case GL_FOG_START:
+#endif // defined(GL_FOG_START)
+#if defined(GL_FOG_END)
+        case GL_FOG_END:
+#endif // defined(GL_FOG_END)
+            _needed = 1;
+            break;
+#if defined(GL_FOG_COLOR)
+        case GL_FOG_COLOR:
+#endif // defined(GL_FOG_COLOR)
+            _needed = 4;
+            break;
+        default:
+            _needed = 0;
+            break;
+    }
+    if (_remaining < _needed) {
+        _env->ThrowNew(IAEClass, "length - offset < needed");
+        goto exit;
+    }
+    params_base = (GLfloat *)
+        _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
+    params = params_base + offset;
+
+    glFogfv(
+        (GLenum)pname,
+        (GLfloat *)params
+    );
+
+exit:
+    if (params_base) {
+        _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
+            JNI_ABORT);
+    }
+}
+
+/* void glFogfv ( GLenum pname, const GLfloat *params ) */
+static void
+android_glFogfv__ILjava_nio_FloatBuffer_2
+  (JNIEnv *_env, jobject _this, jint pname, jobject params_buf) {
+    jarray _array = (jarray) 0;
+    jint _remaining;
+    GLfloat *params = (GLfloat *) 0;
+
+    params = (GLfloat *)getPointer(_env, params_buf, &_array, &_remaining);
+    int _needed;
+    switch (pname) {
+#if defined(GL_FOG_MODE)
+        case GL_FOG_MODE:
+#endif // defined(GL_FOG_MODE)
+#if defined(GL_FOG_DENSITY)
+        case GL_FOG_DENSITY:
+#endif // defined(GL_FOG_DENSITY)
+#if defined(GL_FOG_START)
+        case GL_FOG_START:
+#endif // defined(GL_FOG_START)
+#if defined(GL_FOG_END)
+        case GL_FOG_END:
+#endif // defined(GL_FOG_END)
+            _needed = 1;
+            break;
+#if defined(GL_FOG_COLOR)
+        case GL_FOG_COLOR:
+#endif // defined(GL_FOG_COLOR)
+            _needed = 4;
+            break;
+        default:
+            _needed = 0;
+            break;
+    }
+    if (_remaining < _needed) {
+        _env->ThrowNew(IAEClass, "remaining() < needed");
+        goto exit;
+    }
+    glFogfv(
+        (GLenum)pname,
+        (GLfloat *)params
+    );
+
+exit:
+    if (_array) {
+        releasePointer(_env, _array, params, JNI_FALSE);
+    }
+}
+
+/* void glFogx ( GLenum pname, GLfixed param ) */
+static void
+android_glFogx__II
+  (JNIEnv *_env, jobject _this, jint pname, jint param) {
+    glFogx(
+        (GLenum)pname,
+        (GLfixed)param
+    );
+}
+
+/* void glFogxv ( GLenum pname, const GLfixed *params ) */
+static void
+android_glFogxv__I_3II
+  (JNIEnv *_env, jobject _this, jint pname, jintArray params_ref, jint offset) {
+    GLfixed *params_base = (GLfixed *) 0;
+    jint _remaining;
+    GLfixed *params = (GLfixed *) 0;
+
+    if (!params_ref) {
+        _env->ThrowNew(IAEClass, "params == null");
+        goto exit;
+    }
+    if (offset < 0) {
+        _env->ThrowNew(IAEClass, "offset < 0");
+        goto exit;
+    }
+    _remaining = _env->GetArrayLength(params_ref) - offset;
+    int _needed;
+    switch (pname) {
+#if defined(GL_FOG_MODE)
+        case GL_FOG_MODE:
+#endif // defined(GL_FOG_MODE)
+#if defined(GL_FOG_DENSITY)
+        case GL_FOG_DENSITY:
+#endif // defined(GL_FOG_DENSITY)
+#if defined(GL_FOG_START)
+        case GL_FOG_START:
+#endif // defined(GL_FOG_START)
+#if defined(GL_FOG_END)
+        case GL_FOG_END:
+#endif // defined(GL_FOG_END)
+            _needed = 1;
+            break;
+#if defined(GL_FOG_COLOR)
+        case GL_FOG_COLOR:
+#endif // defined(GL_FOG_COLOR)
+            _needed = 4;
+            break;
+        default:
+            _needed = 0;
+            break;
+    }
+    if (_remaining < _needed) {
+        _env->ThrowNew(IAEClass, "length - offset < needed");
+        goto exit;
+    }
+    params_base = (GLfixed *)
+        _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
+    params = params_base + offset;
+
+    glFogxv(
+        (GLenum)pname,
+        (GLfixed *)params
+    );
+
+exit:
+    if (params_base) {
+        _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
+            JNI_ABORT);
+    }
+}
+
+/* void glFogxv ( GLenum pname, const GLfixed *params ) */
+static void
+android_glFogxv__ILjava_nio_IntBuffer_2
+  (JNIEnv *_env, jobject _this, jint pname, jobject params_buf) {
+    jarray _array = (jarray) 0;
+    jint _remaining;
+    GLfixed *params = (GLfixed *) 0;
+
+    params = (GLfixed *)getPointer(_env, params_buf, &_array, &_remaining);
+    int _needed;
+    switch (pname) {
+#if defined(GL_FOG_MODE)
+        case GL_FOG_MODE:
+#endif // defined(GL_FOG_MODE)
+#if defined(GL_FOG_DENSITY)
+        case GL_FOG_DENSITY:
+#endif // defined(GL_FOG_DENSITY)
+#if defined(GL_FOG_START)
+        case GL_FOG_START:
+#endif // defined(GL_FOG_START)
+#if defined(GL_FOG_END)
+        case GL_FOG_END:
+#endif // defined(GL_FOG_END)
+            _needed = 1;
+            break;
+#if defined(GL_FOG_COLOR)
+        case GL_FOG_COLOR:
+#endif // defined(GL_FOG_COLOR)
+            _needed = 4;
+            break;
+        default:
+            _needed = 0;
+            break;
+    }
+    if (_remaining < _needed) {
+        _env->ThrowNew(IAEClass, "remaining() < needed");
+        goto exit;
+    }
+    glFogxv(
+        (GLenum)pname,
+        (GLfixed *)params
+    );
+
+exit:
+    if (_array) {
+        releasePointer(_env, _array, params, JNI_FALSE);
+    }
+}
+
+/* void glFrontFace ( GLenum mode ) */
+static void
+android_glFrontFace__I
+  (JNIEnv *_env, jobject _this, jint mode) {
+    glFrontFace(
+        (GLenum)mode
+    );
+}
+
+/* void glFrustumf ( GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar ) */
+static void
+android_glFrustumf__FFFFFF
+  (JNIEnv *_env, jobject _this, jfloat left, jfloat right, jfloat bottom, jfloat top, jfloat zNear, jfloat zFar) {
+    glFrustumf(
+        (GLfloat)left,
+        (GLfloat)right,
+        (GLfloat)bottom,
+        (GLfloat)top,
+        (GLfloat)zNear,
+        (GLfloat)zFar
+    );
+}
+
+/* void glFrustumx ( GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar ) */
+static void
+android_glFrustumx__IIIIII
+  (JNIEnv *_env, jobject _this, jint left, jint right, jint bottom, jint top, jint zNear, jint zFar) {
+    glFrustumx(
+        (GLfixed)left,
+        (GLfixed)right,
+        (GLfixed)bottom,
+        (GLfixed)top,
+        (GLfixed)zNear,
+        (GLfixed)zFar
+    );
+}
+
+/* void glGenTextures ( GLsizei n, GLuint *textures ) */
+static void
+android_glGenTextures__I_3II
+  (JNIEnv *_env, jobject _this, jint n, jintArray textures_ref, jint offset) {
+    jint _exception = 0;
+    GLuint *textures_base = (GLuint *) 0;
+    jint _remaining;
+    GLuint *textures = (GLuint *) 0;
+
+    if (!textures_ref) {
+        _exception = 1;
+        _env->ThrowNew(IAEClass, "textures == null");
+        goto exit;
+    }
+    if (offset < 0) {
+        _exception = 1;
+        _env->ThrowNew(IAEClass, "offset < 0");
+        goto exit;
+    }
+    _remaining = _env->GetArrayLength(textures_ref) - offset;
+    if (_remaining < n) {
+        _exception = 1;
+        _env->ThrowNew(IAEClass, "length - offset < n");
+        goto exit;
+    }
+    textures_base = (GLuint *)
+        _env->GetPrimitiveArrayCritical(textures_ref, (jboolean *)0);
+    textures = textures_base + offset;
+
+    glGenTextures(
+        (GLsizei)n,
+        (GLuint *)textures
+    );
+
+exit:
+    if (textures_base) {
+        _env->ReleasePrimitiveArrayCritical(textures_ref, textures_base,
+            _exception ? JNI_ABORT: 0);
+    }
+}
+
+/* void glGenTextures ( GLsizei n, GLuint *textures ) */
+static void
+android_glGenTextures__ILjava_nio_IntBuffer_2
+  (JNIEnv *_env, jobject _this, jint n, jobject textures_buf) {
+    jint _exception = 0;
+    jarray _array = (jarray) 0;
+    jint _remaining;
+    GLuint *textures = (GLuint *) 0;
+
+    textures = (GLuint *)getPointer(_env, textures_buf, &_array, &_remaining);
+    if (_remaining < n) {
+        _exception = 1;
+        _env->ThrowNew(IAEClass, "remaining() < n");
+        goto exit;
+    }
+    glGenTextures(
+        (GLsizei)n,
+        (GLuint *)textures
+    );
+
+exit:
+    if (_array) {
+        releasePointer(_env, _array, textures, _exception ? JNI_FALSE : JNI_TRUE);
+    }
+}
+
+/* GLenum glGetError ( void ) */
+static jint
+android_glGetError__
+  (JNIEnv *_env, jobject _this) {
+    GLenum _returnValue;
+    _returnValue = glGetError();
+    return _returnValue;
+}
+
+/* void glGetIntegerv ( GLenum pname, GLint *params ) */
+static void
+android_glGetIntegerv__I_3II
+  (JNIEnv *_env, jobject _this, jint pname, jintArray params_ref, jint offset) {
+    jint _exception = 0;
+    GLint *params_base = (GLint *) 0;
+    jint _remaining;
+    GLint *params = (GLint *) 0;
+
+    if (!params_ref) {
+        _exception = 1;
+        _env->ThrowNew(IAEClass, "params == null");
+        goto exit;
+    }
+    if (offset < 0) {
+        _exception = 1;
+        _env->ThrowNew(IAEClass, "offset < 0");
+        goto exit;
+    }
+    _remaining = _env->GetArrayLength(params_ref) - offset;
+    int _needed;
+    switch (pname) {
+#if defined(GL_ALPHA_BITS)
+        case GL_ALPHA_BITS:
+#endif // defined(GL_ALPHA_BITS)
+#if defined(GL_ALPHA_TEST_FUNC)
+        case GL_ALPHA_TEST_FUNC:
+#endif // defined(GL_ALPHA_TEST_FUNC)
+#if defined(GL_ALPHA_TEST_REF)
+        case GL_ALPHA_TEST_REF:
+#endif // defined(GL_ALPHA_TEST_REF)
+#if defined(GL_BLEND_DST)
+        case GL_BLEND_DST:
+#endif // defined(GL_BLEND_DST)
+#if defined(GL_BLUE_BITS)
+        case GL_BLUE_BITS:
+#endif // defined(GL_BLUE_BITS)
+#if defined(GL_COLOR_ARRAY_BUFFER_BINDING)
+        case GL_COLOR_ARRAY_BUFFER_BINDING:
+#endif // defined(GL_COLOR_ARRAY_BUFFER_BINDING)
+#if defined(GL_COLOR_ARRAY_SIZE)
+        case GL_COLOR_ARRAY_SIZE:
+#endif // defined(GL_COLOR_ARRAY_SIZE)
+#if defined(GL_COLOR_ARRAY_STRIDE)
+        case GL_COLOR_ARRAY_STRIDE:
+#endif // defined(GL_COLOR_ARRAY_STRIDE)
+#if defined(GL_COLOR_ARRAY_TYPE)
+        case GL_COLOR_ARRAY_TYPE:
+#endif // defined(GL_COLOR_ARRAY_TYPE)
+#if defined(GL_CULL_FACE)
+        case GL_CULL_FACE:
+#endif // defined(GL_CULL_FACE)
+#if defined(GL_DEPTH_BITS)
+        case GL_DEPTH_BITS:
+#endif // defined(GL_DEPTH_BITS)
+#if defined(GL_DEPTH_CLEAR_VALUE)
+        case GL_DEPTH_CLEAR_VALUE:
+#endif // defined(GL_DEPTH_CLEAR_VALUE)
+#if defined(GL_DEPTH_FUNC)
+        case GL_DEPTH_FUNC:
+#endif // defined(GL_DEPTH_FUNC)
+#if defined(GL_DEPTH_WRITEMASK)
+        case GL_DEPTH_WRITEMASK:
+#endif // defined(GL_DEPTH_WRITEMASK)
+#if defined(GL_FOG_DENSITY)
+        case GL_FOG_DENSITY:
+#endif // defined(GL_FOG_DENSITY)
+#if defined(GL_FOG_END)
+        case GL_FOG_END:
+#endif // defined(GL_FOG_END)
+#if defined(GL_FOG_MODE)
+        case GL_FOG_MODE:
+#endif // defined(GL_FOG_MODE)
+#if defined(GL_FOG_START)
+        case GL_FOG_START:
+#endif // defined(GL_FOG_START)
+#if defined(GL_FRONT_FACE)
+        case GL_FRONT_FACE:
+#endif // defined(GL_FRONT_FACE)
+#if defined(GL_GREEN_BITS)
+        case GL_GREEN_BITS:
+#endif // defined(GL_GREEN_BITS)
+#if defined(GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES)
+        case GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES:
+#endif // defined(GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES)
+#if defined(GL_IMPLEMENTATION_COLOR_READ_TYPE_OES)
+        case GL_IMPLEMENTATION_COLOR_READ_TYPE_OES:
+#endif // defined(GL_IMPLEMENTATION_COLOR_READ_TYPE_OES)
+#if defined(GL_LIGHT_MODEL_TWO_SIDE)
+        case GL_LIGHT_MODEL_TWO_SIDE:
+#endif // defined(GL_LIGHT_MODEL_TWO_SIDE)
+#if defined(GL_LINE_SMOOTH_HINT)
+        case GL_LINE_SMOOTH_HINT:
+#endif // defined(GL_LINE_SMOOTH_HINT)
+#if defined(GL_LINE_WIDTH)
+        case GL_LINE_WIDTH:
+#endif // defined(GL_LINE_WIDTH)
+#if defined(GL_LOGIC_OP_MODE)
+        case GL_LOGIC_OP_MODE:
+#endif // defined(GL_LOGIC_OP_MODE)
+#if defined(GL_MATRIX_INDEX_ARRAY_BUFFER_BINDING_OES)
+        case GL_MATRIX_INDEX_ARRAY_BUFFER_BINDING_OES:
+#endif // defined(GL_MATRIX_INDEX_ARRAY_BUFFER_BINDING_OES)
+#if defined(GL_MATRIX_INDEX_ARRAY_SIZE_OES)
+        case GL_MATRIX_INDEX_ARRAY_SIZE_OES:
+#endif // defined(GL_MATRIX_INDEX_ARRAY_SIZE_OES)
+#if defined(GL_MATRIX_INDEX_ARRAY_STRIDE_OES)
+        case GL_MATRIX_INDEX_ARRAY_STRIDE_OES:
+#endif // defined(GL_MATRIX_INDEX_ARRAY_STRIDE_OES)
+#if defined(GL_MATRIX_INDEX_ARRAY_TYPE_OES)
+        case GL_MATRIX_INDEX_ARRAY_TYPE_OES:
+#endif // defined(GL_MATRIX_INDEX_ARRAY_TYPE_OES)
+#if defined(GL_MATRIX_MODE)
+        case GL_MATRIX_MODE:
+#endif // defined(GL_MATRIX_MODE)
+#if defined(GL_MAX_CLIP_PLANES)
+        case GL_MAX_CLIP_PLANES:
+#endif // defined(GL_MAX_CLIP_PLANES)
+#if defined(GL_MAX_ELEMENTS_INDICES)
+        case GL_MAX_ELEMENTS_INDICES:
+#endif // defined(GL_MAX_ELEMENTS_INDICES)
+#if defined(GL_MAX_ELEMENTS_VERTICES)
+        case GL_MAX_ELEMENTS_VERTICES:
+#endif // defined(GL_MAX_ELEMENTS_VERTICES)
+#if defined(GL_MAX_LIGHTS)
+        case GL_MAX_LIGHTS:
+#endif // defined(GL_MAX_LIGHTS)
+#if defined(GL_MAX_MODELVIEW_STACK_DEPTH)
+        case GL_MAX_MODELVIEW_STACK_DEPTH:
+#endif // defined(GL_MAX_MODELVIEW_STACK_DEPTH)
+#if defined(GL_MAX_PALETTE_MATRICES_OES)
+        case GL_MAX_PALETTE_MATRICES_OES:
+#endif // defined(GL_MAX_PALETTE_MATRICES_OES)
+#if defined(GL_MAX_PROJECTION_STACK_DEPTH)
+        case GL_MAX_PROJECTION_STACK_DEPTH:
+#endif // defined(GL_MAX_PROJECTION_STACK_DEPTH)
+#if defined(GL_MAX_TEXTURE_SIZE)
+        case GL_MAX_TEXTURE_SIZE:
+#endif // defined(GL_MAX_TEXTURE_SIZE)
+#if defined(GL_MAX_TEXTURE_STACK_DEPTH)
+        case GL_MAX_TEXTURE_STACK_DEPTH:
+#endif // defined(GL_MAX_TEXTURE_STACK_DEPTH)
+#if defined(GL_MAX_TEXTURE_UNITS)
+        case GL_MAX_TEXTURE_UNITS:
+#endif // defined(GL_MAX_TEXTURE_UNITS)
+#if defined(GL_MAX_VERTEX_UNITS_OES)
+        case GL_MAX_VERTEX_UNITS_OES:
+#endif // defined(GL_MAX_VERTEX_UNITS_OES)
+#if defined(GL_MODELVIEW_STACK_DEPTH)
+        case GL_MODELVIEW_STACK_DEPTH:
+#endif // defined(GL_MODELVIEW_STACK_DEPTH)
+#if defined(GL_NORMAL_ARRAY_BUFFER_BINDING)
+        case GL_NORMAL_ARRAY_BUFFER_BINDING:
+#endif // defined(GL_NORMAL_ARRAY_BUFFER_BINDING)
+#if defined(GL_NORMAL_ARRAY_STRIDE)
+        case GL_NORMAL_ARRAY_STRIDE:
+#endif // defined(GL_NORMAL_ARRAY_STRIDE)
+#if defined(GL_NORMAL_ARRAY_TYPE)
+        case GL_NORMAL_ARRAY_TYPE:
+#endif // defined(GL_NORMAL_ARRAY_TYPE)
+#if defined(GL_NUM_COMPRESSED_TEXTURE_FORMATS)
+        case GL_NUM_COMPRESSED_TEXTURE_FORMATS:
+#endif // defined(GL_NUM_COMPRESSED_TEXTURE_FORMATS)
+#if defined(GL_PACK_ALIGNMENT)
+        case GL_PACK_ALIGNMENT:
+#endif // defined(GL_PACK_ALIGNMENT)
+#if defined(GL_PERSPECTIVE_CORRECTION_HINT)
+        case GL_PERSPECTIVE_CORRECTION_HINT:
+#endif // defined(GL_PERSPECTIVE_CORRECTION_HINT)
+#if defined(GL_POINT_SIZE)
+        case GL_POINT_SIZE:
+#endif // defined(GL_POINT_SIZE)
+#if defined(GL_POINT_SIZE_ARRAY_BUFFER_BINDING_OES)
+        case GL_POINT_SIZE_ARRAY_BUFFER_BINDING_OES:
+#endif // defined(GL_POINT_SIZE_ARRAY_BUFFER_BINDING_OES)
+#if defined(GL_POINT_SIZE_ARRAY_STRIDE_OES)
+        case GL_POINT_SIZE_ARRAY_STRIDE_OES:
+#endif // defined(GL_POINT_SIZE_ARRAY_STRIDE_OES)
+#if defined(GL_POINT_SIZE_ARRAY_TYPE_OES)
+        case GL_POINT_SIZE_ARRAY_TYPE_OES:
+#endif // defined(GL_POINT_SIZE_ARRAY_TYPE_OES)
+#if defined(GL_POINT_SMOOTH_HINT)
+        case GL_POINT_SMOOTH_HINT:
+#endif // defined(GL_POINT_SMOOTH_HINT)
+#if defined(GL_POLYGON_OFFSET_FACTOR)
+        case GL_POLYGON_OFFSET_FACTOR:
+#endif // defined(GL_POLYGON_OFFSET_FACTOR)
+#if defined(GL_POLYGON_OFFSET_UNITS)
+        case GL_POLYGON_OFFSET_UNITS:
+#endif // defined(GL_POLYGON_OFFSET_UNITS)
+#if defined(GL_PROJECTION_STACK_DEPTH)
+        case GL_PROJECTION_STACK_DEPTH:
+#endif // defined(GL_PROJECTION_STACK_DEPTH)
+#if defined(GL_RED_BITS)
+        case GL_RED_BITS:
+#endif // defined(GL_RED_BITS)
+#if defined(GL_SHADE_MODEL)
+        case GL_SHADE_MODEL:
+#endif // defined(GL_SHADE_MODEL)
+#if defined(GL_STENCIL_BITS)
+        case GL_STENCIL_BITS:
+#endif // defined(GL_STENCIL_BITS)
+#if defined(GL_STENCIL_CLEAR_VALUE)
+        case GL_STENCIL_CLEAR_VALUE:
+#endif // defined(GL_STENCIL_CLEAR_VALUE)
+#if defined(GL_STENCIL_FAIL)
+        case GL_STENCIL_FAIL:
+#endif // defined(GL_STENCIL_FAIL)
+#if defined(GL_STENCIL_FUNC)
+        case GL_STENCIL_FUNC:
+#endif // defined(GL_STENCIL_FUNC)
+#if defined(GL_STENCIL_PASS_DEPTH_FAIL)
+        case GL_STENCIL_PASS_DEPTH_FAIL:
+#endif // defined(GL_STENCIL_PASS_DEPTH_FAIL)
+#if defined(GL_STENCIL_PASS_DEPTH_PASS)
+        case GL_STENCIL_PASS_DEPTH_PASS:
+#endif // defined(GL_STENCIL_PASS_DEPTH_PASS)
+#if defined(GL_STENCIL_REF)
+        case GL_STENCIL_REF:
+#endif // defined(GL_STENCIL_REF)
+#if defined(GL_STENCIL_VALUE_MASK)
+        case GL_STENCIL_VALUE_MASK:
+#endif // defined(GL_STENCIL_VALUE_MASK)
+#if defined(GL_STENCIL_WRITEMASK)
+        case GL_STENCIL_WRITEMASK:
+#endif // defined(GL_STENCIL_WRITEMASK)
+#if defined(GL_SUBPIXEL_BITS)
+        case GL_SUBPIXEL_BITS:
+#endif // defined(GL_SUBPIXEL_BITS)
+#if defined(GL_TEXTURE_BINDING_2D)
+        case GL_TEXTURE_BINDING_2D:
+#endif // defined(GL_TEXTURE_BINDING_2D)
+#if defined(GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING)
+        case GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING:
+#endif // defined(GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING)
+#if defined(GL_TEXTURE_COORD_ARRAY_SIZE)
+        case GL_TEXTURE_COORD_ARRAY_SIZE:
+#endif // defined(GL_TEXTURE_COORD_ARRAY_SIZE)
+#if defined(GL_TEXTURE_COORD_ARRAY_STRIDE)
+        case GL_TEXTURE_COORD_ARRAY_STRIDE:
+#endif // defined(GL_TEXTURE_COORD_ARRAY_STRIDE)
+#if defined(GL_TEXTURE_COORD_ARRAY_TYPE)
+        case GL_TEXTURE_COORD_ARRAY_TYPE:
+#endif // defined(GL_TEXTURE_COORD_ARRAY_TYPE)
+#if defined(GL_TEXTURE_STACK_DEPTH)
+        case GL_TEXTURE_STACK_DEPTH:
+#endif // defined(GL_TEXTURE_STACK_DEPTH)
+#if defined(GL_UNPACK_ALIGNMENT)
+        case GL_UNPACK_ALIGNMENT:
+#endif // defined(GL_UNPACK_ALIGNMENT)
+#if defined(GL_VERTEX_ARRAY_BUFFER_BINDING)
+        case GL_VERTEX_ARRAY_BUFFER_BINDING:
+#endif // defined(GL_VERTEX_ARRAY_BUFFER_BINDING)
+#if defined(GL_VERTEX_ARRAY_SIZE)
+        case GL_VERTEX_ARRAY_SIZE:
+#endif // defined(GL_VERTEX_ARRAY_SIZE)
+#if defined(GL_VERTEX_ARRAY_STRIDE)
+        case GL_VERTEX_ARRAY_STRIDE:
+#endif // defined(GL_VERTEX_ARRAY_STRIDE)
+#if defined(GL_VERTEX_ARRAY_TYPE)
+        case GL_VERTEX_ARRAY_TYPE:
+#endif // defined(GL_VERTEX_ARRAY_TYPE)
+#if defined(GL_WEIGHT_ARRAY_BUFFER_BINDING_OES)
+        case GL_WEIGHT_ARRAY_BUFFER_BINDING_OES:
+#endif // defined(GL_WEIGHT_ARRAY_BUFFER_BINDING_OES)
+#if defined(GL_WEIGHT_ARRAY_SIZE_OES)
+        case GL_WEIGHT_ARRAY_SIZE_OES:
+#endif // defined(GL_WEIGHT_ARRAY_SIZE_OES)
+#if defined(GL_WEIGHT_ARRAY_STRIDE_OES)
+        case GL_WEIGHT_ARRAY_STRIDE_OES:
+#endif // defined(GL_WEIGHT_ARRAY_STRIDE_OES)
+#if defined(GL_WEIGHT_ARRAY_TYPE_OES)
+        case GL_WEIGHT_ARRAY_TYPE_OES:
+#endif // defined(GL_WEIGHT_ARRAY_TYPE_OES)
+            _needed = 1;
+            break;
+#if defined(GL_ALIASED_POINT_SIZE_RANGE)
+        case GL_ALIASED_POINT_SIZE_RANGE:
+#endif // defined(GL_ALIASED_POINT_SIZE_RANGE)
+#if defined(GL_ALIASED_LINE_WIDTH_RANGE)
+        case GL_ALIASED_LINE_WIDTH_RANGE:
+#endif // defined(GL_ALIASED_LINE_WIDTH_RANGE)
+#if defined(GL_DEPTH_RANGE)
+        case GL_DEPTH_RANGE:
+#endif // defined(GL_DEPTH_RANGE)
+#if defined(GL_MAX_VIEWPORT_DIMS)
+        case GL_MAX_VIEWPORT_DIMS:
+#endif // defined(GL_MAX_VIEWPORT_DIMS)
+#if defined(GL_SMOOTH_LINE_WIDTH_RANGE)
+        case GL_SMOOTH_LINE_WIDTH_RANGE:
+#endif // defined(GL_SMOOTH_LINE_WIDTH_RANGE)
+#if defined(GL_SMOOTH_POINT_SIZE_RANGE)
+        case GL_SMOOTH_POINT_SIZE_RANGE:
+#endif // defined(GL_SMOOTH_POINT_SIZE_RANGE)
+            _needed = 2;
+            break;
+#if defined(GL_COLOR_CLEAR_VALUE)
+        case GL_COLOR_CLEAR_VALUE:
+#endif // defined(GL_COLOR_CLEAR_VALUE)
+#if defined(GL_COLOR_WRITEMASK)
+        case GL_COLOR_WRITEMASK:
+#endif // defined(GL_COLOR_WRITEMASK)
+#if defined(GL_SCISSOR_BOX)
+        case GL_SCISSOR_BOX:
+#endif // defined(GL_SCISSOR_BOX)
+#if defined(GL_VIEWPORT)
+        case GL_VIEWPORT:
+#endif // defined(GL_VIEWPORT)
+            _needed = 4;
+            break;
+#if defined(GL_MODELVIEW_MATRIX)
+        case GL_MODELVIEW_MATRIX:
+#endif // defined(GL_MODELVIEW_MATRIX)
+#if defined(GL_MODELVIEW_MATRIX_FLOAT_AS_INT_BITS_OES)
+        case GL_MODELVIEW_MATRIX_FLOAT_AS_INT_BITS_OES:
+#endif // defined(GL_MODELVIEW_MATRIX_FLOAT_AS_INT_BITS_OES)
+#if defined(GL_PROJECTION_MATRIX)
+        case GL_PROJECTION_MATRIX:
+#endif // defined(GL_PROJECTION_MATRIX)
+#if defined(GL_PROJECTION_MATRIX_FLOAT_AS_INT_BITS_OES)
+        case GL_PROJECTION_MATRIX_FLOAT_AS_INT_BITS_OES:
+#endif // defined(GL_PROJECTION_MATRIX_FLOAT_AS_INT_BITS_OES)
+#if defined(GL_TEXTURE_MATRIX)
+        case GL_TEXTURE_MATRIX:
+#endif // defined(GL_TEXTURE_MATRIX)
+#if defined(GL_TEXTURE_MATRIX_FLOAT_AS_INT_BITS_OES)
+        case GL_TEXTURE_MATRIX_FLOAT_AS_INT_BITS_OES:
+#endif // defined(GL_TEXTURE_MATRIX_FLOAT_AS_INT_BITS_OES)
+            _needed = 16;
+            break;
+#if defined(GL_COMPRESSED_TEXTURE_FORMATS)
+        case GL_COMPRESSED_TEXTURE_FORMATS:
+#endif // defined(GL_COMPRESSED_TEXTURE_FORMATS)
+#if defined(GL_FOG_COLOR)
+        case GL_FOG_COLOR:
+#endif // defined(GL_FOG_COLOR)
+#if defined(GL_LIGHT_MODEL_AMBIENT)
+        case GL_LIGHT_MODEL_AMBIENT:
+#endif // defined(GL_LIGHT_MODEL_AMBIENT)
+            _needed = _NUM_COMPRESSED_TEXTURE_FORMATS;
+            break;
+        default:
+            _needed = 0;
+            break;
+    }
+    if (_remaining < _needed) {
+        _exception = 1;
+        _env->ThrowNew(IAEClass, "length - offset < needed");
+        goto exit;
+    }
+    params_base = (GLint *)
+        _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
+    params = params_base + offset;
+
+    glGetIntegerv(
+        (GLenum)pname,
+        (GLint *)params
+    );
+
+exit:
+    if (params_base) {
+        _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
+            _exception ? JNI_ABORT: 0);
+    }
+}
+
+/* void glGetIntegerv ( GLenum pname, GLint *params ) */
+static void
+android_glGetIntegerv__ILjava_nio_IntBuffer_2
+  (JNIEnv *_env, jobject _this, jint pname, jobject params_buf) {
+    jint _exception = 0;
+    jarray _array = (jarray) 0;
+    jint _remaining;
+    GLint *params = (GLint *) 0;
+
+    params = (GLint *)getPointer(_env, params_buf, &_array, &_remaining);
+    int _needed;
+    switch (pname) {
+#if defined(GL_ALPHA_BITS)
+        case GL_ALPHA_BITS:
+#endif // defined(GL_ALPHA_BITS)
+#if defined(GL_ALPHA_TEST_FUNC)
+        case GL_ALPHA_TEST_FUNC:
+#endif // defined(GL_ALPHA_TEST_FUNC)
+#if defined(GL_ALPHA_TEST_REF)
+        case GL_ALPHA_TEST_REF:
+#endif // defined(GL_ALPHA_TEST_REF)
+#if defined(GL_BLEND_DST)
+        case GL_BLEND_DST:
+#endif // defined(GL_BLEND_DST)
+#if defined(GL_BLUE_BITS)
+        case GL_BLUE_BITS:
+#endif // defined(GL_BLUE_BITS)
+#if defined(GL_COLOR_ARRAY_BUFFER_BINDING)
+        case GL_COLOR_ARRAY_BUFFER_BINDING:
+#endif // defined(GL_COLOR_ARRAY_BUFFER_BINDING)
+#if defined(GL_COLOR_ARRAY_SIZE)
+        case GL_COLOR_ARRAY_SIZE:
+#endif // defined(GL_COLOR_ARRAY_SIZE)
+#if defined(GL_COLOR_ARRAY_STRIDE)
+        case GL_COLOR_ARRAY_STRIDE:
+#endif // defined(GL_COLOR_ARRAY_STRIDE)
+#if defined(GL_COLOR_ARRAY_TYPE)
+        case GL_COLOR_ARRAY_TYPE:
+#endif // defined(GL_COLOR_ARRAY_TYPE)
+#if defined(GL_CULL_FACE)
+        case GL_CULL_FACE:
+#endif // defined(GL_CULL_FACE)
+#if defined(GL_DEPTH_BITS)
+        case GL_DEPTH_BITS:
+#endif // defined(GL_DEPTH_BITS)
+#if defined(GL_DEPTH_CLEAR_VALUE)
+        case GL_DEPTH_CLEAR_VALUE:
+#endif // defined(GL_DEPTH_CLEAR_VALUE)
+#if defined(GL_DEPTH_FUNC)
+        case GL_DEPTH_FUNC:
+#endif // defined(GL_DEPTH_FUNC)
+#if defined(GL_DEPTH_WRITEMASK)
+        case GL_DEPTH_WRITEMASK:
+#endif // defined(GL_DEPTH_WRITEMASK)
+#if defined(GL_FOG_DENSITY)
+        case GL_FOG_DENSITY:
+#endif // defined(GL_FOG_DENSITY)
+#if defined(GL_FOG_END)
+        case GL_FOG_END:
+#endif // defined(GL_FOG_END)
+#if defined(GL_FOG_MODE)
+        case GL_FOG_MODE:
+#endif // defined(GL_FOG_MODE)
+#if defined(GL_FOG_START)
+        case GL_FOG_START:
+#endif // defined(GL_FOG_START)
+#if defined(GL_FRONT_FACE)
+        case GL_FRONT_FACE:
+#endif // defined(GL_FRONT_FACE)
+#if defined(GL_GREEN_BITS)
+        case GL_GREEN_BITS:
+#endif // defined(GL_GREEN_BITS)
+#if defined(GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES)
+        case GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES:
+#endif // defined(GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES)
+#if defined(GL_IMPLEMENTATION_COLOR_READ_TYPE_OES)
+        case GL_IMPLEMENTATION_COLOR_READ_TYPE_OES:
+#endif // defined(GL_IMPLEMENTATION_COLOR_READ_TYPE_OES)
+#if defined(GL_LIGHT_MODEL_TWO_SIDE)
+        case GL_LIGHT_MODEL_TWO_SIDE:
+#endif // defined(GL_LIGHT_MODEL_TWO_SIDE)
+#if defined(GL_LINE_SMOOTH_HINT)
+        case GL_LINE_SMOOTH_HINT:
+#endif // defined(GL_LINE_SMOOTH_HINT)
+#if defined(GL_LINE_WIDTH)
+        case GL_LINE_WIDTH:
+#endif // defined(GL_LINE_WIDTH)
+#if defined(GL_LOGIC_OP_MODE)
+        case GL_LOGIC_OP_MODE:
+#endif // defined(GL_LOGIC_OP_MODE)
+#if defined(GL_MATRIX_INDEX_ARRAY_BUFFER_BINDING_OES)
+        case GL_MATRIX_INDEX_ARRAY_BUFFER_BINDING_OES:
+#endif // defined(GL_MATRIX_INDEX_ARRAY_BUFFER_BINDING_OES)
+#if defined(GL_MATRIX_INDEX_ARRAY_SIZE_OES)
+        case GL_MATRIX_INDEX_ARRAY_SIZE_OES:
+#endif // defined(GL_MATRIX_INDEX_ARRAY_SIZE_OES)
+#if defined(GL_MATRIX_INDEX_ARRAY_STRIDE_OES)
+        case GL_MATRIX_INDEX_ARRAY_STRIDE_OES:
+#endif // defined(GL_MATRIX_INDEX_ARRAY_STRIDE_OES)
+#if defined(GL_MATRIX_INDEX_ARRAY_TYPE_OES)
+        case GL_MATRIX_INDEX_ARRAY_TYPE_OES:
+#endif // defined(GL_MATRIX_INDEX_ARRAY_TYPE_OES)
+#if defined(GL_MATRIX_MODE)
+        case GL_MATRIX_MODE:
+#endif // defined(GL_MATRIX_MODE)
+#if defined(GL_MAX_CLIP_PLANES)
+        case GL_MAX_CLIP_PLANES:
+#endif // defined(GL_MAX_CLIP_PLANES)
+#if defined(GL_MAX_ELEMENTS_INDICES)
+        case GL_MAX_ELEMENTS_INDICES:
+#endif // defined(GL_MAX_ELEMENTS_INDICES)
+#if defined(GL_MAX_ELEMENTS_VERTICES)
+        case GL_MAX_ELEMENTS_VERTICES:
+#endif // defined(GL_MAX_ELEMENTS_VERTICES)
+#if defined(GL_MAX_LIGHTS)
+        case GL_MAX_LIGHTS:
+#endif // defined(GL_MAX_LIGHTS)
+#if defined(GL_MAX_MODELVIEW_STACK_DEPTH)
+        case GL_MAX_MODELVIEW_STACK_DEPTH:
+#endif // defined(GL_MAX_MODELVIEW_STACK_DEPTH)
+#if defined(GL_MAX_PALETTE_MATRICES_OES)
+        case GL_MAX_PALETTE_MATRICES_OES:
+#endif // defined(GL_MAX_PALETTE_MATRICES_OES)
+#if defined(GL_MAX_PROJECTION_STACK_DEPTH)
+        case GL_MAX_PROJECTION_STACK_DEPTH:
+#endif // defined(GL_MAX_PROJECTION_STACK_DEPTH)
+#if defined(GL_MAX_TEXTURE_SIZE)
+        case GL_MAX_TEXTURE_SIZE:
+#endif // defined(GL_MAX_TEXTURE_SIZE)
+#if defined(GL_MAX_TEXTURE_STACK_DEPTH)
+        case GL_MAX_TEXTURE_STACK_DEPTH:
+#endif // defined(GL_MAX_TEXTURE_STACK_DEPTH)
+#if defined(GL_MAX_TEXTURE_UNITS)
+        case GL_MAX_TEXTURE_UNITS:
+#endif // defined(GL_MAX_TEXTURE_UNITS)
+#if defined(GL_MAX_VERTEX_UNITS_OES)
+        case GL_MAX_VERTEX_UNITS_OES:
+#endif // defined(GL_MAX_VERTEX_UNITS_OES)
+#if defined(GL_MODELVIEW_STACK_DEPTH)
+        case GL_MODELVIEW_STACK_DEPTH:
+#endif // defined(GL_MODELVIEW_STACK_DEPTH)
+#if defined(GL_NORMAL_ARRAY_BUFFER_BINDING)
+        case GL_NORMAL_ARRAY_BUFFER_BINDING:
+#endif // defined(GL_NORMAL_ARRAY_BUFFER_BINDING)
+#if defined(GL_NORMAL_ARRAY_STRIDE)
+        case GL_NORMAL_ARRAY_STRIDE:
+#endif // defined(GL_NORMAL_ARRAY_STRIDE)
+#if defined(GL_NORMAL_ARRAY_TYPE)
+        case GL_NORMAL_ARRAY_TYPE:
+#endif // defined(GL_NORMAL_ARRAY_TYPE)
+#if defined(GL_NUM_COMPRESSED_TEXTURE_FORMATS)
+        case GL_NUM_COMPRESSED_TEXTURE_FORMATS:
+#endif // defined(GL_NUM_COMPRESSED_TEXTURE_FORMATS)
+#if defined(GL_PACK_ALIGNMENT)
+        case GL_PACK_ALIGNMENT:
+#endif // defined(GL_PACK_ALIGNMENT)
+#if defined(GL_PERSPECTIVE_CORRECTION_HINT)
+        case GL_PERSPECTIVE_CORRECTION_HINT:
+#endif // defined(GL_PERSPECTIVE_CORRECTION_HINT)
+#if defined(GL_POINT_SIZE)
+        case GL_POINT_SIZE:
+#endif // defined(GL_POINT_SIZE)
+#if defined(GL_POINT_SIZE_ARRAY_BUFFER_BINDING_OES)
+        case GL_POINT_SIZE_ARRAY_BUFFER_BINDING_OES:
+#endif // defined(GL_POINT_SIZE_ARRAY_BUFFER_BINDING_OES)
+#if defined(GL_POINT_SIZE_ARRAY_STRIDE_OES)
+        case GL_POINT_SIZE_ARRAY_STRIDE_OES:
+#endif // defined(GL_POINT_SIZE_ARRAY_STRIDE_OES)
+#if defined(GL_POINT_SIZE_ARRAY_TYPE_OES)
+        case GL_POINT_SIZE_ARRAY_TYPE_OES:
+#endif // defined(GL_POINT_SIZE_ARRAY_TYPE_OES)
+#if defined(GL_POINT_SMOOTH_HINT)
+        case GL_POINT_SMOOTH_HINT:
+#endif // defined(GL_POINT_SMOOTH_HINT)
+#if defined(GL_POLYGON_OFFSET_FACTOR)
+        case GL_POLYGON_OFFSET_FACTOR:
+#endif // defined(GL_POLYGON_OFFSET_FACTOR)
+#if defined(GL_POLYGON_OFFSET_UNITS)
+        case GL_POLYGON_OFFSET_UNITS:
+#endif // defined(GL_POLYGON_OFFSET_UNITS)
+#if defined(GL_PROJECTION_STACK_DEPTH)
+        case GL_PROJECTION_STACK_DEPTH:
+#endif // defined(GL_PROJECTION_STACK_DEPTH)
+#if defined(GL_RED_BITS)
+        case GL_RED_BITS:
+#endif // defined(GL_RED_BITS)
+#if defined(GL_SHADE_MODEL)
+        case GL_SHADE_MODEL:
+#endif // defined(GL_SHADE_MODEL)
+#if defined(GL_STENCIL_BITS)
+        case GL_STENCIL_BITS:
+#endif // defined(GL_STENCIL_BITS)
+#if defined(GL_STENCIL_CLEAR_VALUE)
+        case GL_STENCIL_CLEAR_VALUE:
+#endif // defined(GL_STENCIL_CLEAR_VALUE)
+#if defined(GL_STENCIL_FAIL)
+        case GL_STENCIL_FAIL:
+#endif // defined(GL_STENCIL_FAIL)
+#if defined(GL_STENCIL_FUNC)
+        case GL_STENCIL_FUNC:
+#endif // defined(GL_STENCIL_FUNC)
+#if defined(GL_STENCIL_PASS_DEPTH_FAIL)
+        case GL_STENCIL_PASS_DEPTH_FAIL:
+#endif // defined(GL_STENCIL_PASS_DEPTH_FAIL)
+#if defined(GL_STENCIL_PASS_DEPTH_PASS)
+        case GL_STENCIL_PASS_DEPTH_PASS:
+#endif // defined(GL_STENCIL_PASS_DEPTH_PASS)
+#if defined(GL_STENCIL_REF)
+        case GL_STENCIL_REF:
+#endif // defined(GL_STENCIL_REF)
+#if defined(GL_STENCIL_VALUE_MASK)
+        case GL_STENCIL_VALUE_MASK:
+#endif // defined(GL_STENCIL_VALUE_MASK)
+#if defined(GL_STENCIL_WRITEMASK)
+        case GL_STENCIL_WRITEMASK:
+#endif // defined(GL_STENCIL_WRITEMASK)
+#if defined(GL_SUBPIXEL_BITS)
+        case GL_SUBPIXEL_BITS:
+#endif // defined(GL_SUBPIXEL_BITS)
+#if defined(GL_TEXTURE_BINDING_2D)
+        case GL_TEXTURE_BINDING_2D:
+#endif // defined(GL_TEXTURE_BINDING_2D)
+#if defined(GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING)
+        case GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING:
+#endif // defined(GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING)
+#if defined(GL_TEXTURE_COORD_ARRAY_SIZE)
+        case GL_TEXTURE_COORD_ARRAY_SIZE:
+#endif // defined(GL_TEXTURE_COORD_ARRAY_SIZE)
+#if defined(GL_TEXTURE_COORD_ARRAY_STRIDE)
+        case GL_TEXTURE_COORD_ARRAY_STRIDE:
+#endif // defined(GL_TEXTURE_COORD_ARRAY_STRIDE)
+#if defined(GL_TEXTURE_COORD_ARRAY_TYPE)
+        case GL_TEXTURE_COORD_ARRAY_TYPE:
+#endif // defined(GL_TEXTURE_COORD_ARRAY_TYPE)
+#if defined(GL_TEXTURE_STACK_DEPTH)
+        case GL_TEXTURE_STACK_DEPTH:
+#endif // defined(GL_TEXTURE_STACK_DEPTH)
+#if defined(GL_UNPACK_ALIGNMENT)
+        case GL_UNPACK_ALIGNMENT:
+#endif // defined(GL_UNPACK_ALIGNMENT)
+#if defined(GL_VERTEX_ARRAY_BUFFER_BINDING)
+        case GL_VERTEX_ARRAY_BUFFER_BINDING:
+#endif // defined(GL_VERTEX_ARRAY_BUFFER_BINDING)
+#if defined(GL_VERTEX_ARRAY_SIZE)
+        case GL_VERTEX_ARRAY_SIZE:
+#endif // defined(GL_VERTEX_ARRAY_SIZE)
+#if defined(GL_VERTEX_ARRAY_STRIDE)
+        case GL_VERTEX_ARRAY_STRIDE:
+#endif // defined(GL_VERTEX_ARRAY_STRIDE)
+#if defined(GL_VERTEX_ARRAY_TYPE)
+        case GL_VERTEX_ARRAY_TYPE:
+#endif // defined(GL_VERTEX_ARRAY_TYPE)
+#if defined(GL_WEIGHT_ARRAY_BUFFER_BINDING_OES)
+        case GL_WEIGHT_ARRAY_BUFFER_BINDING_OES:
+#endif // defined(GL_WEIGHT_ARRAY_BUFFER_BINDING_OES)
+#if defined(GL_WEIGHT_ARRAY_SIZE_OES)
+        case GL_WEIGHT_ARRAY_SIZE_OES:
+#endif // defined(GL_WEIGHT_ARRAY_SIZE_OES)
+#if defined(GL_WEIGHT_ARRAY_STRIDE_OES)
+        case GL_WEIGHT_ARRAY_STRIDE_OES:
+#endif // defined(GL_WEIGHT_ARRAY_STRIDE_OES)
+#if defined(GL_WEIGHT_ARRAY_TYPE_OES)
+        case GL_WEIGHT_ARRAY_TYPE_OES:
+#endif // defined(GL_WEIGHT_ARRAY_TYPE_OES)
+            _needed = 1;
+            break;
+#if defined(GL_ALIASED_POINT_SIZE_RANGE)
+        case GL_ALIASED_POINT_SIZE_RANGE:
+#endif // defined(GL_ALIASED_POINT_SIZE_RANGE)
+#if defined(GL_ALIASED_LINE_WIDTH_RANGE)
+        case GL_ALIASED_LINE_WIDTH_RANGE:
+#endif // defined(GL_ALIASED_LINE_WIDTH_RANGE)
+#if defined(GL_DEPTH_RANGE)
+        case GL_DEPTH_RANGE:
+#endif // defined(GL_DEPTH_RANGE)
+#if defined(GL_MAX_VIEWPORT_DIMS)
+        case GL_MAX_VIEWPORT_DIMS:
+#endif // defined(GL_MAX_VIEWPORT_DIMS)
+#if defined(GL_SMOOTH_LINE_WIDTH_RANGE)
+        case GL_SMOOTH_LINE_WIDTH_RANGE:
+#endif // defined(GL_SMOOTH_LINE_WIDTH_RANGE)
+#if defined(GL_SMOOTH_POINT_SIZE_RANGE)
+        case GL_SMOOTH_POINT_SIZE_RANGE:
+#endif // defined(GL_SMOOTH_POINT_SIZE_RANGE)
+            _needed = 2;
+            break;
+#if defined(GL_COLOR_CLEAR_VALUE)
+        case GL_COLOR_CLEAR_VALUE:
+#endif // defined(GL_COLOR_CLEAR_VALUE)
+#if defined(GL_COLOR_WRITEMASK)
+        case GL_COLOR_WRITEMASK:
+#endif // defined(GL_COLOR_WRITEMASK)
+#if defined(GL_SCISSOR_BOX)
+        case GL_SCISSOR_BOX:
+#endif // defined(GL_SCISSOR_BOX)
+#if defined(GL_VIEWPORT)
+        case GL_VIEWPORT:
+#endif // defined(GL_VIEWPORT)
+            _needed = 4;
+            break;
+#if defined(GL_MODELVIEW_MATRIX)
+        case GL_MODELVIEW_MATRIX:
+#endif // defined(GL_MODELVIEW_MATRIX)
+#if defined(GL_MODELVIEW_MATRIX_FLOAT_AS_INT_BITS_OES)
+        case GL_MODELVIEW_MATRIX_FLOAT_AS_INT_BITS_OES:
+#endif // defined(GL_MODELVIEW_MATRIX_FLOAT_AS_INT_BITS_OES)
+#if defined(GL_PROJECTION_MATRIX)
+        case GL_PROJECTION_MATRIX:
+#endif // defined(GL_PROJECTION_MATRIX)
+#if defined(GL_PROJECTION_MATRIX_FLOAT_AS_INT_BITS_OES)
+        case GL_PROJECTION_MATRIX_FLOAT_AS_INT_BITS_OES:
+#endif // defined(GL_PROJECTION_MATRIX_FLOAT_AS_INT_BITS_OES)
+#if defined(GL_TEXTURE_MATRIX)
+        case GL_TEXTURE_MATRIX:
+#endif // defined(GL_TEXTURE_MATRIX)
+#if defined(GL_TEXTURE_MATRIX_FLOAT_AS_INT_BITS_OES)
+        case GL_TEXTURE_MATRIX_FLOAT_AS_INT_BITS_OES:
+#endif // defined(GL_TEXTURE_MATRIX_FLOAT_AS_INT_BITS_OES)
+            _needed = 16;
+            break;
+#if defined(GL_COMPRESSED_TEXTURE_FORMATS)
+        case GL_COMPRESSED_TEXTURE_FORMATS:
+#endif // defined(GL_COMPRESSED_TEXTURE_FORMATS)
+#if defined(GL_FOG_COLOR)
+        case GL_FOG_COLOR:
+#endif // defined(GL_FOG_COLOR)
+#if defined(GL_LIGHT_MODEL_AMBIENT)
+        case GL_LIGHT_MODEL_AMBIENT:
+#endif // defined(GL_LIGHT_MODEL_AMBIENT)
+            _needed = _NUM_COMPRESSED_TEXTURE_FORMATS;
+            break;
+        default:
+            _needed = 0;
+            break;
+    }
+    if (_remaining < _needed) {
+        _exception = 1;
+        _env->ThrowNew(IAEClass, "remaining() < needed");
+        goto exit;
+    }
+    glGetIntegerv(
+        (GLenum)pname,
+        (GLint *)params
+    );
+
+exit:
+    if (_array) {
+        releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE);
+    }
+}
+
+#include <string.h>
+
+/* const GLubyte * glGetString ( GLenum name ) */
+static
+jstring
+android_glGetString
+  (JNIEnv *_env, jobject _this, jint name) {
+    const char * chars = (const char *)glGetString((GLenum)name);
+    jstring output = _env->NewStringUTF(chars);
+    return output;
+}
+/* void glHint ( GLenum target, GLenum mode ) */
+static void
+android_glHint__II
+  (JNIEnv *_env, jobject _this, jint target, jint mode) {
+    glHint(
+        (GLenum)target,
+        (GLenum)mode
+    );
+}
+
+/* void glLightModelf ( GLenum pname, GLfloat param ) */
+static void
+android_glLightModelf__IF
+  (JNIEnv *_env, jobject _this, jint pname, jfloat param) {
+    glLightModelf(
+        (GLenum)pname,
+        (GLfloat)param
+    );
+}
+
+/* void glLightModelfv ( GLenum pname, const GLfloat *params ) */
+static void
+android_glLightModelfv__I_3FI
+  (JNIEnv *_env, jobject _this, jint pname, jfloatArray params_ref, jint offset) {
+    GLfloat *params_base = (GLfloat *) 0;
+    jint _remaining;
+    GLfloat *params = (GLfloat *) 0;
+
+    if (!params_ref) {
+        _env->ThrowNew(IAEClass, "params == null");
+        goto exit;
+    }
+    if (offset < 0) {
+        _env->ThrowNew(IAEClass, "offset < 0");
+        goto exit;
+    }
+    _remaining = _env->GetArrayLength(params_ref) - offset;
+    int _needed;
+    switch (pname) {
+#if defined(GL_LIGHT_MODEL_TWO_SIDE)
+        case GL_LIGHT_MODEL_TWO_SIDE:
+#endif // defined(GL_LIGHT_MODEL_TWO_SIDE)
+            _needed = 1;
+            break;
+#if defined(GL_LIGHT_MODEL_AMBIENT)
+        case GL_LIGHT_MODEL_AMBIENT:
+#endif // defined(GL_LIGHT_MODEL_AMBIENT)
+            _needed = 4;
+            break;
+        default:
+            _needed = 0;
+            break;
+    }
+    if (_remaining < _needed) {
+        _env->ThrowNew(IAEClass, "length - offset < needed");
+        goto exit;
+    }
+    params_base = (GLfloat *)
+        _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
+    params = params_base + offset;
+
+    glLightModelfv(
+        (GLenum)pname,
+        (GLfloat *)params
+    );
+
+exit:
+    if (params_base) {
+        _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
+            JNI_ABORT);
+    }
+}
+
+/* void glLightModelfv ( GLenum pname, const GLfloat *params ) */
+static void
+android_glLightModelfv__ILjava_nio_FloatBuffer_2
+  (JNIEnv *_env, jobject _this, jint pname, jobject params_buf) {
+    jarray _array = (jarray) 0;
+    jint _remaining;
+    GLfloat *params = (GLfloat *) 0;
+
+    params = (GLfloat *)getPointer(_env, params_buf, &_array, &_remaining);
+    int _needed;
+    switch (pname) {
+#if defined(GL_LIGHT_MODEL_TWO_SIDE)
+        case GL_LIGHT_MODEL_TWO_SIDE:
+#endif // defined(GL_LIGHT_MODEL_TWO_SIDE)
+            _needed = 1;
+            break;
+#if defined(GL_LIGHT_MODEL_AMBIENT)
+        case GL_LIGHT_MODEL_AMBIENT:
+#endif // defined(GL_LIGHT_MODEL_AMBIENT)
+            _needed = 4;
+            break;
+        default:
+            _needed = 0;
+            break;
+    }
+    if (_remaining < _needed) {
+        _env->ThrowNew(IAEClass, "remaining() < needed");
+        goto exit;
+    }
+    glLightModelfv(
+        (GLenum)pname,
+        (GLfloat *)params
+    );
+
+exit:
+    if (_array) {
+        releasePointer(_env, _array, params, JNI_FALSE);
+    }
+}
+
+/* void glLightModelx ( GLenum pname, GLfixed param ) */
+static void
+android_glLightModelx__II
+  (JNIEnv *_env, jobject _this, jint pname, jint param) {
+    glLightModelx(
+        (GLenum)pname,
+        (GLfixed)param
+    );
+}
+
+/* void glLightModelxv ( GLenum pname, const GLfixed *params ) */
+static void
+android_glLightModelxv__I_3II
+  (JNIEnv *_env, jobject _this, jint pname, jintArray params_ref, jint offset) {
+    GLfixed *params_base = (GLfixed *) 0;
+    jint _remaining;
+    GLfixed *params = (GLfixed *) 0;
+
+    if (!params_ref) {
+        _env->ThrowNew(IAEClass, "params == null");
+        goto exit;
+    }
+    if (offset < 0) {
+        _env->ThrowNew(IAEClass, "offset < 0");
+        goto exit;
+    }
+    _remaining = _env->GetArrayLength(params_ref) - offset;
+    int _needed;
+    switch (pname) {
+#if defined(GL_LIGHT_MODEL_TWO_SIDE)
+        case GL_LIGHT_MODEL_TWO_SIDE:
+#endif // defined(GL_LIGHT_MODEL_TWO_SIDE)
+            _needed = 1;
+            break;
+#if defined(GL_LIGHT_MODEL_AMBIENT)
+        case GL_LIGHT_MODEL_AMBIENT:
+#endif // defined(GL_LIGHT_MODEL_AMBIENT)
+            _needed = 4;
+            break;
+        default:
+            _needed = 0;
+            break;
+    }
+    if (_remaining < _needed) {
+        _env->ThrowNew(IAEClass, "length - offset < needed");
+        goto exit;
+    }
+    params_base = (GLfixed *)
+        _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
+    params = params_base + offset;
+
+    glLightModelxv(
+        (GLenum)pname,
+        (GLfixed *)params
+    );
+
+exit:
+    if (params_base) {
+        _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
+            JNI_ABORT);
+    }
+}
+
+/* void glLightModelxv ( GLenum pname, const GLfixed *params ) */
+static void
+android_glLightModelxv__ILjava_nio_IntBuffer_2
+  (JNIEnv *_env, jobject _this, jint pname, jobject params_buf) {
+    jarray _array = (jarray) 0;
+    jint _remaining;
+    GLfixed *params = (GLfixed *) 0;
+
+    params = (GLfixed *)getPointer(_env, params_buf, &_array, &_remaining);
+    int _needed;
+    switch (pname) {
+#if defined(GL_LIGHT_MODEL_TWO_SIDE)
+        case GL_LIGHT_MODEL_TWO_SIDE:
+#endif // defined(GL_LIGHT_MODEL_TWO_SIDE)
+            _needed = 1;
+            break;
+#if defined(GL_LIGHT_MODEL_AMBIENT)
+        case GL_LIGHT_MODEL_AMBIENT:
+#endif // defined(GL_LIGHT_MODEL_AMBIENT)
+            _needed = 4;
+            break;
+        default:
+            _needed = 0;
+            break;
+    }
+    if (_remaining < _needed) {
+        _env->ThrowNew(IAEClass, "remaining() < needed");
+        goto exit;
+    }
+    glLightModelxv(
+        (GLenum)pname,
+        (GLfixed *)params
+    );
+
+exit:
+    if (_array) {
+        releasePointer(_env, _array, params, JNI_FALSE);
+    }
+}
+
+/* void glLightf ( GLenum light, GLenum pname, GLfloat param ) */
+static void
+android_glLightf__IIF
+  (JNIEnv *_env, jobject _this, jint light, jint pname, jfloat param) {
+    glLightf(
+        (GLenum)light,
+        (GLenum)pname,
+        (GLfloat)param
+    );
+}
+
+/* void glLightfv ( GLenum light, GLenum pname, const GLfloat *params ) */
+static void
+android_glLightfv__II_3FI
+  (JNIEnv *_env, jobject _this, jint light, jint pname, jfloatArray params_ref, jint offset) {
+    GLfloat *params_base = (GLfloat *) 0;
+    jint _remaining;
+    GLfloat *params = (GLfloat *) 0;
+
+    if (!params_ref) {
+        _env->ThrowNew(IAEClass, "params == null");
+        goto exit;
+    }
+    if (offset < 0) {
+        _env->ThrowNew(IAEClass, "offset < 0");
+        goto exit;
+    }
+    _remaining = _env->GetArrayLength(params_ref) - offset;
+    int _needed;
+    switch (pname) {
+#if defined(GL_SPOT_EXPONENT)
+        case GL_SPOT_EXPONENT:
+#endif // defined(GL_SPOT_EXPONENT)
+#if defined(GL_SPOT_CUTOFF)
+        case GL_SPOT_CUTOFF:
+#endif // defined(GL_SPOT_CUTOFF)
+#if defined(GL_CONSTANT_ATTENUATION)
+        case GL_CONSTANT_ATTENUATION:
+#endif // defined(GL_CONSTANT_ATTENUATION)
+#if defined(GL_LINEAR_ATTENUATION)
+        case GL_LINEAR_ATTENUATION:
+#endif // defined(GL_LINEAR_ATTENUATION)
+#if defined(GL_QUADRATIC_ATTENUATION)
+        case GL_QUADRATIC_ATTENUATION:
+#endif // defined(GL_QUADRATIC_ATTENUATION)
+            _needed = 1;
+            break;
+#if defined(GL_SPOT_DIRECTION)
+        case GL_SPOT_DIRECTION:
+#endif // defined(GL_SPOT_DIRECTION)
+            _needed = 3;
+            break;
+#if defined(GL_AMBIENT)
+        case GL_AMBIENT:
+#endif // defined(GL_AMBIENT)
+#if defined(GL_DIFFUSE)
+        case GL_DIFFUSE:
+#endif // defined(GL_DIFFUSE)
+#if defined(GL_SPECULAR)
+        case GL_SPECULAR:
+#endif // defined(GL_SPECULAR)
+#if defined(GL_EMISSION)
+        case GL_EMISSION:
+#endif // defined(GL_EMISSION)
+            _needed = 4;
+            break;
+        default:
+            _needed = 0;
+            break;
+    }
+    if (_remaining < _needed) {
+        _env->ThrowNew(IAEClass, "length - offset < needed");
+        goto exit;
+    }
+    params_base = (GLfloat *)
+        _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
+    params = params_base + offset;
+
+    glLightfv(
+        (GLenum)light,
+        (GLenum)pname,
+        (GLfloat *)params
+    );
+
+exit:
+    if (params_base) {
+        _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
+            JNI_ABORT);
+    }
+}
+
+/* void glLightfv ( GLenum light, GLenum pname, const GLfloat *params ) */
+static void
+android_glLightfv__IILjava_nio_FloatBuffer_2
+  (JNIEnv *_env, jobject _this, jint light, jint pname, jobject params_buf) {
+    jarray _array = (jarray) 0;
+    jint _remaining;
+    GLfloat *params = (GLfloat *) 0;
+
+    params = (GLfloat *)getPointer(_env, params_buf, &_array, &_remaining);
+    int _needed;
+    switch (pname) {
+#if defined(GL_SPOT_EXPONENT)
+        case GL_SPOT_EXPONENT:
+#endif // defined(GL_SPOT_EXPONENT)
+#if defined(GL_SPOT_CUTOFF)
+        case GL_SPOT_CUTOFF:
+#endif // defined(GL_SPOT_CUTOFF)
+#if defined(GL_CONSTANT_ATTENUATION)
+        case GL_CONSTANT_ATTENUATION:
+#endif // defined(GL_CONSTANT_ATTENUATION)
+#if defined(GL_LINEAR_ATTENUATION)
+        case GL_LINEAR_ATTENUATION:
+#endif // defined(GL_LINEAR_ATTENUATION)
+#if defined(GL_QUADRATIC_ATTENUATION)
+        case GL_QUADRATIC_ATTENUATION:
+#endif // defined(GL_QUADRATIC_ATTENUATION)
+            _needed = 1;
+            break;
+#if defined(GL_SPOT_DIRECTION)
+        case GL_SPOT_DIRECTION:
+#endif // defined(GL_SPOT_DIRECTION)
+            _needed = 3;
+            break;
+#if defined(GL_AMBIENT)
+        case GL_AMBIENT:
+#endif // defined(GL_AMBIENT)
+#if defined(GL_DIFFUSE)
+        case GL_DIFFUSE:
+#endif // defined(GL_DIFFUSE)
+#if defined(GL_SPECULAR)
+        case GL_SPECULAR:
+#endif // defined(GL_SPECULAR)
+#if defined(GL_EMISSION)
+        case GL_EMISSION:
+#endif // defined(GL_EMISSION)
+            _needed = 4;
+            break;
+        default:
+            _needed = 0;
+            break;
+    }
+    if (_remaining < _needed) {
+        _env->ThrowNew(IAEClass, "remaining() < needed");
+        goto exit;
+    }
+    glLightfv(
+        (GLenum)light,
+        (GLenum)pname,
+        (GLfloat *)params
+    );
+
+exit:
+    if (_array) {
+        releasePointer(_env, _array, params, JNI_FALSE);
+    }
+}
+
+/* void glLightx ( GLenum light, GLenum pname, GLfixed param ) */
+static void
+android_glLightx__III
+  (JNIEnv *_env, jobject _this, jint light, jint pname, jint param) {
+    glLightx(
+        (GLenum)light,
+        (GLenum)pname,
+        (GLfixed)param
+    );
+}
+
+/* void glLightxv ( GLenum light, GLenum pname, const GLfixed *params ) */
+static void
+android_glLightxv__II_3II
+  (JNIEnv *_env, jobject _this, jint light, jint pname, jintArray params_ref, jint offset) {
+    GLfixed *params_base = (GLfixed *) 0;
+    jint _remaining;
+    GLfixed *params = (GLfixed *) 0;
+
+    if (!params_ref) {
+        _env->ThrowNew(IAEClass, "params == null");
+        goto exit;
+    }
+    if (offset < 0) {
+        _env->ThrowNew(IAEClass, "offset < 0");
+        goto exit;
+    }
+    _remaining = _env->GetArrayLength(params_ref) - offset;
+    int _needed;
+    switch (pname) {
+#if defined(GL_SPOT_EXPONENT)
+        case GL_SPOT_EXPONENT:
+#endif // defined(GL_SPOT_EXPONENT)
+#if defined(GL_SPOT_CUTOFF)
+        case GL_SPOT_CUTOFF:
+#endif // defined(GL_SPOT_CUTOFF)
+#if defined(GL_CONSTANT_ATTENUATION)
+        case GL_CONSTANT_ATTENUATION:
+#endif // defined(GL_CONSTANT_ATTENUATION)
+#if defined(GL_LINEAR_ATTENUATION)
+        case GL_LINEAR_ATTENUATION:
+#endif // defined(GL_LINEAR_ATTENUATION)
+#if defined(GL_QUADRATIC_ATTENUATION)
+        case GL_QUADRATIC_ATTENUATION:
+#endif // defined(GL_QUADRATIC_ATTENUATION)
+            _needed = 1;
+            break;
+#if defined(GL_SPOT_DIRECTION)
+        case GL_SPOT_DIRECTION:
+#endif // defined(GL_SPOT_DIRECTION)
+            _needed = 3;
+            break;
+#if defined(GL_AMBIENT)
+        case GL_AMBIENT:
+#endif // defined(GL_AMBIENT)
+#if defined(GL_DIFFUSE)
+        case GL_DIFFUSE:
+#endif // defined(GL_DIFFUSE)
+#if defined(GL_SPECULAR)
+        case GL_SPECULAR:
+#endif // defined(GL_SPECULAR)
+#if defined(GL_EMISSION)
+        case GL_EMISSION:
+#endif // defined(GL_EMISSION)
+            _needed = 4;
+            break;
+        default:
+            _needed = 0;
+            break;
+    }
+    if (_remaining < _needed) {
+        _env->ThrowNew(IAEClass, "length - offset < needed");
+        goto exit;
+    }
+    params_base = (GLfixed *)
+        _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
+    params = params_base + offset;
+
+    glLightxv(
+        (GLenum)light,
+        (GLenum)pname,
+        (GLfixed *)params
+    );
+
+exit:
+    if (params_base) {
+        _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
+            JNI_ABORT);
+    }
+}
+
+/* void glLightxv ( GLenum light, GLenum pname, const GLfixed *params ) */
+static void
+android_glLightxv__IILjava_nio_IntBuffer_2
+  (JNIEnv *_env, jobject _this, jint light, jint pname, jobject params_buf) {
+    jarray _array = (jarray) 0;
+    jint _remaining;
+    GLfixed *params = (GLfixed *) 0;
+
+    params = (GLfixed *)getPointer(_env, params_buf, &_array, &_remaining);
+    int _needed;
+    switch (pname) {
+#if defined(GL_SPOT_EXPONENT)
+        case GL_SPOT_EXPONENT:
+#endif // defined(GL_SPOT_EXPONENT)
+#if defined(GL_SPOT_CUTOFF)
+        case GL_SPOT_CUTOFF:
+#endif // defined(GL_SPOT_CUTOFF)
+#if defined(GL_CONSTANT_ATTENUATION)
+        case GL_CONSTANT_ATTENUATION:
+#endif // defined(GL_CONSTANT_ATTENUATION)
+#if defined(GL_LINEAR_ATTENUATION)
+        case GL_LINEAR_ATTENUATION:
+#endif // defined(GL_LINEAR_ATTENUATION)
+#if defined(GL_QUADRATIC_ATTENUATION)
+        case GL_QUADRATIC_ATTENUATION:
+#endif // defined(GL_QUADRATIC_ATTENUATION)
+            _needed = 1;
+            break;
+#if defined(GL_SPOT_DIRECTION)
+        case GL_SPOT_DIRECTION:
+#endif // defined(GL_SPOT_DIRECTION)
+            _needed = 3;
+            break;
+#if defined(GL_AMBIENT)
+        case GL_AMBIENT:
+#endif // defined(GL_AMBIENT)
+#if defined(GL_DIFFUSE)
+        case GL_DIFFUSE:
+#endif // defined(GL_DIFFUSE)
+#if defined(GL_SPECULAR)
+        case GL_SPECULAR:
+#endif // defined(GL_SPECULAR)
+#if defined(GL_EMISSION)
+        case GL_EMISSION:
+#endif // defined(GL_EMISSION)
+            _needed = 4;
+            break;
+        default:
+            _needed = 0;
+            break;
+    }
+    if (_remaining < _needed) {
+        _env->ThrowNew(IAEClass, "remaining() < needed");
+        goto exit;
+    }
+    glLightxv(
+        (GLenum)light,
+        (GLenum)pname,
+        (GLfixed *)params
+    );
+
+exit:
+    if (_array) {
+        releasePointer(_env, _array, params, JNI_FALSE);
+    }
+}
+
+/* void glLineWidth ( GLfloat width ) */
+static void
+android_glLineWidth__F
+  (JNIEnv *_env, jobject _this, jfloat width) {
+    glLineWidth(
+        (GLfloat)width
+    );
+}
+
+/* void glLineWidthx ( GLfixed width ) */
+static void
+android_glLineWidthx__I
+  (JNIEnv *_env, jobject _this, jint width) {
+    glLineWidthx(
+        (GLfixed)width
+    );
+}
+
+/* void glLoadIdentity ( void ) */
+static void
+android_glLoadIdentity__
+  (JNIEnv *_env, jobject _this) {
+    glLoadIdentity();
+}
+
+/* void glLoadMatrixf ( const GLfloat *m ) */
+static void
+android_glLoadMatrixf___3FI
+  (JNIEnv *_env, jobject _this, jfloatArray m_ref, jint offset) {
+    GLfloat *m_base = (GLfloat *) 0;
+    jint _remaining;
+    GLfloat *m = (GLfloat *) 0;
+
+    if (!m_ref) {
+        _env->ThrowNew(IAEClass, "m == null");
+        goto exit;
+    }
+    if (offset < 0) {
+        _env->ThrowNew(IAEClass, "offset < 0");
+        goto exit;
+    }
+    _remaining = _env->GetArrayLength(m_ref) - offset;
+    m_base = (GLfloat *)
+        _env->GetPrimitiveArrayCritical(m_ref, (jboolean *)0);
+    m = m_base + offset;
+
+    glLoadMatrixf(
+        (GLfloat *)m
+    );
+
+exit:
+    if (m_base) {
+        _env->ReleasePrimitiveArrayCritical(m_ref, m_base,
+            JNI_ABORT);
+    }
+}
+
+/* void glLoadMatrixf ( const GLfloat *m ) */
+static void
+android_glLoadMatrixf__Ljava_nio_FloatBuffer_2
+  (JNIEnv *_env, jobject _this, jobject m_buf) {
+    jarray _array = (jarray) 0;
+    jint _remaining;
+    GLfloat *m = (GLfloat *) 0;
+
+    m = (GLfloat *)getPointer(_env, m_buf, &_array, &_remaining);
+    glLoadMatrixf(
+        (GLfloat *)m
+    );
+    if (_array) {
+        releasePointer(_env, _array, m, JNI_FALSE);
+    }
+}
+
+/* void glLoadMatrixx ( const GLfixed *m ) */
+static void
+android_glLoadMatrixx___3II
+  (JNIEnv *_env, jobject _this, jintArray m_ref, jint offset) {
+    GLfixed *m_base = (GLfixed *) 0;
+    jint _remaining;
+    GLfixed *m = (GLfixed *) 0;
+
+    if (!m_ref) {
+        _env->ThrowNew(IAEClass, "m == null");
+        goto exit;
+    }
+    if (offset < 0) {
+        _env->ThrowNew(IAEClass, "offset < 0");
+        goto exit;
+    }
+    _remaining = _env->GetArrayLength(m_ref) - offset;
+    m_base = (GLfixed *)
+        _env->GetPrimitiveArrayCritical(m_ref, (jboolean *)0);
+    m = m_base + offset;
+
+    glLoadMatrixx(
+        (GLfixed *)m
+    );
+
+exit:
+    if (m_base) {
+        _env->ReleasePrimitiveArrayCritical(m_ref, m_base,
+            JNI_ABORT);
+    }
+}
+
+/* void glLoadMatrixx ( const GLfixed *m ) */
+static void
+android_glLoadMatrixx__Ljava_nio_IntBuffer_2
+  (JNIEnv *_env, jobject _this, jobject m_buf) {
+    jarray _array = (jarray) 0;
+    jint _remaining;
+    GLfixed *m = (GLfixed *) 0;
+
+    m = (GLfixed *)getPointer(_env, m_buf, &_array, &_remaining);
+    glLoadMatrixx(
+        (GLfixed *)m
+    );
+    if (_array) {
+        releasePointer(_env, _array, m, JNI_FALSE);
+    }
+}
+
+/* void glLogicOp ( GLenum opcode ) */
+static void
+android_glLogicOp__I
+  (JNIEnv *_env, jobject _this, jint opcode) {
+    glLogicOp(
+        (GLenum)opcode
+    );
+}
+
+/* void glMaterialf ( GLenum face, GLenum pname, GLfloat param ) */
+static void
+android_glMaterialf__IIF
+  (JNIEnv *_env, jobject _this, jint face, jint pname, jfloat param) {
+    glMaterialf(
+        (GLenum)face,
+        (GLenum)pname,
+        (GLfloat)param
+    );
+}
+
+/* void glMaterialfv ( GLenum face, GLenum pname, const GLfloat *params ) */
+static void
+android_glMaterialfv__II_3FI
+  (JNIEnv *_env, jobject _this, jint face, jint pname, jfloatArray params_ref, jint offset) {
+    GLfloat *params_base = (GLfloat *) 0;
+    jint _remaining;
+    GLfloat *params = (GLfloat *) 0;
+
+    if (!params_ref) {
+        _env->ThrowNew(IAEClass, "params == null");
+        goto exit;
+    }
+    if (offset < 0) {
+        _env->ThrowNew(IAEClass, "offset < 0");
+        goto exit;
+    }
+    _remaining = _env->GetArrayLength(params_ref) - offset;
+    int _needed;
+    switch (pname) {
+#if defined(GL_SHININESS)
+        case GL_SHININESS:
+#endif // defined(GL_SHININESS)
+            _needed = 1;
+            break;
+#if defined(GL_AMBIENT)
+        case GL_AMBIENT:
+#endif // defined(GL_AMBIENT)
+#if defined(GL_DIFFUSE)
+        case GL_DIFFUSE:
+#endif // defined(GL_DIFFUSE)
+#if defined(GL_SPECULAR)
+        case GL_SPECULAR:
+#endif // defined(GL_SPECULAR)
+#if defined(GL_EMISSION)
+        case GL_EMISSION:
+#endif // defined(GL_EMISSION)
+#if defined(GL_AMBIENT_AND_DIFFUSE)
+        case GL_AMBIENT_AND_DIFFUSE:
+#endif // defined(GL_AMBIENT_AND_DIFFUSE)
+            _needed = 4;
+            break;
+        default:
+            _needed = 0;
+            break;
+    }
+    if (_remaining < _needed) {
+        _env->ThrowNew(IAEClass, "length - offset < needed");
+        goto exit;
+    }
+    params_base = (GLfloat *)
+        _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
+    params = params_base + offset;
+
+    glMaterialfv(
+        (GLenum)face,
+        (GLenum)pname,
+        (GLfloat *)params
+    );
+
+exit:
+    if (params_base) {
+        _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
+            JNI_ABORT);
+    }
+}
+
+/* void glMaterialfv ( GLenum face, GLenum pname, const GLfloat *params ) */
+static void
+android_glMaterialfv__IILjava_nio_FloatBuffer_2
+  (JNIEnv *_env, jobject _this, jint face, jint pname, jobject params_buf) {
+    jarray _array = (jarray) 0;
+    jint _remaining;
+    GLfloat *params = (GLfloat *) 0;
+
+    params = (GLfloat *)getPointer(_env, params_buf, &_array, &_remaining);
+    int _needed;
+    switch (pname) {
+#if defined(GL_SHININESS)
+        case GL_SHININESS:
+#endif // defined(GL_SHININESS)
+            _needed = 1;
+            break;
+#if defined(GL_AMBIENT)
+        case GL_AMBIENT:
+#endif // defined(GL_AMBIENT)
+#if defined(GL_DIFFUSE)
+        case GL_DIFFUSE:
+#endif // defined(GL_DIFFUSE)
+#if defined(GL_SPECULAR)
+        case GL_SPECULAR:
+#endif // defined(GL_SPECULAR)
+#if defined(GL_EMISSION)
+        case GL_EMISSION:
+#endif // defined(GL_EMISSION)
+#if defined(GL_AMBIENT_AND_DIFFUSE)
+        case GL_AMBIENT_AND_DIFFUSE:
+#endif // defined(GL_AMBIENT_AND_DIFFUSE)
+            _needed = 4;
+            break;
+        default:
+            _needed = 0;
+            break;
+    }
+    if (_remaining < _needed) {
+        _env->ThrowNew(IAEClass, "remaining() < needed");
+        goto exit;
+    }
+    glMaterialfv(
+        (GLenum)face,
+        (GLenum)pname,
+        (GLfloat *)params
+    );
+
+exit:
+    if (_array) {
+        releasePointer(_env, _array, params, JNI_FALSE);
+    }
+}
+
+/* void glMaterialx ( GLenum face, GLenum pname, GLfixed param ) */
+static void
+android_glMaterialx__III
+  (JNIEnv *_env, jobject _this, jint face, jint pname, jint param) {
+    glMaterialx(
+        (GLenum)face,
+        (GLenum)pname,
+        (GLfixed)param
+    );
+}
+
+/* void glMaterialxv ( GLenum face, GLenum pname, const GLfixed *params ) */
+static void
+android_glMaterialxv__II_3II
+  (JNIEnv *_env, jobject _this, jint face, jint pname, jintArray params_ref, jint offset) {
+    GLfixed *params_base = (GLfixed *) 0;
+    jint _remaining;
+    GLfixed *params = (GLfixed *) 0;
+
+    if (!params_ref) {
+        _env->ThrowNew(IAEClass, "params == null");
+        goto exit;
+    }
+    if (offset < 0) {
+        _env->ThrowNew(IAEClass, "offset < 0");
+        goto exit;
+    }
+    _remaining = _env->GetArrayLength(params_ref) - offset;
+    int _needed;
+    switch (pname) {
+#if defined(GL_SHININESS)
+        case GL_SHININESS:
+#endif // defined(GL_SHININESS)
+            _needed = 1;
+            break;
+#if defined(GL_AMBIENT)
+        case GL_AMBIENT:
+#endif // defined(GL_AMBIENT)
+#if defined(GL_DIFFUSE)
+        case GL_DIFFUSE:
+#endif // defined(GL_DIFFUSE)
+#if defined(GL_SPECULAR)
+        case GL_SPECULAR:
+#endif // defined(GL_SPECULAR)
+#if defined(GL_EMISSION)
+        case GL_EMISSION:
+#endif // defined(GL_EMISSION)
+#if defined(GL_AMBIENT_AND_DIFFUSE)
+        case GL_AMBIENT_AND_DIFFUSE:
+#endif // defined(GL_AMBIENT_AND_DIFFUSE)
+            _needed = 4;
+            break;
+        default:
+            _needed = 0;
+            break;
+    }
+    if (_remaining < _needed) {
+        _env->ThrowNew(IAEClass, "length - offset < needed");
+        goto exit;
+    }
+    params_base = (GLfixed *)
+        _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
+    params = params_base + offset;
+
+    glMaterialxv(
+        (GLenum)face,
+        (GLenum)pname,
+        (GLfixed *)params
+    );
+
+exit:
+    if (params_base) {
+        _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
+            JNI_ABORT);
+    }
+}
+
+/* void glMaterialxv ( GLenum face, GLenum pname, const GLfixed *params ) */
+static void
+android_glMaterialxv__IILjava_nio_IntBuffer_2
+  (JNIEnv *_env, jobject _this, jint face, jint pname, jobject params_buf) {
+    jarray _array = (jarray) 0;
+    jint _remaining;
+    GLfixed *params = (GLfixed *) 0;
+
+    params = (GLfixed *)getPointer(_env, params_buf, &_array, &_remaining);
+    int _needed;
+    switch (pname) {
+#if defined(GL_SHININESS)
+        case GL_SHININESS:
+#endif // defined(GL_SHININESS)
+            _needed = 1;
+            break;
+#if defined(GL_AMBIENT)
+        case GL_AMBIENT:
+#endif // defined(GL_AMBIENT)
+#if defined(GL_DIFFUSE)
+        case GL_DIFFUSE:
+#endif // defined(GL_DIFFUSE)
+#if defined(GL_SPECULAR)
+        case GL_SPECULAR:
+#endif // defined(GL_SPECULAR)
+#if defined(GL_EMISSION)
+        case GL_EMISSION:
+#endif // defined(GL_EMISSION)
+#if defined(GL_AMBIENT_AND_DIFFUSE)
+        case GL_AMBIENT_AND_DIFFUSE:
+#endif // defined(GL_AMBIENT_AND_DIFFUSE)
+            _needed = 4;
+            break;
+        default:
+            _needed = 0;
+            break;
+    }
+    if (_remaining < _needed) {
+        _env->ThrowNew(IAEClass, "remaining() < needed");
+        goto exit;
+    }
+    glMaterialxv(
+        (GLenum)face,
+        (GLenum)pname,
+        (GLfixed *)params
+    );
+
+exit:
+    if (_array) {
+        releasePointer(_env, _array, params, JNI_FALSE);
+    }
+}
+
+/* void glMatrixMode ( GLenum mode ) */
+static void
+android_glMatrixMode__I
+  (JNIEnv *_env, jobject _this, jint mode) {
+    glMatrixMode(
+        (GLenum)mode
+    );
+}
+
+/* void glMultMatrixf ( const GLfloat *m ) */
+static void
+android_glMultMatrixf___3FI
+  (JNIEnv *_env, jobject _this, jfloatArray m_ref, jint offset) {
+    GLfloat *m_base = (GLfloat *) 0;
+    jint _remaining;
+    GLfloat *m = (GLfloat *) 0;
+
+    if (!m_ref) {
+        _env->ThrowNew(IAEClass, "m == null");
+        goto exit;
+    }
+    if (offset < 0) {
+        _env->ThrowNew(IAEClass, "offset < 0");
+        goto exit;
+    }
+    _remaining = _env->GetArrayLength(m_ref) - offset;
+    m_base = (GLfloat *)
+        _env->GetPrimitiveArrayCritical(m_ref, (jboolean *)0);
+    m = m_base + offset;
+
+    glMultMatrixf(
+        (GLfloat *)m
+    );
+
+exit:
+    if (m_base) {
+        _env->ReleasePrimitiveArrayCritical(m_ref, m_base,
+            JNI_ABORT);
+    }
+}
+
+/* void glMultMatrixf ( const GLfloat *m ) */
+static void
+android_glMultMatrixf__Ljava_nio_FloatBuffer_2
+  (JNIEnv *_env, jobject _this, jobject m_buf) {
+    jarray _array = (jarray) 0;
+    jint _remaining;
+    GLfloat *m = (GLfloat *) 0;
+
+    m = (GLfloat *)getPointer(_env, m_buf, &_array, &_remaining);
+    glMultMatrixf(
+        (GLfloat *)m
+    );
+    if (_array) {
+        releasePointer(_env, _array, m, JNI_FALSE);
+    }
+}
+
+/* void glMultMatrixx ( const GLfixed *m ) */
+static void
+android_glMultMatrixx___3II
+  (JNIEnv *_env, jobject _this, jintArray m_ref, jint offset) {
+    GLfixed *m_base = (GLfixed *) 0;
+    jint _remaining;
+    GLfixed *m = (GLfixed *) 0;
+
+    if (!m_ref) {
+        _env->ThrowNew(IAEClass, "m == null");
+        goto exit;
+    }
+    if (offset < 0) {
+        _env->ThrowNew(IAEClass, "offset < 0");
+        goto exit;
+    }
+    _remaining = _env->GetArrayLength(m_ref) - offset;
+    m_base = (GLfixed *)
+        _env->GetPrimitiveArrayCritical(m_ref, (jboolean *)0);
+    m = m_base + offset;
+
+    glMultMatrixx(
+        (GLfixed *)m
+    );
+
+exit:
+    if (m_base) {
+        _env->ReleasePrimitiveArrayCritical(m_ref, m_base,
+            JNI_ABORT);
+    }
+}
+
+/* void glMultMatrixx ( const GLfixed *m ) */
+static void
+android_glMultMatrixx__Ljava_nio_IntBuffer_2
+  (JNIEnv *_env, jobject _this, jobject m_buf) {
+    jarray _array = (jarray) 0;
+    jint _remaining;
+    GLfixed *m = (GLfixed *) 0;
+
+    m = (GLfixed *)getPointer(_env, m_buf, &_array, &_remaining);
+    glMultMatrixx(
+        (GLfixed *)m
+    );
+    if (_array) {
+        releasePointer(_env, _array, m, JNI_FALSE);
+    }
+}
+
+/* void glMultiTexCoord4f ( GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q ) */
+static void
+android_glMultiTexCoord4f__IFFFF
+  (JNIEnv *_env, jobject _this, jint target, jfloat s, jfloat t, jfloat r, jfloat q) {
+    glMultiTexCoord4f(
+        (GLenum)target,
+        (GLfloat)s,
+        (GLfloat)t,
+        (GLfloat)r,
+        (GLfloat)q
+    );
+}
+
+/* void glMultiTexCoord4x ( GLenum target, GLfixed s, GLfixed t, GLfixed r, GLfixed q ) */
+static void
+android_glMultiTexCoord4x__IIIII
+  (JNIEnv *_env, jobject _this, jint target, jint s, jint t, jint r, jint q) {
+    glMultiTexCoord4x(
+        (GLenum)target,
+        (GLfixed)s,
+        (GLfixed)t,
+        (GLfixed)r,
+        (GLfixed)q
+    );
+}
+
+/* void glNormal3f ( GLfloat nx, GLfloat ny, GLfloat nz ) */
+static void
+android_glNormal3f__FFF
+  (JNIEnv *_env, jobject _this, jfloat nx, jfloat ny, jfloat nz) {
+    glNormal3f(
+        (GLfloat)nx,
+        (GLfloat)ny,
+        (GLfloat)nz
+    );
+}
+
+/* void glNormal3x ( GLfixed nx, GLfixed ny, GLfixed nz ) */
+static void
+android_glNormal3x__III
+  (JNIEnv *_env, jobject _this, jint nx, jint ny, jint nz) {
+    glNormal3x(
+        (GLfixed)nx,
+        (GLfixed)ny,
+        (GLfixed)nz
+    );
+}
+
+/* void glNormalPointer ( GLenum type, GLsizei stride, const GLvoid *pointer ) */
+static void
+android_glNormalPointerBounds__IILjava_nio_Buffer_2I
+  (JNIEnv *_env, jobject _this, jint type, jint stride, jobject pointer_buf, jint remaining) {
+    jarray _array = (jarray) 0;
+    jint _remaining;
+    GLvoid *pointer = (GLvoid *) 0;
+
+    pointer = (GLvoid *)getPointer(_env, pointer_buf, &_array, &_remaining);
+    glNormalPointerBounds(
+        (GLenum)type,
+        (GLsizei)stride,
+        (GLvoid *)pointer,
+        (GLsizei)remaining
+    );
+    if (_array) {
+        releasePointer(_env, _array, pointer, JNI_FALSE);
+    }
+}
+
+/* void glOrthof ( GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar ) */
+static void
+android_glOrthof__FFFFFF
+  (JNIEnv *_env, jobject _this, jfloat left, jfloat right, jfloat bottom, jfloat top, jfloat zNear, jfloat zFar) {
+    glOrthof(
+        (GLfloat)left,
+        (GLfloat)right,
+        (GLfloat)bottom,
+        (GLfloat)top,
+        (GLfloat)zNear,
+        (GLfloat)zFar
+    );
+}
+
+/* void glOrthox ( GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar ) */
+static void
+android_glOrthox__IIIIII
+  (JNIEnv *_env, jobject _this, jint left, jint right, jint bottom, jint top, jint zNear, jint zFar) {
+    glOrthox(
+        (GLfixed)left,
+        (GLfixed)right,
+        (GLfixed)bottom,
+        (GLfixed)top,
+        (GLfixed)zNear,
+        (GLfixed)zFar
+    );
+}
+
+/* void glPixelStorei ( GLenum pname, GLint param ) */
+static void
+android_glPixelStorei__II
+  (JNIEnv *_env, jobject _this, jint pname, jint param) {
+    glPixelStorei(
+        (GLenum)pname,
+        (GLint)param
+    );
+}
+
+/* void glPointSize ( GLfloat size ) */
+static void
+android_glPointSize__F
+  (JNIEnv *_env, jobject _this, jfloat size) {
+    glPointSize(
+        (GLfloat)size
+    );
+}
+
+/* void glPointSizex ( GLfixed size ) */
+static void
+android_glPointSizex__I
+  (JNIEnv *_env, jobject _this, jint size) {
+    glPointSizex(
+        (GLfixed)size
+    );
+}
+
+/* void glPolygonOffset ( GLfloat factor, GLfloat units ) */
+static void
+android_glPolygonOffset__FF
+  (JNIEnv *_env, jobject _this, jfloat factor, jfloat units) {
+    glPolygonOffset(
+        (GLfloat)factor,
+        (GLfloat)units
+    );
+}
+
+/* void glPolygonOffsetx ( GLfixed factor, GLfixed units ) */
+static void
+android_glPolygonOffsetx__II
+  (JNIEnv *_env, jobject _this, jint factor, jint units) {
+    glPolygonOffsetx(
+        (GLfixed)factor,
+        (GLfixed)units
+    );
+}
+
+/* void glPopMatrix ( void ) */
+static void
+android_glPopMatrix__
+  (JNIEnv *_env, jobject _this) {
+    glPopMatrix();
+}
+
+/* void glPushMatrix ( void ) */
+static void
+android_glPushMatrix__
+  (JNIEnv *_env, jobject _this) {
+    glPushMatrix();
+}
+
+/* void glReadPixels ( GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels ) */
+static void
+android_glReadPixels__IIIIIILjava_nio_Buffer_2
+  (JNIEnv *_env, jobject _this, jint x, jint y, jint width, jint height, jint format, jint type, jobject pixels_buf) {
+    jint _exception = 0;
+    jarray _array = (jarray) 0;
+    jint _remaining;
+    GLvoid *pixels = (GLvoid *) 0;
+
+    pixels = (GLvoid *)getPointer(_env, pixels_buf, &_array, &_remaining);
+    glReadPixels(
+        (GLint)x,
+        (GLint)y,
+        (GLsizei)width,
+        (GLsizei)height,
+        (GLenum)format,
+        (GLenum)type,
+        (GLvoid *)pixels
+    );
+    if (_array) {
+        releasePointer(_env, _array, pixels, _exception ? JNI_FALSE : JNI_TRUE);
+    }
+}
+
+/* void glRotatef ( GLfloat angle, GLfloat x, GLfloat y, GLfloat z ) */
+static void
+android_glRotatef__FFFF
+  (JNIEnv *_env, jobject _this, jfloat angle, jfloat x, jfloat y, jfloat z) {
+    glRotatef(
+        (GLfloat)angle,
+        (GLfloat)x,
+        (GLfloat)y,
+        (GLfloat)z
+    );
+}
+
+/* void glRotatex ( GLfixed angle, GLfixed x, GLfixed y, GLfixed z ) */
+static void
+android_glRotatex__IIII
+  (JNIEnv *_env, jobject _this, jint angle, jint x, jint y, jint z) {
+    glRotatex(
+        (GLfixed)angle,
+        (GLfixed)x,
+        (GLfixed)y,
+        (GLfixed)z
+    );
+}
+
+/* void glSampleCoverage ( GLclampf value, GLboolean invert ) */
+static void
+android_glSampleCoverage__FZ
+  (JNIEnv *_env, jobject _this, jfloat value, jboolean invert) {
+    glSampleCoverage(
+        (GLclampf)value,
+        (GLboolean)invert
+    );
+}
+
+/* void glSampleCoveragex ( GLclampx value, GLboolean invert ) */
+static void
+android_glSampleCoveragex__IZ
+  (JNIEnv *_env, jobject _this, jint value, jboolean invert) {
+    glSampleCoveragex(
+        (GLclampx)value,
+        (GLboolean)invert
+    );
+}
+
+/* void glScalef ( GLfloat x, GLfloat y, GLfloat z ) */
+static void
+android_glScalef__FFF
+  (JNIEnv *_env, jobject _this, jfloat x, jfloat y, jfloat z) {
+    glScalef(
+        (GLfloat)x,
+        (GLfloat)y,
+        (GLfloat)z
+    );
+}
+
+/* void glScalex ( GLfixed x, GLfixed y, GLfixed z ) */
+static void
+android_glScalex__III
+  (JNIEnv *_env, jobject _this, jint x, jint y, jint z) {
+    glScalex(
+        (GLfixed)x,
+        (GLfixed)y,
+        (GLfixed)z
+    );
+}
+
+/* void glScissor ( GLint x, GLint y, GLsizei width, GLsizei height ) */
+static void
+android_glScissor__IIII
+  (JNIEnv *_env, jobject _this, jint x, jint y, jint width, jint height) {
+    glScissor(
+        (GLint)x,
+        (GLint)y,
+        (GLsizei)width,
+        (GLsizei)height
+    );
+}
+
+/* void glShadeModel ( GLenum mode ) */
+static void
+android_glShadeModel__I
+  (JNIEnv *_env, jobject _this, jint mode) {
+    glShadeModel(
+        (GLenum)mode
+    );
+}
+
+/* void glStencilFunc ( GLenum func, GLint ref, GLuint mask ) */
+static void
+android_glStencilFunc__III
+  (JNIEnv *_env, jobject _this, jint func, jint ref, jint mask) {
+    glStencilFunc(
+        (GLenum)func,
+        (GLint)ref,
+        (GLuint)mask
+    );
+}
+
+/* void glStencilMask ( GLuint mask ) */
+static void
+android_glStencilMask__I
+  (JNIEnv *_env, jobject _this, jint mask) {
+    glStencilMask(
+        (GLuint)mask
+    );
+}
+
+/* void glStencilOp ( GLenum fail, GLenum zfail, GLenum zpass ) */
+static void
+android_glStencilOp__III
+  (JNIEnv *_env, jobject _this, jint fail, jint zfail, jint zpass) {
+    glStencilOp(
+        (GLenum)fail,
+        (GLenum)zfail,
+        (GLenum)zpass
+    );
+}
+
+/* void glTexCoordPointer ( GLint size, GLenum type, GLsizei stride, const GLvoid *pointer ) */
+static void
+android_glTexCoordPointerBounds__IIILjava_nio_Buffer_2I
+  (JNIEnv *_env, jobject _this, jint size, jint type, jint stride, jobject pointer_buf, jint remaining) {
+    jarray _array = (jarray) 0;
+    jint _remaining;
+    GLvoid *pointer = (GLvoid *) 0;
+
+    pointer = (GLvoid *)getPointer(_env, pointer_buf, &_array, &_remaining);
+    glTexCoordPointerBounds(
+        (GLint)size,
+        (GLenum)type,
+        (GLsizei)stride,
+        (GLvoid *)pointer,
+        (GLsizei)remaining
+    );
+    if (_array) {
+        releasePointer(_env, _array, pointer, JNI_FALSE);
+    }
+}
+
+/* void glTexEnvf ( GLenum target, GLenum pname, GLfloat param ) */
+static void
+android_glTexEnvf__IIF
+  (JNIEnv *_env, jobject _this, jint target, jint pname, jfloat param) {
+    glTexEnvf(
+        (GLenum)target,
+        (GLenum)pname,
+        (GLfloat)param
+    );
+}
+
+/* void glTexEnvfv ( GLenum target, GLenum pname, const GLfloat *params ) */
+static void
+android_glTexEnvfv__II_3FI
+  (JNIEnv *_env, jobject _this, jint target, jint pname, jfloatArray params_ref, jint offset) {
+    GLfloat *params_base = (GLfloat *) 0;
+    jint _remaining;
+    GLfloat *params = (GLfloat *) 0;
+
+    if (!params_ref) {
+        _env->ThrowNew(IAEClass, "params == null");
+        goto exit;
+    }
+    if (offset < 0) {
+        _env->ThrowNew(IAEClass, "offset < 0");
+        goto exit;
+    }
+    _remaining = _env->GetArrayLength(params_ref) - offset;
+    int _needed;
+    switch (pname) {
+#if defined(GL_TEXTURE_ENV_MODE)
+        case GL_TEXTURE_ENV_MODE:
+#endif // defined(GL_TEXTURE_ENV_MODE)
+#if defined(GL_COMBINE_RGB)
+        case GL_COMBINE_RGB:
+#endif // defined(GL_COMBINE_RGB)
+#if defined(GL_COMBINE_ALPHA)
+        case GL_COMBINE_ALPHA:
+#endif // defined(GL_COMBINE_ALPHA)
+            _needed = 1;
+            break;
+#if defined(GL_TEXTURE_ENV_COLOR)
+        case GL_TEXTURE_ENV_COLOR:
+#endif // defined(GL_TEXTURE_ENV_COLOR)
+            _needed = 4;
+            break;
+        default:
+            _needed = 0;
+            break;
+    }
+    if (_remaining < _needed) {
+        _env->ThrowNew(IAEClass, "length - offset < needed");
+        goto exit;
+    }
+    params_base = (GLfloat *)
+        _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
+    params = params_base + offset;
+
+    glTexEnvfv(
+        (GLenum)target,
+        (GLenum)pname,
+        (GLfloat *)params
+    );
+
+exit:
+    if (params_base) {
+        _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
+            JNI_ABORT);
+    }
+}
+
+/* void glTexEnvfv ( GLenum target, GLenum pname, const GLfloat *params ) */
+static void
+android_glTexEnvfv__IILjava_nio_FloatBuffer_2
+  (JNIEnv *_env, jobject _this, jint target, jint pname, jobject params_buf) {
+    jarray _array = (jarray) 0;
+    jint _remaining;
+    GLfloat *params = (GLfloat *) 0;
+
+    params = (GLfloat *)getPointer(_env, params_buf, &_array, &_remaining);
+    int _needed;
+    switch (pname) {
+#if defined(GL_TEXTURE_ENV_MODE)
+        case GL_TEXTURE_ENV_MODE:
+#endif // defined(GL_TEXTURE_ENV_MODE)
+#if defined(GL_COMBINE_RGB)
+        case GL_COMBINE_RGB:
+#endif // defined(GL_COMBINE_RGB)
+#if defined(GL_COMBINE_ALPHA)
+        case GL_COMBINE_ALPHA:
+#endif // defined(GL_COMBINE_ALPHA)
+            _needed = 1;
+            break;
+#if defined(GL_TEXTURE_ENV_COLOR)
+        case GL_TEXTURE_ENV_COLOR:
+#endif // defined(GL_TEXTURE_ENV_COLOR)
+            _needed = 4;
+            break;
+        default:
+            _needed = 0;
+            break;
+    }
+    if (_remaining < _needed) {
+        _env->ThrowNew(IAEClass, "remaining() < needed");
+        goto exit;
+    }
+    glTexEnvfv(
+        (GLenum)target,
+        (GLenum)pname,
+        (GLfloat *)params
+    );
+
+exit:
+    if (_array) {
+        releasePointer(_env, _array, params, JNI_FALSE);
+    }
+}
+
+/* void glTexEnvx ( GLenum target, GLenum pname, GLfixed param ) */
+static void
+android_glTexEnvx__III
+  (JNIEnv *_env, jobject _this, jint target, jint pname, jint param) {
+    glTexEnvx(
+        (GLenum)target,
+        (GLenum)pname,
+        (GLfixed)param
+    );
+}
+
+/* void glTexEnvxv ( GLenum target, GLenum pname, const GLfixed *params ) */
+static void
+android_glTexEnvxv__II_3II
+  (JNIEnv *_env, jobject _this, jint target, jint pname, jintArray params_ref, jint offset) {
+    GLfixed *params_base = (GLfixed *) 0;
+    jint _remaining;
+    GLfixed *params = (GLfixed *) 0;
+
+    if (!params_ref) {
+        _env->ThrowNew(IAEClass, "params == null");
+        goto exit;
+    }
+    if (offset < 0) {
+        _env->ThrowNew(IAEClass, "offset < 0");
+        goto exit;
+    }
+    _remaining = _env->GetArrayLength(params_ref) - offset;
+    int _needed;
+    switch (pname) {
+#if defined(GL_TEXTURE_ENV_MODE)
+        case GL_TEXTURE_ENV_MODE:
+#endif // defined(GL_TEXTURE_ENV_MODE)
+#if defined(GL_COMBINE_RGB)
+        case GL_COMBINE_RGB:
+#endif // defined(GL_COMBINE_RGB)
+#if defined(GL_COMBINE_ALPHA)
+        case GL_COMBINE_ALPHA:
+#endif // defined(GL_COMBINE_ALPHA)
+            _needed = 1;
+            break;
+#if defined(GL_TEXTURE_ENV_COLOR)
+        case GL_TEXTURE_ENV_COLOR:
+#endif // defined(GL_TEXTURE_ENV_COLOR)
+            _needed = 4;
+            break;
+        default:
+            _needed = 0;
+            break;
+    }
+    if (_remaining < _needed) {
+        _env->ThrowNew(IAEClass, "length - offset < needed");
+        goto exit;
+    }
+    params_base = (GLfixed *)
+        _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
+    params = params_base + offset;
+
+    glTexEnvxv(
+        (GLenum)target,
+        (GLenum)pname,
+        (GLfixed *)params
+    );
+
+exit:
+    if (params_base) {
+        _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
+            JNI_ABORT);
+    }
+}
+
+/* void glTexEnvxv ( GLenum target, GLenum pname, const GLfixed *params ) */
+static void
+android_glTexEnvxv__IILjava_nio_IntBuffer_2
+  (JNIEnv *_env, jobject _this, jint target, jint pname, jobject params_buf) {
+    jarray _array = (jarray) 0;
+    jint _remaining;
+    GLfixed *params = (GLfixed *) 0;
+
+    params = (GLfixed *)getPointer(_env, params_buf, &_array, &_remaining);
+    int _needed;
+    switch (pname) {
+#if defined(GL_TEXTURE_ENV_MODE)
+        case GL_TEXTURE_ENV_MODE:
+#endif // defined(GL_TEXTURE_ENV_MODE)
+#if defined(GL_COMBINE_RGB)
+        case GL_COMBINE_RGB:
+#endif // defined(GL_COMBINE_RGB)
+#if defined(GL_COMBINE_ALPHA)
+        case GL_COMBINE_ALPHA:
+#endif // defined(GL_COMBINE_ALPHA)
+            _needed = 1;
+            break;
+#if defined(GL_TEXTURE_ENV_COLOR)
+        case GL_TEXTURE_ENV_COLOR:
+#endif // defined(GL_TEXTURE_ENV_COLOR)
+            _needed = 4;
+            break;
+        default:
+            _needed = 0;
+            break;
+    }
+    if (_remaining < _needed) {
+        _env->ThrowNew(IAEClass, "remaining() < needed");
+        goto exit;
+    }
+    glTexEnvxv(
+        (GLenum)target,
+        (GLenum)pname,
+        (GLfixed *)params
+    );
+
+exit:
+    if (_array) {
+        releasePointer(_env, _array, params, JNI_FALSE);
+    }
+}
+
+/* void glTexImage2D ( GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels ) */
+static void
+android_glTexImage2D__IIIIIIIILjava_nio_Buffer_2
+  (JNIEnv *_env, jobject _this, jint target, jint level, jint internalformat, jint width, jint height, jint border, jint format, jint type, jobject pixels_buf) {
+    jarray _array = (jarray) 0;
+    jint _remaining;
+    GLvoid *pixels = (GLvoid *) 0;
+
+    if (pixels_buf) {
+        pixels = (GLvoid *)getPointer(_env, pixels_buf, &_array, &_remaining);
+    }
+    glTexImage2D(
+        (GLenum)target,
+        (GLint)level,
+        (GLint)internalformat,
+        (GLsizei)width,
+        (GLsizei)height,
+        (GLint)border,
+        (GLenum)format,
+        (GLenum)type,
+        (GLvoid *)pixels
+    );
+    if (_array) {
+        releasePointer(_env, _array, pixels, JNI_FALSE);
+    }
+}
+
+/* void glTexParameterf ( GLenum target, GLenum pname, GLfloat param ) */
+static void
+android_glTexParameterf__IIF
+  (JNIEnv *_env, jobject _this, jint target, jint pname, jfloat param) {
+    glTexParameterf(
+        (GLenum)target,
+        (GLenum)pname,
+        (GLfloat)param
+    );
+}
+
+/* void glTexParameterx ( GLenum target, GLenum pname, GLfixed param ) */
+static void
+android_glTexParameterx__III
+  (JNIEnv *_env, jobject _this, jint target, jint pname, jint param) {
+    glTexParameterx(
+        (GLenum)target,
+        (GLenum)pname,
+        (GLfixed)param
+    );
+}
+
+/* void glTexSubImage2D ( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels ) */
+static void
+android_glTexSubImage2D__IIIIIIIILjava_nio_Buffer_2
+  (JNIEnv *_env, jobject _this, jint target, jint level, jint xoffset, jint yoffset, jint width, jint height, jint format, jint type, jobject pixels_buf) {
+    jarray _array = (jarray) 0;
+    jint _remaining;
+    GLvoid *pixels = (GLvoid *) 0;
+
+    if (pixels_buf) {
+        pixels = (GLvoid *)getPointer(_env, pixels_buf, &_array, &_remaining);
+    }
+    glTexSubImage2D(
+        (GLenum)target,
+        (GLint)level,
+        (GLint)xoffset,
+        (GLint)yoffset,
+        (GLsizei)width,
+        (GLsizei)height,
+        (GLenum)format,
+        (GLenum)type,
+        (GLvoid *)pixels
+    );
+    if (_array) {
+        releasePointer(_env, _array, pixels, JNI_FALSE);
+    }
+}
+
+/* void glTranslatef ( GLfloat x, GLfloat y, GLfloat z ) */
+static void
+android_glTranslatef__FFF
+  (JNIEnv *_env, jobject _this, jfloat x, jfloat y, jfloat z) {
+    glTranslatef(
+        (GLfloat)x,
+        (GLfloat)y,
+        (GLfloat)z
+    );
+}
+
+/* void glTranslatex ( GLfixed x, GLfixed y, GLfixed z ) */
+static void
+android_glTranslatex__III
+  (JNIEnv *_env, jobject _this, jint x, jint y, jint z) {
+    glTranslatex(
+        (GLfixed)x,
+        (GLfixed)y,
+        (GLfixed)z
+    );
+}
+
+/* void glVertexPointer ( GLint size, GLenum type, GLsizei stride, const GLvoid *pointer ) */
+static void
+android_glVertexPointerBounds__IIILjava_nio_Buffer_2I
+  (JNIEnv *_env, jobject _this, jint size, jint type, jint stride, jobject pointer_buf, jint remaining) {
+    jarray _array = (jarray) 0;
+    jint _remaining;
+    GLvoid *pointer = (GLvoid *) 0;
+
+    pointer = (GLvoid *)getPointer(_env, pointer_buf, &_array, &_remaining);
+    glVertexPointerBounds(
+        (GLint)size,
+        (GLenum)type,
+        (GLsizei)stride,
+        (GLvoid *)pointer,
+        (GLsizei)remaining
+    );
+    if (_array) {
+        releasePointer(_env, _array, pointer, JNI_FALSE);
+    }
+}
+
+/* void glViewport ( GLint x, GLint y, GLsizei width, GLsizei height ) */
+static void
+android_glViewport__IIII
+  (JNIEnv *_env, jobject _this, jint x, jint y, jint width, jint height) {
+    glViewport(
+        (GLint)x,
+        (GLint)y,
+        (GLsizei)width,
+        (GLsizei)height
+    );
+}
+
+static const char *classPathName = "android/opengl/GLES10";
+
+static JNINativeMethod methods[] = {
+{"_nativeClassInit", "()V", (void*)nativeClassInit },
+{"glActiveTexture", "(I)V", (void *) android_glActiveTexture__I },
+{"glAlphaFunc", "(IF)V", (void *) android_glAlphaFunc__IF },
+{"glAlphaFuncx", "(II)V", (void *) android_glAlphaFuncx__II },
+{"glBindTexture", "(II)V", (void *) android_glBindTexture__II },
+{"glBlendFunc", "(II)V", (void *) android_glBlendFunc__II },
+{"glClear", "(I)V", (void *) android_glClear__I },
+{"glClearColor", "(FFFF)V", (void *) android_glClearColor__FFFF },
+{"glClearColorx", "(IIII)V", (void *) android_glClearColorx__IIII },
+{"glClearDepthf", "(F)V", (void *) android_glClearDepthf__F },
+{"glClearDepthx", "(I)V", (void *) android_glClearDepthx__I },
+{"glClearStencil", "(I)V", (void *) android_glClearStencil__I },
+{"glClientActiveTexture", "(I)V", (void *) android_glClientActiveTexture__I },
+{"glColor4f", "(FFFF)V", (void *) android_glColor4f__FFFF },
+{"glColor4x", "(IIII)V", (void *) android_glColor4x__IIII },
+{"glColorMask", "(ZZZZ)V", (void *) android_glColorMask__ZZZZ },
+{"glColorPointerBounds", "(IIILjava/nio/Buffer;I)V", (void *) android_glColorPointerBounds__IIILjava_nio_Buffer_2I },
+{"glCompressedTexImage2D", "(IIIIIIILjava/nio/Buffer;)V", (void *) android_glCompressedTexImage2D__IIIIIIILjava_nio_Buffer_2 },
+{"glCompressedTexSubImage2D", "(IIIIIIIILjava/nio/Buffer;)V", (void *) android_glCompressedTexSubImage2D__IIIIIIIILjava_nio_Buffer_2 },
+{"glCopyTexImage2D", "(IIIIIIII)V", (void *) android_glCopyTexImage2D__IIIIIIII },
+{"glCopyTexSubImage2D", "(IIIIIIII)V", (void *) android_glCopyTexSubImage2D__IIIIIIII },
+{"glCullFace", "(I)V", (void *) android_glCullFace__I },
+{"glDeleteTextures", "(I[II)V", (void *) android_glDeleteTextures__I_3II },
+{"glDeleteTextures", "(ILjava/nio/IntBuffer;)V", (void *) android_glDeleteTextures__ILjava_nio_IntBuffer_2 },
+{"glDepthFunc", "(I)V", (void *) android_glDepthFunc__I },
+{"glDepthMask", "(Z)V", (void *) android_glDepthMask__Z },
+{"glDepthRangef", "(FF)V", (void *) android_glDepthRangef__FF },
+{"glDepthRangex", "(II)V", (void *) android_glDepthRangex__II },
+{"glDisable", "(I)V", (void *) android_glDisable__I },
+{"glDisableClientState", "(I)V", (void *) android_glDisableClientState__I },
+{"glDrawArrays", "(III)V", (void *) android_glDrawArrays__III },
+{"glDrawElements", "(IIILjava/nio/Buffer;)V", (void *) android_glDrawElements__IIILjava_nio_Buffer_2 },
+{"glEnable", "(I)V", (void *) android_glEnable__I },
+{"glEnableClientState", "(I)V", (void *) android_glEnableClientState__I },
+{"glFinish", "()V", (void *) android_glFinish__ },
+{"glFlush", "()V", (void *) android_glFlush__ },
+{"glFogf", "(IF)V", (void *) android_glFogf__IF },
+{"glFogfv", "(I[FI)V", (void *) android_glFogfv__I_3FI },
+{"glFogfv", "(ILjava/nio/FloatBuffer;)V", (void *) android_glFogfv__ILjava_nio_FloatBuffer_2 },
+{"glFogx", "(II)V", (void *) android_glFogx__II },
+{"glFogxv", "(I[II)V", (void *) android_glFogxv__I_3II },
+{"glFogxv", "(ILjava/nio/IntBuffer;)V", (void *) android_glFogxv__ILjava_nio_IntBuffer_2 },
+{"glFrontFace", "(I)V", (void *) android_glFrontFace__I },
+{"glFrustumf", "(FFFFFF)V", (void *) android_glFrustumf__FFFFFF },
+{"glFrustumx", "(IIIIII)V", (void *) android_glFrustumx__IIIIII },
+{"glGenTextures", "(I[II)V", (void *) android_glGenTextures__I_3II },
+{"glGenTextures", "(ILjava/nio/IntBuffer;)V", (void *) android_glGenTextures__ILjava_nio_IntBuffer_2 },
+{"glGetError", "()I", (void *) android_glGetError__ },
+{"glGetIntegerv", "(I[II)V", (void *) android_glGetIntegerv__I_3II },
+{"glGetIntegerv", "(ILjava/nio/IntBuffer;)V", (void *) android_glGetIntegerv__ILjava_nio_IntBuffer_2 },
+{"glGetString", "(I)Ljava/lang/String;", (void *) android_glGetString },
+{"glHint", "(II)V", (void *) android_glHint__II },
+{"glLightModelf", "(IF)V", (void *) android_glLightModelf__IF },
+{"glLightModelfv", "(I[FI)V", (void *) android_glLightModelfv__I_3FI },
+{"glLightModelfv", "(ILjava/nio/FloatBuffer;)V", (void *) android_glLightModelfv__ILjava_nio_FloatBuffer_2 },
+{"glLightModelx", "(II)V", (void *) android_glLightModelx__II },
+{"glLightModelxv", "(I[II)V", (void *) android_glLightModelxv__I_3II },
+{"glLightModelxv", "(ILjava/nio/IntBuffer;)V", (void *) android_glLightModelxv__ILjava_nio_IntBuffer_2 },
+{"glLightf", "(IIF)V", (void *) android_glLightf__IIF },
+{"glLightfv", "(II[FI)V", (void *) android_glLightfv__II_3FI },
+{"glLightfv", "(IILjava/nio/FloatBuffer;)V", (void *) android_glLightfv__IILjava_nio_FloatBuffer_2 },
+{"glLightx", "(III)V", (void *) android_glLightx__III },
+{"glLightxv", "(II[II)V", (void *) android_glLightxv__II_3II },
+{"glLightxv", "(IILjava/nio/IntBuffer;)V", (void *) android_glLightxv__IILjava_nio_IntBuffer_2 },
+{"glLineWidth", "(F)V", (void *) android_glLineWidth__F },
+{"glLineWidthx", "(I)V", (void *) android_glLineWidthx__I },
+{"glLoadIdentity", "()V", (void *) android_glLoadIdentity__ },
+{"glLoadMatrixf", "([FI)V", (void *) android_glLoadMatrixf___3FI },
+{"glLoadMatrixf", "(Ljava/nio/FloatBuffer;)V", (void *) android_glLoadMatrixf__Ljava_nio_FloatBuffer_2 },
+{"glLoadMatrixx", "([II)V", (void *) android_glLoadMatrixx___3II },
+{"glLoadMatrixx", "(Ljava/nio/IntBuffer;)V", (void *) android_glLoadMatrixx__Ljava_nio_IntBuffer_2 },
+{"glLogicOp", "(I)V", (void *) android_glLogicOp__I },
+{"glMaterialf", "(IIF)V", (void *) android_glMaterialf__IIF },
+{"glMaterialfv", "(II[FI)V", (void *) android_glMaterialfv__II_3FI },
+{"glMaterialfv", "(IILjava/nio/FloatBuffer;)V", (void *) android_glMaterialfv__IILjava_nio_FloatBuffer_2 },
+{"glMaterialx", "(III)V", (void *) android_glMaterialx__III },
+{"glMaterialxv", "(II[II)V", (void *) android_glMaterialxv__II_3II },
+{"glMaterialxv", "(IILjava/nio/IntBuffer;)V", (void *) android_glMaterialxv__IILjava_nio_IntBuffer_2 },
+{"glMatrixMode", "(I)V", (void *) android_glMatrixMode__I },
+{"glMultMatrixf", "([FI)V", (void *) android_glMultMatrixf___3FI },
+{"glMultMatrixf", "(Ljava/nio/FloatBuffer;)V", (void *) android_glMultMatrixf__Ljava_nio_FloatBuffer_2 },
+{"glMultMatrixx", "([II)V", (void *) android_glMultMatrixx___3II },
+{"glMultMatrixx", "(Ljava/nio/IntBuffer;)V", (void *) android_glMultMatrixx__Ljava_nio_IntBuffer_2 },
+{"glMultiTexCoord4f", "(IFFFF)V", (void *) android_glMultiTexCoord4f__IFFFF },
+{"glMultiTexCoord4x", "(IIIII)V", (void *) android_glMultiTexCoord4x__IIIII },
+{"glNormal3f", "(FFF)V", (void *) android_glNormal3f__FFF },
+{"glNormal3x", "(III)V", (void *) android_glNormal3x__III },
+{"glNormalPointerBounds", "(IILjava/nio/Buffer;I)V", (void *) android_glNormalPointerBounds__IILjava_nio_Buffer_2I },
+{"glOrthof", "(FFFFFF)V", (void *) android_glOrthof__FFFFFF },
+{"glOrthox", "(IIIIII)V", (void *) android_glOrthox__IIIIII },
+{"glPixelStorei", "(II)V", (void *) android_glPixelStorei__II },
+{"glPointSize", "(F)V", (void *) android_glPointSize__F },
+{"glPointSizex", "(I)V", (void *) android_glPointSizex__I },
+{"glPolygonOffset", "(FF)V", (void *) android_glPolygonOffset__FF },
+{"glPolygonOffsetx", "(II)V", (void *) android_glPolygonOffsetx__II },
+{"glPopMatrix", "()V", (void *) android_glPopMatrix__ },
+{"glPushMatrix", "()V", (void *) android_glPushMatrix__ },
+{"glReadPixels", "(IIIIIILjava/nio/Buffer;)V", (void *) android_glReadPixels__IIIIIILjava_nio_Buffer_2 },
+{"glRotatef", "(FFFF)V", (void *) android_glRotatef__FFFF },
+{"glRotatex", "(IIII)V", (void *) android_glRotatex__IIII },
+{"glSampleCoverage", "(FZ)V", (void *) android_glSampleCoverage__FZ },
+{"glSampleCoveragex", "(IZ)V", (void *) android_glSampleCoveragex__IZ },
+{"glScalef", "(FFF)V", (void *) android_glScalef__FFF },
+{"glScalex", "(III)V", (void *) android_glScalex__III },
+{"glScissor", "(IIII)V", (void *) android_glScissor__IIII },
+{"glShadeModel", "(I)V", (void *) android_glShadeModel__I },
+{"glStencilFunc", "(III)V", (void *) android_glStencilFunc__III },
+{"glStencilMask", "(I)V", (void *) android_glStencilMask__I },
+{"glStencilOp", "(III)V", (void *) android_glStencilOp__III },
+{"glTexCoordPointerBounds", "(IIILjava/nio/Buffer;I)V", (void *) android_glTexCoordPointerBounds__IIILjava_nio_Buffer_2I },
+{"glTexEnvf", "(IIF)V", (void *) android_glTexEnvf__IIF },
+{"glTexEnvfv", "(II[FI)V", (void *) android_glTexEnvfv__II_3FI },
+{"glTexEnvfv", "(IILjava/nio/FloatBuffer;)V", (void *) android_glTexEnvfv__IILjava_nio_FloatBuffer_2 },
+{"glTexEnvx", "(III)V", (void *) android_glTexEnvx__III },
+{"glTexEnvxv", "(II[II)V", (void *) android_glTexEnvxv__II_3II },
+{"glTexEnvxv", "(IILjava/nio/IntBuffer;)V", (void *) android_glTexEnvxv__IILjava_nio_IntBuffer_2 },
+{"glTexImage2D", "(IIIIIIIILjava/nio/Buffer;)V", (void *) android_glTexImage2D__IIIIIIIILjava_nio_Buffer_2 },
+{"glTexParameterf", "(IIF)V", (void *) android_glTexParameterf__IIF },
+{"glTexParameterx", "(III)V", (void *) android_glTexParameterx__III },
+{"glTexSubImage2D", "(IIIIIIIILjava/nio/Buffer;)V", (void *) android_glTexSubImage2D__IIIIIIIILjava_nio_Buffer_2 },
+{"glTranslatef", "(FFF)V", (void *) android_glTranslatef__FFF },
+{"glTranslatex", "(III)V", (void *) android_glTranslatex__III },
+{"glVertexPointerBounds", "(IIILjava/nio/Buffer;I)V", (void *) android_glVertexPointerBounds__IIILjava_nio_Buffer_2I },
+{"glViewport", "(IIII)V", (void *) android_glViewport__IIII },
+};
+
+int register_android_opengl_jni_GLES10(JNIEnv *_env)
+{
+    int err;
+    err = android::AndroidRuntime::registerNativeMethods(_env, classPathName, methods, NELEM(methods));
+    return err;
+}
diff --git a/core/jni/android_opengl_GLES10Ext.cpp b/core/jni/android_opengl_GLES10Ext.cpp
new file mode 100644
index 0000000..6114d6a
--- /dev/null
+++ b/core/jni/android_opengl_GLES10Ext.cpp
@@ -0,0 +1,254 @@
+/*
+**
+** Copyright 2009, The Android Open Source Project
+**
+** Licensed under the Apache License, Version 2.0 (the "License"); 
+** you may not use this file except in compliance with the License. 
+** You may obtain a copy of the License at 
+**
+**     http://www.apache.org/licenses/LICENSE-2.0 
+**
+** Unless required by applicable law or agreed to in writing, software 
+** distributed under the License is distributed on an "AS IS" BASIS, 
+** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+** See the License for the specific language governing permissions and 
+** limitations under the License.
+*/
+
+// This source file is automatically generated
+
+#include <android_runtime/AndroidRuntime.h>
+#include <utils/misc.h>
+
+#include <assert.h>
+#include <GLES/gl.h>
+
+#include <private/opengles/gl_context.h>
+
+#define _NUM_COMPRESSED_TEXTURE_FORMATS \
+        (::android::OGLES_NUM_COMPRESSED_TEXTURE_FORMATS)
+
+static int initialized = 0;
+
+static jclass nioAccessClass;
+static jclass bufferClass;
+static jclass OOMEClass;
+static jclass UOEClass;
+static jclass IAEClass;
+static jclass AIOOBEClass;
+static jmethodID getBasePointerID;
+static jmethodID getBaseArrayID;
+static jmethodID getBaseArrayOffsetID;
+static jfieldID positionID;
+static jfieldID limitID;
+static jfieldID elementSizeShiftID;
+
+/* Cache method IDs each time the class is loaded. */
+
+static void
+nativeClassInitBuffer(JNIEnv *_env)
+{
+    jclass nioAccessClassLocal = _env->FindClass("java/nio/NIOAccess");
+    nioAccessClass = (jclass) _env->NewGlobalRef(nioAccessClassLocal);
+
+    jclass bufferClassLocal = _env->FindClass("java/nio/Buffer");
+    bufferClass = (jclass) _env->NewGlobalRef(bufferClassLocal);
+
+    getBasePointerID = _env->GetStaticMethodID(nioAccessClass,
+            "getBasePointer", "(Ljava/nio/Buffer;)J");
+    getBaseArrayID = _env->GetStaticMethodID(nioAccessClass,
+            "getBaseArray", "(Ljava/nio/Buffer;)Ljava/lang/Object;");
+    getBaseArrayOffsetID = _env->GetStaticMethodID(nioAccessClass,
+            "getBaseArrayOffset", "(Ljava/nio/Buffer;)I");
+
+    positionID = _env->GetFieldID(bufferClass, "position", "I");
+    limitID = _env->GetFieldID(bufferClass, "limit", "I");
+    elementSizeShiftID =
+        _env->GetFieldID(bufferClass, "_elementSizeShift", "I");
+}
+
+
+static void
+nativeClassInit(JNIEnv *_env, jclass glImplClass)
+{
+    nativeClassInitBuffer(_env);
+
+    jclass IAEClassLocal =
+        _env->FindClass("java/lang/IllegalArgumentException");
+    jclass OOMEClassLocal =
+         _env->FindClass("java/lang/OutOfMemoryError");
+    jclass UOEClassLocal =
+         _env->FindClass("java/lang/UnsupportedOperationException");
+    jclass AIOOBEClassLocal =
+         _env->FindClass("java/lang/ArrayIndexOutOfBoundsException");
+
+    IAEClass = (jclass) _env->NewGlobalRef(IAEClassLocal);
+    OOMEClass = (jclass) _env->NewGlobalRef(OOMEClassLocal);
+    UOEClass = (jclass) _env->NewGlobalRef(UOEClassLocal);
+    AIOOBEClass = (jclass) _env->NewGlobalRef(AIOOBEClassLocal);
+}
+
+static void *
+getPointer(JNIEnv *_env, jobject buffer, jarray *array, jint *remaining)
+{
+    jint position;
+    jint limit;
+    jint elementSizeShift;
+    jlong pointer;
+    jint offset;
+    void *data;
+
+    position = _env->GetIntField(buffer, positionID);
+    limit = _env->GetIntField(buffer, limitID);
+    elementSizeShift = _env->GetIntField(buffer, elementSizeShiftID);
+    *remaining = (limit - position) << elementSizeShift;
+    pointer = _env->CallStaticLongMethod(nioAccessClass,
+            getBasePointerID, buffer);
+    if (pointer != 0L) {
+        *array = NULL;
+        return (void *) (jint) pointer;
+    }
+    
+    *array = (jarray) _env->CallStaticObjectMethod(nioAccessClass,
+            getBaseArrayID, buffer);
+    offset = _env->CallStaticIntMethod(nioAccessClass,
+            getBaseArrayOffsetID, buffer);
+    data = _env->GetPrimitiveArrayCritical(*array, (jboolean *) 0);
+    
+    return (void *) ((char *) data + offset);
+}
+
+
+static void
+releasePointer(JNIEnv *_env, jarray array, void *data, jboolean commit)
+{
+    _env->ReleasePrimitiveArrayCritical(array, data,
+					   commit ? 0 : JNI_ABORT);
+}
+
+// --------------------------------------------------------------------------
+
+/* GLbitfield glQueryMatrixxOES ( GLfixed *mantissa, GLint *exponent ) */
+static jint
+android_glQueryMatrixxOES___3II_3II
+  (JNIEnv *_env, jobject _this, jintArray mantissa_ref, jint mantissaOffset, jintArray exponent_ref, jint exponentOffset) {
+    jint _exception = 0;
+    GLbitfield _returnValue = -1;
+    GLfixed *mantissa_base = (GLfixed *) 0;
+    jint _mantissaRemaining;
+    GLfixed *mantissa = (GLfixed *) 0;
+    GLint *exponent_base = (GLint *) 0;
+    jint _exponentRemaining;
+    GLint *exponent = (GLint *) 0;
+
+    if (!mantissa_ref) {
+        _exception = 1;
+        _env->ThrowNew(IAEClass, "mantissa == null");
+        goto exit;
+    }
+    if (mantissaOffset < 0) {
+        _exception = 1;
+        _env->ThrowNew(IAEClass, "mantissaOffset < 0");
+        goto exit;
+    }
+    _mantissaRemaining = _env->GetArrayLength(mantissa_ref) - mantissaOffset;
+    if (_mantissaRemaining < 16) {
+        _exception = 1;
+        _env->ThrowNew(IAEClass, "length - mantissaOffset < 16");
+        goto exit;
+    }
+    mantissa_base = (GLfixed *)
+        _env->GetPrimitiveArrayCritical(mantissa_ref, (jboolean *)0);
+    mantissa = mantissa_base + mantissaOffset;
+
+    if (!exponent_ref) {
+        _exception = 1;
+        _env->ThrowNew(IAEClass, "exponent == null");
+        goto exit;
+    }
+    if (exponentOffset < 0) {
+        _exception = 1;
+        _env->ThrowNew(IAEClass, "exponentOffset < 0");
+        goto exit;
+    }
+    _exponentRemaining = _env->GetArrayLength(exponent_ref) - exponentOffset;
+    if (_exponentRemaining < 16) {
+        _exception = 1;
+        _env->ThrowNew(IAEClass, "length - exponentOffset < 16");
+        goto exit;
+    }
+    exponent_base = (GLint *)
+        _env->GetPrimitiveArrayCritical(exponent_ref, (jboolean *)0);
+    exponent = exponent_base + exponentOffset;
+
+    _returnValue = glQueryMatrixxOES(
+        (GLfixed *)mantissa,
+        (GLint *)exponent
+    );
+
+exit:
+    if (exponent_base) {
+        _env->ReleasePrimitiveArrayCritical(exponent_ref, exponent_base,
+            _exception ? JNI_ABORT: 0);
+    }
+    if (mantissa_base) {
+        _env->ReleasePrimitiveArrayCritical(mantissa_ref, mantissa_base,
+            _exception ? JNI_ABORT: 0);
+    }
+    return _returnValue;
+}
+
+/* GLbitfield glQueryMatrixxOES ( GLfixed *mantissa, GLint *exponent ) */
+static jint
+android_glQueryMatrixxOES__Ljava_nio_IntBuffer_2Ljava_nio_IntBuffer_2
+  (JNIEnv *_env, jobject _this, jobject mantissa_buf, jobject exponent_buf) {
+    jint _exception = 0;
+    jarray _mantissaArray = (jarray) 0;
+    jarray _exponentArray = (jarray) 0;
+    GLbitfield _returnValue = -1;
+    jint _mantissaRemaining;
+    GLfixed *mantissa = (GLfixed *) 0;
+    jint _exponentRemaining;
+    GLint *exponent = (GLint *) 0;
+
+    mantissa = (GLfixed *)getPointer(_env, mantissa_buf, &_mantissaArray, &_mantissaRemaining);
+    if (_mantissaRemaining < 16) {
+        _exception = 1;
+        _env->ThrowNew(IAEClass, "remaining() < 16");
+        goto exit;
+    }
+    exponent = (GLint *)getPointer(_env, exponent_buf, &_exponentArray, &_exponentRemaining);
+    if (_exponentRemaining < 16) {
+        _exception = 1;
+        _env->ThrowNew(IAEClass, "remaining() < 16");
+        goto exit;
+    }
+    _returnValue = glQueryMatrixxOES(
+        (GLfixed *)mantissa,
+        (GLint *)exponent
+    );
+
+exit:
+    if (_mantissaArray) {
+        releasePointer(_env, _mantissaArray, exponent, _exception ? JNI_FALSE : JNI_TRUE);
+    }
+    if (_exponentArray) {
+        releasePointer(_env, _exponentArray, mantissa, _exception ? JNI_FALSE : JNI_TRUE);
+    }
+    return _returnValue;
+}
+
+static const char *classPathName = "android/opengl/GLES10Ext";
+
+static JNINativeMethod methods[] = {
+{"_nativeClassInit", "()V", (void*)nativeClassInit },
+{"glQueryMatrixxOES", "([II[II)I", (void *) android_glQueryMatrixxOES___3II_3II },
+{"glQueryMatrixxOES", "(Ljava/nio/IntBuffer;Ljava/nio/IntBuffer;)I", (void *) android_glQueryMatrixxOES__Ljava_nio_IntBuffer_2Ljava_nio_IntBuffer_2 },
+};
+
+int register_android_opengl_jni_GLES10Ext(JNIEnv *_env)
+{
+    int err;
+    err = android::AndroidRuntime::registerNativeMethods(_env, classPathName, methods, NELEM(methods));
+    return err;
+}
diff --git a/core/jni/android_opengl_GLES11.cpp b/core/jni/android_opengl_GLES11.cpp
new file mode 100644
index 0000000..a7e59a8
--- /dev/null
+++ b/core/jni/android_opengl_GLES11.cpp
@@ -0,0 +1,2469 @@
+/*
+**
+** Copyright 2009, The Android Open Source Project
+**
+** Licensed under the Apache License, Version 2.0 (the "License"); 
+** you may not use this file except in compliance with the License. 
+** You may obtain a copy of the License at 
+**
+**     http://www.apache.org/licenses/LICENSE-2.0 
+**
+** Unless required by applicable law or agreed to in writing, software 
+** distributed under the License is distributed on an "AS IS" BASIS, 
+** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+** See the License for the specific language governing permissions and 
+** limitations under the License.
+*/
+
+// This source file is automatically generated
+
+#include <android_runtime/AndroidRuntime.h>
+#include <utils/misc.h>
+
+#include <assert.h>
+#include <GLES/gl.h>
+
+#include <private/opengles/gl_context.h>
+
+#define _NUM_COMPRESSED_TEXTURE_FORMATS \
+        (::android::OGLES_NUM_COMPRESSED_TEXTURE_FORMATS)
+
+static int initialized = 0;
+
+static jclass nioAccessClass;
+static jclass bufferClass;
+static jclass OOMEClass;
+static jclass UOEClass;
+static jclass IAEClass;
+static jclass AIOOBEClass;
+static jmethodID getBasePointerID;
+static jmethodID getBaseArrayID;
+static jmethodID getBaseArrayOffsetID;
+static jfieldID positionID;
+static jfieldID limitID;
+static jfieldID elementSizeShiftID;
+
+/* Cache method IDs each time the class is loaded. */
+
+static void
+nativeClassInitBuffer(JNIEnv *_env)
+{
+    jclass nioAccessClassLocal = _env->FindClass("java/nio/NIOAccess");
+    nioAccessClass = (jclass) _env->NewGlobalRef(nioAccessClassLocal);
+
+    jclass bufferClassLocal = _env->FindClass("java/nio/Buffer");
+    bufferClass = (jclass) _env->NewGlobalRef(bufferClassLocal);
+
+    getBasePointerID = _env->GetStaticMethodID(nioAccessClass,
+            "getBasePointer", "(Ljava/nio/Buffer;)J");
+    getBaseArrayID = _env->GetStaticMethodID(nioAccessClass,
+            "getBaseArray", "(Ljava/nio/Buffer;)Ljava/lang/Object;");
+    getBaseArrayOffsetID = _env->GetStaticMethodID(nioAccessClass,
+            "getBaseArrayOffset", "(Ljava/nio/Buffer;)I");
+
+    positionID = _env->GetFieldID(bufferClass, "position", "I");
+    limitID = _env->GetFieldID(bufferClass, "limit", "I");
+    elementSizeShiftID =
+        _env->GetFieldID(bufferClass, "_elementSizeShift", "I");
+}
+
+
+static void
+nativeClassInit(JNIEnv *_env, jclass glImplClass)
+{
+    nativeClassInitBuffer(_env);
+
+    jclass IAEClassLocal =
+        _env->FindClass("java/lang/IllegalArgumentException");
+    jclass OOMEClassLocal =
+         _env->FindClass("java/lang/OutOfMemoryError");
+    jclass UOEClassLocal =
+         _env->FindClass("java/lang/UnsupportedOperationException");
+    jclass AIOOBEClassLocal =
+         _env->FindClass("java/lang/ArrayIndexOutOfBoundsException");
+
+    IAEClass = (jclass) _env->NewGlobalRef(IAEClassLocal);
+    OOMEClass = (jclass) _env->NewGlobalRef(OOMEClassLocal);
+    UOEClass = (jclass) _env->NewGlobalRef(UOEClassLocal);
+    AIOOBEClass = (jclass) _env->NewGlobalRef(AIOOBEClassLocal);
+}
+
+static void *
+getPointer(JNIEnv *_env, jobject buffer, jarray *array, jint *remaining)
+{
+    jint position;
+    jint limit;
+    jint elementSizeShift;
+    jlong pointer;
+    jint offset;
+    void *data;
+
+    position = _env->GetIntField(buffer, positionID);
+    limit = _env->GetIntField(buffer, limitID);
+    elementSizeShift = _env->GetIntField(buffer, elementSizeShiftID);
+    *remaining = (limit - position) << elementSizeShift;
+    pointer = _env->CallStaticLongMethod(nioAccessClass,
+            getBasePointerID, buffer);
+    if (pointer != 0L) {
+        *array = NULL;
+        return (void *) (jint) pointer;
+    }
+    
+    *array = (jarray) _env->CallStaticObjectMethod(nioAccessClass,
+            getBaseArrayID, buffer);
+    offset = _env->CallStaticIntMethod(nioAccessClass,
+            getBaseArrayOffsetID, buffer);
+    data = _env->GetPrimitiveArrayCritical(*array, (jboolean *) 0);
+    
+    return (void *) ((char *) data + offset);
+}
+
+
+static void
+releasePointer(JNIEnv *_env, jarray array, void *data, jboolean commit)
+{
+    _env->ReleasePrimitiveArrayCritical(array, data,
+					   commit ? 0 : JNI_ABORT);
+}
+
+// --------------------------------------------------------------------------
+
+/* void glBindBuffer ( GLenum target, GLuint buffer ) */
+static void
+android_glBindBuffer__II
+  (JNIEnv *_env, jobject _this, jint target, jint buffer) {
+    glBindBuffer(
+        (GLenum)target,
+        (GLuint)buffer
+    );
+}
+
+/* void glBufferData ( GLenum target, GLsizeiptr size, const GLvoid *data, GLenum usage ) */
+static void
+android_glBufferData__IILjava_nio_Buffer_2I
+  (JNIEnv *_env, jobject _this, jint target, jint size, jobject data_buf, jint usage) {
+    jarray _array = (jarray) 0;
+    jint _remaining;
+    GLvoid *data = (GLvoid *) 0;
+
+    if (data_buf) {
+        data = (GLvoid *)getPointer(_env, data_buf, &_array, &_remaining);
+    }
+    glBufferData(
+        (GLenum)target,
+        (GLsizeiptr)size,
+        (GLvoid *)data,
+        (GLenum)usage
+    );
+    if (_array) {
+        releasePointer(_env, _array, data, JNI_FALSE);
+    }
+}
+
+/* void glBufferSubData ( GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid *data ) */
+static void
+android_glBufferSubData__IIILjava_nio_Buffer_2
+  (JNIEnv *_env, jobject _this, jint target, jint offset, jint size, jobject data_buf) {
+    jarray _array = (jarray) 0;
+    jint _remaining;
+    GLvoid *data = (GLvoid *) 0;
+
+    data = (GLvoid *)getPointer(_env, data_buf, &_array, &_remaining);
+    glBufferSubData(
+        (GLenum)target,
+        (GLintptr)offset,
+        (GLsizeiptr)size,
+        (GLvoid *)data
+    );
+    if (_array) {
+        releasePointer(_env, _array, data, JNI_FALSE);
+    }
+}
+
+/* void glClipPlanef ( GLenum plane, const GLfloat *equation ) */
+static void
+android_glClipPlanef__I_3FI
+  (JNIEnv *_env, jobject _this, jint plane, jfloatArray equation_ref, jint offset) {
+    GLfloat *equation_base = (GLfloat *) 0;
+    jint _remaining;
+    GLfloat *equation = (GLfloat *) 0;
+
+    if (!equation_ref) {
+        _env->ThrowNew(IAEClass, "equation == null");
+        goto exit;
+    }
+    if (offset < 0) {
+        _env->ThrowNew(IAEClass, "offset < 0");
+        goto exit;
+    }
+    _remaining = _env->GetArrayLength(equation_ref) - offset;
+    equation_base = (GLfloat *)
+        _env->GetPrimitiveArrayCritical(equation_ref, (jboolean *)0);
+    equation = equation_base + offset;
+
+    glClipPlanef(
+        (GLenum)plane,
+        (GLfloat *)equation
+    );
+
+exit:
+    if (equation_base) {
+        _env->ReleasePrimitiveArrayCritical(equation_ref, equation_base,
+            JNI_ABORT);
+    }
+}
+
+/* void glClipPlanef ( GLenum plane, const GLfloat *equation ) */
+static void
+android_glClipPlanef__ILjava_nio_FloatBuffer_2
+  (JNIEnv *_env, jobject _this, jint plane, jobject equation_buf) {
+    jarray _array = (jarray) 0;
+    jint _remaining;
+    GLfloat *equation = (GLfloat *) 0;
+
+    equation = (GLfloat *)getPointer(_env, equation_buf, &_array, &_remaining);
+    glClipPlanef(
+        (GLenum)plane,
+        (GLfloat *)equation
+    );
+    if (_array) {
+        releasePointer(_env, _array, equation, JNI_FALSE);
+    }
+}
+
+/* void glClipPlanex ( GLenum plane, const GLfixed *equation ) */
+static void
+android_glClipPlanex__I_3II
+  (JNIEnv *_env, jobject _this, jint plane, jintArray equation_ref, jint offset) {
+    GLfixed *equation_base = (GLfixed *) 0;
+    jint _remaining;
+    GLfixed *equation = (GLfixed *) 0;
+
+    if (!equation_ref) {
+        _env->ThrowNew(IAEClass, "equation == null");
+        goto exit;
+    }
+    if (offset < 0) {
+        _env->ThrowNew(IAEClass, "offset < 0");
+        goto exit;
+    }
+    _remaining = _env->GetArrayLength(equation_ref) - offset;
+    equation_base = (GLfixed *)
+        _env->GetPrimitiveArrayCritical(equation_ref, (jboolean *)0);
+    equation = equation_base + offset;
+
+    glClipPlanex(
+        (GLenum)plane,
+        (GLfixed *)equation
+    );
+
+exit:
+    if (equation_base) {
+        _env->ReleasePrimitiveArrayCritical(equation_ref, equation_base,
+            JNI_ABORT);
+    }
+}
+
+/* void glClipPlanex ( GLenum plane, const GLfixed *equation ) */
+static void
+android_glClipPlanex__ILjava_nio_IntBuffer_2
+  (JNIEnv *_env, jobject _this, jint plane, jobject equation_buf) {
+    jarray _array = (jarray) 0;
+    jint _remaining;
+    GLfixed *equation = (GLfixed *) 0;
+
+    equation = (GLfixed *)getPointer(_env, equation_buf, &_array, &_remaining);
+    glClipPlanex(
+        (GLenum)plane,
+        (GLfixed *)equation
+    );
+    if (_array) {
+        releasePointer(_env, _array, equation, JNI_FALSE);
+    }
+}
+
+/* void glColor4ub ( GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha ) */
+static void
+android_glColor4ub__BBBB
+  (JNIEnv *_env, jobject _this, jbyte red, jbyte green, jbyte blue, jbyte alpha) {
+    glColor4ub(
+        (GLubyte)red,
+        (GLubyte)green,
+        (GLubyte)blue,
+        (GLubyte)alpha
+    );
+}
+
+/* void glColorPointer ( GLint size, GLenum type, GLsizei stride, GLint offset ) */
+static void
+android_glColorPointer__IIII
+  (JNIEnv *_env, jobject _this, jint size, jint type, jint stride, jint offset) {
+    glColorPointer(
+        (GLint)size,
+        (GLenum)type,
+        (GLsizei)stride,
+        (const GLvoid *)offset
+    );
+}
+
+/* void glDeleteBuffers ( GLsizei n, const GLuint *buffers ) */
+static void
+android_glDeleteBuffers__I_3II
+  (JNIEnv *_env, jobject _this, jint n, jintArray buffers_ref, jint offset) {
+    GLuint *buffers_base = (GLuint *) 0;
+    jint _remaining;
+    GLuint *buffers = (GLuint *) 0;
+
+    if (!buffers_ref) {
+        _env->ThrowNew(IAEClass, "buffers == null");
+        goto exit;
+    }
+    if (offset < 0) {
+        _env->ThrowNew(IAEClass, "offset < 0");
+        goto exit;
+    }
+    _remaining = _env->GetArrayLength(buffers_ref) - offset;
+    if (_remaining < n) {
+        _env->ThrowNew(IAEClass, "length - offset < n");
+        goto exit;
+    }
+    buffers_base = (GLuint *)
+        _env->GetPrimitiveArrayCritical(buffers_ref, (jboolean *)0);
+    buffers = buffers_base + offset;
+
+    glDeleteBuffers(
+        (GLsizei)n,
+        (GLuint *)buffers
+    );
+
+exit:
+    if (buffers_base) {
+        _env->ReleasePrimitiveArrayCritical(buffers_ref, buffers_base,
+            JNI_ABORT);
+    }
+}
+
+/* void glDeleteBuffers ( GLsizei n, const GLuint *buffers ) */
+static void
+android_glDeleteBuffers__ILjava_nio_IntBuffer_2
+  (JNIEnv *_env, jobject _this, jint n, jobject buffers_buf) {
+    jarray _array = (jarray) 0;
+    jint _remaining;
+    GLuint *buffers = (GLuint *) 0;
+
+    buffers = (GLuint *)getPointer(_env, buffers_buf, &_array, &_remaining);
+    if (_remaining < n) {
+        _env->ThrowNew(IAEClass, "remaining() < n");
+        goto exit;
+    }
+    glDeleteBuffers(
+        (GLsizei)n,
+        (GLuint *)buffers
+    );
+
+exit:
+    if (_array) {
+        releasePointer(_env, _array, buffers, JNI_FALSE);
+    }
+}
+
+/* void glDrawElements ( GLenum mode, GLsizei count, GLenum type, GLint offset ) */
+static void
+android_glDrawElements__IIII
+  (JNIEnv *_env, jobject _this, jint mode, jint count, jint type, jint offset) {
+    glDrawElements(
+        (GLenum)mode,
+        (GLsizei)count,
+        (GLenum)type,
+        (const GLvoid *)offset
+    );
+}
+
+/* void glGenBuffers ( GLsizei n, GLuint *buffers ) */
+static void
+android_glGenBuffers__I_3II
+  (JNIEnv *_env, jobject _this, jint n, jintArray buffers_ref, jint offset) {
+    jint _exception = 0;
+    GLuint *buffers_base = (GLuint *) 0;
+    jint _remaining;
+    GLuint *buffers = (GLuint *) 0;
+
+    if (!buffers_ref) {
+        _exception = 1;
+        _env->ThrowNew(IAEClass, "buffers == null");
+        goto exit;
+    }
+    if (offset < 0) {
+        _exception = 1;
+        _env->ThrowNew(IAEClass, "offset < 0");
+        goto exit;
+    }
+    _remaining = _env->GetArrayLength(buffers_ref) - offset;
+    if (_remaining < n) {
+        _exception = 1;
+        _env->ThrowNew(IAEClass, "length - offset < n");
+        goto exit;
+    }
+    buffers_base = (GLuint *)
+        _env->GetPrimitiveArrayCritical(buffers_ref, (jboolean *)0);
+    buffers = buffers_base + offset;
+
+    glGenBuffers(
+        (GLsizei)n,
+        (GLuint *)buffers
+    );
+
+exit:
+    if (buffers_base) {
+        _env->ReleasePrimitiveArrayCritical(buffers_ref, buffers_base,
+            _exception ? JNI_ABORT: 0);
+    }
+}
+
+/* void glGenBuffers ( GLsizei n, GLuint *buffers ) */
+static void
+android_glGenBuffers__ILjava_nio_IntBuffer_2
+  (JNIEnv *_env, jobject _this, jint n, jobject buffers_buf) {
+    jint _exception = 0;
+    jarray _array = (jarray) 0;
+    jint _remaining;
+    GLuint *buffers = (GLuint *) 0;
+
+    buffers = (GLuint *)getPointer(_env, buffers_buf, &_array, &_remaining);
+    if (_remaining < n) {
+        _exception = 1;
+        _env->ThrowNew(IAEClass, "remaining() < n");
+        goto exit;
+    }
+    glGenBuffers(
+        (GLsizei)n,
+        (GLuint *)buffers
+    );
+
+exit:
+    if (_array) {
+        releasePointer(_env, _array, buffers, _exception ? JNI_FALSE : JNI_TRUE);
+    }
+}
+
+/* void glGetBooleanv ( GLenum pname, GLboolean *params ) */
+static void
+android_glGetBooleanv__I_3ZI
+  (JNIEnv *_env, jobject _this, jint pname, jbooleanArray params_ref, jint offset) {
+    jint _exception = 0;
+    GLboolean *params_base = (GLboolean *) 0;
+    jint _remaining;
+    GLboolean *params = (GLboolean *) 0;
+
+    if (!params_ref) {
+        _exception = 1;
+        _env->ThrowNew(IAEClass, "params == null");
+        goto exit;
+    }
+    if (offset < 0) {
+        _exception = 1;
+        _env->ThrowNew(IAEClass, "offset < 0");
+        goto exit;
+    }
+    _remaining = _env->GetArrayLength(params_ref) - offset;
+    params_base = (GLboolean *)
+        _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
+    params = params_base + offset;
+
+    glGetBooleanv(
+        (GLenum)pname,
+        (GLboolean *)params
+    );
+
+exit:
+    if (params_base) {
+        _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
+            _exception ? JNI_ABORT: 0);
+    }
+}
+
+/* void glGetBooleanv ( GLenum pname, GLboolean *params ) */
+static void
+android_glGetBooleanv__ILjava_nio_IntBuffer_2
+  (JNIEnv *_env, jobject _this, jint pname, jobject params_buf) {
+    jint _exception = 0;
+    jarray _array = (jarray) 0;
+    jint _remaining;
+    GLboolean *params = (GLboolean *) 0;
+
+    params = (GLboolean *)getPointer(_env, params_buf, &_array, &_remaining);
+    glGetBooleanv(
+        (GLenum)pname,
+        (GLboolean *)params
+    );
+    if (_array) {
+        releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE);
+    }
+}
+
+/* void glGetBufferParameteriv ( GLenum target, GLenum pname, GLint *params ) */
+static void
+android_glGetBufferParameteriv__II_3II
+  (JNIEnv *_env, jobject _this, jint target, jint pname, jintArray params_ref, jint offset) {
+    _env->ThrowNew(UOEClass,
+        "glGetBufferParameteriv");
+}
+
+/* void glGetBufferParameteriv ( GLenum target, GLenum pname, GLint *params ) */
+static void
+android_glGetBufferParameteriv__IILjava_nio_IntBuffer_2
+  (JNIEnv *_env, jobject _this, jint target, jint pname, jobject params_buf) {
+    _env->ThrowNew(UOEClass,
+        "glGetBufferParameteriv");
+}
+
+/* void glGetClipPlanef ( GLenum pname, GLfloat *eqn ) */
+static void
+android_glGetClipPlanef__I_3FI
+  (JNIEnv *_env, jobject _this, jint pname, jfloatArray eqn_ref, jint offset) {
+    jint _exception = 0;
+    GLfloat *eqn_base = (GLfloat *) 0;
+    jint _remaining;
+    GLfloat *eqn = (GLfloat *) 0;
+
+    if (!eqn_ref) {
+        _exception = 1;
+        _env->ThrowNew(IAEClass, "eqn == null");
+        goto exit;
+    }
+    if (offset < 0) {
+        _exception = 1;
+        _env->ThrowNew(IAEClass, "offset < 0");
+        goto exit;
+    }
+    _remaining = _env->GetArrayLength(eqn_ref) - offset;
+    eqn_base = (GLfloat *)
+        _env->GetPrimitiveArrayCritical(eqn_ref, (jboolean *)0);
+    eqn = eqn_base + offset;
+
+    glGetClipPlanef(
+        (GLenum)pname,
+        (GLfloat *)eqn
+    );
+
+exit:
+    if (eqn_base) {
+        _env->ReleasePrimitiveArrayCritical(eqn_ref, eqn_base,
+            _exception ? JNI_ABORT: 0);
+    }
+}
+
+/* void glGetClipPlanef ( GLenum pname, GLfloat *eqn ) */
+static void
+android_glGetClipPlanef__ILjava_nio_FloatBuffer_2
+  (JNIEnv *_env, jobject _this, jint pname, jobject eqn_buf) {
+    jint _exception = 0;
+    jarray _array = (jarray) 0;
+    jint _remaining;
+    GLfloat *eqn = (GLfloat *) 0;
+
+    eqn = (GLfloat *)getPointer(_env, eqn_buf, &_array, &_remaining);
+    glGetClipPlanef(
+        (GLenum)pname,
+        (GLfloat *)eqn
+    );
+    if (_array) {
+        releasePointer(_env, _array, eqn, _exception ? JNI_FALSE : JNI_TRUE);
+    }
+}
+
+/* void glGetClipPlanex ( GLenum pname, GLfixed *eqn ) */
+static void
+android_glGetClipPlanex__I_3II
+  (JNIEnv *_env, jobject _this, jint pname, jintArray eqn_ref, jint offset) {
+    jint _exception = 0;
+    GLfixed *eqn_base = (GLfixed *) 0;
+    jint _remaining;
+    GLfixed *eqn = (GLfixed *) 0;
+
+    if (!eqn_ref) {
+        _exception = 1;
+        _env->ThrowNew(IAEClass, "eqn == null");
+        goto exit;
+    }
+    if (offset < 0) {
+        _exception = 1;
+        _env->ThrowNew(IAEClass, "offset < 0");
+        goto exit;
+    }
+    _remaining = _env->GetArrayLength(eqn_ref) - offset;
+    eqn_base = (GLfixed *)
+        _env->GetPrimitiveArrayCritical(eqn_ref, (jboolean *)0);
+    eqn = eqn_base + offset;
+
+    glGetClipPlanex(
+        (GLenum)pname,
+        (GLfixed *)eqn
+    );
+
+exit:
+    if (eqn_base) {
+        _env->ReleasePrimitiveArrayCritical(eqn_ref, eqn_base,
+            _exception ? JNI_ABORT: 0);
+    }
+}
+
+/* void glGetClipPlanex ( GLenum pname, GLfixed *eqn ) */
+static void
+android_glGetClipPlanex__ILjava_nio_IntBuffer_2
+  (JNIEnv *_env, jobject _this, jint pname, jobject eqn_buf) {
+    jint _exception = 0;
+    jarray _array = (jarray) 0;
+    jint _remaining;
+    GLfixed *eqn = (GLfixed *) 0;
+
+    eqn = (GLfixed *)getPointer(_env, eqn_buf, &_array, &_remaining);
+    glGetClipPlanex(
+        (GLenum)pname,
+        (GLfixed *)eqn
+    );
+    if (_array) {
+        releasePointer(_env, _array, eqn, _exception ? JNI_FALSE : JNI_TRUE);
+    }
+}
+
+/* void glGetFixedv ( GLenum pname, GLfixed *params ) */
+static void
+android_glGetFixedv__I_3II
+  (JNIEnv *_env, jobject _this, jint pname, jintArray params_ref, jint offset) {
+    jint _exception = 0;
+    GLfixed *params_base = (GLfixed *) 0;
+    jint _remaining;
+    GLfixed *params = (GLfixed *) 0;
+
+    if (!params_ref) {
+        _exception = 1;
+        _env->ThrowNew(IAEClass, "params == null");
+        goto exit;
+    }
+    if (offset < 0) {
+        _exception = 1;
+        _env->ThrowNew(IAEClass, "offset < 0");
+        goto exit;
+    }
+    _remaining = _env->GetArrayLength(params_ref) - offset;
+    params_base = (GLfixed *)
+        _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
+    params = params_base + offset;
+
+    glGetFixedv(
+        (GLenum)pname,
+        (GLfixed *)params
+    );
+
+exit:
+    if (params_base) {
+        _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
+            _exception ? JNI_ABORT: 0);
+    }
+}
+
+/* void glGetFixedv ( GLenum pname, GLfixed *params ) */
+static void
+android_glGetFixedv__ILjava_nio_IntBuffer_2
+  (JNIEnv *_env, jobject _this, jint pname, jobject params_buf) {
+    jint _exception = 0;
+    jarray _array = (jarray) 0;
+    jint _remaining;
+    GLfixed *params = (GLfixed *) 0;
+
+    params = (GLfixed *)getPointer(_env, params_buf, &_array, &_remaining);
+    glGetFixedv(
+        (GLenum)pname,
+        (GLfixed *)params
+    );
+    if (_array) {
+        releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE);
+    }
+}
+
+/* void glGetFloatv ( GLenum pname, GLfloat *params ) */
+static void
+android_glGetFloatv__I_3FI
+  (JNIEnv *_env, jobject _this, jint pname, jfloatArray params_ref, jint offset) {
+    jint _exception = 0;
+    GLfloat *params_base = (GLfloat *) 0;
+    jint _remaining;
+    GLfloat *params = (GLfloat *) 0;
+
+    if (!params_ref) {
+        _exception = 1;
+        _env->ThrowNew(IAEClass, "params == null");
+        goto exit;
+    }
+    if (offset < 0) {
+        _exception = 1;
+        _env->ThrowNew(IAEClass, "offset < 0");
+        goto exit;
+    }
+    _remaining = _env->GetArrayLength(params_ref) - offset;
+    params_base = (GLfloat *)
+        _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
+    params = params_base + offset;
+
+    glGetFloatv(
+        (GLenum)pname,
+        (GLfloat *)params
+    );
+
+exit:
+    if (params_base) {
+        _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
+            _exception ? JNI_ABORT: 0);
+    }
+}
+
+/* void glGetFloatv ( GLenum pname, GLfloat *params ) */
+static void
+android_glGetFloatv__ILjava_nio_FloatBuffer_2
+  (JNIEnv *_env, jobject _this, jint pname, jobject params_buf) {
+    jint _exception = 0;
+    jarray _array = (jarray) 0;
+    jint _remaining;
+    GLfloat *params = (GLfloat *) 0;
+
+    params = (GLfloat *)getPointer(_env, params_buf, &_array, &_remaining);
+    glGetFloatv(
+        (GLenum)pname,
+        (GLfloat *)params
+    );
+    if (_array) {
+        releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE);
+    }
+}
+
+/* void glGetLightfv ( GLenum light, GLenum pname, GLfloat *params ) */
+static void
+android_glGetLightfv__II_3FI
+  (JNIEnv *_env, jobject _this, jint light, jint pname, jfloatArray params_ref, jint offset) {
+    jint _exception = 0;
+    GLfloat *params_base = (GLfloat *) 0;
+    jint _remaining;
+    GLfloat *params = (GLfloat *) 0;
+
+    if (!params_ref) {
+        _exception = 1;
+        _env->ThrowNew(IAEClass, "params == null");
+        goto exit;
+    }
+    if (offset < 0) {
+        _exception = 1;
+        _env->ThrowNew(IAEClass, "offset < 0");
+        goto exit;
+    }
+    _remaining = _env->GetArrayLength(params_ref) - offset;
+    int _needed;
+    switch (pname) {
+#if defined(GL_SPOT_EXPONENT)
+        case GL_SPOT_EXPONENT:
+#endif // defined(GL_SPOT_EXPONENT)
+#if defined(GL_SPOT_CUTOFF)
+        case GL_SPOT_CUTOFF:
+#endif // defined(GL_SPOT_CUTOFF)
+#if defined(GL_CONSTANT_ATTENUATION)
+        case GL_CONSTANT_ATTENUATION:
+#endif // defined(GL_CONSTANT_ATTENUATION)
+#if defined(GL_LINEAR_ATTENUATION)
+        case GL_LINEAR_ATTENUATION:
+#endif // defined(GL_LINEAR_ATTENUATION)
+#if defined(GL_QUADRATIC_ATTENUATION)
+        case GL_QUADRATIC_ATTENUATION:
+#endif // defined(GL_QUADRATIC_ATTENUATION)
+            _needed = 1;
+            break;
+#if defined(GL_SPOT_DIRECTION)
+        case GL_SPOT_DIRECTION:
+#endif // defined(GL_SPOT_DIRECTION)
+            _needed = 3;
+            break;
+#if defined(GL_AMBIENT)
+        case GL_AMBIENT:
+#endif // defined(GL_AMBIENT)
+#if defined(GL_DIFFUSE)
+        case GL_DIFFUSE:
+#endif // defined(GL_DIFFUSE)
+#if defined(GL_SPECULAR)
+        case GL_SPECULAR:
+#endif // defined(GL_SPECULAR)
+#if defined(GL_EMISSION)
+        case GL_EMISSION:
+#endif // defined(GL_EMISSION)
+            _needed = 4;
+            break;
+        default:
+            _needed = 0;
+            break;
+    }
+    if (_remaining < _needed) {
+        _exception = 1;
+        _env->ThrowNew(IAEClass, "length - offset < needed");
+        goto exit;
+    }
+    params_base = (GLfloat *)
+        _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
+    params = params_base + offset;
+
+    glGetLightfv(
+        (GLenum)light,
+        (GLenum)pname,
+        (GLfloat *)params
+    );
+
+exit:
+    if (params_base) {
+        _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
+            _exception ? JNI_ABORT: 0);
+    }
+}
+
+/* void glGetLightfv ( GLenum light, GLenum pname, GLfloat *params ) */
+static void
+android_glGetLightfv__IILjava_nio_FloatBuffer_2
+  (JNIEnv *_env, jobject _this, jint light, jint pname, jobject params_buf) {
+    jint _exception = 0;
+    jarray _array = (jarray) 0;
+    jint _remaining;
+    GLfloat *params = (GLfloat *) 0;
+
+    params = (GLfloat *)getPointer(_env, params_buf, &_array, &_remaining);
+    int _needed;
+    switch (pname) {
+#if defined(GL_SPOT_EXPONENT)
+        case GL_SPOT_EXPONENT:
+#endif // defined(GL_SPOT_EXPONENT)
+#if defined(GL_SPOT_CUTOFF)
+        case GL_SPOT_CUTOFF:
+#endif // defined(GL_SPOT_CUTOFF)
+#if defined(GL_CONSTANT_ATTENUATION)
+        case GL_CONSTANT_ATTENUATION:
+#endif // defined(GL_CONSTANT_ATTENUATION)
+#if defined(GL_LINEAR_ATTENUATION)
+        case GL_LINEAR_ATTENUATION:
+#endif // defined(GL_LINEAR_ATTENUATION)
+#if defined(GL_QUADRATIC_ATTENUATION)
+        case GL_QUADRATIC_ATTENUATION:
+#endif // defined(GL_QUADRATIC_ATTENUATION)
+            _needed = 1;
+            break;
+#if defined(GL_SPOT_DIRECTION)
+        case GL_SPOT_DIRECTION:
+#endif // defined(GL_SPOT_DIRECTION)
+            _needed = 3;
+            break;
+#if defined(GL_AMBIENT)
+        case GL_AMBIENT:
+#endif // defined(GL_AMBIENT)
+#if defined(GL_DIFFUSE)
+        case GL_DIFFUSE:
+#endif // defined(GL_DIFFUSE)
+#if defined(GL_SPECULAR)
+        case GL_SPECULAR:
+#endif // defined(GL_SPECULAR)
+#if defined(GL_EMISSION)
+        case GL_EMISSION:
+#endif // defined(GL_EMISSION)
+            _needed = 4;
+            break;
+        default:
+            _needed = 0;
+            break;
+    }
+    if (_remaining < _needed) {
+        _exception = 1;
+        _env->ThrowNew(IAEClass, "remaining() < needed");
+        goto exit;
+    }
+    glGetLightfv(
+        (GLenum)light,
+        (GLenum)pname,
+        (GLfloat *)params
+    );
+
+exit:
+    if (_array) {
+        releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE);
+    }
+}
+
+/* void glGetLightxv ( GLenum light, GLenum pname, GLfixed *params ) */
+static void
+android_glGetLightxv__II_3II
+  (JNIEnv *_env, jobject _this, jint light, jint pname, jintArray params_ref, jint offset) {
+    jint _exception = 0;
+    GLfixed *params_base = (GLfixed *) 0;
+    jint _remaining;
+    GLfixed *params = (GLfixed *) 0;
+
+    if (!params_ref) {
+        _exception = 1;
+        _env->ThrowNew(IAEClass, "params == null");
+        goto exit;
+    }
+    if (offset < 0) {
+        _exception = 1;
+        _env->ThrowNew(IAEClass, "offset < 0");
+        goto exit;
+    }
+    _remaining = _env->GetArrayLength(params_ref) - offset;
+    int _needed;
+    switch (pname) {
+#if defined(GL_SPOT_EXPONENT)
+        case GL_SPOT_EXPONENT:
+#endif // defined(GL_SPOT_EXPONENT)
+#if defined(GL_SPOT_CUTOFF)
+        case GL_SPOT_CUTOFF:
+#endif // defined(GL_SPOT_CUTOFF)
+#if defined(GL_CONSTANT_ATTENUATION)
+        case GL_CONSTANT_ATTENUATION:
+#endif // defined(GL_CONSTANT_ATTENUATION)
+#if defined(GL_LINEAR_ATTENUATION)
+        case GL_LINEAR_ATTENUATION:
+#endif // defined(GL_LINEAR_ATTENUATION)
+#if defined(GL_QUADRATIC_ATTENUATION)
+        case GL_QUADRATIC_ATTENUATION:
+#endif // defined(GL_QUADRATIC_ATTENUATION)
+            _needed = 1;
+            break;
+#if defined(GL_SPOT_DIRECTION)
+        case GL_SPOT_DIRECTION:
+#endif // defined(GL_SPOT_DIRECTION)
+            _needed = 3;
+            break;
+#if defined(GL_AMBIENT)
+        case GL_AMBIENT:
+#endif // defined(GL_AMBIENT)
+#if defined(GL_DIFFUSE)
+        case GL_DIFFUSE:
+#endif // defined(GL_DIFFUSE)
+#if defined(GL_SPECULAR)
+        case GL_SPECULAR:
+#endif // defined(GL_SPECULAR)
+#if defined(GL_EMISSION)
+        case GL_EMISSION:
+#endif // defined(GL_EMISSION)
+            _needed = 4;
+            break;
+        default:
+            _needed = 0;
+            break;
+    }
+    if (_remaining < _needed) {
+        _exception = 1;
+        _env->ThrowNew(IAEClass, "length - offset < needed");
+        goto exit;
+    }
+    params_base = (GLfixed *)
+        _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
+    params = params_base + offset;
+
+    glGetLightxv(
+        (GLenum)light,
+        (GLenum)pname,
+        (GLfixed *)params
+    );
+
+exit:
+    if (params_base) {
+        _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
+            _exception ? JNI_ABORT: 0);
+    }
+}
+
+/* void glGetLightxv ( GLenum light, GLenum pname, GLfixed *params ) */
+static void
+android_glGetLightxv__IILjava_nio_IntBuffer_2
+  (JNIEnv *_env, jobject _this, jint light, jint pname, jobject params_buf) {
+    jint _exception = 0;
+    jarray _array = (jarray) 0;
+    jint _remaining;
+    GLfixed *params = (GLfixed *) 0;
+
+    params = (GLfixed *)getPointer(_env, params_buf, &_array, &_remaining);
+    int _needed;
+    switch (pname) {
+#if defined(GL_SPOT_EXPONENT)
+        case GL_SPOT_EXPONENT:
+#endif // defined(GL_SPOT_EXPONENT)
+#if defined(GL_SPOT_CUTOFF)
+        case GL_SPOT_CUTOFF:
+#endif // defined(GL_SPOT_CUTOFF)
+#if defined(GL_CONSTANT_ATTENUATION)
+        case GL_CONSTANT_ATTENUATION:
+#endif // defined(GL_CONSTANT_ATTENUATION)
+#if defined(GL_LINEAR_ATTENUATION)
+        case GL_LINEAR_ATTENUATION:
+#endif // defined(GL_LINEAR_ATTENUATION)
+#if defined(GL_QUADRATIC_ATTENUATION)
+        case GL_QUADRATIC_ATTENUATION:
+#endif // defined(GL_QUADRATIC_ATTENUATION)
+            _needed = 1;
+            break;
+#if defined(GL_SPOT_DIRECTION)
+        case GL_SPOT_DIRECTION:
+#endif // defined(GL_SPOT_DIRECTION)
+            _needed = 3;
+            break;
+#if defined(GL_AMBIENT)
+        case GL_AMBIENT:
+#endif // defined(GL_AMBIENT)
+#if defined(GL_DIFFUSE)
+        case GL_DIFFUSE:
+#endif // defined(GL_DIFFUSE)
+#if defined(GL_SPECULAR)
+        case GL_SPECULAR:
+#endif // defined(GL_SPECULAR)
+#if defined(GL_EMISSION)
+        case GL_EMISSION:
+#endif // defined(GL_EMISSION)
+            _needed = 4;
+            break;
+        default:
+            _needed = 0;
+            break;
+    }
+    if (_remaining < _needed) {
+        _exception = 1;
+        _env->ThrowNew(IAEClass, "remaining() < needed");
+        goto exit;
+    }
+    glGetLightxv(
+        (GLenum)light,
+        (GLenum)pname,
+        (GLfixed *)params
+    );
+
+exit:
+    if (_array) {
+        releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE);
+    }
+}
+
+/* void glGetMaterialfv ( GLenum face, GLenum pname, GLfloat *params ) */
+static void
+android_glGetMaterialfv__II_3FI
+  (JNIEnv *_env, jobject _this, jint face, jint pname, jfloatArray params_ref, jint offset) {
+    jint _exception = 0;
+    GLfloat *params_base = (GLfloat *) 0;
+    jint _remaining;
+    GLfloat *params = (GLfloat *) 0;
+
+    if (!params_ref) {
+        _exception = 1;
+        _env->ThrowNew(IAEClass, "params == null");
+        goto exit;
+    }
+    if (offset < 0) {
+        _exception = 1;
+        _env->ThrowNew(IAEClass, "offset < 0");
+        goto exit;
+    }
+    _remaining = _env->GetArrayLength(params_ref) - offset;
+    int _needed;
+    switch (pname) {
+#if defined(GL_SHININESS)
+        case GL_SHININESS:
+#endif // defined(GL_SHININESS)
+            _needed = 1;
+            break;
+#if defined(GL_AMBIENT)
+        case GL_AMBIENT:
+#endif // defined(GL_AMBIENT)
+#if defined(GL_DIFFUSE)
+        case GL_DIFFUSE:
+#endif // defined(GL_DIFFUSE)
+#if defined(GL_SPECULAR)
+        case GL_SPECULAR:
+#endif // defined(GL_SPECULAR)
+#if defined(GL_EMISSION)
+        case GL_EMISSION:
+#endif // defined(GL_EMISSION)
+#if defined(GL_AMBIENT_AND_DIFFUSE)
+        case GL_AMBIENT_AND_DIFFUSE:
+#endif // defined(GL_AMBIENT_AND_DIFFUSE)
+            _needed = 4;
+            break;
+        default:
+            _needed = 0;
+            break;
+    }
+    if (_remaining < _needed) {
+        _exception = 1;
+        _env->ThrowNew(IAEClass, "length - offset < needed");
+        goto exit;
+    }
+    params_base = (GLfloat *)
+        _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
+    params = params_base + offset;
+
+    glGetMaterialfv(
+        (GLenum)face,
+        (GLenum)pname,
+        (GLfloat *)params
+    );
+
+exit:
+    if (params_base) {
+        _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
+            _exception ? JNI_ABORT: 0);
+    }
+}
+
+/* void glGetMaterialfv ( GLenum face, GLenum pname, GLfloat *params ) */
+static void
+android_glGetMaterialfv__IILjava_nio_FloatBuffer_2
+  (JNIEnv *_env, jobject _this, jint face, jint pname, jobject params_buf) {
+    jint _exception = 0;
+    jarray _array = (jarray) 0;
+    jint _remaining;
+    GLfloat *params = (GLfloat *) 0;
+
+    params = (GLfloat *)getPointer(_env, params_buf, &_array, &_remaining);
+    int _needed;
+    switch (pname) {
+#if defined(GL_SHININESS)
+        case GL_SHININESS:
+#endif // defined(GL_SHININESS)
+            _needed = 1;
+            break;
+#if defined(GL_AMBIENT)
+        case GL_AMBIENT:
+#endif // defined(GL_AMBIENT)
+#if defined(GL_DIFFUSE)
+        case GL_DIFFUSE:
+#endif // defined(GL_DIFFUSE)
+#if defined(GL_SPECULAR)
+        case GL_SPECULAR:
+#endif // defined(GL_SPECULAR)
+#if defined(GL_EMISSION)
+        case GL_EMISSION:
+#endif // defined(GL_EMISSION)
+#if defined(GL_AMBIENT_AND_DIFFUSE)
+        case GL_AMBIENT_AND_DIFFUSE:
+#endif // defined(GL_AMBIENT_AND_DIFFUSE)
+            _needed = 4;
+            break;
+        default:
+            _needed = 0;
+            break;
+    }
+    if (_remaining < _needed) {
+        _exception = 1;
+        _env->ThrowNew(IAEClass, "remaining() < needed");
+        goto exit;
+    }
+    glGetMaterialfv(
+        (GLenum)face,
+        (GLenum)pname,
+        (GLfloat *)params
+    );
+
+exit:
+    if (_array) {
+        releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE);
+    }
+}
+
+/* void glGetMaterialxv ( GLenum face, GLenum pname, GLfixed *params ) */
+static void
+android_glGetMaterialxv__II_3II
+  (JNIEnv *_env, jobject _this, jint face, jint pname, jintArray params_ref, jint offset) {
+    jint _exception = 0;
+    GLfixed *params_base = (GLfixed *) 0;
+    jint _remaining;
+    GLfixed *params = (GLfixed *) 0;
+
+    if (!params_ref) {
+        _exception = 1;
+        _env->ThrowNew(IAEClass, "params == null");
+        goto exit;
+    }
+    if (offset < 0) {
+        _exception = 1;
+        _env->ThrowNew(IAEClass, "offset < 0");
+        goto exit;
+    }
+    _remaining = _env->GetArrayLength(params_ref) - offset;
+    int _needed;
+    switch (pname) {
+#if defined(GL_SHININESS)
+        case GL_SHININESS:
+#endif // defined(GL_SHININESS)
+            _needed = 1;
+            break;
+#if defined(GL_AMBIENT)
+        case GL_AMBIENT:
+#endif // defined(GL_AMBIENT)
+#if defined(GL_DIFFUSE)
+        case GL_DIFFUSE:
+#endif // defined(GL_DIFFUSE)
+#if defined(GL_SPECULAR)
+        case GL_SPECULAR:
+#endif // defined(GL_SPECULAR)
+#if defined(GL_EMISSION)
+        case GL_EMISSION:
+#endif // defined(GL_EMISSION)
+#if defined(GL_AMBIENT_AND_DIFFUSE)
+        case GL_AMBIENT_AND_DIFFUSE:
+#endif // defined(GL_AMBIENT_AND_DIFFUSE)
+            _needed = 4;
+            break;
+        default:
+            _needed = 0;
+            break;
+    }
+    if (_remaining < _needed) {
+        _exception = 1;
+        _env->ThrowNew(IAEClass, "length - offset < needed");
+        goto exit;
+    }
+    params_base = (GLfixed *)
+        _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
+    params = params_base + offset;
+
+    glGetMaterialxv(
+        (GLenum)face,
+        (GLenum)pname,
+        (GLfixed *)params
+    );
+
+exit:
+    if (params_base) {
+        _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
+            _exception ? JNI_ABORT: 0);
+    }
+}
+
+/* void glGetMaterialxv ( GLenum face, GLenum pname, GLfixed *params ) */
+static void
+android_glGetMaterialxv__IILjava_nio_IntBuffer_2
+  (JNIEnv *_env, jobject _this, jint face, jint pname, jobject params_buf) {
+    jint _exception = 0;
+    jarray _array = (jarray) 0;
+    jint _remaining;
+    GLfixed *params = (GLfixed *) 0;
+
+    params = (GLfixed *)getPointer(_env, params_buf, &_array, &_remaining);
+    int _needed;
+    switch (pname) {
+#if defined(GL_SHININESS)
+        case GL_SHININESS:
+#endif // defined(GL_SHININESS)
+            _needed = 1;
+            break;
+#if defined(GL_AMBIENT)
+        case GL_AMBIENT:
+#endif // defined(GL_AMBIENT)
+#if defined(GL_DIFFUSE)
+        case GL_DIFFUSE:
+#endif // defined(GL_DIFFUSE)
+#if defined(GL_SPECULAR)
+        case GL_SPECULAR:
+#endif // defined(GL_SPECULAR)
+#if defined(GL_EMISSION)
+        case GL_EMISSION:
+#endif // defined(GL_EMISSION)
+#if defined(GL_AMBIENT_AND_DIFFUSE)
+        case GL_AMBIENT_AND_DIFFUSE:
+#endif // defined(GL_AMBIENT_AND_DIFFUSE)
+            _needed = 4;
+            break;
+        default:
+            _needed = 0;
+            break;
+    }
+    if (_remaining < _needed) {
+        _exception = 1;
+        _env->ThrowNew(IAEClass, "remaining() < needed");
+        goto exit;
+    }
+    glGetMaterialxv(
+        (GLenum)face,
+        (GLenum)pname,
+        (GLfixed *)params
+    );
+
+exit:
+    if (_array) {
+        releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE);
+    }
+}
+
+/* void glGetTexEnvfv ( GLenum env, GLenum pname, GLfloat *params ) */
+static void
+android_glGetTexEnvfv__II_3FI
+  (JNIEnv *_env, jobject _this, jint env, jint pname, jfloatArray params_ref, jint offset) {
+    jint _exception = 0;
+    GLfloat *params_base = (GLfloat *) 0;
+    jint _remaining;
+    GLfloat *params = (GLfloat *) 0;
+
+    if (!params_ref) {
+        _exception = 1;
+        _env->ThrowNew(IAEClass, "params == null");
+        goto exit;
+    }
+    if (offset < 0) {
+        _exception = 1;
+        _env->ThrowNew(IAEClass, "offset < 0");
+        goto exit;
+    }
+    _remaining = _env->GetArrayLength(params_ref) - offset;
+    int _needed;
+    switch (pname) {
+#if defined(GL_TEXTURE_ENV_MODE)
+        case GL_TEXTURE_ENV_MODE:
+#endif // defined(GL_TEXTURE_ENV_MODE)
+#if defined(GL_COMBINE_RGB)
+        case GL_COMBINE_RGB:
+#endif // defined(GL_COMBINE_RGB)
+#if defined(GL_COMBINE_ALPHA)
+        case GL_COMBINE_ALPHA:
+#endif // defined(GL_COMBINE_ALPHA)
+            _needed = 1;
+            break;
+#if defined(GL_TEXTURE_ENV_COLOR)
+        case GL_TEXTURE_ENV_COLOR:
+#endif // defined(GL_TEXTURE_ENV_COLOR)
+            _needed = 4;
+            break;
+        default:
+            _needed = 0;
+            break;
+    }
+    if (_remaining < _needed) {
+        _exception = 1;
+        _env->ThrowNew(IAEClass, "length - offset < needed");
+        goto exit;
+    }
+    params_base = (GLfloat *)
+        _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
+    params = params_base + offset;
+
+    glGetTexEnvfv(
+        (GLenum)env,
+        (GLenum)pname,
+        (GLfloat *)params
+    );
+
+exit:
+    if (params_base) {
+        _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
+            _exception ? JNI_ABORT: 0);
+    }
+}
+
+/* void glGetTexEnvfv ( GLenum env, GLenum pname, GLfloat *params ) */
+static void
+android_glGetTexEnvfv__IILjava_nio_FloatBuffer_2
+  (JNIEnv *_env, jobject _this, jint env, jint pname, jobject params_buf) {
+    jint _exception = 0;
+    jarray _array = (jarray) 0;
+    jint _remaining;
+    GLfloat *params = (GLfloat *) 0;
+
+    params = (GLfloat *)getPointer(_env, params_buf, &_array, &_remaining);
+    int _needed;
+    switch (pname) {
+#if defined(GL_TEXTURE_ENV_MODE)
+        case GL_TEXTURE_ENV_MODE:
+#endif // defined(GL_TEXTURE_ENV_MODE)
+#if defined(GL_COMBINE_RGB)
+        case GL_COMBINE_RGB:
+#endif // defined(GL_COMBINE_RGB)
+#if defined(GL_COMBINE_ALPHA)
+        case GL_COMBINE_ALPHA:
+#endif // defined(GL_COMBINE_ALPHA)
+            _needed = 1;
+            break;
+#if defined(GL_TEXTURE_ENV_COLOR)
+        case GL_TEXTURE_ENV_COLOR:
+#endif // defined(GL_TEXTURE_ENV_COLOR)
+            _needed = 4;
+            break;
+        default:
+            _needed = 0;
+            break;
+    }
+    if (_remaining < _needed) {
+        _exception = 1;
+        _env->ThrowNew(IAEClass, "remaining() < needed");
+        goto exit;
+    }
+    glGetTexEnvfv(
+        (GLenum)env,
+        (GLenum)pname,
+        (GLfloat *)params
+    );
+
+exit:
+    if (_array) {
+        releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE);
+    }
+}
+
+/* void glGetTexEnviv ( GLenum env, GLenum pname, GLint *params ) */
+static void
+android_glGetTexEnviv__II_3II
+  (JNIEnv *_env, jobject _this, jint env, jint pname, jintArray params_ref, jint offset) {
+    jint _exception = 0;
+    GLint *params_base = (GLint *) 0;
+    jint _remaining;
+    GLint *params = (GLint *) 0;
+
+    if (!params_ref) {
+        _exception = 1;
+        _env->ThrowNew(IAEClass, "params == null");
+        goto exit;
+    }
+    if (offset < 0) {
+        _exception = 1;
+        _env->ThrowNew(IAEClass, "offset < 0");
+        goto exit;
+    }
+    _remaining = _env->GetArrayLength(params_ref) - offset;
+    int _needed;
+    switch (pname) {
+#if defined(GL_TEXTURE_ENV_MODE)
+        case GL_TEXTURE_ENV_MODE:
+#endif // defined(GL_TEXTURE_ENV_MODE)
+#if defined(GL_COMBINE_RGB)
+        case GL_COMBINE_RGB:
+#endif // defined(GL_COMBINE_RGB)
+#if defined(GL_COMBINE_ALPHA)
+        case GL_COMBINE_ALPHA:
+#endif // defined(GL_COMBINE_ALPHA)
+            _needed = 1;
+            break;
+#if defined(GL_TEXTURE_ENV_COLOR)
+        case GL_TEXTURE_ENV_COLOR:
+#endif // defined(GL_TEXTURE_ENV_COLOR)
+            _needed = 4;
+            break;
+        default:
+            _needed = 0;
+            break;
+    }
+    if (_remaining < _needed) {
+        _exception = 1;
+        _env->ThrowNew(IAEClass, "length - offset < needed");
+        goto exit;
+    }
+    params_base = (GLint *)
+        _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
+    params = params_base + offset;
+
+    glGetTexEnviv(
+        (GLenum)env,
+        (GLenum)pname,
+        (GLint *)params
+    );
+
+exit:
+    if (params_base) {
+        _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
+            _exception ? JNI_ABORT: 0);
+    }
+}
+
+/* void glGetTexEnviv ( GLenum env, GLenum pname, GLint *params ) */
+static void
+android_glGetTexEnviv__IILjava_nio_IntBuffer_2
+  (JNIEnv *_env, jobject _this, jint env, jint pname, jobject params_buf) {
+    jint _exception = 0;
+    jarray _array = (jarray) 0;
+    jint _remaining;
+    GLint *params = (GLint *) 0;
+
+    params = (GLint *)getPointer(_env, params_buf, &_array, &_remaining);
+    int _needed;
+    switch (pname) {
+#if defined(GL_TEXTURE_ENV_MODE)
+        case GL_TEXTURE_ENV_MODE:
+#endif // defined(GL_TEXTURE_ENV_MODE)
+#if defined(GL_COMBINE_RGB)
+        case GL_COMBINE_RGB:
+#endif // defined(GL_COMBINE_RGB)
+#if defined(GL_COMBINE_ALPHA)
+        case GL_COMBINE_ALPHA:
+#endif // defined(GL_COMBINE_ALPHA)
+            _needed = 1;
+            break;
+#if defined(GL_TEXTURE_ENV_COLOR)
+        case GL_TEXTURE_ENV_COLOR:
+#endif // defined(GL_TEXTURE_ENV_COLOR)
+            _needed = 4;
+            break;
+        default:
+            _needed = 0;
+            break;
+    }
+    if (_remaining < _needed) {
+        _exception = 1;
+        _env->ThrowNew(IAEClass, "remaining() < needed");
+        goto exit;
+    }
+    glGetTexEnviv(
+        (GLenum)env,
+        (GLenum)pname,
+        (GLint *)params
+    );
+
+exit:
+    if (_array) {
+        releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE);
+    }
+}
+
+/* void glGetTexEnvxv ( GLenum env, GLenum pname, GLfixed *params ) */
+static void
+android_glGetTexEnvxv__II_3II
+  (JNIEnv *_env, jobject _this, jint env, jint pname, jintArray params_ref, jint offset) {
+    jint _exception = 0;
+    GLfixed *params_base = (GLfixed *) 0;
+    jint _remaining;
+    GLfixed *params = (GLfixed *) 0;
+
+    if (!params_ref) {
+        _exception = 1;
+        _env->ThrowNew(IAEClass, "params == null");
+        goto exit;
+    }
+    if (offset < 0) {
+        _exception = 1;
+        _env->ThrowNew(IAEClass, "offset < 0");
+        goto exit;
+    }
+    _remaining = _env->GetArrayLength(params_ref) - offset;
+    int _needed;
+    switch (pname) {
+#if defined(GL_TEXTURE_ENV_MODE)
+        case GL_TEXTURE_ENV_MODE:
+#endif // defined(GL_TEXTURE_ENV_MODE)
+#if defined(GL_COMBINE_RGB)
+        case GL_COMBINE_RGB:
+#endif // defined(GL_COMBINE_RGB)
+#if defined(GL_COMBINE_ALPHA)
+        case GL_COMBINE_ALPHA:
+#endif // defined(GL_COMBINE_ALPHA)
+            _needed = 1;
+            break;
+#if defined(GL_TEXTURE_ENV_COLOR)
+        case GL_TEXTURE_ENV_COLOR:
+#endif // defined(GL_TEXTURE_ENV_COLOR)
+            _needed = 4;
+            break;
+        default:
+            _needed = 0;
+            break;
+    }
+    if (_remaining < _needed) {
+        _exception = 1;
+        _env->ThrowNew(IAEClass, "length - offset < needed");
+        goto exit;
+    }
+    params_base = (GLfixed *)
+        _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
+    params = params_base + offset;
+
+    glGetTexEnvxv(
+        (GLenum)env,
+        (GLenum)pname,
+        (GLfixed *)params
+    );
+
+exit:
+    if (params_base) {
+        _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
+            _exception ? JNI_ABORT: 0);
+    }
+}
+
+/* void glGetTexEnvxv ( GLenum env, GLenum pname, GLfixed *params ) */
+static void
+android_glGetTexEnvxv__IILjava_nio_IntBuffer_2
+  (JNIEnv *_env, jobject _this, jint env, jint pname, jobject params_buf) {
+    jint _exception = 0;
+    jarray _array = (jarray) 0;
+    jint _remaining;
+    GLfixed *params = (GLfixed *) 0;
+
+    params = (GLfixed *)getPointer(_env, params_buf, &_array, &_remaining);
+    int _needed;
+    switch (pname) {
+#if defined(GL_TEXTURE_ENV_MODE)
+        case GL_TEXTURE_ENV_MODE:
+#endif // defined(GL_TEXTURE_ENV_MODE)
+#if defined(GL_COMBINE_RGB)
+        case GL_COMBINE_RGB:
+#endif // defined(GL_COMBINE_RGB)
+#if defined(GL_COMBINE_ALPHA)
+        case GL_COMBINE_ALPHA:
+#endif // defined(GL_COMBINE_ALPHA)
+            _needed = 1;
+            break;
+#if defined(GL_TEXTURE_ENV_COLOR)
+        case GL_TEXTURE_ENV_COLOR:
+#endif // defined(GL_TEXTURE_ENV_COLOR)
+            _needed = 4;
+            break;
+        default:
+            _needed = 0;
+            break;
+    }
+    if (_remaining < _needed) {
+        _exception = 1;
+        _env->ThrowNew(IAEClass, "remaining() < needed");
+        goto exit;
+    }
+    glGetTexEnvxv(
+        (GLenum)env,
+        (GLenum)pname,
+        (GLfixed *)params
+    );
+
+exit:
+    if (_array) {
+        releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE);
+    }
+}
+
+/* void glGetTexParameterfv ( GLenum target, GLenum pname, GLfloat *params ) */
+static void
+android_glGetTexParameterfv__II_3FI
+  (JNIEnv *_env, jobject _this, jint target, jint pname, jfloatArray params_ref, jint offset) {
+    jint _exception = 0;
+    GLfloat *params_base = (GLfloat *) 0;
+    jint _remaining;
+    GLfloat *params = (GLfloat *) 0;
+
+    if (!params_ref) {
+        _exception = 1;
+        _env->ThrowNew(IAEClass, "params == null");
+        goto exit;
+    }
+    if (offset < 0) {
+        _exception = 1;
+        _env->ThrowNew(IAEClass, "offset < 0");
+        goto exit;
+    }
+    _remaining = _env->GetArrayLength(params_ref) - offset;
+    if (_remaining < 1) {
+        _exception = 1;
+        _env->ThrowNew(IAEClass, "length - offset < 1");
+        goto exit;
+    }
+    params_base = (GLfloat *)
+        _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
+    params = params_base + offset;
+
+    glGetTexParameterfv(
+        (GLenum)target,
+        (GLenum)pname,
+        (GLfloat *)params
+    );
+
+exit:
+    if (params_base) {
+        _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
+            _exception ? JNI_ABORT: 0);
+    }
+}
+
+/* void glGetTexParameterfv ( GLenum target, GLenum pname, GLfloat *params ) */
+static void
+android_glGetTexParameterfv__IILjava_nio_FloatBuffer_2
+  (JNIEnv *_env, jobject _this, jint target, jint pname, jobject params_buf) {
+    jint _exception = 0;
+    jarray _array = (jarray) 0;
+    jint _remaining;
+    GLfloat *params = (GLfloat *) 0;
+
+    params = (GLfloat *)getPointer(_env, params_buf, &_array, &_remaining);
+    if (_remaining < 1) {
+        _exception = 1;
+        _env->ThrowNew(IAEClass, "remaining() < 1");
+        goto exit;
+    }
+    glGetTexParameterfv(
+        (GLenum)target,
+        (GLenum)pname,
+        (GLfloat *)params
+    );
+
+exit:
+    if (_array) {
+        releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE);
+    }
+}
+
+/* void glGetTexParameteriv ( GLenum target, GLenum pname, GLint *params ) */
+static void
+android_glGetTexParameteriv__II_3II
+  (JNIEnv *_env, jobject _this, jint target, jint pname, jintArray params_ref, jint offset) {
+    jint _exception = 0;
+    GLint *params_base = (GLint *) 0;
+    jint _remaining;
+    GLint *params = (GLint *) 0;
+
+    if (!params_ref) {
+        _exception = 1;
+        _env->ThrowNew(IAEClass, "params == null");
+        goto exit;
+    }
+    if (offset < 0) {
+        _exception = 1;
+        _env->ThrowNew(IAEClass, "offset < 0");
+        goto exit;
+    }
+    _remaining = _env->GetArrayLength(params_ref) - offset;
+    if (_remaining < 1) {
+        _exception = 1;
+        _env->ThrowNew(IAEClass, "length - offset < 1");
+        goto exit;
+    }
+    params_base = (GLint *)
+        _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
+    params = params_base + offset;
+
+    glGetTexParameteriv(
+        (GLenum)target,
+        (GLenum)pname,
+        (GLint *)params
+    );
+
+exit:
+    if (params_base) {
+        _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
+            _exception ? JNI_ABORT: 0);
+    }
+}
+
+/* void glGetTexParameteriv ( GLenum target, GLenum pname, GLint *params ) */
+static void
+android_glGetTexParameteriv__IILjava_nio_IntBuffer_2
+  (JNIEnv *_env, jobject _this, jint target, jint pname, jobject params_buf) {
+    jint _exception = 0;
+    jarray _array = (jarray) 0;
+    jint _remaining;
+    GLint *params = (GLint *) 0;
+
+    params = (GLint *)getPointer(_env, params_buf, &_array, &_remaining);
+    if (_remaining < 1) {
+        _exception = 1;
+        _env->ThrowNew(IAEClass, "remaining() < 1");
+        goto exit;
+    }
+    glGetTexParameteriv(
+        (GLenum)target,
+        (GLenum)pname,
+        (GLint *)params
+    );
+
+exit:
+    if (_array) {
+        releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE);
+    }
+}
+
+/* void glGetTexParameterxv ( GLenum target, GLenum pname, GLfixed *params ) */
+static void
+android_glGetTexParameterxv__II_3II
+  (JNIEnv *_env, jobject _this, jint target, jint pname, jintArray params_ref, jint offset) {
+    jint _exception = 0;
+    GLfixed *params_base = (GLfixed *) 0;
+    jint _remaining;
+    GLfixed *params = (GLfixed *) 0;
+
+    if (!params_ref) {
+        _exception = 1;
+        _env->ThrowNew(IAEClass, "params == null");
+        goto exit;
+    }
+    if (offset < 0) {
+        _exception = 1;
+        _env->ThrowNew(IAEClass, "offset < 0");
+        goto exit;
+    }
+    _remaining = _env->GetArrayLength(params_ref) - offset;
+    if (_remaining < 1) {
+        _exception = 1;
+        _env->ThrowNew(IAEClass, "length - offset < 1");
+        goto exit;
+    }
+    params_base = (GLfixed *)
+        _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
+    params = params_base + offset;
+
+    glGetTexParameterxv(
+        (GLenum)target,
+        (GLenum)pname,
+        (GLfixed *)params
+    );
+
+exit:
+    if (params_base) {
+        _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
+            _exception ? JNI_ABORT: 0);
+    }
+}
+
+/* void glGetTexParameterxv ( GLenum target, GLenum pname, GLfixed *params ) */
+static void
+android_glGetTexParameterxv__IILjava_nio_IntBuffer_2
+  (JNIEnv *_env, jobject _this, jint target, jint pname, jobject params_buf) {
+    jint _exception = 0;
+    jarray _array = (jarray) 0;
+    jint _remaining;
+    GLfixed *params = (GLfixed *) 0;
+
+    params = (GLfixed *)getPointer(_env, params_buf, &_array, &_remaining);
+    if (_remaining < 1) {
+        _exception = 1;
+        _env->ThrowNew(IAEClass, "remaining() < 1");
+        goto exit;
+    }
+    glGetTexParameterxv(
+        (GLenum)target,
+        (GLenum)pname,
+        (GLfixed *)params
+    );
+
+exit:
+    if (_array) {
+        releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE);
+    }
+}
+
+/* GLboolean glIsBuffer ( GLuint buffer ) */
+static jboolean
+android_glIsBuffer__I
+  (JNIEnv *_env, jobject _this, jint buffer) {
+    GLboolean _returnValue;
+    _returnValue = glIsBuffer(
+        (GLuint)buffer
+    );
+    return _returnValue;
+}
+
+/* GLboolean glIsEnabled ( GLenum cap ) */
+static jboolean
+android_glIsEnabled__I
+  (JNIEnv *_env, jobject _this, jint cap) {
+    GLboolean _returnValue;
+    _returnValue = glIsEnabled(
+        (GLenum)cap
+    );
+    return _returnValue;
+}
+
+/* GLboolean glIsTexture ( GLuint texture ) */
+static jboolean
+android_glIsTexture__I
+  (JNIEnv *_env, jobject _this, jint texture) {
+    GLboolean _returnValue;
+    _returnValue = glIsTexture(
+        (GLuint)texture
+    );
+    return _returnValue;
+}
+
+/* void glNormalPointer ( GLenum type, GLsizei stride, GLint offset ) */
+static void
+android_glNormalPointer__III
+  (JNIEnv *_env, jobject _this, jint type, jint stride, jint offset) {
+    glNormalPointer(
+        (GLenum)type,
+        (GLsizei)stride,
+        (const GLvoid *)offset
+    );
+}
+
+/* void glPointParameterf ( GLenum pname, GLfloat param ) */
+static void
+android_glPointParameterf__IF
+  (JNIEnv *_env, jobject _this, jint pname, jfloat param) {
+    glPointParameterf(
+        (GLenum)pname,
+        (GLfloat)param
+    );
+}
+
+/* void glPointParameterfv ( GLenum pname, const GLfloat *params ) */
+static void
+android_glPointParameterfv__I_3FI
+  (JNIEnv *_env, jobject _this, jint pname, jfloatArray params_ref, jint offset) {
+    GLfloat *params_base = (GLfloat *) 0;
+    jint _remaining;
+    GLfloat *params = (GLfloat *) 0;
+
+    if (!params_ref) {
+        _env->ThrowNew(IAEClass, "params == null");
+        goto exit;
+    }
+    if (offset < 0) {
+        _env->ThrowNew(IAEClass, "offset < 0");
+        goto exit;
+    }
+    _remaining = _env->GetArrayLength(params_ref) - offset;
+    if (_remaining < 1) {
+        _env->ThrowNew(IAEClass, "length - offset < 1");
+        goto exit;
+    }
+    params_base = (GLfloat *)
+        _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
+    params = params_base + offset;
+
+    glPointParameterfv(
+        (GLenum)pname,
+        (GLfloat *)params
+    );
+
+exit:
+    if (params_base) {
+        _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
+            JNI_ABORT);
+    }
+}
+
+/* void glPointParameterfv ( GLenum pname, const GLfloat *params ) */
+static void
+android_glPointParameterfv__ILjava_nio_FloatBuffer_2
+  (JNIEnv *_env, jobject _this, jint pname, jobject params_buf) {
+    jarray _array = (jarray) 0;
+    jint _remaining;
+    GLfloat *params = (GLfloat *) 0;
+
+    params = (GLfloat *)getPointer(_env, params_buf, &_array, &_remaining);
+    if (_remaining < 1) {
+        _env->ThrowNew(IAEClass, "remaining() < 1");
+        goto exit;
+    }
+    glPointParameterfv(
+        (GLenum)pname,
+        (GLfloat *)params
+    );
+
+exit:
+    if (_array) {
+        releasePointer(_env, _array, params, JNI_FALSE);
+    }
+}
+
+/* void glPointParameterx ( GLenum pname, GLfixed param ) */
+static void
+android_glPointParameterx__II
+  (JNIEnv *_env, jobject _this, jint pname, jint param) {
+    glPointParameterx(
+        (GLenum)pname,
+        (GLfixed)param
+    );
+}
+
+/* void glPointParameterxv ( GLenum pname, const GLfixed *params ) */
+static void
+android_glPointParameterxv__I_3II
+  (JNIEnv *_env, jobject _this, jint pname, jintArray params_ref, jint offset) {
+    GLfixed *params_base = (GLfixed *) 0;
+    jint _remaining;
+    GLfixed *params = (GLfixed *) 0;
+
+    if (!params_ref) {
+        _env->ThrowNew(IAEClass, "params == null");
+        goto exit;
+    }
+    if (offset < 0) {
+        _env->ThrowNew(IAEClass, "offset < 0");
+        goto exit;
+    }
+    _remaining = _env->GetArrayLength(params_ref) - offset;
+    if (_remaining < 1) {
+        _env->ThrowNew(IAEClass, "length - offset < 1");
+        goto exit;
+    }
+    params_base = (GLfixed *)
+        _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
+    params = params_base + offset;
+
+    glPointParameterxv(
+        (GLenum)pname,
+        (GLfixed *)params
+    );
+
+exit:
+    if (params_base) {
+        _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
+            JNI_ABORT);
+    }
+}
+
+/* void glPointParameterxv ( GLenum pname, const GLfixed *params ) */
+static void
+android_glPointParameterxv__ILjava_nio_IntBuffer_2
+  (JNIEnv *_env, jobject _this, jint pname, jobject params_buf) {
+    jarray _array = (jarray) 0;
+    jint _remaining;
+    GLfixed *params = (GLfixed *) 0;
+
+    params = (GLfixed *)getPointer(_env, params_buf, &_array, &_remaining);
+    if (_remaining < 1) {
+        _env->ThrowNew(IAEClass, "remaining() < 1");
+        goto exit;
+    }
+    glPointParameterxv(
+        (GLenum)pname,
+        (GLfixed *)params
+    );
+
+exit:
+    if (_array) {
+        releasePointer(_env, _array, params, JNI_FALSE);
+    }
+}
+
+/* void glPointSizePointerOES ( GLenum type, GLsizei stride, const GLvoid *pointer ) */
+static void
+android_glPointSizePointerOES__IILjava_nio_Buffer_2
+  (JNIEnv *_env, jobject _this, jint type, jint stride, jobject pointer_buf) {
+    jarray _array = (jarray) 0;
+    jint _remaining;
+    GLvoid *pointer = (GLvoid *) 0;
+
+    pointer = (GLvoid *)getPointer(_env, pointer_buf, &_array, &_remaining);
+    glPointSizePointerOES(
+        (GLenum)type,
+        (GLsizei)stride,
+        (GLvoid *)pointer
+    );
+    if (_array) {
+        releasePointer(_env, _array, pointer, JNI_FALSE);
+    }
+}
+
+/* void glTexCoordPointer ( GLint size, GLenum type, GLsizei stride, GLint offset ) */
+static void
+android_glTexCoordPointer__IIII
+  (JNIEnv *_env, jobject _this, jint size, jint type, jint stride, jint offset) {
+    glTexCoordPointer(
+        (GLint)size,
+        (GLenum)type,
+        (GLsizei)stride,
+        (const GLvoid *)offset
+    );
+}
+
+/* void glTexEnvi ( GLenum target, GLenum pname, GLint param ) */
+static void
+android_glTexEnvi__III
+  (JNIEnv *_env, jobject _this, jint target, jint pname, jint param) {
+    glTexEnvi(
+        (GLenum)target,
+        (GLenum)pname,
+        (GLint)param
+    );
+}
+
+/* void glTexEnviv ( GLenum target, GLenum pname, const GLint *params ) */
+static void
+android_glTexEnviv__II_3II
+  (JNIEnv *_env, jobject _this, jint target, jint pname, jintArray params_ref, jint offset) {
+    GLint *params_base = (GLint *) 0;
+    jint _remaining;
+    GLint *params = (GLint *) 0;
+
+    if (!params_ref) {
+        _env->ThrowNew(IAEClass, "params == null");
+        goto exit;
+    }
+    if (offset < 0) {
+        _env->ThrowNew(IAEClass, "offset < 0");
+        goto exit;
+    }
+    _remaining = _env->GetArrayLength(params_ref) - offset;
+    int _needed;
+    switch (pname) {
+#if defined(GL_TEXTURE_ENV_MODE)
+        case GL_TEXTURE_ENV_MODE:
+#endif // defined(GL_TEXTURE_ENV_MODE)
+#if defined(GL_COMBINE_RGB)
+        case GL_COMBINE_RGB:
+#endif // defined(GL_COMBINE_RGB)
+#if defined(GL_COMBINE_ALPHA)
+        case GL_COMBINE_ALPHA:
+#endif // defined(GL_COMBINE_ALPHA)
+            _needed = 1;
+            break;
+#if defined(GL_TEXTURE_ENV_COLOR)
+        case GL_TEXTURE_ENV_COLOR:
+#endif // defined(GL_TEXTURE_ENV_COLOR)
+            _needed = 4;
+            break;
+        default:
+            _needed = 0;
+            break;
+    }
+    if (_remaining < _needed) {
+        _env->ThrowNew(IAEClass, "length - offset < needed");
+        goto exit;
+    }
+    params_base = (GLint *)
+        _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
+    params = params_base + offset;
+
+    glTexEnviv(
+        (GLenum)target,
+        (GLenum)pname,
+        (GLint *)params
+    );
+
+exit:
+    if (params_base) {
+        _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
+            JNI_ABORT);
+    }
+}
+
+/* void glTexEnviv ( GLenum target, GLenum pname, const GLint *params ) */
+static void
+android_glTexEnviv__IILjava_nio_IntBuffer_2
+  (JNIEnv *_env, jobject _this, jint target, jint pname, jobject params_buf) {
+    jarray _array = (jarray) 0;
+    jint _remaining;
+    GLint *params = (GLint *) 0;
+
+    params = (GLint *)getPointer(_env, params_buf, &_array, &_remaining);
+    int _needed;
+    switch (pname) {
+#if defined(GL_TEXTURE_ENV_MODE)
+        case GL_TEXTURE_ENV_MODE:
+#endif // defined(GL_TEXTURE_ENV_MODE)
+#if defined(GL_COMBINE_RGB)
+        case GL_COMBINE_RGB:
+#endif // defined(GL_COMBINE_RGB)
+#if defined(GL_COMBINE_ALPHA)
+        case GL_COMBINE_ALPHA:
+#endif // defined(GL_COMBINE_ALPHA)
+            _needed = 1;
+            break;
+#if defined(GL_TEXTURE_ENV_COLOR)
+        case GL_TEXTURE_ENV_COLOR:
+#endif // defined(GL_TEXTURE_ENV_COLOR)
+            _needed = 4;
+            break;
+        default:
+            _needed = 0;
+            break;
+    }
+    if (_remaining < _needed) {
+        _env->ThrowNew(IAEClass, "remaining() < needed");
+        goto exit;
+    }
+    glTexEnviv(
+        (GLenum)target,
+        (GLenum)pname,
+        (GLint *)params
+    );
+
+exit:
+    if (_array) {
+        releasePointer(_env, _array, params, JNI_FALSE);
+    }
+}
+
+/* void glTexParameterfv ( GLenum target, GLenum pname, const GLfloat *params ) */
+static void
+android_glTexParameterfv__II_3FI
+  (JNIEnv *_env, jobject _this, jint target, jint pname, jfloatArray params_ref, jint offset) {
+    GLfloat *params_base = (GLfloat *) 0;
+    jint _remaining;
+    GLfloat *params = (GLfloat *) 0;
+
+    if (!params_ref) {
+        _env->ThrowNew(IAEClass, "params == null");
+        goto exit;
+    }
+    if (offset < 0) {
+        _env->ThrowNew(IAEClass, "offset < 0");
+        goto exit;
+    }
+    _remaining = _env->GetArrayLength(params_ref) - offset;
+    if (_remaining < 1) {
+        _env->ThrowNew(IAEClass, "length - offset < 1");
+        goto exit;
+    }
+    params_base = (GLfloat *)
+        _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
+    params = params_base + offset;
+
+    glTexParameterfv(
+        (GLenum)target,
+        (GLenum)pname,
+        (GLfloat *)params
+    );
+
+exit:
+    if (params_base) {
+        _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
+            JNI_ABORT);
+    }
+}
+
+/* void glTexParameterfv ( GLenum target, GLenum pname, const GLfloat *params ) */
+static void
+android_glTexParameterfv__IILjava_nio_FloatBuffer_2
+  (JNIEnv *_env, jobject _this, jint target, jint pname, jobject params_buf) {
+    jarray _array = (jarray) 0;
+    jint _remaining;
+    GLfloat *params = (GLfloat *) 0;
+
+    params = (GLfloat *)getPointer(_env, params_buf, &_array, &_remaining);
+    if (_remaining < 1) {
+        _env->ThrowNew(IAEClass, "remaining() < 1");
+        goto exit;
+    }
+    glTexParameterfv(
+        (GLenum)target,
+        (GLenum)pname,
+        (GLfloat *)params
+    );
+
+exit:
+    if (_array) {
+        releasePointer(_env, _array, params, JNI_FALSE);
+    }
+}
+
+/* void glTexParameteri ( GLenum target, GLenum pname, GLint param ) */
+static void
+android_glTexParameteri__III
+  (JNIEnv *_env, jobject _this, jint target, jint pname, jint param) {
+    glTexParameteri(
+        (GLenum)target,
+        (GLenum)pname,
+        (GLint)param
+    );
+}
+
+/* void glTexParameteriv ( GLenum target, GLenum pname, const GLint *params ) */
+static void
+android_glTexParameteriv__II_3II
+  (JNIEnv *_env, jobject _this, jint target, jint pname, jintArray params_ref, jint offset) {
+    GLint *params_base = (GLint *) 0;
+    jint _remaining;
+    GLint *params = (GLint *) 0;
+
+    if (!params_ref) {
+        _env->ThrowNew(IAEClass, "params == null");
+        goto exit;
+    }
+    if (offset < 0) {
+        _env->ThrowNew(IAEClass, "offset < 0");
+        goto exit;
+    }
+    _remaining = _env->GetArrayLength(params_ref) - offset;
+    if (_remaining < 1) {
+        _env->ThrowNew(IAEClass, "length - offset < 1");
+        goto exit;
+    }
+    params_base = (GLint *)
+        _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
+    params = params_base + offset;
+
+    glTexParameteriv(
+        (GLenum)target,
+        (GLenum)pname,
+        (GLint *)params
+    );
+
+exit:
+    if (params_base) {
+        _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
+            JNI_ABORT);
+    }
+}
+
+/* void glTexParameteriv ( GLenum target, GLenum pname, const GLint *params ) */
+static void
+android_glTexParameteriv__IILjava_nio_IntBuffer_2
+  (JNIEnv *_env, jobject _this, jint target, jint pname, jobject params_buf) {
+    jarray _array = (jarray) 0;
+    jint _remaining;
+    GLint *params = (GLint *) 0;
+
+    params = (GLint *)getPointer(_env, params_buf, &_array, &_remaining);
+    if (_remaining < 1) {
+        _env->ThrowNew(IAEClass, "remaining() < 1");
+        goto exit;
+    }
+    glTexParameteriv(
+        (GLenum)target,
+        (GLenum)pname,
+        (GLint *)params
+    );
+
+exit:
+    if (_array) {
+        releasePointer(_env, _array, params, JNI_FALSE);
+    }
+}
+
+/* void glTexParameterxv ( GLenum target, GLenum pname, const GLfixed *params ) */
+static void
+android_glTexParameterxv__II_3II
+  (JNIEnv *_env, jobject _this, jint target, jint pname, jintArray params_ref, jint offset) {
+    GLfixed *params_base = (GLfixed *) 0;
+    jint _remaining;
+    GLfixed *params = (GLfixed *) 0;
+
+    if (!params_ref) {
+        _env->ThrowNew(IAEClass, "params == null");
+        goto exit;
+    }
+    if (offset < 0) {
+        _env->ThrowNew(IAEClass, "offset < 0");
+        goto exit;
+    }
+    _remaining = _env->GetArrayLength(params_ref) - offset;
+    if (_remaining < 1) {
+        _env->ThrowNew(IAEClass, "length - offset < 1");
+        goto exit;
+    }
+    params_base = (GLfixed *)
+        _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
+    params = params_base + offset;
+
+    glTexParameterxv(
+        (GLenum)target,
+        (GLenum)pname,
+        (GLfixed *)params
+    );
+
+exit:
+    if (params_base) {
+        _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
+            JNI_ABORT);
+    }
+}
+
+/* void glTexParameterxv ( GLenum target, GLenum pname, const GLfixed *params ) */
+static void
+android_glTexParameterxv__IILjava_nio_IntBuffer_2
+  (JNIEnv *_env, jobject _this, jint target, jint pname, jobject params_buf) {
+    jarray _array = (jarray) 0;
+    jint _remaining;
+    GLfixed *params = (GLfixed *) 0;
+
+    params = (GLfixed *)getPointer(_env, params_buf, &_array, &_remaining);
+    if (_remaining < 1) {
+        _env->ThrowNew(IAEClass, "remaining() < 1");
+        goto exit;
+    }
+    glTexParameterxv(
+        (GLenum)target,
+        (GLenum)pname,
+        (GLfixed *)params
+    );
+
+exit:
+    if (_array) {
+        releasePointer(_env, _array, params, JNI_FALSE);
+    }
+}
+
+/* void glVertexPointer ( GLint size, GLenum type, GLsizei stride, GLint offset ) */
+static void
+android_glVertexPointer__IIII
+  (JNIEnv *_env, jobject _this, jint size, jint type, jint stride, jint offset) {
+    glVertexPointer(
+        (GLint)size,
+        (GLenum)type,
+        (GLsizei)stride,
+        (const GLvoid *)offset
+    );
+}
+
+static const char *classPathName = "android/opengl/GLES11";
+
+static JNINativeMethod methods[] = {
+{"_nativeClassInit", "()V", (void*)nativeClassInit },
+{"glBindBuffer", "(II)V", (void *) android_glBindBuffer__II },
+{"glBufferData", "(IILjava/nio/Buffer;I)V", (void *) android_glBufferData__IILjava_nio_Buffer_2I },
+{"glBufferSubData", "(IIILjava/nio/Buffer;)V", (void *) android_glBufferSubData__IIILjava_nio_Buffer_2 },
+{"glClipPlanef", "(I[FI)V", (void *) android_glClipPlanef__I_3FI },
+{"glClipPlanef", "(ILjava/nio/FloatBuffer;)V", (void *) android_glClipPlanef__ILjava_nio_FloatBuffer_2 },
+{"glClipPlanex", "(I[II)V", (void *) android_glClipPlanex__I_3II },
+{"glClipPlanex", "(ILjava/nio/IntBuffer;)V", (void *) android_glClipPlanex__ILjava_nio_IntBuffer_2 },
+{"glColor4ub", "(BBBB)V", (void *) android_glColor4ub__BBBB },
+{"glColorPointer", "(IIII)V", (void *) android_glColorPointer__IIII },
+{"glDeleteBuffers", "(I[II)V", (void *) android_glDeleteBuffers__I_3II },
+{"glDeleteBuffers", "(ILjava/nio/IntBuffer;)V", (void *) android_glDeleteBuffers__ILjava_nio_IntBuffer_2 },
+{"glDrawElements", "(IIII)V", (void *) android_glDrawElements__IIII },
+{"glGenBuffers", "(I[II)V", (void *) android_glGenBuffers__I_3II },
+{"glGenBuffers", "(ILjava/nio/IntBuffer;)V", (void *) android_glGenBuffers__ILjava_nio_IntBuffer_2 },
+{"glGetBooleanv", "(I[ZI)V", (void *) android_glGetBooleanv__I_3ZI },
+{"glGetBooleanv", "(ILjava/nio/IntBuffer;)V", (void *) android_glGetBooleanv__ILjava_nio_IntBuffer_2 },
+{"glGetBufferParameteriv", "(II[II)V", (void *) android_glGetBufferParameteriv__II_3II },
+{"glGetBufferParameteriv", "(IILjava/nio/IntBuffer;)V", (void *) android_glGetBufferParameteriv__IILjava_nio_IntBuffer_2 },
+{"glGetClipPlanef", "(I[FI)V", (void *) android_glGetClipPlanef__I_3FI },
+{"glGetClipPlanef", "(ILjava/nio/FloatBuffer;)V", (void *) android_glGetClipPlanef__ILjava_nio_FloatBuffer_2 },
+{"glGetClipPlanex", "(I[II)V", (void *) android_glGetClipPlanex__I_3II },
+{"glGetClipPlanex", "(ILjava/nio/IntBuffer;)V", (void *) android_glGetClipPlanex__ILjava_nio_IntBuffer_2 },
+{"glGetFixedv", "(I[II)V", (void *) android_glGetFixedv__I_3II },
+{"glGetFixedv", "(ILjava/nio/IntBuffer;)V", (void *) android_glGetFixedv__ILjava_nio_IntBuffer_2 },
+{"glGetFloatv", "(I[FI)V", (void *) android_glGetFloatv__I_3FI },
+{"glGetFloatv", "(ILjava/nio/FloatBuffer;)V", (void *) android_glGetFloatv__ILjava_nio_FloatBuffer_2 },
+{"glGetLightfv", "(II[FI)V", (void *) android_glGetLightfv__II_3FI },
+{"glGetLightfv", "(IILjava/nio/FloatBuffer;)V", (void *) android_glGetLightfv__IILjava_nio_FloatBuffer_2 },
+{"glGetLightxv", "(II[II)V", (void *) android_glGetLightxv__II_3II },
+{"glGetLightxv", "(IILjava/nio/IntBuffer;)V", (void *) android_glGetLightxv__IILjava_nio_IntBuffer_2 },
+{"glGetMaterialfv", "(II[FI)V", (void *) android_glGetMaterialfv__II_3FI },
+{"glGetMaterialfv", "(IILjava/nio/FloatBuffer;)V", (void *) android_glGetMaterialfv__IILjava_nio_FloatBuffer_2 },
+{"glGetMaterialxv", "(II[II)V", (void *) android_glGetMaterialxv__II_3II },
+{"glGetMaterialxv", "(IILjava/nio/IntBuffer;)V", (void *) android_glGetMaterialxv__IILjava_nio_IntBuffer_2 },
+{"glGetTexEnvfv", "(II[FI)V", (void *) android_glGetTexEnvfv__II_3FI },
+{"glGetTexEnvfv", "(IILjava/nio/FloatBuffer;)V", (void *) android_glGetTexEnvfv__IILjava_nio_FloatBuffer_2 },
+{"glGetTexEnviv", "(II[II)V", (void *) android_glGetTexEnviv__II_3II },
+{"glGetTexEnviv", "(IILjava/nio/IntBuffer;)V", (void *) android_glGetTexEnviv__IILjava_nio_IntBuffer_2 },
+{"glGetTexEnvxv", "(II[II)V", (void *) android_glGetTexEnvxv__II_3II },
+{"glGetTexEnvxv", "(IILjava/nio/IntBuffer;)V", (void *) android_glGetTexEnvxv__IILjava_nio_IntBuffer_2 },
+{"glGetTexParameterfv", "(II[FI)V", (void *) android_glGetTexParameterfv__II_3FI },
+{"glGetTexParameterfv", "(IILjava/nio/FloatBuffer;)V", (void *) android_glGetTexParameterfv__IILjava_nio_FloatBuffer_2 },
+{"glGetTexParameteriv", "(II[II)V", (void *) android_glGetTexParameteriv__II_3II },
+{"glGetTexParameteriv", "(IILjava/nio/IntBuffer;)V", (void *) android_glGetTexParameteriv__IILjava_nio_IntBuffer_2 },
+{"glGetTexParameterxv", "(II[II)V", (void *) android_glGetTexParameterxv__II_3II },
+{"glGetTexParameterxv", "(IILjava/nio/IntBuffer;)V", (void *) android_glGetTexParameterxv__IILjava_nio_IntBuffer_2 },
+{"glIsBuffer", "(I)Z", (void *) android_glIsBuffer__I },
+{"glIsEnabled", "(I)Z", (void *) android_glIsEnabled__I },
+{"glIsTexture", "(I)Z", (void *) android_glIsTexture__I },
+{"glNormalPointer", "(III)V", (void *) android_glNormalPointer__III },
+{"glPointParameterf", "(IF)V", (void *) android_glPointParameterf__IF },
+{"glPointParameterfv", "(I[FI)V", (void *) android_glPointParameterfv__I_3FI },
+{"glPointParameterfv", "(ILjava/nio/FloatBuffer;)V", (void *) android_glPointParameterfv__ILjava_nio_FloatBuffer_2 },
+{"glPointParameterx", "(II)V", (void *) android_glPointParameterx__II },
+{"glPointParameterxv", "(I[II)V", (void *) android_glPointParameterxv__I_3II },
+{"glPointParameterxv", "(ILjava/nio/IntBuffer;)V", (void *) android_glPointParameterxv__ILjava_nio_IntBuffer_2 },
+{"glPointSizePointerOES", "(IILjava/nio/Buffer;)V", (void *) android_glPointSizePointerOES__IILjava_nio_Buffer_2 },
+{"glTexCoordPointer", "(IIII)V", (void *) android_glTexCoordPointer__IIII },
+{"glTexEnvi", "(III)V", (void *) android_glTexEnvi__III },
+{"glTexEnviv", "(II[II)V", (void *) android_glTexEnviv__II_3II },
+{"glTexEnviv", "(IILjava/nio/IntBuffer;)V", (void *) android_glTexEnviv__IILjava_nio_IntBuffer_2 },
+{"glTexParameterfv", "(II[FI)V", (void *) android_glTexParameterfv__II_3FI },
+{"glTexParameterfv", "(IILjava/nio/FloatBuffer;)V", (void *) android_glTexParameterfv__IILjava_nio_FloatBuffer_2 },
+{"glTexParameteri", "(III)V", (void *) android_glTexParameteri__III },
+{"glTexParameteriv", "(II[II)V", (void *) android_glTexParameteriv__II_3II },
+{"glTexParameteriv", "(IILjava/nio/IntBuffer;)V", (void *) android_glTexParameteriv__IILjava_nio_IntBuffer_2 },
+{"glTexParameterxv", "(II[II)V", (void *) android_glTexParameterxv__II_3II },
+{"glTexParameterxv", "(IILjava/nio/IntBuffer;)V", (void *) android_glTexParameterxv__IILjava_nio_IntBuffer_2 },
+{"glVertexPointer", "(IIII)V", (void *) android_glVertexPointer__IIII },
+};
+
+int register_android_opengl_jni_GLES11(JNIEnv *_env)
+{
+    int err;
+    err = android::AndroidRuntime::registerNativeMethods(_env, classPathName, methods, NELEM(methods));
+    return err;
+}
diff --git a/core/jni/android_opengl_GLES11Ext.cpp b/core/jni/android_opengl_GLES11Ext.cpp
new file mode 100644
index 0000000..069cec1
--- /dev/null
+++ b/core/jni/android_opengl_GLES11Ext.cpp
@@ -0,0 +1,2465 @@
+/*
+**
+** Copyright 2009, The Android Open Source Project
+**
+** Licensed under the Apache License, Version 2.0 (the "License"); 
+** you may not use this file except in compliance with the License. 
+** You may obtain a copy of the License at 
+**
+**     http://www.apache.org/licenses/LICENSE-2.0 
+**
+** Unless required by applicable law or agreed to in writing, software 
+** distributed under the License is distributed on an "AS IS" BASIS, 
+** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+** See the License for the specific language governing permissions and 
+** limitations under the License.
+*/
+
+// This source file is automatically generated
+
+#include <android_runtime/AndroidRuntime.h>
+#include <utils/misc.h>
+
+#include <assert.h>
+#include <GLES/gl.h>
+
+#include <private/opengles/gl_context.h>
+
+#define _NUM_COMPRESSED_TEXTURE_FORMATS \
+        (::android::OGLES_NUM_COMPRESSED_TEXTURE_FORMATS)
+
+static int initialized = 0;
+
+static jclass nioAccessClass;
+static jclass bufferClass;
+static jclass OOMEClass;
+static jclass UOEClass;
+static jclass IAEClass;
+static jclass AIOOBEClass;
+static jmethodID getBasePointerID;
+static jmethodID getBaseArrayID;
+static jmethodID getBaseArrayOffsetID;
+static jfieldID positionID;
+static jfieldID limitID;
+static jfieldID elementSizeShiftID;
+
+/* Cache method IDs each time the class is loaded. */
+
+static void
+nativeClassInitBuffer(JNIEnv *_env)
+{
+    jclass nioAccessClassLocal = _env->FindClass("java/nio/NIOAccess");
+    nioAccessClass = (jclass) _env->NewGlobalRef(nioAccessClassLocal);
+
+    jclass bufferClassLocal = _env->FindClass("java/nio/Buffer");
+    bufferClass = (jclass) _env->NewGlobalRef(bufferClassLocal);
+
+    getBasePointerID = _env->GetStaticMethodID(nioAccessClass,
+            "getBasePointer", "(Ljava/nio/Buffer;)J");
+    getBaseArrayID = _env->GetStaticMethodID(nioAccessClass,
+            "getBaseArray", "(Ljava/nio/Buffer;)Ljava/lang/Object;");
+    getBaseArrayOffsetID = _env->GetStaticMethodID(nioAccessClass,
+            "getBaseArrayOffset", "(Ljava/nio/Buffer;)I");
+
+    positionID = _env->GetFieldID(bufferClass, "position", "I");
+    limitID = _env->GetFieldID(bufferClass, "limit", "I");
+    elementSizeShiftID =
+        _env->GetFieldID(bufferClass, "_elementSizeShift", "I");
+}
+
+
+static void
+nativeClassInit(JNIEnv *_env, jclass glImplClass)
+{
+    nativeClassInitBuffer(_env);
+
+    jclass IAEClassLocal =
+        _env->FindClass("java/lang/IllegalArgumentException");
+    jclass OOMEClassLocal =
+         _env->FindClass("java/lang/OutOfMemoryError");
+    jclass UOEClassLocal =
+         _env->FindClass("java/lang/UnsupportedOperationException");
+    jclass AIOOBEClassLocal =
+         _env->FindClass("java/lang/ArrayIndexOutOfBoundsException");
+
+    IAEClass = (jclass) _env->NewGlobalRef(IAEClassLocal);
+    OOMEClass = (jclass) _env->NewGlobalRef(OOMEClassLocal);
+    UOEClass = (jclass) _env->NewGlobalRef(UOEClassLocal);
+    AIOOBEClass = (jclass) _env->NewGlobalRef(AIOOBEClassLocal);
+}
+
+static void *
+getPointer(JNIEnv *_env, jobject buffer, jarray *array, jint *remaining)
+{
+    jint position;
+    jint limit;
+    jint elementSizeShift;
+    jlong pointer;
+    jint offset;
+    void *data;
+
+    position = _env->GetIntField(buffer, positionID);
+    limit = _env->GetIntField(buffer, limitID);
+    elementSizeShift = _env->GetIntField(buffer, elementSizeShiftID);
+    *remaining = (limit - position) << elementSizeShift;
+    pointer = _env->CallStaticLongMethod(nioAccessClass,
+            getBasePointerID, buffer);
+    if (pointer != 0L) {
+        *array = NULL;
+        return (void *) (jint) pointer;
+    }
+    
+    *array = (jarray) _env->CallStaticObjectMethod(nioAccessClass,
+            getBaseArrayID, buffer);
+    offset = _env->CallStaticIntMethod(nioAccessClass,
+            getBaseArrayOffsetID, buffer);
+    data = _env->GetPrimitiveArrayCritical(*array, (jboolean *) 0);
+    
+    return (void *) ((char *) data + offset);
+}
+
+
+static void
+releasePointer(JNIEnv *_env, jarray array, void *data, jboolean commit)
+{
+    _env->ReleasePrimitiveArrayCritical(array, data,
+					   commit ? 0 : JNI_ABORT);
+}
+
+// --------------------------------------------------------------------------
+
+/* void glBlendEquationSeparateOES ( GLenum modeRGB, GLenum modeAlpha ) */
+static void
+android_glBlendEquationSeparateOES__II
+  (JNIEnv *_env, jobject _this, jint modeRGB, jint modeAlpha) {
+    glBlendEquationSeparateOES(
+        (GLenum)modeRGB,
+        (GLenum)modeAlpha
+    );
+}
+
+/* void glBlendFuncSeparateOES ( GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha ) */
+static void
+android_glBlendFuncSeparateOES__IIII
+  (JNIEnv *_env, jobject _this, jint srcRGB, jint dstRGB, jint srcAlpha, jint dstAlpha) {
+    glBlendFuncSeparateOES(
+        (GLenum)srcRGB,
+        (GLenum)dstRGB,
+        (GLenum)srcAlpha,
+        (GLenum)dstAlpha
+    );
+}
+
+/* void glBlendEquationOES ( GLenum mode ) */
+static void
+android_glBlendEquationOES__I
+  (JNIEnv *_env, jobject _this, jint mode) {
+    glBlendEquationOES(
+        (GLenum)mode
+    );
+}
+
+/* void glDrawTexsOES ( GLshort x, GLshort y, GLshort z, GLshort width, GLshort height ) */
+static void
+android_glDrawTexsOES__SSSSS
+  (JNIEnv *_env, jobject _this, jshort x, jshort y, jshort z, jshort width, jshort height) {
+    glDrawTexsOES(
+        (GLshort)x,
+        (GLshort)y,
+        (GLshort)z,
+        (GLshort)width,
+        (GLshort)height
+    );
+}
+
+/* void glDrawTexiOES ( GLint x, GLint y, GLint z, GLint width, GLint height ) */
+static void
+android_glDrawTexiOES__IIIII
+  (JNIEnv *_env, jobject _this, jint x, jint y, jint z, jint width, jint height) {
+    glDrawTexiOES(
+        (GLint)x,
+        (GLint)y,
+        (GLint)z,
+        (GLint)width,
+        (GLint)height
+    );
+}
+
+/* void glDrawTexxOES ( GLfixed x, GLfixed y, GLfixed z, GLfixed width, GLfixed height ) */
+static void
+android_glDrawTexxOES__IIIII
+  (JNIEnv *_env, jobject _this, jint x, jint y, jint z, jint width, jint height) {
+    glDrawTexxOES(
+        (GLfixed)x,
+        (GLfixed)y,
+        (GLfixed)z,
+        (GLfixed)width,
+        (GLfixed)height
+    );
+}
+
+/* void glDrawTexsvOES ( const GLshort *coords ) */
+static void
+android_glDrawTexsvOES___3SI
+  (JNIEnv *_env, jobject _this, jshortArray coords_ref, jint offset) {
+    GLshort *coords_base = (GLshort *) 0;
+    jint _remaining;
+    GLshort *coords = (GLshort *) 0;
+
+    if (!coords_ref) {
+        _env->ThrowNew(IAEClass, "coords == null");
+        goto exit;
+    }
+    if (offset < 0) {
+        _env->ThrowNew(IAEClass, "offset < 0");
+        goto exit;
+    }
+    _remaining = _env->GetArrayLength(coords_ref) - offset;
+    if (_remaining < 5) {
+        _env->ThrowNew(IAEClass, "length - offset < 5");
+        goto exit;
+    }
+    coords_base = (GLshort *)
+        _env->GetPrimitiveArrayCritical(coords_ref, (jboolean *)0);
+    coords = coords_base + offset;
+
+    glDrawTexsvOES(
+        (GLshort *)coords
+    );
+
+exit:
+    if (coords_base) {
+        _env->ReleasePrimitiveArrayCritical(coords_ref, coords_base,
+            JNI_ABORT);
+    }
+}
+
+/* void glDrawTexsvOES ( const GLshort *coords ) */
+static void
+android_glDrawTexsvOES__Ljava_nio_ShortBuffer_2
+  (JNIEnv *_env, jobject _this, jobject coords_buf) {
+    jarray _array = (jarray) 0;
+    jint _remaining;
+    GLshort *coords = (GLshort *) 0;
+
+    coords = (GLshort *)getPointer(_env, coords_buf, &_array, &_remaining);
+    if (_remaining < 5) {
+        _env->ThrowNew(IAEClass, "remaining() < 5");
+        goto exit;
+    }
+    glDrawTexsvOES(
+        (GLshort *)coords
+    );
+
+exit:
+    if (_array) {
+        releasePointer(_env, _array, coords, JNI_FALSE);
+    }
+}
+
+/* void glDrawTexivOES ( const GLint *coords ) */
+static void
+android_glDrawTexivOES___3II
+  (JNIEnv *_env, jobject _this, jintArray coords_ref, jint offset) {
+    GLint *coords_base = (GLint *) 0;
+    jint _remaining;
+    GLint *coords = (GLint *) 0;
+
+    if (!coords_ref) {
+        _env->ThrowNew(IAEClass, "coords == null");
+        goto exit;
+    }
+    if (offset < 0) {
+        _env->ThrowNew(IAEClass, "offset < 0");
+        goto exit;
+    }
+    _remaining = _env->GetArrayLength(coords_ref) - offset;
+    if (_remaining < 5) {
+        _env->ThrowNew(IAEClass, "length - offset < 5");
+        goto exit;
+    }
+    coords_base = (GLint *)
+        _env->GetPrimitiveArrayCritical(coords_ref, (jboolean *)0);
+    coords = coords_base + offset;
+
+    glDrawTexivOES(
+        (GLint *)coords
+    );
+
+exit:
+    if (coords_base) {
+        _env->ReleasePrimitiveArrayCritical(coords_ref, coords_base,
+            JNI_ABORT);
+    }
+}
+
+/* void glDrawTexivOES ( const GLint *coords ) */
+static void
+android_glDrawTexivOES__Ljava_nio_IntBuffer_2
+  (JNIEnv *_env, jobject _this, jobject coords_buf) {
+    jarray _array = (jarray) 0;
+    jint _remaining;
+    GLint *coords = (GLint *) 0;
+
+    coords = (GLint *)getPointer(_env, coords_buf, &_array, &_remaining);
+    if (_remaining < 5) {
+        _env->ThrowNew(IAEClass, "remaining() < 5");
+        goto exit;
+    }
+    glDrawTexivOES(
+        (GLint *)coords
+    );
+
+exit:
+    if (_array) {
+        releasePointer(_env, _array, coords, JNI_FALSE);
+    }
+}
+
+/* void glDrawTexxvOES ( const GLfixed *coords ) */
+static void
+android_glDrawTexxvOES___3II
+  (JNIEnv *_env, jobject _this, jintArray coords_ref, jint offset) {
+    GLfixed *coords_base = (GLfixed *) 0;
+    jint _remaining;
+    GLfixed *coords = (GLfixed *) 0;
+
+    if (!coords_ref) {
+        _env->ThrowNew(IAEClass, "coords == null");
+        goto exit;
+    }
+    if (offset < 0) {
+        _env->ThrowNew(IAEClass, "offset < 0");
+        goto exit;
+    }
+    _remaining = _env->GetArrayLength(coords_ref) - offset;
+    if (_remaining < 5) {
+        _env->ThrowNew(IAEClass, "length - offset < 5");
+        goto exit;
+    }
+    coords_base = (GLfixed *)
+        _env->GetPrimitiveArrayCritical(coords_ref, (jboolean *)0);
+    coords = coords_base + offset;
+
+    glDrawTexxvOES(
+        (GLfixed *)coords
+    );
+
+exit:
+    if (coords_base) {
+        _env->ReleasePrimitiveArrayCritical(coords_ref, coords_base,
+            JNI_ABORT);
+    }
+}
+
+/* void glDrawTexxvOES ( const GLfixed *coords ) */
+static void
+android_glDrawTexxvOES__Ljava_nio_IntBuffer_2
+  (JNIEnv *_env, jobject _this, jobject coords_buf) {
+    jarray _array = (jarray) 0;
+    jint _remaining;
+    GLfixed *coords = (GLfixed *) 0;
+
+    coords = (GLfixed *)getPointer(_env, coords_buf, &_array, &_remaining);
+    if (_remaining < 5) {
+        _env->ThrowNew(IAEClass, "remaining() < 5");
+        goto exit;
+    }
+    glDrawTexxvOES(
+        (GLfixed *)coords
+    );
+
+exit:
+    if (_array) {
+        releasePointer(_env, _array, coords, JNI_FALSE);
+    }
+}
+
+/* void glDrawTexfOES ( GLfloat x, GLfloat y, GLfloat z, GLfloat width, GLfloat height ) */
+static void
+android_glDrawTexfOES__FFFFF
+  (JNIEnv *_env, jobject _this, jfloat x, jfloat y, jfloat z, jfloat width, jfloat height) {
+    glDrawTexfOES(
+        (GLfloat)x,
+        (GLfloat)y,
+        (GLfloat)z,
+        (GLfloat)width,
+        (GLfloat)height
+    );
+}
+
+/* void glDrawTexfvOES ( const GLfloat *coords ) */
+static void
+android_glDrawTexfvOES___3FI
+  (JNIEnv *_env, jobject _this, jfloatArray coords_ref, jint offset) {
+    GLfloat *coords_base = (GLfloat *) 0;
+    jint _remaining;
+    GLfloat *coords = (GLfloat *) 0;
+
+    if (!coords_ref) {
+        _env->ThrowNew(IAEClass, "coords == null");
+        goto exit;
+    }
+    if (offset < 0) {
+        _env->ThrowNew(IAEClass, "offset < 0");
+        goto exit;
+    }
+    _remaining = _env->GetArrayLength(coords_ref) - offset;
+    if (_remaining < 5) {
+        _env->ThrowNew(IAEClass, "length - offset < 5");
+        goto exit;
+    }
+    coords_base = (GLfloat *)
+        _env->GetPrimitiveArrayCritical(coords_ref, (jboolean *)0);
+    coords = coords_base + offset;
+
+    glDrawTexfvOES(
+        (GLfloat *)coords
+    );
+
+exit:
+    if (coords_base) {
+        _env->ReleasePrimitiveArrayCritical(coords_ref, coords_base,
+            JNI_ABORT);
+    }
+}
+
+/* void glDrawTexfvOES ( const GLfloat *coords ) */
+static void
+android_glDrawTexfvOES__Ljava_nio_FloatBuffer_2
+  (JNIEnv *_env, jobject _this, jobject coords_buf) {
+    jarray _array = (jarray) 0;
+    jint _remaining;
+    GLfloat *coords = (GLfloat *) 0;
+
+    coords = (GLfloat *)getPointer(_env, coords_buf, &_array, &_remaining);
+    if (_remaining < 5) {
+        _env->ThrowNew(IAEClass, "remaining() < 5");
+        goto exit;
+    }
+    glDrawTexfvOES(
+        (GLfloat *)coords
+    );
+
+exit:
+    if (_array) {
+        releasePointer(_env, _array, coords, JNI_FALSE);
+    }
+}
+
+/* void glEGLImageTargetTexture2DOES ( GLenum target, GLeglImageOES image ) */
+static void
+android_glEGLImageTargetTexture2DOES__ILjava_nio_Buffer_2
+  (JNIEnv *_env, jobject _this, jint target, jobject image_buf) {
+    jint _exception = 0;
+    jarray _array = (jarray) 0;
+    jint _remaining;
+    GLeglImageOES image = (GLeglImageOES) 0;
+
+    image = (GLeglImageOES)getPointer(_env, image_buf, &_array, &_remaining);
+    glEGLImageTargetTexture2DOES(
+        (GLenum)target,
+        (GLeglImageOES)image
+    );
+    if (_array) {
+        releasePointer(_env, _array, image, _exception ? JNI_FALSE : JNI_TRUE);
+    }
+}
+
+/* void glEGLImageTargetRenderbufferStorageOES ( GLenum target, GLeglImageOES image ) */
+static void
+android_glEGLImageTargetRenderbufferStorageOES__ILjava_nio_Buffer_2
+  (JNIEnv *_env, jobject _this, jint target, jobject image_buf) {
+    jint _exception = 0;
+    jarray _array = (jarray) 0;
+    jint _remaining;
+    GLeglImageOES image = (GLeglImageOES) 0;
+
+    image = (GLeglImageOES)getPointer(_env, image_buf, &_array, &_remaining);
+    glEGLImageTargetRenderbufferStorageOES(
+        (GLenum)target,
+        (GLeglImageOES)image
+    );
+    if (_array) {
+        releasePointer(_env, _array, image, _exception ? JNI_FALSE : JNI_TRUE);
+    }
+}
+
+/* void glAlphaFuncxOES ( GLenum func, GLclampx ref ) */
+static void
+android_glAlphaFuncxOES__II
+  (JNIEnv *_env, jobject _this, jint func, jint ref) {
+    glAlphaFuncxOES(
+        (GLenum)func,
+        (GLclampx)ref
+    );
+}
+
+/* void glClearColorxOES ( GLclampx red, GLclampx green, GLclampx blue, GLclampx alpha ) */
+static void
+android_glClearColorxOES__IIII
+  (JNIEnv *_env, jobject _this, jint red, jint green, jint blue, jint alpha) {
+    glClearColorxOES(
+        (GLclampx)red,
+        (GLclampx)green,
+        (GLclampx)blue,
+        (GLclampx)alpha
+    );
+}
+
+/* void glClearDepthxOES ( GLclampx depth ) */
+static void
+android_glClearDepthxOES__I
+  (JNIEnv *_env, jobject _this, jint depth) {
+    glClearDepthxOES(
+        (GLclampx)depth
+    );
+}
+
+/* void glClipPlanexOES ( GLenum plane, const GLfixed *equation ) */
+static void
+android_glClipPlanexOES__I_3II
+  (JNIEnv *_env, jobject _this, jint plane, jintArray equation_ref, jint offset) {
+    GLfixed *equation_base = (GLfixed *) 0;
+    jint _remaining;
+    GLfixed *equation = (GLfixed *) 0;
+
+    if (!equation_ref) {
+        _env->ThrowNew(IAEClass, "equation == null");
+        goto exit;
+    }
+    if (offset < 0) {
+        _env->ThrowNew(IAEClass, "offset < 0");
+        goto exit;
+    }
+    _remaining = _env->GetArrayLength(equation_ref) - offset;
+    equation_base = (GLfixed *)
+        _env->GetPrimitiveArrayCritical(equation_ref, (jboolean *)0);
+    equation = equation_base + offset;
+
+    glClipPlanexOES(
+        (GLenum)plane,
+        (GLfixed *)equation
+    );
+
+exit:
+    if (equation_base) {
+        _env->ReleasePrimitiveArrayCritical(equation_ref, equation_base,
+            JNI_ABORT);
+    }
+}
+
+/* void glClipPlanexOES ( GLenum plane, const GLfixed *equation ) */
+static void
+android_glClipPlanexOES__ILjava_nio_IntBuffer_2
+  (JNIEnv *_env, jobject _this, jint plane, jobject equation_buf) {
+    jarray _array = (jarray) 0;
+    jint _remaining;
+    GLfixed *equation = (GLfixed *) 0;
+
+    equation = (GLfixed *)getPointer(_env, equation_buf, &_array, &_remaining);
+    glClipPlanexOES(
+        (GLenum)plane,
+        (GLfixed *)equation
+    );
+    if (_array) {
+        releasePointer(_env, _array, equation, JNI_FALSE);
+    }
+}
+
+/* void glColor4xOES ( GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha ) */
+static void
+android_glColor4xOES__IIII
+  (JNIEnv *_env, jobject _this, jint red, jint green, jint blue, jint alpha) {
+    glColor4xOES(
+        (GLfixed)red,
+        (GLfixed)green,
+        (GLfixed)blue,
+        (GLfixed)alpha
+    );
+}
+
+/* void glDepthRangexOES ( GLclampx zNear, GLclampx zFar ) */
+static void
+android_glDepthRangexOES__II
+  (JNIEnv *_env, jobject _this, jint zNear, jint zFar) {
+    glDepthRangexOES(
+        (GLclampx)zNear,
+        (GLclampx)zFar
+    );
+}
+
+/* void glFogxOES ( GLenum pname, GLfixed param ) */
+static void
+android_glFogxOES__II
+  (JNIEnv *_env, jobject _this, jint pname, jint param) {
+    glFogxOES(
+        (GLenum)pname,
+        (GLfixed)param
+    );
+}
+
+/* void glFogxvOES ( GLenum pname, const GLfixed *params ) */
+static void
+android_glFogxvOES__I_3II
+  (JNIEnv *_env, jobject _this, jint pname, jintArray params_ref, jint offset) {
+    GLfixed *params_base = (GLfixed *) 0;
+    jint _remaining;
+    GLfixed *params = (GLfixed *) 0;
+
+    if (!params_ref) {
+        _env->ThrowNew(IAEClass, "params == null");
+        goto exit;
+    }
+    if (offset < 0) {
+        _env->ThrowNew(IAEClass, "offset < 0");
+        goto exit;
+    }
+    _remaining = _env->GetArrayLength(params_ref) - offset;
+    params_base = (GLfixed *)
+        _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
+    params = params_base + offset;
+
+    glFogxvOES(
+        (GLenum)pname,
+        (GLfixed *)params
+    );
+
+exit:
+    if (params_base) {
+        _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
+            JNI_ABORT);
+    }
+}
+
+/* void glFogxvOES ( GLenum pname, const GLfixed *params ) */
+static void
+android_glFogxvOES__ILjava_nio_IntBuffer_2
+  (JNIEnv *_env, jobject _this, jint pname, jobject params_buf) {
+    jarray _array = (jarray) 0;
+    jint _remaining;
+    GLfixed *params = (GLfixed *) 0;
+
+    params = (GLfixed *)getPointer(_env, params_buf, &_array, &_remaining);
+    glFogxvOES(
+        (GLenum)pname,
+        (GLfixed *)params
+    );
+    if (_array) {
+        releasePointer(_env, _array, params, JNI_FALSE);
+    }
+}
+
+/* void glFrustumxOES ( GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar ) */
+static void
+android_glFrustumxOES__IIIIII
+  (JNIEnv *_env, jobject _this, jint left, jint right, jint bottom, jint top, jint zNear, jint zFar) {
+    glFrustumxOES(
+        (GLfixed)left,
+        (GLfixed)right,
+        (GLfixed)bottom,
+        (GLfixed)top,
+        (GLfixed)zNear,
+        (GLfixed)zFar
+    );
+}
+
+/* void glGetClipPlanexOES ( GLenum pname, GLfixed *eqn ) */
+static void
+android_glGetClipPlanexOES__I_3II
+  (JNIEnv *_env, jobject _this, jint pname, jintArray eqn_ref, jint offset) {
+    jint _exception = 0;
+    GLfixed *eqn_base = (GLfixed *) 0;
+    jint _remaining;
+    GLfixed *eqn = (GLfixed *) 0;
+
+    if (!eqn_ref) {
+        _exception = 1;
+        _env->ThrowNew(IAEClass, "eqn == null");
+        goto exit;
+    }
+    if (offset < 0) {
+        _exception = 1;
+        _env->ThrowNew(IAEClass, "offset < 0");
+        goto exit;
+    }
+    _remaining = _env->GetArrayLength(eqn_ref) - offset;
+    if (_remaining < 4) {
+        _exception = 1;
+        _env->ThrowNew(IAEClass, "length - offset < 4");
+        goto exit;
+    }
+    eqn_base = (GLfixed *)
+        _env->GetPrimitiveArrayCritical(eqn_ref, (jboolean *)0);
+    eqn = eqn_base + offset;
+
+    glGetClipPlanexOES(
+        (GLenum)pname,
+        (GLfixed *)eqn
+    );
+
+exit:
+    if (eqn_base) {
+        _env->ReleasePrimitiveArrayCritical(eqn_ref, eqn_base,
+            _exception ? JNI_ABORT: 0);
+    }
+}
+
+/* void glGetClipPlanexOES ( GLenum pname, GLfixed *eqn ) */
+static void
+android_glGetClipPlanexOES__ILjava_nio_IntBuffer_2
+  (JNIEnv *_env, jobject _this, jint pname, jobject eqn_buf) {
+    jint _exception = 0;
+    jarray _array = (jarray) 0;
+    jint _remaining;
+    GLfixed *eqn = (GLfixed *) 0;
+
+    eqn = (GLfixed *)getPointer(_env, eqn_buf, &_array, &_remaining);
+    if (_remaining < 4) {
+        _exception = 1;
+        _env->ThrowNew(IAEClass, "remaining() < 4");
+        goto exit;
+    }
+    glGetClipPlanexOES(
+        (GLenum)pname,
+        (GLfixed *)eqn
+    );
+
+exit:
+    if (_array) {
+        releasePointer(_env, _array, eqn, _exception ? JNI_FALSE : JNI_TRUE);
+    }
+}
+
+/* void glGetFixedvOES ( GLenum pname, GLfixed *params ) */
+static void
+android_glGetFixedvOES__I_3II
+  (JNIEnv *_env, jobject _this, jint pname, jintArray params_ref, jint offset) {
+    jint _exception = 0;
+    GLfixed *params_base = (GLfixed *) 0;
+    jint _remaining;
+    GLfixed *params = (GLfixed *) 0;
+
+    if (!params_ref) {
+        _exception = 1;
+        _env->ThrowNew(IAEClass, "params == null");
+        goto exit;
+    }
+    if (offset < 0) {
+        _exception = 1;
+        _env->ThrowNew(IAEClass, "offset < 0");
+        goto exit;
+    }
+    _remaining = _env->GetArrayLength(params_ref) - offset;
+    params_base = (GLfixed *)
+        _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
+    params = params_base + offset;
+
+    glGetFixedvOES(
+        (GLenum)pname,
+        (GLfixed *)params
+    );
+
+exit:
+    if (params_base) {
+        _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
+            _exception ? JNI_ABORT: 0);
+    }
+}
+
+/* void glGetFixedvOES ( GLenum pname, GLfixed *params ) */
+static void
+android_glGetFixedvOES__ILjava_nio_IntBuffer_2
+  (JNIEnv *_env, jobject _this, jint pname, jobject params_buf) {
+    jint _exception = 0;
+    jarray _array = (jarray) 0;
+    jint _remaining;
+    GLfixed *params = (GLfixed *) 0;
+
+    params = (GLfixed *)getPointer(_env, params_buf, &_array, &_remaining);
+    glGetFixedvOES(
+        (GLenum)pname,
+        (GLfixed *)params
+    );
+    if (_array) {
+        releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE);
+    }
+}
+
+/* void glGetLightxvOES ( GLenum light, GLenum pname, GLfixed *params ) */
+static void
+android_glGetLightxvOES__II_3II
+  (JNIEnv *_env, jobject _this, jint light, jint pname, jintArray params_ref, jint offset) {
+    jint _exception = 0;
+    GLfixed *params_base = (GLfixed *) 0;
+    jint _remaining;
+    GLfixed *params = (GLfixed *) 0;
+
+    if (!params_ref) {
+        _exception = 1;
+        _env->ThrowNew(IAEClass, "params == null");
+        goto exit;
+    }
+    if (offset < 0) {
+        _exception = 1;
+        _env->ThrowNew(IAEClass, "offset < 0");
+        goto exit;
+    }
+    _remaining = _env->GetArrayLength(params_ref) - offset;
+    params_base = (GLfixed *)
+        _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
+    params = params_base + offset;
+
+    glGetLightxvOES(
+        (GLenum)light,
+        (GLenum)pname,
+        (GLfixed *)params
+    );
+
+exit:
+    if (params_base) {
+        _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
+            _exception ? JNI_ABORT: 0);
+    }
+}
+
+/* void glGetLightxvOES ( GLenum light, GLenum pname, GLfixed *params ) */
+static void
+android_glGetLightxvOES__IILjava_nio_IntBuffer_2
+  (JNIEnv *_env, jobject _this, jint light, jint pname, jobject params_buf) {
+    jint _exception = 0;
+    jarray _array = (jarray) 0;
+    jint _remaining;
+    GLfixed *params = (GLfixed *) 0;
+
+    params = (GLfixed *)getPointer(_env, params_buf, &_array, &_remaining);
+    glGetLightxvOES(
+        (GLenum)light,
+        (GLenum)pname,
+        (GLfixed *)params
+    );
+    if (_array) {
+        releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE);
+    }
+}
+
+/* void glGetMaterialxvOES ( GLenum face, GLenum pname, GLfixed *params ) */
+static void
+android_glGetMaterialxvOES__II_3II
+  (JNIEnv *_env, jobject _this, jint face, jint pname, jintArray params_ref, jint offset) {
+    jint _exception = 0;
+    GLfixed *params_base = (GLfixed *) 0;
+    jint _remaining;
+    GLfixed *params = (GLfixed *) 0;
+
+    if (!params_ref) {
+        _exception = 1;
+        _env->ThrowNew(IAEClass, "params == null");
+        goto exit;
+    }
+    if (offset < 0) {
+        _exception = 1;
+        _env->ThrowNew(IAEClass, "offset < 0");
+        goto exit;
+    }
+    _remaining = _env->GetArrayLength(params_ref) - offset;
+    params_base = (GLfixed *)
+        _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
+    params = params_base + offset;
+
+    glGetMaterialxvOES(
+        (GLenum)face,
+        (GLenum)pname,
+        (GLfixed *)params
+    );
+
+exit:
+    if (params_base) {
+        _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
+            _exception ? JNI_ABORT: 0);
+    }
+}
+
+/* void glGetMaterialxvOES ( GLenum face, GLenum pname, GLfixed *params ) */
+static void
+android_glGetMaterialxvOES__IILjava_nio_IntBuffer_2
+  (JNIEnv *_env, jobject _this, jint face, jint pname, jobject params_buf) {
+    jint _exception = 0;
+    jarray _array = (jarray) 0;
+    jint _remaining;
+    GLfixed *params = (GLfixed *) 0;
+
+    params = (GLfixed *)getPointer(_env, params_buf, &_array, &_remaining);
+    glGetMaterialxvOES(
+        (GLenum)face,
+        (GLenum)pname,
+        (GLfixed *)params
+    );
+    if (_array) {
+        releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE);
+    }
+}
+
+/* void glGetTexEnvxvOES ( GLenum env, GLenum pname, GLfixed *params ) */
+static void
+android_glGetTexEnvxvOES__II_3II
+  (JNIEnv *_env, jobject _this, jint env, jint pname, jintArray params_ref, jint offset) {
+    jint _exception = 0;
+    GLfixed *params_base = (GLfixed *) 0;
+    jint _remaining;
+    GLfixed *params = (GLfixed *) 0;
+
+    if (!params_ref) {
+        _exception = 1;
+        _env->ThrowNew(IAEClass, "params == null");
+        goto exit;
+    }
+    if (offset < 0) {
+        _exception = 1;
+        _env->ThrowNew(IAEClass, "offset < 0");
+        goto exit;
+    }
+    _remaining = _env->GetArrayLength(params_ref) - offset;
+    params_base = (GLfixed *)
+        _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
+    params = params_base + offset;
+
+    glGetTexEnvxvOES(
+        (GLenum)env,
+        (GLenum)pname,
+        (GLfixed *)params
+    );
+
+exit:
+    if (params_base) {
+        _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
+            _exception ? JNI_ABORT: 0);
+    }
+}
+
+/* void glGetTexEnvxvOES ( GLenum env, GLenum pname, GLfixed *params ) */
+static void
+android_glGetTexEnvxvOES__IILjava_nio_IntBuffer_2
+  (JNIEnv *_env, jobject _this, jint env, jint pname, jobject params_buf) {
+    jint _exception = 0;
+    jarray _array = (jarray) 0;
+    jint _remaining;
+    GLfixed *params = (GLfixed *) 0;
+
+    params = (GLfixed *)getPointer(_env, params_buf, &_array, &_remaining);
+    glGetTexEnvxvOES(
+        (GLenum)env,
+        (GLenum)pname,
+        (GLfixed *)params
+    );
+    if (_array) {
+        releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE);
+    }
+}
+
+/* void glGetTexParameterxvOES ( GLenum target, GLenum pname, GLfixed *params ) */
+static void
+android_glGetTexParameterxvOES__II_3II
+  (JNIEnv *_env, jobject _this, jint target, jint pname, jintArray params_ref, jint offset) {
+    jint _exception = 0;
+    GLfixed *params_base = (GLfixed *) 0;
+    jint _remaining;
+    GLfixed *params = (GLfixed *) 0;
+
+    if (!params_ref) {
+        _exception = 1;
+        _env->ThrowNew(IAEClass, "params == null");
+        goto exit;
+    }
+    if (offset < 0) {
+        _exception = 1;
+        _env->ThrowNew(IAEClass, "offset < 0");
+        goto exit;
+    }
+    _remaining = _env->GetArrayLength(params_ref) - offset;
+    params_base = (GLfixed *)
+        _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
+    params = params_base + offset;
+
+    glGetTexParameterxvOES(
+        (GLenum)target,
+        (GLenum)pname,
+        (GLfixed *)params
+    );
+
+exit:
+    if (params_base) {
+        _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
+            _exception ? JNI_ABORT: 0);
+    }
+}
+
+/* void glGetTexParameterxvOES ( GLenum target, GLenum pname, GLfixed *params ) */
+static void
+android_glGetTexParameterxvOES__IILjava_nio_IntBuffer_2
+  (JNIEnv *_env, jobject _this, jint target, jint pname, jobject params_buf) {
+    jint _exception = 0;
+    jarray _array = (jarray) 0;
+    jint _remaining;
+    GLfixed *params = (GLfixed *) 0;
+
+    params = (GLfixed *)getPointer(_env, params_buf, &_array, &_remaining);
+    glGetTexParameterxvOES(
+        (GLenum)target,
+        (GLenum)pname,
+        (GLfixed *)params
+    );
+    if (_array) {
+        releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE);
+    }
+}
+
+/* void glLightModelxOES ( GLenum pname, GLfixed param ) */
+static void
+android_glLightModelxOES__II
+  (JNIEnv *_env, jobject _this, jint pname, jint param) {
+    glLightModelxOES(
+        (GLenum)pname,
+        (GLfixed)param
+    );
+}
+
+/* void glLightModelxvOES ( GLenum pname, const GLfixed *params ) */
+static void
+android_glLightModelxvOES__I_3II
+  (JNIEnv *_env, jobject _this, jint pname, jintArray params_ref, jint offset) {
+    GLfixed *params_base = (GLfixed *) 0;
+    jint _remaining;
+    GLfixed *params = (GLfixed *) 0;
+
+    if (!params_ref) {
+        _env->ThrowNew(IAEClass, "params == null");
+        goto exit;
+    }
+    if (offset < 0) {
+        _env->ThrowNew(IAEClass, "offset < 0");
+        goto exit;
+    }
+    _remaining = _env->GetArrayLength(params_ref) - offset;
+    params_base = (GLfixed *)
+        _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
+    params = params_base + offset;
+
+    glLightModelxvOES(
+        (GLenum)pname,
+        (GLfixed *)params
+    );
+
+exit:
+    if (params_base) {
+        _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
+            JNI_ABORT);
+    }
+}
+
+/* void glLightModelxvOES ( GLenum pname, const GLfixed *params ) */
+static void
+android_glLightModelxvOES__ILjava_nio_IntBuffer_2
+  (JNIEnv *_env, jobject _this, jint pname, jobject params_buf) {
+    jarray _array = (jarray) 0;
+    jint _remaining;
+    GLfixed *params = (GLfixed *) 0;
+
+    params = (GLfixed *)getPointer(_env, params_buf, &_array, &_remaining);
+    glLightModelxvOES(
+        (GLenum)pname,
+        (GLfixed *)params
+    );
+    if (_array) {
+        releasePointer(_env, _array, params, JNI_FALSE);
+    }
+}
+
+/* void glLightxOES ( GLenum light, GLenum pname, GLfixed param ) */
+static void
+android_glLightxOES__III
+  (JNIEnv *_env, jobject _this, jint light, jint pname, jint param) {
+    glLightxOES(
+        (GLenum)light,
+        (GLenum)pname,
+        (GLfixed)param
+    );
+}
+
+/* void glLightxvOES ( GLenum light, GLenum pname, const GLfixed *params ) */
+static void
+android_glLightxvOES__II_3II
+  (JNIEnv *_env, jobject _this, jint light, jint pname, jintArray params_ref, jint offset) {
+    GLfixed *params_base = (GLfixed *) 0;
+    jint _remaining;
+    GLfixed *params = (GLfixed *) 0;
+
+    if (!params_ref) {
+        _env->ThrowNew(IAEClass, "params == null");
+        goto exit;
+    }
+    if (offset < 0) {
+        _env->ThrowNew(IAEClass, "offset < 0");
+        goto exit;
+    }
+    _remaining = _env->GetArrayLength(params_ref) - offset;
+    params_base = (GLfixed *)
+        _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
+    params = params_base + offset;
+
+    glLightxvOES(
+        (GLenum)light,
+        (GLenum)pname,
+        (GLfixed *)params
+    );
+
+exit:
+    if (params_base) {
+        _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
+            JNI_ABORT);
+    }
+}
+
+/* void glLightxvOES ( GLenum light, GLenum pname, const GLfixed *params ) */
+static void
+android_glLightxvOES__IILjava_nio_IntBuffer_2
+  (JNIEnv *_env, jobject _this, jint light, jint pname, jobject params_buf) {
+    jarray _array = (jarray) 0;
+    jint _remaining;
+    GLfixed *params = (GLfixed *) 0;
+
+    params = (GLfixed *)getPointer(_env, params_buf, &_array, &_remaining);
+    glLightxvOES(
+        (GLenum)light,
+        (GLenum)pname,
+        (GLfixed *)params
+    );
+    if (_array) {
+        releasePointer(_env, _array, params, JNI_FALSE);
+    }
+}
+
+/* void glLineWidthxOES ( GLfixed width ) */
+static void
+android_glLineWidthxOES__I
+  (JNIEnv *_env, jobject _this, jint width) {
+    glLineWidthxOES(
+        (GLfixed)width
+    );
+}
+
+/* void glLoadMatrixxOES ( const GLfixed *m ) */
+static void
+android_glLoadMatrixxOES___3II
+  (JNIEnv *_env, jobject _this, jintArray m_ref, jint offset) {
+    GLfixed *m_base = (GLfixed *) 0;
+    jint _remaining;
+    GLfixed *m = (GLfixed *) 0;
+
+    if (!m_ref) {
+        _env->ThrowNew(IAEClass, "m == null");
+        goto exit;
+    }
+    if (offset < 0) {
+        _env->ThrowNew(IAEClass, "offset < 0");
+        goto exit;
+    }
+    _remaining = _env->GetArrayLength(m_ref) - offset;
+    m_base = (GLfixed *)
+        _env->GetPrimitiveArrayCritical(m_ref, (jboolean *)0);
+    m = m_base + offset;
+
+    glLoadMatrixxOES(
+        (GLfixed *)m
+    );
+
+exit:
+    if (m_base) {
+        _env->ReleasePrimitiveArrayCritical(m_ref, m_base,
+            JNI_ABORT);
+    }
+}
+
+/* void glLoadMatrixxOES ( const GLfixed *m ) */
+static void
+android_glLoadMatrixxOES__Ljava_nio_IntBuffer_2
+  (JNIEnv *_env, jobject _this, jobject m_buf) {
+    jarray _array = (jarray) 0;
+    jint _remaining;
+    GLfixed *m = (GLfixed *) 0;
+
+    m = (GLfixed *)getPointer(_env, m_buf, &_array, &_remaining);
+    glLoadMatrixxOES(
+        (GLfixed *)m
+    );
+    if (_array) {
+        releasePointer(_env, _array, m, JNI_FALSE);
+    }
+}
+
+/* void glMaterialxOES ( GLenum face, GLenum pname, GLfixed param ) */
+static void
+android_glMaterialxOES__III
+  (JNIEnv *_env, jobject _this, jint face, jint pname, jint param) {
+    glMaterialxOES(
+        (GLenum)face,
+        (GLenum)pname,
+        (GLfixed)param
+    );
+}
+
+/* void glMaterialxvOES ( GLenum face, GLenum pname, const GLfixed *params ) */
+static void
+android_glMaterialxvOES__II_3II
+  (JNIEnv *_env, jobject _this, jint face, jint pname, jintArray params_ref, jint offset) {
+    GLfixed *params_base = (GLfixed *) 0;
+    jint _remaining;
+    GLfixed *params = (GLfixed *) 0;
+
+    if (!params_ref) {
+        _env->ThrowNew(IAEClass, "params == null");
+        goto exit;
+    }
+    if (offset < 0) {
+        _env->ThrowNew(IAEClass, "offset < 0");
+        goto exit;
+    }
+    _remaining = _env->GetArrayLength(params_ref) - offset;
+    params_base = (GLfixed *)
+        _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
+    params = params_base + offset;
+
+    glMaterialxvOES(
+        (GLenum)face,
+        (GLenum)pname,
+        (GLfixed *)params
+    );
+
+exit:
+    if (params_base) {
+        _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
+            JNI_ABORT);
+    }
+}
+
+/* void glMaterialxvOES ( GLenum face, GLenum pname, const GLfixed *params ) */
+static void
+android_glMaterialxvOES__IILjava_nio_IntBuffer_2
+  (JNIEnv *_env, jobject _this, jint face, jint pname, jobject params_buf) {
+    jarray _array = (jarray) 0;
+    jint _remaining;
+    GLfixed *params = (GLfixed *) 0;
+
+    params = (GLfixed *)getPointer(_env, params_buf, &_array, &_remaining);
+    glMaterialxvOES(
+        (GLenum)face,
+        (GLenum)pname,
+        (GLfixed *)params
+    );
+    if (_array) {
+        releasePointer(_env, _array, params, JNI_FALSE);
+    }
+}
+
+/* void glMultMatrixxOES ( const GLfixed *m ) */
+static void
+android_glMultMatrixxOES___3II
+  (JNIEnv *_env, jobject _this, jintArray m_ref, jint offset) {
+    GLfixed *m_base = (GLfixed *) 0;
+    jint _remaining;
+    GLfixed *m = (GLfixed *) 0;
+
+    if (!m_ref) {
+        _env->ThrowNew(IAEClass, "m == null");
+        goto exit;
+    }
+    if (offset < 0) {
+        _env->ThrowNew(IAEClass, "offset < 0");
+        goto exit;
+    }
+    _remaining = _env->GetArrayLength(m_ref) - offset;
+    m_base = (GLfixed *)
+        _env->GetPrimitiveArrayCritical(m_ref, (jboolean *)0);
+    m = m_base + offset;
+
+    glMultMatrixxOES(
+        (GLfixed *)m
+    );
+
+exit:
+    if (m_base) {
+        _env->ReleasePrimitiveArrayCritical(m_ref, m_base,
+            JNI_ABORT);
+    }
+}
+
+/* void glMultMatrixxOES ( const GLfixed *m ) */
+static void
+android_glMultMatrixxOES__Ljava_nio_IntBuffer_2
+  (JNIEnv *_env, jobject _this, jobject m_buf) {
+    jarray _array = (jarray) 0;
+    jint _remaining;
+    GLfixed *m = (GLfixed *) 0;
+
+    m = (GLfixed *)getPointer(_env, m_buf, &_array, &_remaining);
+    glMultMatrixxOES(
+        (GLfixed *)m
+    );
+    if (_array) {
+        releasePointer(_env, _array, m, JNI_FALSE);
+    }
+}
+
+/* void glMultiTexCoord4xOES ( GLenum target, GLfixed s, GLfixed t, GLfixed r, GLfixed q ) */
+static void
+android_glMultiTexCoord4xOES__IIIII
+  (JNIEnv *_env, jobject _this, jint target, jint s, jint t, jint r, jint q) {
+    glMultiTexCoord4xOES(
+        (GLenum)target,
+        (GLfixed)s,
+        (GLfixed)t,
+        (GLfixed)r,
+        (GLfixed)q
+    );
+}
+
+/* void glNormal3xOES ( GLfixed nx, GLfixed ny, GLfixed nz ) */
+static void
+android_glNormal3xOES__III
+  (JNIEnv *_env, jobject _this, jint nx, jint ny, jint nz) {
+    glNormal3xOES(
+        (GLfixed)nx,
+        (GLfixed)ny,
+        (GLfixed)nz
+    );
+}
+
+/* void glOrthoxOES ( GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar ) */
+static void
+android_glOrthoxOES__IIIIII
+  (JNIEnv *_env, jobject _this, jint left, jint right, jint bottom, jint top, jint zNear, jint zFar) {
+    glOrthoxOES(
+        (GLfixed)left,
+        (GLfixed)right,
+        (GLfixed)bottom,
+        (GLfixed)top,
+        (GLfixed)zNear,
+        (GLfixed)zFar
+    );
+}
+
+/* void glPointParameterxOES ( GLenum pname, GLfixed param ) */
+static void
+android_glPointParameterxOES__II
+  (JNIEnv *_env, jobject _this, jint pname, jint param) {
+    glPointParameterxOES(
+        (GLenum)pname,
+        (GLfixed)param
+    );
+}
+
+/* void glPointParameterxvOES ( GLenum pname, const GLfixed *params ) */
+static void
+android_glPointParameterxvOES__I_3II
+  (JNIEnv *_env, jobject _this, jint pname, jintArray params_ref, jint offset) {
+    GLfixed *params_base = (GLfixed *) 0;
+    jint _remaining;
+    GLfixed *params = (GLfixed *) 0;
+
+    if (!params_ref) {
+        _env->ThrowNew(IAEClass, "params == null");
+        goto exit;
+    }
+    if (offset < 0) {
+        _env->ThrowNew(IAEClass, "offset < 0");
+        goto exit;
+    }
+    _remaining = _env->GetArrayLength(params_ref) - offset;
+    params_base = (GLfixed *)
+        _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
+    params = params_base + offset;
+
+    glPointParameterxvOES(
+        (GLenum)pname,
+        (GLfixed *)params
+    );
+
+exit:
+    if (params_base) {
+        _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
+            JNI_ABORT);
+    }
+}
+
+/* void glPointParameterxvOES ( GLenum pname, const GLfixed *params ) */
+static void
+android_glPointParameterxvOES__ILjava_nio_IntBuffer_2
+  (JNIEnv *_env, jobject _this, jint pname, jobject params_buf) {
+    jarray _array = (jarray) 0;
+    jint _remaining;
+    GLfixed *params = (GLfixed *) 0;
+
+    params = (GLfixed *)getPointer(_env, params_buf, &_array, &_remaining);
+    glPointParameterxvOES(
+        (GLenum)pname,
+        (GLfixed *)params
+    );
+    if (_array) {
+        releasePointer(_env, _array, params, JNI_FALSE);
+    }
+}
+
+/* void glPointSizexOES ( GLfixed size ) */
+static void
+android_glPointSizexOES__I
+  (JNIEnv *_env, jobject _this, jint size) {
+    glPointSizexOES(
+        (GLfixed)size
+    );
+}
+
+/* void glPolygonOffsetxOES ( GLfixed factor, GLfixed units ) */
+static void
+android_glPolygonOffsetxOES__II
+  (JNIEnv *_env, jobject _this, jint factor, jint units) {
+    glPolygonOffsetxOES(
+        (GLfixed)factor,
+        (GLfixed)units
+    );
+}
+
+/* void glRotatexOES ( GLfixed angle, GLfixed x, GLfixed y, GLfixed z ) */
+static void
+android_glRotatexOES__IIII
+  (JNIEnv *_env, jobject _this, jint angle, jint x, jint y, jint z) {
+    glRotatexOES(
+        (GLfixed)angle,
+        (GLfixed)x,
+        (GLfixed)y,
+        (GLfixed)z
+    );
+}
+
+/* void glSampleCoveragexOES ( GLclampx value, GLboolean invert ) */
+static void
+android_glSampleCoveragexOES__IZ
+  (JNIEnv *_env, jobject _this, jint value, jboolean invert) {
+    glSampleCoveragexOES(
+        (GLclampx)value,
+        (GLboolean)invert
+    );
+}
+
+/* void glScalexOES ( GLfixed x, GLfixed y, GLfixed z ) */
+static void
+android_glScalexOES__III
+  (JNIEnv *_env, jobject _this, jint x, jint y, jint z) {
+    glScalexOES(
+        (GLfixed)x,
+        (GLfixed)y,
+        (GLfixed)z
+    );
+}
+
+/* void glTexEnvxOES ( GLenum target, GLenum pname, GLfixed param ) */
+static void
+android_glTexEnvxOES__III
+  (JNIEnv *_env, jobject _this, jint target, jint pname, jint param) {
+    glTexEnvxOES(
+        (GLenum)target,
+        (GLenum)pname,
+        (GLfixed)param
+    );
+}
+
+/* void glTexEnvxvOES ( GLenum target, GLenum pname, const GLfixed *params ) */
+static void
+android_glTexEnvxvOES__II_3II
+  (JNIEnv *_env, jobject _this, jint target, jint pname, jintArray params_ref, jint offset) {
+    GLfixed *params_base = (GLfixed *) 0;
+    jint _remaining;
+    GLfixed *params = (GLfixed *) 0;
+
+    if (!params_ref) {
+        _env->ThrowNew(IAEClass, "params == null");
+        goto exit;
+    }
+    if (offset < 0) {
+        _env->ThrowNew(IAEClass, "offset < 0");
+        goto exit;
+    }
+    _remaining = _env->GetArrayLength(params_ref) - offset;
+    params_base = (GLfixed *)
+        _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
+    params = params_base + offset;
+
+    glTexEnvxvOES(
+        (GLenum)target,
+        (GLenum)pname,
+        (GLfixed *)params
+    );
+
+exit:
+    if (params_base) {
+        _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
+            JNI_ABORT);
+    }
+}
+
+/* void glTexEnvxvOES ( GLenum target, GLenum pname, const GLfixed *params ) */
+static void
+android_glTexEnvxvOES__IILjava_nio_IntBuffer_2
+  (JNIEnv *_env, jobject _this, jint target, jint pname, jobject params_buf) {
+    jarray _array = (jarray) 0;
+    jint _remaining;
+    GLfixed *params = (GLfixed *) 0;
+
+    params = (GLfixed *)getPointer(_env, params_buf, &_array, &_remaining);
+    glTexEnvxvOES(
+        (GLenum)target,
+        (GLenum)pname,
+        (GLfixed *)params
+    );
+    if (_array) {
+        releasePointer(_env, _array, params, JNI_FALSE);
+    }
+}
+
+/* void glTexParameterxOES ( GLenum target, GLenum pname, GLfixed param ) */
+static void
+android_glTexParameterxOES__III
+  (JNIEnv *_env, jobject _this, jint target, jint pname, jint param) {
+    glTexParameterxOES(
+        (GLenum)target,
+        (GLenum)pname,
+        (GLfixed)param
+    );
+}
+
+/* void glTexParameterxvOES ( GLenum target, GLenum pname, const GLfixed *params ) */
+static void
+android_glTexParameterxvOES__II_3II
+  (JNIEnv *_env, jobject _this, jint target, jint pname, jintArray params_ref, jint offset) {
+    GLfixed *params_base = (GLfixed *) 0;
+    jint _remaining;
+    GLfixed *params = (GLfixed *) 0;
+
+    if (!params_ref) {
+        _env->ThrowNew(IAEClass, "params == null");
+        goto exit;
+    }
+    if (offset < 0) {
+        _env->ThrowNew(IAEClass, "offset < 0");
+        goto exit;
+    }
+    _remaining = _env->GetArrayLength(params_ref) - offset;
+    params_base = (GLfixed *)
+        _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
+    params = params_base + offset;
+
+    glTexParameterxvOES(
+        (GLenum)target,
+        (GLenum)pname,
+        (GLfixed *)params
+    );
+
+exit:
+    if (params_base) {
+        _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
+            JNI_ABORT);
+    }
+}
+
+/* void glTexParameterxvOES ( GLenum target, GLenum pname, const GLfixed *params ) */
+static void
+android_glTexParameterxvOES__IILjava_nio_IntBuffer_2
+  (JNIEnv *_env, jobject _this, jint target, jint pname, jobject params_buf) {
+    jarray _array = (jarray) 0;
+    jint _remaining;
+    GLfixed *params = (GLfixed *) 0;
+
+    params = (GLfixed *)getPointer(_env, params_buf, &_array, &_remaining);
+    glTexParameterxvOES(
+        (GLenum)target,
+        (GLenum)pname,
+        (GLfixed *)params
+    );
+    if (_array) {
+        releasePointer(_env, _array, params, JNI_FALSE);
+    }
+}
+
+/* void glTranslatexOES ( GLfixed x, GLfixed y, GLfixed z ) */
+static void
+android_glTranslatexOES__III
+  (JNIEnv *_env, jobject _this, jint x, jint y, jint z) {
+    glTranslatexOES(
+        (GLfixed)x,
+        (GLfixed)y,
+        (GLfixed)z
+    );
+}
+
+/* GLboolean glIsRenderbufferOES ( GLuint renderbuffer ) */
+static jboolean
+android_glIsRenderbufferOES__I
+  (JNIEnv *_env, jobject _this, jint renderbuffer) {
+    _env->ThrowNew(UOEClass,
+        "glIsRenderbufferOES");
+    return JNI_FALSE;
+}
+
+/* void glBindRenderbufferOES ( GLenum target, GLuint renderbuffer ) */
+static void
+android_glBindRenderbufferOES__II
+  (JNIEnv *_env, jobject _this, jint target, jint renderbuffer) {
+    _env->ThrowNew(UOEClass,
+        "glBindRenderbufferOES");
+}
+
+/* void glDeleteRenderbuffersOES ( GLsizei n, const GLuint *renderbuffers ) */
+static void
+android_glDeleteRenderbuffersOES__I_3II
+  (JNIEnv *_env, jobject _this, jint n, jintArray renderbuffers_ref, jint offset) {
+    _env->ThrowNew(UOEClass,
+        "glDeleteRenderbuffersOES");
+}
+
+/* void glDeleteRenderbuffersOES ( GLsizei n, const GLuint *renderbuffers ) */
+static void
+android_glDeleteRenderbuffersOES__ILjava_nio_IntBuffer_2
+  (JNIEnv *_env, jobject _this, jint n, jobject renderbuffers_buf) {
+    _env->ThrowNew(UOEClass,
+        "glDeleteRenderbuffersOES");
+}
+
+/* void glGenRenderbuffersOES ( GLsizei n, GLuint *renderbuffers ) */
+static void
+android_glGenRenderbuffersOES__I_3II
+  (JNIEnv *_env, jobject _this, jint n, jintArray renderbuffers_ref, jint offset) {
+    _env->ThrowNew(UOEClass,
+        "glGenRenderbuffersOES");
+}
+
+/* void glGenRenderbuffersOES ( GLsizei n, GLuint *renderbuffers ) */
+static void
+android_glGenRenderbuffersOES__ILjava_nio_IntBuffer_2
+  (JNIEnv *_env, jobject _this, jint n, jobject renderbuffers_buf) {
+    _env->ThrowNew(UOEClass,
+        "glGenRenderbuffersOES");
+}
+
+/* void glRenderbufferStorageOES ( GLenum target, GLenum internalformat, GLsizei width, GLsizei height ) */
+static void
+android_glRenderbufferStorageOES__IIII
+  (JNIEnv *_env, jobject _this, jint target, jint internalformat, jint width, jint height) {
+    _env->ThrowNew(UOEClass,
+        "glRenderbufferStorageOES");
+}
+
+/* void glGetRenderbufferParameterivOES ( GLenum target, GLenum pname, GLint *params ) */
+static void
+android_glGetRenderbufferParameterivOES__II_3II
+  (JNIEnv *_env, jobject _this, jint target, jint pname, jintArray params_ref, jint offset) {
+    _env->ThrowNew(UOEClass,
+        "glGetRenderbufferParameterivOES");
+}
+
+/* void glGetRenderbufferParameterivOES ( GLenum target, GLenum pname, GLint *params ) */
+static void
+android_glGetRenderbufferParameterivOES__IILjava_nio_IntBuffer_2
+  (JNIEnv *_env, jobject _this, jint target, jint pname, jobject params_buf) {
+    _env->ThrowNew(UOEClass,
+        "glGetRenderbufferParameterivOES");
+}
+
+/* GLboolean glIsFramebufferOES ( GLuint framebuffer ) */
+static jboolean
+android_glIsFramebufferOES__I
+  (JNIEnv *_env, jobject _this, jint framebuffer) {
+    _env->ThrowNew(UOEClass,
+        "glIsFramebufferOES");
+    return JNI_FALSE;
+}
+
+/* void glBindFramebufferOES ( GLenum target, GLuint framebuffer ) */
+static void
+android_glBindFramebufferOES__II
+  (JNIEnv *_env, jobject _this, jint target, jint framebuffer) {
+    _env->ThrowNew(UOEClass,
+        "glBindFramebufferOES");
+}
+
+/* void glDeleteFramebuffersOES ( GLsizei n, const GLuint *framebuffers ) */
+static void
+android_glDeleteFramebuffersOES__I_3II
+  (JNIEnv *_env, jobject _this, jint n, jintArray framebuffers_ref, jint offset) {
+    _env->ThrowNew(UOEClass,
+        "glDeleteFramebuffersOES");
+}
+
+/* void glDeleteFramebuffersOES ( GLsizei n, const GLuint *framebuffers ) */
+static void
+android_glDeleteFramebuffersOES__ILjava_nio_IntBuffer_2
+  (JNIEnv *_env, jobject _this, jint n, jobject framebuffers_buf) {
+    _env->ThrowNew(UOEClass,
+        "glDeleteFramebuffersOES");
+}
+
+/* void glGenFramebuffersOES ( GLsizei n, GLuint *framebuffers ) */
+static void
+android_glGenFramebuffersOES__I_3II
+  (JNIEnv *_env, jobject _this, jint n, jintArray framebuffers_ref, jint offset) {
+    _env->ThrowNew(UOEClass,
+        "glGenFramebuffersOES");
+}
+
+/* void glGenFramebuffersOES ( GLsizei n, GLuint *framebuffers ) */
+static void
+android_glGenFramebuffersOES__ILjava_nio_IntBuffer_2
+  (JNIEnv *_env, jobject _this, jint n, jobject framebuffers_buf) {
+    _env->ThrowNew(UOEClass,
+        "glGenFramebuffersOES");
+}
+
+/* GLenum glCheckFramebufferStatusOES ( GLenum target ) */
+static jint
+android_glCheckFramebufferStatusOES__I
+  (JNIEnv *_env, jobject _this, jint target) {
+    _env->ThrowNew(UOEClass,
+        "glCheckFramebufferStatusOES");
+    return 0;
+}
+
+/* void glFramebufferRenderbufferOES ( GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer ) */
+static void
+android_glFramebufferRenderbufferOES__IIII
+  (JNIEnv *_env, jobject _this, jint target, jint attachment, jint renderbuffertarget, jint renderbuffer) {
+    _env->ThrowNew(UOEClass,
+        "glFramebufferRenderbufferOES");
+}
+
+/* void glFramebufferTexture2DOES ( GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level ) */
+static void
+android_glFramebufferTexture2DOES__IIIII
+  (JNIEnv *_env, jobject _this, jint target, jint attachment, jint textarget, jint texture, jint level) {
+    _env->ThrowNew(UOEClass,
+        "glFramebufferTexture2DOES");
+}
+
+/* void glGetFramebufferAttachmentParameterivOES ( GLenum target, GLenum attachment, GLenum pname, GLint *params ) */
+static void
+android_glGetFramebufferAttachmentParameterivOES__III_3II
+  (JNIEnv *_env, jobject _this, jint target, jint attachment, jint pname, jintArray params_ref, jint offset) {
+    _env->ThrowNew(UOEClass,
+        "glGetFramebufferAttachmentParameterivOES");
+}
+
+/* void glGetFramebufferAttachmentParameterivOES ( GLenum target, GLenum attachment, GLenum pname, GLint *params ) */
+static void
+android_glGetFramebufferAttachmentParameterivOES__IIILjava_nio_IntBuffer_2
+  (JNIEnv *_env, jobject _this, jint target, jint attachment, jint pname, jobject params_buf) {
+    _env->ThrowNew(UOEClass,
+        "glGetFramebufferAttachmentParameterivOES");
+}
+
+/* void glGenerateMipmapOES ( GLenum target ) */
+static void
+android_glGenerateMipmapOES__I
+  (JNIEnv *_env, jobject _this, jint target) {
+    _env->ThrowNew(UOEClass,
+        "glGenerateMipmapOES");
+}
+
+/* void glCurrentPaletteMatrixOES ( GLuint matrixpaletteindex ) */
+static void
+android_glCurrentPaletteMatrixOES__I
+  (JNIEnv *_env, jobject _this, jint matrixpaletteindex) {
+    _env->ThrowNew(UOEClass,
+        "glCurrentPaletteMatrixOES");
+}
+
+/* void glLoadPaletteFromModelViewMatrixOES ( void ) */
+static void
+android_glLoadPaletteFromModelViewMatrixOES__
+  (JNIEnv *_env, jobject _this) {
+    _env->ThrowNew(UOEClass,
+        "glLoadPaletteFromModelViewMatrixOES");
+}
+
+/* void glMatrixIndexPointerOES ( GLint size, GLenum type, GLsizei stride, const GLvoid *pointer ) */
+static void
+android_glMatrixIndexPointerOES__IIILjava_nio_Buffer_2
+  (JNIEnv *_env, jobject _this, jint size, jint type, jint stride, jobject pointer_buf) {
+    _env->ThrowNew(UOEClass,
+        "glMatrixIndexPointerOES");
+}
+
+/* void glWeightPointerOES ( GLint size, GLenum type, GLsizei stride, const GLvoid *pointer ) */
+static void
+android_glWeightPointerOES__IIILjava_nio_Buffer_2
+  (JNIEnv *_env, jobject _this, jint size, jint type, jint stride, jobject pointer_buf) {
+    _env->ThrowNew(UOEClass,
+        "glWeightPointerOES");
+}
+
+/* void glDepthRangefOES ( GLclampf zNear, GLclampf zFar ) */
+static void
+android_glDepthRangefOES__FF
+  (JNIEnv *_env, jobject _this, jfloat zNear, jfloat zFar) {
+    glDepthRangefOES(
+        (GLclampf)zNear,
+        (GLclampf)zFar
+    );
+}
+
+/* void glFrustumfOES ( GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar ) */
+static void
+android_glFrustumfOES__FFFFFF
+  (JNIEnv *_env, jobject _this, jfloat left, jfloat right, jfloat bottom, jfloat top, jfloat zNear, jfloat zFar) {
+    glFrustumfOES(
+        (GLfloat)left,
+        (GLfloat)right,
+        (GLfloat)bottom,
+        (GLfloat)top,
+        (GLfloat)zNear,
+        (GLfloat)zFar
+    );
+}
+
+/* void glOrthofOES ( GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar ) */
+static void
+android_glOrthofOES__FFFFFF
+  (JNIEnv *_env, jobject _this, jfloat left, jfloat right, jfloat bottom, jfloat top, jfloat zNear, jfloat zFar) {
+    glOrthofOES(
+        (GLfloat)left,
+        (GLfloat)right,
+        (GLfloat)bottom,
+        (GLfloat)top,
+        (GLfloat)zNear,
+        (GLfloat)zFar
+    );
+}
+
+/* void glClipPlanefOES ( GLenum plane, const GLfloat *equation ) */
+static void
+android_glClipPlanefOES__I_3FI
+  (JNIEnv *_env, jobject _this, jint plane, jfloatArray equation_ref, jint offset) {
+    GLfloat *equation_base = (GLfloat *) 0;
+    jint _remaining;
+    GLfloat *equation = (GLfloat *) 0;
+
+    if (!equation_ref) {
+        _env->ThrowNew(IAEClass, "equation == null");
+        goto exit;
+    }
+    if (offset < 0) {
+        _env->ThrowNew(IAEClass, "offset < 0");
+        goto exit;
+    }
+    _remaining = _env->GetArrayLength(equation_ref) - offset;
+    equation_base = (GLfloat *)
+        _env->GetPrimitiveArrayCritical(equation_ref, (jboolean *)0);
+    equation = equation_base + offset;
+
+    glClipPlanefOES(
+        (GLenum)plane,
+        (GLfloat *)equation
+    );
+
+exit:
+    if (equation_base) {
+        _env->ReleasePrimitiveArrayCritical(equation_ref, equation_base,
+            JNI_ABORT);
+    }
+}
+
+/* void glClipPlanefOES ( GLenum plane, const GLfloat *equation ) */
+static void
+android_glClipPlanefOES__ILjava_nio_FloatBuffer_2
+  (JNIEnv *_env, jobject _this, jint plane, jobject equation_buf) {
+    jarray _array = (jarray) 0;
+    jint _remaining;
+    GLfloat *equation = (GLfloat *) 0;
+
+    equation = (GLfloat *)getPointer(_env, equation_buf, &_array, &_remaining);
+    glClipPlanefOES(
+        (GLenum)plane,
+        (GLfloat *)equation
+    );
+    if (_array) {
+        releasePointer(_env, _array, equation, JNI_FALSE);
+    }
+}
+
+/* void glGetClipPlanefOES ( GLenum pname, GLfloat *eqn ) */
+static void
+android_glGetClipPlanefOES__I_3FI
+  (JNIEnv *_env, jobject _this, jint pname, jfloatArray eqn_ref, jint offset) {
+    jint _exception = 0;
+    GLfloat *eqn_base = (GLfloat *) 0;
+    jint _remaining;
+    GLfloat *eqn = (GLfloat *) 0;
+
+    if (!eqn_ref) {
+        _exception = 1;
+        _env->ThrowNew(IAEClass, "eqn == null");
+        goto exit;
+    }
+    if (offset < 0) {
+        _exception = 1;
+        _env->ThrowNew(IAEClass, "offset < 0");
+        goto exit;
+    }
+    _remaining = _env->GetArrayLength(eqn_ref) - offset;
+    if (_remaining < 4) {
+        _exception = 1;
+        _env->ThrowNew(IAEClass, "length - offset < 4");
+        goto exit;
+    }
+    eqn_base = (GLfloat *)
+        _env->GetPrimitiveArrayCritical(eqn_ref, (jboolean *)0);
+    eqn = eqn_base + offset;
+
+    glGetClipPlanefOES(
+        (GLenum)pname,
+        (GLfloat *)eqn
+    );
+
+exit:
+    if (eqn_base) {
+        _env->ReleasePrimitiveArrayCritical(eqn_ref, eqn_base,
+            _exception ? JNI_ABORT: 0);
+    }
+}
+
+/* void glGetClipPlanefOES ( GLenum pname, GLfloat *eqn ) */
+static void
+android_glGetClipPlanefOES__ILjava_nio_FloatBuffer_2
+  (JNIEnv *_env, jobject _this, jint pname, jobject eqn_buf) {
+    jint _exception = 0;
+    jarray _array = (jarray) 0;
+    jint _remaining;
+    GLfloat *eqn = (GLfloat *) 0;
+
+    eqn = (GLfloat *)getPointer(_env, eqn_buf, &_array, &_remaining);
+    if (_remaining < 4) {
+        _exception = 1;
+        _env->ThrowNew(IAEClass, "remaining() < 4");
+        goto exit;
+    }
+    glGetClipPlanefOES(
+        (GLenum)pname,
+        (GLfloat *)eqn
+    );
+
+exit:
+    if (_array) {
+        releasePointer(_env, _array, eqn, _exception ? JNI_FALSE : JNI_TRUE);
+    }
+}
+
+/* void glClearDepthfOES ( GLclampf depth ) */
+static void
+android_glClearDepthfOES__F
+  (JNIEnv *_env, jobject _this, jfloat depth) {
+    glClearDepthfOES(
+        (GLclampf)depth
+    );
+}
+
+/* void glTexGenfOES ( GLenum coord, GLenum pname, GLfloat param ) */
+static void
+android_glTexGenfOES__IIF
+  (JNIEnv *_env, jobject _this, jint coord, jint pname, jfloat param) {
+    glTexGenfOES(
+        (GLenum)coord,
+        (GLenum)pname,
+        (GLfloat)param
+    );
+}
+
+/* void glTexGenfvOES ( GLenum coord, GLenum pname, const GLfloat *params ) */
+static void
+android_glTexGenfvOES__II_3FI
+  (JNIEnv *_env, jobject _this, jint coord, jint pname, jfloatArray params_ref, jint offset) {
+    GLfloat *params_base = (GLfloat *) 0;
+    jint _remaining;
+    GLfloat *params = (GLfloat *) 0;
+
+    if (!params_ref) {
+        _env->ThrowNew(IAEClass, "params == null");
+        goto exit;
+    }
+    if (offset < 0) {
+        _env->ThrowNew(IAEClass, "offset < 0");
+        goto exit;
+    }
+    _remaining = _env->GetArrayLength(params_ref) - offset;
+    params_base = (GLfloat *)
+        _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
+    params = params_base + offset;
+
+    glTexGenfvOES(
+        (GLenum)coord,
+        (GLenum)pname,
+        (GLfloat *)params
+    );
+
+exit:
+    if (params_base) {
+        _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
+            JNI_ABORT);
+    }
+}
+
+/* void glTexGenfvOES ( GLenum coord, GLenum pname, const GLfloat *params ) */
+static void
+android_glTexGenfvOES__IILjava_nio_FloatBuffer_2
+  (JNIEnv *_env, jobject _this, jint coord, jint pname, jobject params_buf) {
+    jarray _array = (jarray) 0;
+    jint _remaining;
+    GLfloat *params = (GLfloat *) 0;
+
+    params = (GLfloat *)getPointer(_env, params_buf, &_array, &_remaining);
+    glTexGenfvOES(
+        (GLenum)coord,
+        (GLenum)pname,
+        (GLfloat *)params
+    );
+    if (_array) {
+        releasePointer(_env, _array, params, JNI_FALSE);
+    }
+}
+
+/* void glTexGeniOES ( GLenum coord, GLenum pname, GLint param ) */
+static void
+android_glTexGeniOES__III
+  (JNIEnv *_env, jobject _this, jint coord, jint pname, jint param) {
+    glTexGeniOES(
+        (GLenum)coord,
+        (GLenum)pname,
+        (GLint)param
+    );
+}
+
+/* void glTexGenivOES ( GLenum coord, GLenum pname, const GLint *params ) */
+static void
+android_glTexGenivOES__II_3II
+  (JNIEnv *_env, jobject _this, jint coord, jint pname, jintArray params_ref, jint offset) {
+    GLint *params_base = (GLint *) 0;
+    jint _remaining;
+    GLint *params = (GLint *) 0;
+
+    if (!params_ref) {
+        _env->ThrowNew(IAEClass, "params == null");
+        goto exit;
+    }
+    if (offset < 0) {
+        _env->ThrowNew(IAEClass, "offset < 0");
+        goto exit;
+    }
+    _remaining = _env->GetArrayLength(params_ref) - offset;
+    params_base = (GLint *)
+        _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
+    params = params_base + offset;
+
+    glTexGenivOES(
+        (GLenum)coord,
+        (GLenum)pname,
+        (GLint *)params
+    );
+
+exit:
+    if (params_base) {
+        _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
+            JNI_ABORT);
+    }
+}
+
+/* void glTexGenivOES ( GLenum coord, GLenum pname, const GLint *params ) */
+static void
+android_glTexGenivOES__IILjava_nio_IntBuffer_2
+  (JNIEnv *_env, jobject _this, jint coord, jint pname, jobject params_buf) {
+    jarray _array = (jarray) 0;
+    jint _remaining;
+    GLint *params = (GLint *) 0;
+
+    params = (GLint *)getPointer(_env, params_buf, &_array, &_remaining);
+    glTexGenivOES(
+        (GLenum)coord,
+        (GLenum)pname,
+        (GLint *)params
+    );
+    if (_array) {
+        releasePointer(_env, _array, params, JNI_FALSE);
+    }
+}
+
+/* void glTexGenxOES ( GLenum coord, GLenum pname, GLfixed param ) */
+static void
+android_glTexGenxOES__III
+  (JNIEnv *_env, jobject _this, jint coord, jint pname, jint param) {
+    glTexGenxOES(
+        (GLenum)coord,
+        (GLenum)pname,
+        (GLfixed)param
+    );
+}
+
+/* void glTexGenxvOES ( GLenum coord, GLenum pname, const GLfixed *params ) */
+static void
+android_glTexGenxvOES__II_3II
+  (JNIEnv *_env, jobject _this, jint coord, jint pname, jintArray params_ref, jint offset) {
+    GLfixed *params_base = (GLfixed *) 0;
+    jint _remaining;
+    GLfixed *params = (GLfixed *) 0;
+
+    if (!params_ref) {
+        _env->ThrowNew(IAEClass, "params == null");
+        goto exit;
+    }
+    if (offset < 0) {
+        _env->ThrowNew(IAEClass, "offset < 0");
+        goto exit;
+    }
+    _remaining = _env->GetArrayLength(params_ref) - offset;
+    params_base = (GLfixed *)
+        _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
+    params = params_base + offset;
+
+    glTexGenxvOES(
+        (GLenum)coord,
+        (GLenum)pname,
+        (GLfixed *)params
+    );
+
+exit:
+    if (params_base) {
+        _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
+            JNI_ABORT);
+    }
+}
+
+/* void glTexGenxvOES ( GLenum coord, GLenum pname, const GLfixed *params ) */
+static void
+android_glTexGenxvOES__IILjava_nio_IntBuffer_2
+  (JNIEnv *_env, jobject _this, jint coord, jint pname, jobject params_buf) {
+    jarray _array = (jarray) 0;
+    jint _remaining;
+    GLfixed *params = (GLfixed *) 0;
+
+    params = (GLfixed *)getPointer(_env, params_buf, &_array, &_remaining);
+    glTexGenxvOES(
+        (GLenum)coord,
+        (GLenum)pname,
+        (GLfixed *)params
+    );
+    if (_array) {
+        releasePointer(_env, _array, params, JNI_FALSE);
+    }
+}
+
+/* void glGetTexGenfvOES ( GLenum coord, GLenum pname, GLfloat *params ) */
+static void
+android_glGetTexGenfvOES__II_3FI
+  (JNIEnv *_env, jobject _this, jint coord, jint pname, jfloatArray params_ref, jint offset) {
+    jint _exception = 0;
+    GLfloat *params_base = (GLfloat *) 0;
+    jint _remaining;
+    GLfloat *params = (GLfloat *) 0;
+
+    if (!params_ref) {
+        _exception = 1;
+        _env->ThrowNew(IAEClass, "params == null");
+        goto exit;
+    }
+    if (offset < 0) {
+        _exception = 1;
+        _env->ThrowNew(IAEClass, "offset < 0");
+        goto exit;
+    }
+    _remaining = _env->GetArrayLength(params_ref) - offset;
+    params_base = (GLfloat *)
+        _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
+    params = params_base + offset;
+
+    glGetTexGenfvOES(
+        (GLenum)coord,
+        (GLenum)pname,
+        (GLfloat *)params
+    );
+
+exit:
+    if (params_base) {
+        _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
+            _exception ? JNI_ABORT: 0);
+    }
+}
+
+/* void glGetTexGenfvOES ( GLenum coord, GLenum pname, GLfloat *params ) */
+static void
+android_glGetTexGenfvOES__IILjava_nio_FloatBuffer_2
+  (JNIEnv *_env, jobject _this, jint coord, jint pname, jobject params_buf) {
+    jint _exception = 0;
+    jarray _array = (jarray) 0;
+    jint _remaining;
+    GLfloat *params = (GLfloat *) 0;
+
+    params = (GLfloat *)getPointer(_env, params_buf, &_array, &_remaining);
+    glGetTexGenfvOES(
+        (GLenum)coord,
+        (GLenum)pname,
+        (GLfloat *)params
+    );
+    if (_array) {
+        releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE);
+    }
+}
+
+/* void glGetTexGenivOES ( GLenum coord, GLenum pname, GLint *params ) */
+static void
+android_glGetTexGenivOES__II_3II
+  (JNIEnv *_env, jobject _this, jint coord, jint pname, jintArray params_ref, jint offset) {
+    jint _exception = 0;
+    GLint *params_base = (GLint *) 0;
+    jint _remaining;
+    GLint *params = (GLint *) 0;
+
+    if (!params_ref) {
+        _exception = 1;
+        _env->ThrowNew(IAEClass, "params == null");
+        goto exit;
+    }
+    if (offset < 0) {
+        _exception = 1;
+        _env->ThrowNew(IAEClass, "offset < 0");
+        goto exit;
+    }
+    _remaining = _env->GetArrayLength(params_ref) - offset;
+    params_base = (GLint *)
+        _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
+    params = params_base + offset;
+
+    glGetTexGenivOES(
+        (GLenum)coord,
+        (GLenum)pname,
+        (GLint *)params
+    );
+
+exit:
+    if (params_base) {
+        _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
+            _exception ? JNI_ABORT: 0);
+    }
+}
+
+/* void glGetTexGenivOES ( GLenum coord, GLenum pname, GLint *params ) */
+static void
+android_glGetTexGenivOES__IILjava_nio_IntBuffer_2
+  (JNIEnv *_env, jobject _this, jint coord, jint pname, jobject params_buf) {
+    jint _exception = 0;
+    jarray _array = (jarray) 0;
+    jint _remaining;
+    GLint *params = (GLint *) 0;
+
+    params = (GLint *)getPointer(_env, params_buf, &_array, &_remaining);
+    glGetTexGenivOES(
+        (GLenum)coord,
+        (GLenum)pname,
+        (GLint *)params
+    );
+    if (_array) {
+        releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE);
+    }
+}
+
+/* void glGetTexGenxvOES ( GLenum coord, GLenum pname, GLfixed *params ) */
+static void
+android_glGetTexGenxvOES__II_3II
+  (JNIEnv *_env, jobject _this, jint coord, jint pname, jintArray params_ref, jint offset) {
+    jint _exception = 0;
+    GLfixed *params_base = (GLfixed *) 0;
+    jint _remaining;
+    GLfixed *params = (GLfixed *) 0;
+
+    if (!params_ref) {
+        _exception = 1;
+        _env->ThrowNew(IAEClass, "params == null");
+        goto exit;
+    }
+    if (offset < 0) {
+        _exception = 1;
+        _env->ThrowNew(IAEClass, "offset < 0");
+        goto exit;
+    }
+    _remaining = _env->GetArrayLength(params_ref) - offset;
+    params_base = (GLfixed *)
+        _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
+    params = params_base + offset;
+
+    glGetTexGenxvOES(
+        (GLenum)coord,
+        (GLenum)pname,
+        (GLfixed *)params
+    );
+
+exit:
+    if (params_base) {
+        _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
+            _exception ? JNI_ABORT: 0);
+    }
+}
+
+/* void glGetTexGenxvOES ( GLenum coord, GLenum pname, GLfixed *params ) */
+static void
+android_glGetTexGenxvOES__IILjava_nio_IntBuffer_2
+  (JNIEnv *_env, jobject _this, jint coord, jint pname, jobject params_buf) {
+    jint _exception = 0;
+    jarray _array = (jarray) 0;
+    jint _remaining;
+    GLfixed *params = (GLfixed *) 0;
+
+    params = (GLfixed *)getPointer(_env, params_buf, &_array, &_remaining);
+    glGetTexGenxvOES(
+        (GLenum)coord,
+        (GLenum)pname,
+        (GLfixed *)params
+    );
+    if (_array) {
+        releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE);
+    }
+}
+
+static const char *classPathName = "android/opengl/GLES11Ext";
+
+static JNINativeMethod methods[] = {
+{"_nativeClassInit", "()V", (void*)nativeClassInit },
+{"glBlendEquationSeparateOES", "(II)V", (void *) android_glBlendEquationSeparateOES__II },
+{"glBlendFuncSeparateOES", "(IIII)V", (void *) android_glBlendFuncSeparateOES__IIII },
+{"glBlendEquationOES", "(I)V", (void *) android_glBlendEquationOES__I },
+{"glDrawTexsOES", "(SSSSS)V", (void *) android_glDrawTexsOES__SSSSS },
+{"glDrawTexiOES", "(IIIII)V", (void *) android_glDrawTexiOES__IIIII },
+{"glDrawTexxOES", "(IIIII)V", (void *) android_glDrawTexxOES__IIIII },
+{"glDrawTexsvOES", "([SI)V", (void *) android_glDrawTexsvOES___3SI },
+{"glDrawTexsvOES", "(Ljava/nio/ShortBuffer;)V", (void *) android_glDrawTexsvOES__Ljava_nio_ShortBuffer_2 },
+{"glDrawTexivOES", "([II)V", (void *) android_glDrawTexivOES___3II },
+{"glDrawTexivOES", "(Ljava/nio/IntBuffer;)V", (void *) android_glDrawTexivOES__Ljava_nio_IntBuffer_2 },
+{"glDrawTexxvOES", "([II)V", (void *) android_glDrawTexxvOES___3II },
+{"glDrawTexxvOES", "(Ljava/nio/IntBuffer;)V", (void *) android_glDrawTexxvOES__Ljava_nio_IntBuffer_2 },
+{"glDrawTexfOES", "(FFFFF)V", (void *) android_glDrawTexfOES__FFFFF },
+{"glDrawTexfvOES", "([FI)V", (void *) android_glDrawTexfvOES___3FI },
+{"glDrawTexfvOES", "(Ljava/nio/FloatBuffer;)V", (void *) android_glDrawTexfvOES__Ljava_nio_FloatBuffer_2 },
+{"glEGLImageTargetTexture2DOES", "(ILjava/nio/Buffer;)V", (void *) android_glEGLImageTargetTexture2DOES__ILjava_nio_Buffer_2 },
+{"glEGLImageTargetRenderbufferStorageOES", "(ILjava/nio/Buffer;)V", (void *) android_glEGLImageTargetRenderbufferStorageOES__ILjava_nio_Buffer_2 },
+{"glAlphaFuncxOES", "(II)V", (void *) android_glAlphaFuncxOES__II },
+{"glClearColorxOES", "(IIII)V", (void *) android_glClearColorxOES__IIII },
+{"glClearDepthxOES", "(I)V", (void *) android_glClearDepthxOES__I },
+{"glClipPlanexOES", "(I[II)V", (void *) android_glClipPlanexOES__I_3II },
+{"glClipPlanexOES", "(ILjava/nio/IntBuffer;)V", (void *) android_glClipPlanexOES__ILjava_nio_IntBuffer_2 },
+{"glColor4xOES", "(IIII)V", (void *) android_glColor4xOES__IIII },
+{"glDepthRangexOES", "(II)V", (void *) android_glDepthRangexOES__II },
+{"glFogxOES", "(II)V", (void *) android_glFogxOES__II },
+{"glFogxvOES", "(I[II)V", (void *) android_glFogxvOES__I_3II },
+{"glFogxvOES", "(ILjava/nio/IntBuffer;)V", (void *) android_glFogxvOES__ILjava_nio_IntBuffer_2 },
+{"glFrustumxOES", "(IIIIII)V", (void *) android_glFrustumxOES__IIIIII },
+{"glGetClipPlanexOES", "(I[II)V", (void *) android_glGetClipPlanexOES__I_3II },
+{"glGetClipPlanexOES", "(ILjava/nio/IntBuffer;)V", (void *) android_glGetClipPlanexOES__ILjava_nio_IntBuffer_2 },
+{"glGetFixedvOES", "(I[II)V", (void *) android_glGetFixedvOES__I_3II },
+{"glGetFixedvOES", "(ILjava/nio/IntBuffer;)V", (void *) android_glGetFixedvOES__ILjava_nio_IntBuffer_2 },
+{"glGetLightxvOES", "(II[II)V", (void *) android_glGetLightxvOES__II_3II },
+{"glGetLightxvOES", "(IILjava/nio/IntBuffer;)V", (void *) android_glGetLightxvOES__IILjava_nio_IntBuffer_2 },
+{"glGetMaterialxvOES", "(II[II)V", (void *) android_glGetMaterialxvOES__II_3II },
+{"glGetMaterialxvOES", "(IILjava/nio/IntBuffer;)V", (void *) android_glGetMaterialxvOES__IILjava_nio_IntBuffer_2 },
+{"glGetTexEnvxvOES", "(II[II)V", (void *) android_glGetTexEnvxvOES__II_3II },
+{"glGetTexEnvxvOES", "(IILjava/nio/IntBuffer;)V", (void *) android_glGetTexEnvxvOES__IILjava_nio_IntBuffer_2 },
+{"glGetTexParameterxvOES", "(II[II)V", (void *) android_glGetTexParameterxvOES__II_3II },
+{"glGetTexParameterxvOES", "(IILjava/nio/IntBuffer;)V", (void *) android_glGetTexParameterxvOES__IILjava_nio_IntBuffer_2 },
+{"glLightModelxOES", "(II)V", (void *) android_glLightModelxOES__II },
+{"glLightModelxvOES", "(I[II)V", (void *) android_glLightModelxvOES__I_3II },
+{"glLightModelxvOES", "(ILjava/nio/IntBuffer;)V", (void *) android_glLightModelxvOES__ILjava_nio_IntBuffer_2 },
+{"glLightxOES", "(III)V", (void *) android_glLightxOES__III },
+{"glLightxvOES", "(II[II)V", (void *) android_glLightxvOES__II_3II },
+{"glLightxvOES", "(IILjava/nio/IntBuffer;)V", (void *) android_glLightxvOES__IILjava_nio_IntBuffer_2 },
+{"glLineWidthxOES", "(I)V", (void *) android_glLineWidthxOES__I },
+{"glLoadMatrixxOES", "([II)V", (void *) android_glLoadMatrixxOES___3II },
+{"glLoadMatrixxOES", "(Ljava/nio/IntBuffer;)V", (void *) android_glLoadMatrixxOES__Ljava_nio_IntBuffer_2 },
+{"glMaterialxOES", "(III)V", (void *) android_glMaterialxOES__III },
+{"glMaterialxvOES", "(II[II)V", (void *) android_glMaterialxvOES__II_3II },
+{"glMaterialxvOES", "(IILjava/nio/IntBuffer;)V", (void *) android_glMaterialxvOES__IILjava_nio_IntBuffer_2 },
+{"glMultMatrixxOES", "([II)V", (void *) android_glMultMatrixxOES___3II },
+{"glMultMatrixxOES", "(Ljava/nio/IntBuffer;)V", (void *) android_glMultMatrixxOES__Ljava_nio_IntBuffer_2 },
+{"glMultiTexCoord4xOES", "(IIIII)V", (void *) android_glMultiTexCoord4xOES__IIIII },
+{"glNormal3xOES", "(III)V", (void *) android_glNormal3xOES__III },
+{"glOrthoxOES", "(IIIIII)V", (void *) android_glOrthoxOES__IIIIII },
+{"glPointParameterxOES", "(II)V", (void *) android_glPointParameterxOES__II },
+{"glPointParameterxvOES", "(I[II)V", (void *) android_glPointParameterxvOES__I_3II },
+{"glPointParameterxvOES", "(ILjava/nio/IntBuffer;)V", (void *) android_glPointParameterxvOES__ILjava_nio_IntBuffer_2 },
+{"glPointSizexOES", "(I)V", (void *) android_glPointSizexOES__I },
+{"glPolygonOffsetxOES", "(II)V", (void *) android_glPolygonOffsetxOES__II },
+{"glRotatexOES", "(IIII)V", (void *) android_glRotatexOES__IIII },
+{"glSampleCoveragexOES", "(IZ)V", (void *) android_glSampleCoveragexOES__IZ },
+{"glScalexOES", "(III)V", (void *) android_glScalexOES__III },
+{"glTexEnvxOES", "(III)V", (void *) android_glTexEnvxOES__III },
+{"glTexEnvxvOES", "(II[II)V", (void *) android_glTexEnvxvOES__II_3II },
+{"glTexEnvxvOES", "(IILjava/nio/IntBuffer;)V", (void *) android_glTexEnvxvOES__IILjava_nio_IntBuffer_2 },
+{"glTexParameterxOES", "(III)V", (void *) android_glTexParameterxOES__III },
+{"glTexParameterxvOES", "(II[II)V", (void *) android_glTexParameterxvOES__II_3II },
+{"glTexParameterxvOES", "(IILjava/nio/IntBuffer;)V", (void *) android_glTexParameterxvOES__IILjava_nio_IntBuffer_2 },
+{"glTranslatexOES", "(III)V", (void *) android_glTranslatexOES__III },
+{"glIsRenderbufferOES", "(I)Z", (void *) android_glIsRenderbufferOES__I },
+{"glBindRenderbufferOES", "(II)V", (void *) android_glBindRenderbufferOES__II },
+{"glDeleteRenderbuffersOES", "(I[II)V", (void *) android_glDeleteRenderbuffersOES__I_3II },
+{"glDeleteRenderbuffersOES", "(ILjava/nio/IntBuffer;)V", (void *) android_glDeleteRenderbuffersOES__ILjava_nio_IntBuffer_2 },
+{"glGenRenderbuffersOES", "(I[II)V", (void *) android_glGenRenderbuffersOES__I_3II },
+{"glGenRenderbuffersOES", "(ILjava/nio/IntBuffer;)V", (void *) android_glGenRenderbuffersOES__ILjava_nio_IntBuffer_2 },
+{"glRenderbufferStorageOES", "(IIII)V", (void *) android_glRenderbufferStorageOES__IIII },
+{"glGetRenderbufferParameterivOES", "(II[II)V", (void *) android_glGetRenderbufferParameterivOES__II_3II },
+{"glGetRenderbufferParameterivOES", "(IILjava/nio/IntBuffer;)V", (void *) android_glGetRenderbufferParameterivOES__IILjava_nio_IntBuffer_2 },
+{"glIsFramebufferOES", "(I)Z", (void *) android_glIsFramebufferOES__I },
+{"glBindFramebufferOES", "(II)V", (void *) android_glBindFramebufferOES__II },
+{"glDeleteFramebuffersOES", "(I[II)V", (void *) android_glDeleteFramebuffersOES__I_3II },
+{"glDeleteFramebuffersOES", "(ILjava/nio/IntBuffer;)V", (void *) android_glDeleteFramebuffersOES__ILjava_nio_IntBuffer_2 },
+{"glGenFramebuffersOES", "(I[II)V", (void *) android_glGenFramebuffersOES__I_3II },
+{"glGenFramebuffersOES", "(ILjava/nio/IntBuffer;)V", (void *) android_glGenFramebuffersOES__ILjava_nio_IntBuffer_2 },
+{"glCheckFramebufferStatusOES", "(I)I", (void *) android_glCheckFramebufferStatusOES__I },
+{"glFramebufferRenderbufferOES", "(IIII)V", (void *) android_glFramebufferRenderbufferOES__IIII },
+{"glFramebufferTexture2DOES", "(IIIII)V", (void *) android_glFramebufferTexture2DOES__IIIII },
+{"glGetFramebufferAttachmentParameterivOES", "(III[II)V", (void *) android_glGetFramebufferAttachmentParameterivOES__III_3II },
+{"glGetFramebufferAttachmentParameterivOES", "(IIILjava/nio/IntBuffer;)V", (void *) android_glGetFramebufferAttachmentParameterivOES__IIILjava_nio_IntBuffer_2 },
+{"glGenerateMipmapOES", "(I)V", (void *) android_glGenerateMipmapOES__I },
+{"glCurrentPaletteMatrixOES", "(I)V", (void *) android_glCurrentPaletteMatrixOES__I },
+{"glLoadPaletteFromModelViewMatrixOES", "()V", (void *) android_glLoadPaletteFromModelViewMatrixOES__ },
+{"glMatrixIndexPointerOES", "(IIILjava/nio/Buffer;)V", (void *) android_glMatrixIndexPointerOES__IIILjava_nio_Buffer_2 },
+{"glWeightPointerOES", "(IIILjava/nio/Buffer;)V", (void *) android_glWeightPointerOES__IIILjava_nio_Buffer_2 },
+{"glDepthRangefOES", "(FF)V", (void *) android_glDepthRangefOES__FF },
+{"glFrustumfOES", "(FFFFFF)V", (void *) android_glFrustumfOES__FFFFFF },
+{"glOrthofOES", "(FFFFFF)V", (void *) android_glOrthofOES__FFFFFF },
+{"glClipPlanefOES", "(I[FI)V", (void *) android_glClipPlanefOES__I_3FI },
+{"glClipPlanefOES", "(ILjava/nio/FloatBuffer;)V", (void *) android_glClipPlanefOES__ILjava_nio_FloatBuffer_2 },
+{"glGetClipPlanefOES", "(I[FI)V", (void *) android_glGetClipPlanefOES__I_3FI },
+{"glGetClipPlanefOES", "(ILjava/nio/FloatBuffer;)V", (void *) android_glGetClipPlanefOES__ILjava_nio_FloatBuffer_2 },
+{"glClearDepthfOES", "(F)V", (void *) android_glClearDepthfOES__F },
+{"glTexGenfOES", "(IIF)V", (void *) android_glTexGenfOES__IIF },
+{"glTexGenfvOES", "(II[FI)V", (void *) android_glTexGenfvOES__II_3FI },
+{"glTexGenfvOES", "(IILjava/nio/FloatBuffer;)V", (void *) android_glTexGenfvOES__IILjava_nio_FloatBuffer_2 },
+{"glTexGeniOES", "(III)V", (void *) android_glTexGeniOES__III },
+{"glTexGenivOES", "(II[II)V", (void *) android_glTexGenivOES__II_3II },
+{"glTexGenivOES", "(IILjava/nio/IntBuffer;)V", (void *) android_glTexGenivOES__IILjava_nio_IntBuffer_2 },
+{"glTexGenxOES", "(III)V", (void *) android_glTexGenxOES__III },
+{"glTexGenxvOES", "(II[II)V", (void *) android_glTexGenxvOES__II_3II },
+{"glTexGenxvOES", "(IILjava/nio/IntBuffer;)V", (void *) android_glTexGenxvOES__IILjava_nio_IntBuffer_2 },
+{"glGetTexGenfvOES", "(II[FI)V", (void *) android_glGetTexGenfvOES__II_3FI },
+{"glGetTexGenfvOES", "(IILjava/nio/FloatBuffer;)V", (void *) android_glGetTexGenfvOES__IILjava_nio_FloatBuffer_2 },
+{"glGetTexGenivOES", "(II[II)V", (void *) android_glGetTexGenivOES__II_3II },
+{"glGetTexGenivOES", "(IILjava/nio/IntBuffer;)V", (void *) android_glGetTexGenivOES__IILjava_nio_IntBuffer_2 },
+{"glGetTexGenxvOES", "(II[II)V", (void *) android_glGetTexGenxvOES__II_3II },
+{"glGetTexGenxvOES", "(IILjava/nio/IntBuffer;)V", (void *) android_glGetTexGenxvOES__IILjava_nio_IntBuffer_2 },
+};
+
+int register_android_opengl_jni_GLES11Ext(JNIEnv *_env)
+{
+    int err;
+    err = android::AndroidRuntime::registerNativeMethods(_env, classPathName, methods, NELEM(methods));
+    return err;
+}
diff --git a/core/jni/android_util_Process.cpp b/core/jni/android_util_Process.cpp
index bd56605..d760feb 100644
--- a/core/jni/android_util_Process.cpp
+++ b/core/jni/android_util_Process.cpp
@@ -50,6 +50,16 @@
 #undef __KERNEL__
 #endif
 
+#define ENABLE_CGROUP_ERR_LOGGING 0
+
+/*
+ * List of cgroup names which map to ANDROID_TGROUP_ values in Thread.h
+ * and Process.java
+ * These names are used to construct the path to the cgroup control dir
+ */
+
+static const char *cgroup_names[] = { NULL, "bg_non_interactive", "fg_boost" };
+
 using namespace android;
 
 static void signalExceptionForPriorityError(JNIEnv* env, jobject obj, int err)
@@ -73,6 +83,28 @@
     }
 }
 
+static void signalExceptionForGroupError(JNIEnv* env, jobject obj, int err)
+{
+    switch (err) {
+        case EINVAL:
+            jniThrowException(env, "java/lang/IllegalArgumentException", NULL);
+            break;
+        case ESRCH:
+            jniThrowException(env, "java/lang/IllegalArgumentException", "Given thread does not exist");
+            break;
+        case EPERM:
+            jniThrowException(env, "java/lang/SecurityException", "No permission to modify given thread");
+            break;
+        case EACCES:
+            jniThrowException(env, "java/lang/SecurityException", "No permission to set to given group");
+            break;
+        default:
+            jniThrowException(env, "java/lang/RuntimeException", "Unknown error");
+            break;
+    }
+}
+
+
 static void fakeProcessEntry(void* arg)
 {
     String8* cls = (String8*)arg;
@@ -164,9 +196,55 @@
     return -1;
 }
 
+static int add_pid_to_cgroup(int pid, int grp)
+{
+    FILE *fp;
+    char path[255];
+    int rc;
+
+    sprintf(path, "/dev/cpuctl/%s/tasks", (cgroup_names[grp] ? cgroup_names[grp] : ""));
+
+    if (!(fp = fopen(path, "w"))) {
+#if ENABLE_CGROUP_ERR_LOGGING
+        LOGW("Unable to open %s (%s)\n", path, strerror(errno));
+#endif
+        return -errno;
+    }
+
+    rc = fprintf(fp, "%d", pid);
+    fclose(fp);
+
+    if (rc < 0) {
+#if ENABLE_CGROUP_ERR_LOGGING
+        LOGW("Unable to move pid %d to cgroup %s (%s)\n", pid,
+             (cgroup_names[grp] ? cgroup_names[grp] : "<default>"),
+             strerror(errno));
+#endif
+    }
+
+    return (rc < 0) ? errno : 0;
+}
+
+void android_os_Process_setThreadGroup(JNIEnv* env, jobject clazz, int pid, jint grp)
+{
+    if (grp > ANDROID_TGROUP_MAX || grp < 0) { 
+        signalExceptionForGroupError(env, clazz, EINVAL);
+        return;
+    }
+
+    if (add_pid_to_cgroup(pid, grp))
+        signalExceptionForGroupError(env, clazz, errno);
+}
+
 void android_os_Process_setThreadPriority(JNIEnv* env, jobject clazz,
                                               jint pid, jint pri)
 {
+    if (pri == ANDROID_PRIORITY_BACKGROUND) {
+        add_pid_to_cgroup(pid, ANDROID_TGROUP_BG_NONINTERACT);
+    } else if (getpriority(PRIO_PROCESS, pid) == ANDROID_PRIORITY_BACKGROUND) {
+        add_pid_to_cgroup(pid, ANDROID_TGROUP_DEFAULT);
+    }
+
     if (setpriority(PRIO_PROCESS, pid, pri) < 0) {
         signalExceptionForPriorityError(env, clazz, errno);
     }
@@ -741,6 +819,7 @@
     {"setThreadPriority",   "(II)V", (void*)android_os_Process_setThreadPriority},
     {"setThreadPriority",   "(I)V", (void*)android_os_Process_setCallingThreadPriority},
     {"getThreadPriority",   "(I)I", (void*)android_os_Process_getThreadPriority},
+    {"setThreadGroup",      "(II)V", (void*)android_os_Process_setThreadGroup},
     {"setOomAdj",   "(II)Z", (void*)android_os_Process_setOomAdj},
     {"setArgV0",    "(Ljava/lang/String;)V", (void*)android_os_Process_setArgV0},
     {"setUid", "(I)I", (void*)android_os_Process_setUid},
diff --git a/core/jni/com_google_android_gles_jni_GLImpl.cpp b/core/jni/com_google_android_gles_jni_GLImpl.cpp
index 9b09c9b..4ca79b5 100644
--- a/core/jni/com_google_android_gles_jni_GLImpl.cpp
+++ b/core/jni/com_google_android_gles_jni_GLImpl.cpp
@@ -45,7 +45,7 @@
 
 /* Cache method IDs each time the class is loaded. */
 
-void
+static void
 nativeClassInitBuffer(JNIEnv *_env)
 {
     jclass nioAccessClassLocal = _env->FindClass("java/nio/NIOAccess");
@@ -1654,6 +1654,7 @@
 #include <string.h>
 
 /* const GLubyte * glGetString ( GLenum name ) */
+static
 jstring
 android_glGetString
   (JNIEnv *_env, jobject _this, jint name) {
diff --git a/core/res/AndroidManifest.xml b/core/res/AndroidManifest.xml
index 9f6ebed..caa1318 100644
--- a/core/res/AndroidManifest.xml
+++ b/core/res/AndroidManifest.xml
@@ -366,6 +366,23 @@
         android:label="@string/permlab_readPhoneState"
         android:description="@string/permdesc_readPhoneState" />
 
+    <!-- ================================== -->
+    <!-- Permissions for sdcard interaction -->
+    <!-- ================================== -->
+    <eat-comment />
+
+    <!-- Group of permissions that are related to SD card access. -->
+    <permission-group android:name="android.permission-group.STORAGE"
+        android:label="@string/permgrouplab_storage"
+        android:description="@string/permgroupdesc_storage" />
+
+    <!-- Allows an application to write to the SD card -->
+    <permission android:name="android.permission.SDCARD_WRITE"
+        android:permissionGroup="android.permission-group.STORAGE"
+        android:label="@string/permlab_sdcardWrite"
+        android:description="@string/permdesc_sdcardWrite"
+        android:protectionLevel="normal" />
+
     <!-- ============================================ -->
     <!-- Permissions for low-level system interaction -->
     <!-- ============================================ -->
diff --git a/core/res/res/drawable/search_plate_global.9.png b/core/res/res/drawable/search_plate_global.9.png
index 126054b..1cad902 100644
--- a/core/res/res/drawable/search_plate_global.9.png
+++ b/core/res/res/drawable/search_plate_global.9.png
Binary files differ
diff --git a/core/res/res/layout/search_bar.xml b/core/res/res/layout/search_bar.xml
index 6155626..5db0737 100644
--- a/core/res/res/layout/search_bar.xml
+++ b/core/res/res/layout/search_bar.xml
@@ -22,11 +22,9 @@
     android:id="@+id/search_bar"
     android:layout_width="fill_parent"
     android:layout_height="fill_parent"
-    android:paddingBottom="200dip"
-    android:orientation="vertical" 
+    android:orientation="vertical"
     android:focusable="true"
     android:descendantFocusability="afterDescendants">
-    <!-- android:paddingBottom="200dip"  TODO MUST FIX - it's a hack to get the popup to show -->
 
     <!-- Outer layout defines the entire search bar at the top of the screen -->
     <LinearLayout
@@ -50,13 +48,21 @@
             android:textAppearance="?android:attr/textAppearanceSmall"
             android:textColor="?android:attr/textColorPrimaryInverse" />
 
-        <!-- Inner layout contains the button(s) and EditText -->
+        <!-- Inner layout contains the app icon, button(s) and EditText -->
         <LinearLayout
             android:id="@+id/search_edit_frame"
             android:layout_width="fill_parent"
             android:layout_height="wrap_content"
             android:orientation="horizontal">
             
+            <ImageView
+                android:id="@+id/search_app_icon"
+                android:layout_height="36dip"
+                android:layout_width="36dip"
+                android:layout_marginRight="7dip"
+                android:layout_gravity="center_vertical"
+            />
+
             <view class="android.app.SearchDialog$SearchAutoComplete"
                 android:id="@+id/search_src_text"
                 android:background="@drawable/textfield_search"
@@ -71,7 +77,7 @@
                 android:dropDownAnchor="@id/search_plate"
                 android:dropDownVerticalOffset="-9dip"
                 android:popupBackground="@android:drawable/search_dropdown_background"
-                />
+            />
                 
             <!-- This button can switch between text and icon "modes" -->
             <Button 
diff --git a/core/res/res/values/strings.xml b/core/res/res/values/strings.xml
index 8150a96..c35676c 100644
--- a/core/res/res/values/strings.xml
+++ b/core/res/res/values/strings.xml
@@ -335,6 +335,11 @@
     <string name="permgroupdesc_developmentTools">Features only needed for
         application developers.</string>
 
+    <!-- Title of a category of application permissions, listed so the user can choose whether they want to allow the application to do this. -->
+    <string name="permgrouplab_storage">Storage</string>
+    <!-- Description of a category of application permissions, listed so the user can choose whether they want to allow the application to do this. -->
+    <string name="permgroupdesc_storage">Access the SD card.</string>
+
     <!--  Permissions -->
 
     <!-- Title of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
@@ -1045,6 +1050,11 @@
     <string name="permdesc_writeDictionary">Allows an application to write new words into the
       user dictionary.</string>
 
+    <!-- Title of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
+    <string name="permlab_sdcardWrite">write to SD card</string>
+    <!-- Description of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
+    <string name="permdesc_sdcardWrite">Allows an application to write to the SD card.</string>
+
     <!-- The order of these is important, don't reorder without changing Contacts.java --> <skip />
     <!-- Phone number types from android.provider.Contacts. This could be used when adding a new phone number for a contact, for example. -->
     <string-array name="phoneTypes">
diff --git a/data/etc/platform.xml b/data/etc/platform.xml
index b13a292..f80bd6b 100644
--- a/data/etc/platform.xml
+++ b/data/etc/platform.xml
@@ -54,6 +54,10 @@
         <group gid="log" />
     </permission>
 
+    <permission name="android.permission.SDCARD_WRITE" >
+        <group gid="sdcard_rw" />
+    </permission>
+
     <!-- The group that /cache belongs to, linked to the permission
          set on the applications that can access /cache -->
     <permission name="android.permission.ACCESS_CACHE_FILESYSTEM" >
diff --git a/graphics/java/android/graphics/BitmapFactory.java b/graphics/java/android/graphics/BitmapFactory.java
index 3813d8f..9e88d7e 100644
--- a/graphics/java/android/graphics/BitmapFactory.java
+++ b/graphics/java/android/graphics/BitmapFactory.java
@@ -103,6 +103,36 @@
         public boolean inScaled;
 
         /**
+         * If this is set to true, then the resulting bitmap will allocate its
+         * pixels such that they can be purged if the system needs to reclaim
+         * memory. In that instance, when the pixels need to be accessed again
+         * (e.g. the bitmap is drawn, getPixels() is called), they will be
+         * automatically re-decoded.
+         *
+         * For the re-decode to happen, the bitmap must have access to the
+         * encoded data, either by sharing a reference to the input
+         * or by making a copy of it. This distinction is controlled by
+         * inInputShareable. If this is true, then the bitmap may keep a shallow
+         * reference to the input. If this is false, then the bitmap will
+         * explicitly make a copy of the input data, and keep that. Even if
+         * sharing is allowed, the implementation may still decide to make a
+         * deep copy of the input data.
+         *
+         * @hide pending API council approval
+         */
+        public boolean inPurgeable;
+
+        /**
+         * This field works in conjuction with inPurgeable. If inPurgeable is
+         * false, then this field is ignored. If inPurgeable is true, then this
+         * field determines whether the bitmap can share a reference to the
+         * input data (inputstream, array, etc.) or if it must make a deep copy.
+         *
+         * @hide pending API council approval
+         */
+        public boolean inInputShareable;
+
+        /**
          * The resulting width of the bitmap, set independent of the state of
          * inJustDecodeBounds. However, if there is an error trying to decode,
          * outWidth will be set to -1.
diff --git a/graphics/java/android/graphics/Canvas.java b/graphics/java/android/graphics/Canvas.java
index 32ecd9f..06d53e3 100644
--- a/graphics/java/android/graphics/Canvas.java
+++ b/graphics/java/android/graphics/Canvas.java
@@ -112,7 +112,9 @@
      * on behalf of the Canvas. Any subsequent drawing with a GL-backed Canvas
      * will have to recreate those resources.
      */
-    public static native void freeGlCaches();
+    public static void freeGlCaches() {
+        freeCaches();
+    }
         
     /**
      * Specify a bitmap for the canvas to draw into.
@@ -1405,6 +1407,14 @@
         finalizer(mNativeCanvas);
     }
 
+    /**
+     * Free up as much memory as possible from private caches (e.g. fonts,
+     * images)
+     *
+     * @hide - for now
+     */
+    public static native void freeCaches();
+
     private static native int initRaster(int nativeBitmapOrZero);
     private static native int initGL();
     private static native void native_setBitmap(int nativeCanvas, int bitmap);
diff --git a/graphics/java/android/graphics/Matrix.java b/graphics/java/android/graphics/Matrix.java
index 2681eae..f549900 100644
--- a/graphics/java/android/graphics/Matrix.java
+++ b/graphics/java/android/graphics/Matrix.java
@@ -16,6 +16,8 @@
 
 package android.graphics;
 
+import java.io.PrintWriter;
+
 
 /**
  * The Matrix class holds a 3x3 matrix for transforming coordinates.
@@ -539,17 +541,49 @@
     }
 
     public String toString() {
-        return "Matrix{" + toShortString() + "}";
+        StringBuilder sb = new StringBuilder(64);
+        sb.append("Matrix{");
+        toShortString(sb);
+        sb.append('}');
+        return sb.toString();
                 
     }
 
     public String toShortString() {
+        StringBuilder sb = new StringBuilder(64);
+        toShortString(sb);
+        return sb.toString();
+    }
+
+    /**
+     * @hide
+     */
+    public void toShortString(StringBuilder sb) {
         float[] values = new float[9];
         getValues(values);
-        return "[" +
-                values[0] + ", " + values[1] + ", " + values[2] + "][" +
-                values[3] + ", " + values[4] + ", " + values[5] + "][" +
-                values[6] + ", " + values[7] + ", " + values[8] + "]";
+        sb.append('[');
+        sb.append(values[0]); sb.append(", "); sb.append(values[1]); sb.append(", ");
+        sb.append(values[2]); sb.append("][");
+        sb.append(values[3]); sb.append(", "); sb.append(values[4]); sb.append(", ");
+        sb.append(values[5]); sb.append("][");
+        sb.append(values[6]); sb.append(", "); sb.append(values[7]); sb.append(", ");
+        sb.append(values[8]); sb.append(']');
+    }
+
+    /**
+     * Print short string, to optimize dumping.
+     * @hide
+     */
+    public void printShortString(PrintWriter pw) {
+        float[] values = new float[9];
+        getValues(values);
+        pw.print('[');
+        pw.print(values[0]); pw.print(", "); pw.print(values[1]); pw.print(", ");
+                pw.print(values[2]); pw.print("][");
+        pw.print(values[3]); pw.print(", "); pw.print(values[4]); pw.print(", ");
+                pw.print(values[5]); pw.print("][");
+        pw.print(values[6]); pw.print(", "); pw.print(values[7]); pw.print(", ");
+                pw.print(values[8]); pw.print(']');
                 
     }
 
diff --git a/graphics/java/android/graphics/Rect.java b/graphics/java/android/graphics/Rect.java
index dda37e5..50ab566 100644
--- a/graphics/java/android/graphics/Rect.java
+++ b/graphics/java/android/graphics/Rect.java
@@ -19,6 +19,8 @@
 import android.os.Parcel;
 import android.os.Parcelable;
 
+import java.io.PrintWriter;
+
 /**
  * Rect holds four integer coordinates for a rectangle. The rectangle is
  * represented by the coordinates of its 4 edges (left, top, right bottom).
@@ -78,14 +80,40 @@
     }
 
     public String toString() {
-        return "Rect(" + left + ", " + top + " - " + right + ", " + bottom + ")";
+        StringBuilder sb = new StringBuilder(32);
+        sb.append("Rect("); sb.append(left); sb.append(", ");
+        sb.append(top); sb.append(" - "); sb.append(right);
+        sb.append(", "); sb.append(bottom); sb.append(")");
+        return sb.toString();
     }
 
     /**
      * Return a string representation of the rectangle in a compact form.
      */
     public String toShortString() {
-        return "[" + left + "," + top + "][" + right + "," + bottom + "]";
+        return toShortString(new StringBuilder(32));
+    }
+    
+    /**
+     * Return a string representation of the rectangle in a compact form.
+     * @hide
+     */
+    public String toShortString(StringBuilder sb) {
+        sb.setLength(0);
+        sb.append('['); sb.append(left); sb.append(',');
+        sb.append(top); sb.append("]["); sb.append(right);
+        sb.append(','); sb.append(bottom); sb.append(']');
+        return sb.toString();
+    }
+    
+    /**
+     * Print short representation to given writer.
+     * @hide
+     */
+    public void printShortString(PrintWriter pw) {
+        pw.print('['); pw.print(left); pw.print(',');
+        pw.print(top); pw.print("]["); pw.print(right);
+        pw.print(','); pw.print(bottom); pw.print(']');
     }
     
     /**
diff --git a/graphics/java/android/graphics/drawable/Drawable.java b/graphics/java/android/graphics/drawable/Drawable.java
index 42e28e8..f0d49f5 100644
--- a/graphics/java/android/graphics/drawable/Drawable.java
+++ b/graphics/java/android/graphics/drawable/Drawable.java
@@ -38,32 +38,32 @@
  * dealing with an underlying visual resource that may take a variety of forms.
  * Unlike a {@link android.view.View}, a Drawable does not have any facility to
  * receive events or otherwise interact with the user.
- * 
+ *
  * <p>In addition to simple drawing, Drawable provides a number of generic
  * mechanisms for its client to interact with what is being drawn:
- * 
+ *
  * <ul>
  *     <li> The {@link #setBounds} method <var>must</var> be called to tell the
  *     Drawable where it is drawn and how large it should be.  All Drawables
  *     should respect the requested size, often simply by scaling their
  *     imagery.  A client can find the preferred size for some Drawables with
  *     the {@link #getIntrinsicHeight} and {@link #getIntrinsicWidth} methods.
- * 
+ *
  *     <li> The {@link #getPadding} method can return from some Drawables
  *     information about how to frame content that is placed inside of them.
  *     For example, a Drawable that is intended to be the frame for a button
  *     widget would need to return padding that correctly places the label
  *     inside of itself.
- * 
+ *
  *     <li> The {@link #setState} method allows the client to tell the Drawable
  *     in which state it is to be drawn, such as "focused", "selected", etc.
  *     Some drawables may modify their imagery based on the selected state.
- * 
+ *
  *     <li> The {@link #setLevel} method allows the client to supply a single
  *     continuous controller that can modify the Drawable is displayed, such as
  *     a battery level or progress level.  Some drawables may modify their
  *     imagery based on the current level.
- * 
+ *
  *     <li> A Drawable can perform animations by calling back to its client
  *     through the {@link Callback} interface.  All clients should support this
  *     interface (via {@link #setCallback}) so that animations will work.  A
@@ -71,7 +71,7 @@
  *     {@link android.view.View#setBackgroundDrawable(Drawable)} and
  *     {@link android.widget.ImageView}.
  * </ul>
- * 
+ *
  * Though usually not visible to the application, Drawables may take a variety
  * of forms:
  *
@@ -96,11 +96,12 @@
  * and Internationalization</a>.
  */
 public abstract class Drawable {
+    private static final Rect ZERO_BOUNDS_RECT = new Rect();
 
     private int[] mStateSet = StateSet.WILD_CARD;
     private int mLevel = 0;
     private int mChangingConfigurations = 0;
-    private Rect mBounds = new Rect();
+    private Rect mBounds = ZERO_BOUNDS_RECT;
     /*package*/ Callback mCallback = null;
     private boolean mVisible = true;
 
@@ -118,14 +119,18 @@
      */
     public void setBounds(int left, int top, int right, int bottom) {
         Rect oldBounds = mBounds;
-        
+
+        if (oldBounds == ZERO_BOUNDS_RECT) {
+            oldBounds = mBounds = new Rect();
+        }
+
         if (oldBounds.left != left || oldBounds.top != top ||
                 oldBounds.right != right || oldBounds.bottom != bottom) {
             mBounds.set(left, top, right, bottom);
             onBoundsChange(mBounds);
         }
     }
-    
+
     /**
      * Specify a bounding rectangle for the Drawable. This is where the drawable
      * will draw when its draw() method is called.
@@ -145,12 +150,12 @@
     public final void copyBounds(Rect bounds) {
         bounds.set(mBounds);
     }
-    
+
     /**
      * Return a copy of the drawable's bounds in a new Rect. This returns the
      * same values as getBounds(), but the returned object is guaranteed to not
      * be changed later by the drawable (i.e. it retains no reference to this
-     * rect). If the caller already has a Rect allocated, call copyBounds(rect)
+     * rect). If the caller already has a Rect allocated, call copyBounds(rect).
      *
      * @return A copy of the drawable's bounds
      */
@@ -163,27 +168,37 @@
      * object may be the same object stored in the drawable (though this is not
      * guaranteed), so if a persistent copy of the bounds is needed, call
      * copyBounds(rect) instead.
+     * You should also not change the object returned by this method as it may
+     * be the same object stored in the drawable.
      *
      * @return The bounds of the drawable (which may change later, so caller
-     *         beware).
+     *         beware). DO NOT ALTER the returned object as it may change the
+     *         stored bounds of this drawable.
+     *
+     * @see #copyBounds()
+     * @see #copyBounds(android.graphics.Rect) 
      */
     public final Rect getBounds() {
+        if (mBounds == ZERO_BOUNDS_RECT) {
+            mBounds = new Rect();
+        }
+
         return mBounds;
     }
 
     /**
      * Set a mask of the configuration parameters for which this drawable
      * may change, requiring that it be re-created.
-     * 
+     *
      * @param configs A mask of the changing configuration parameters, as
      * defined by {@link android.content.res.Configuration}.
-     * 
+     *
      * @see android.content.res.Configuration
      */
     public void setChangingConfigurations(int configs) {
         mChangingConfigurations = configs;
     }
-    
+
     /**
      * Return a mask of the configuration parameters for which this drawable
      * mau change, requiring that it be re-created.  The default implementation
@@ -191,23 +206,23 @@
      * {@link #setChangingConfigurations(int)} or 0 by default.  Subclasses
      * may extend this to or in the changing configurations of any other
      * drawables they hold.
-     * 
+     *
      * @return Returns a mask of the changing configuration parameters, as
      * defined by {@link android.content.res.Configuration}.
-     * 
+     *
      * @see android.content.res.Configuration
      */
     public int getChangingConfigurations() {
         return mChangingConfigurations;
     }
-    
+
     /**
      * Set to true to have the drawable dither its colors when drawn to a device
      * with fewer than 8-bits per color component. This can improve the look on
      * those devices, but can also slow down the drawing a little.
      */
     public void setDither(boolean dither) {}
-    
+
     /**
      * Set to true to have the drawable filter its bitmap when scaled or rotated
      * (for drawables that use bitmaps). If the drawable does not use bitmaps,
@@ -229,7 +244,7 @@
          * Called when the drawable needs to be redrawn.  A view at this point
          * should invalidate itself (or at least the part of itself where the
          * drawable appears).
-         * 
+         *
          * @param who The drawable that is requesting the update.
          */
         public void invalidateDrawable(Drawable who);
@@ -240,7 +255,7 @@
          * {@link android.os.Handler#postAtTime(Runnable, Object, long)} with
          * the parameters <var>(what, who, when)</var> to perform the
          * scheduling.
-         * 
+         *
          * @param who The drawable being scheduled.
          * @param what The action to execute.
          * @param when The time (in milliseconds) to run.  The timebase is
@@ -254,7 +269,7 @@
          * generally simply call
          * {@link android.os.Handler#removeCallbacks(Runnable, Object)} with
          * the parameters <var>(what, who)</var> to unschedule the drawable.
-         * 
+         *
          * @param who The drawable being unscheduled.
          * @param what The action being unscheduled.
          */
@@ -264,7 +279,7 @@
     /**
      * Bind a {@link Callback} object to this Drawable.  Required for clients
      * that want to support animated drawables.
-     * 
+     *
      * @param cb The client's Callback implementation.
      */
     public final void setCallback(Callback cb) {
@@ -275,7 +290,7 @@
      * Use the current {@link Callback} implementation to have this Drawable
      * redrawn.  Does nothing if there is no Callback attached to the
      * Drawable.
-     * 
+     *
      * @see Callback#invalidateDrawable
      */
     public void invalidateSelf()
@@ -289,10 +304,10 @@
      * Use the current {@link Callback} implementation to have this Drawable
      * scheduled.  Does nothing if there is no Callback attached to the
      * Drawable.
-     * 
+     *
      * @param what The action being scheduled.
      * @param when The time (in milliseconds) to run.
-     * 
+     *
      * @see Callback#scheduleDrawable
      */
     public void scheduleSelf(Runnable what, long when)
@@ -306,9 +321,9 @@
      * Use the current {@link Callback} implementation to have this Drawable
      * unscheduled.  Does nothing if there is no Callback attached to the
      * Drawable.
-     * 
+     *
      * @param what The runnable that you no longer want called.
-     * 
+     *
      * @see Callback#unscheduleDrawable
      */
     public void unscheduleSelf(Runnable what)
@@ -323,13 +338,13 @@
      * 255 means fully opaque.
      */
     public abstract void setAlpha(int alpha);
-    
+
     /**
      * Specify an optional colorFilter for the drawable. Pass null to remove
      * any filters.
     */
     public abstract void setColorFilter(ColorFilter cf);
-    
+
     /**
      * Specify a color and porterduff mode to be the colorfilter for this
      * drawable.
@@ -337,7 +352,7 @@
     public void setColorFilter(int color, PorterDuff.Mode mode) {
         setColorFilter(new PorterDuffColorFilter(color, mode));
     }
-    
+
     public void clearColorFilter() {
         setColorFilter(null);
     }
@@ -346,34 +361,34 @@
      * Indicates whether this view will change its appearance based on state.
      * Clients can use this to determine whether it is necessary to calculate
      * their state and call setState.
-     * 
+     *
      * @return True if this view changes its appearance based on state, false
      *         otherwise.
-     * 
+     *
      * @see #setState(int[])
      */
     public boolean isStateful() {
         return false;
     }
-    
+
     /**
      * Specify a set of states for the drawable. These are use-case specific,
      * so see the relevant documentation. As an example, the background for
      * widgets like Button understand the following states:
      * [{@link android.R.attr#state_focused},
      *  {@link android.R.attr#state_pressed}].
-     * 
+     *
      * <p>If the new state you are supplying causes the appearance of the
      * Drawable to change, then it is responsible for calling
      * {@link #invalidateSelf} in order to have itself redrawn, <em>and</em>
      * true will be returned from this function.
-     * 
+     *
      * <p>Note: The Drawable holds a reference on to <var>stateSet</var>
      * until a new state array is given to it, so you must not modify this
      * array during that time.</p>
-     * 
+     *
      * @param stateSet The new set of states to be displayed.
-     * 
+     *
      * @return Returns true if this change in state has caused the appearance
      * of the Drawable to change (hence requiring an invalidate), otherwise
      * returns false.
@@ -396,7 +411,7 @@
     public int[] getState() {
         return mStateSet;
     }
-    
+
     /**
      * @return The current drawable that will be used by this drawable. For simple drawables, this
      *         is just the drawable itself. For drawables that change state like
@@ -416,9 +431,9 @@
      * Drawable to change, then it is responsible for calling
      * {@link #invalidateSelf} in order to have itself redrawn, <em>and</em>
      * true will be returned from this function.
-     * 
+     *
      * @param level The new level, from 0 (minimum) to 10000 (maximum).
-     * 
+     *
      * @return Returns true if this change in level has caused the appearance
      * of the Drawable to change (hence requiring an invalidate), otherwise
      * returns false.
@@ -529,7 +544,7 @@
      * region; subclasses can optionally override this to return an actual
      * Region if they want to supply this optimization information, but it is
      * not required that they do so.
-     * 
+     *
      * @return Returns null if the Drawables has no transparent region to
      * report, else a Region holding the parts of the Drawable's bounds that
      * are transparent.
@@ -537,11 +552,11 @@
     public Region getTransparentRegion() {
         return null;
     }
-    
+
     /**
      * Override this in your subclass to change appearance if you recognize the
      * specified state.
-     * 
+     *
      * @return Returns true if the state change has caused the appearance of
      * the Drawable to change (that is, it needs to be drawn), else false
      * if it looks the same and there is no need to redraw it since its
@@ -577,13 +592,13 @@
     public int getIntrinsicHeight() {
         return -1;
     }
-    
+
     /**
      * Returns the minimum width suggested by this Drawable. If a View uses this
      * Drawable as a background, it is suggested that the View use at least this
      * value for its width. (There will be some scenarios where this will not be
      * possible.) This value should INCLUDE any padding.
-     * 
+     *
      * @return The minimum width suggested by this Drawable. If this Drawable
      *         doesn't have a suggested minimum width, 0 is returned.
      */
@@ -597,7 +612,7 @@
      * Drawable as a background, it is suggested that the View use at least this
      * value for its height. (There will be some scenarios where this will not be
      * possible.) This value should INCLUDE any padding.
-     * 
+     *
      * @return The minimum height suggested by this Drawable. If this Drawable
      *         doesn't have a suggested minimum height, 0 is returned.
      */
@@ -605,7 +620,7 @@
         final int intrinsicHeight = getIntrinsicHeight();
         return intrinsicHeight > 0 ? intrinsicHeight : 0;
     }
-    
+
     /**
      * Return in padding the insets suggested by this Drawable for placing
      * content inside the drawable's bounds. Positive values move toward the
@@ -643,7 +658,7 @@
 
     /**
      * Create a drawable from an inputstream
-     * 
+     *
      * @hide pending API council approval
      */
     public static Drawable createFromResourceStream(Resources res, TypedValue value,
diff --git a/include/media/AudioRecord.h b/include/media/AudioRecord.h
index 7164b78..6aa40d00 100644
--- a/include/media/AudioRecord.h
+++ b/include/media/AudioRecord.h
@@ -312,7 +312,6 @@
 
             bool processAudioBuffer(const sp<ClientRecordThread>& thread);
 
-    sp<IAudioFlinger>       mAudioFlinger;
     sp<IAudioRecord>        mAudioRecord;
     sp<IMemory>             mCblkMemory;
     sp<ClientRecordThread>  mClientRecordThread;
diff --git a/include/media/AudioTrack.h b/include/media/AudioTrack.h
index 7645978..ba0467c 100644
--- a/include/media/AudioTrack.h
+++ b/include/media/AudioTrack.h
@@ -383,7 +383,6 @@
 
             bool processAudioBuffer(const sp<AudioTrackThread>& thread);
 
-    sp<IAudioFlinger>       mAudioFlinger;
     sp<IAudioTrack>         mAudioTrack;
     sp<IMemory>             mCblkMemory;
     sp<AudioTrackThread>    mAudioTrackThread;
diff --git a/include/ui/Camera.h b/include/ui/Camera.h
index e593fea..fd851d9 100644
--- a/include/ui/Camera.h
+++ b/include/ui/Camera.h
@@ -78,8 +78,7 @@
 {
 public:
             // construct a camera client from an existing remote
-            Camera(const sp<ICamera>& camera);
-
+    static  sp<Camera>  create(const sp<ICamera>& camera);
     static  sp<Camera>  connect();
                         ~Camera();
             void        init();
diff --git a/include/utils/ResourceTypes.h b/include/utils/ResourceTypes.h
index d01d83f..9b8c302 100644
--- a/include/utils/ResourceTypes.h
+++ b/include/utils/ResourceTypes.h
@@ -988,119 +988,225 @@
         return diffs;
     }
     
-    // Return true if 'this' is more specific than 'o'.  Optionally, if
-    // 'requested' is null, then they will also be compared against the
-    // requested configuration and true will only be returned if 'this'
-    // is a better candidate than 'o' for the configuration.  This assumes that
-    // match() has already been used to remove any configurations that don't
-    // match the requested configuration at all; if they are not first filtered,
-    // non-matching results can be considered better than matching ones.
+    // Return true if 'this' is more specific than 'o'.
     inline bool
-    isBetterThan(const ResTable_config& o, const ResTable_config* requested = NULL) const {
+    isMoreSpecificThan(const ResTable_config& o) const {
         // The order of the following tests defines the importance of one
         // configuration parameter over another.  Those tests first are more
         // important, trumping any values in those following them.
-        if (imsi != 0 && (!requested || requested->imsi != 0)) {
-            if (mcc != 0 && (!requested || requested->mcc != 0)) {
-                if (o.mcc == 0) {
-                    return true;
-                }
+        if (imsi || o.imsi) {
+            if (mcc != o.mcc) {
+                if (!mcc) return false;
+                if (!o.mcc) return true;
             }
-            if (mnc != 0 && (!requested || requested->mnc != 0)) {
-                if (o.mnc == 0) {
-                    return true;
-                }
+
+            if (mnc != o.mnc) {
+                if (!mnc) return false;
+                if (!o.mnc) return true;
             }
         }
-        if (locale != 0 && (!requested || requested->locale != 0)) {
-            if (language[0] != 0 && (!requested || requested->language[0] != 0)) {
-                if (o.language[0] == 0) {
-                    return true;
-                }
+
+        if (locale || o.locale) {
+            if (language[0] != o.language[0]) {
+                if (!language[0]) return false;
+                if (!o.language[0]) return true;
             }
-            if (country[0] != 0 && (!requested || requested->country[0] != 0)) {
-                if (o.country[0] == 0) {
-                    return true;
-                }
+
+            if (country[0] != o.country[0]) {
+                if (!country[0]) return false;
+                if (!o.country[0]) return true;
             }
         }
-        if (screenType != 0 && (!requested || requested->screenType != 0)) {
-            if (orientation != 0 && (!requested || requested->orientation != 0)) {
-                if (o.orientation == 0) {
-                    return true;
-                }
+
+        if (screenType || o.screenType) {
+            if (orientation != o.orientation) {
+                if (!orientation) return false;
+                if (!o.orientation) return true;
             }
-            if (density != 0 && (!requested || requested->density != 0)) {
-                if (o.density == 0) {
-                    return true;
-                }
-            }
-            if (touchscreen != 0 && (!requested || requested->touchscreen != 0)) {
-                if (o.touchscreen == 0) {
-                    return true;
-                }
+
+            // density is never 'more specific'
+            // as the default just equals 160
+
+            if (touchscreen != o.touchscreen) {
+                if (!touchscreen) return false;
+                if (!o.touchscreen) return true;
             }
         }
-        if (input != 0 && (!requested || requested->input != 0)) {
-            const int keysHidden = inputFlags&MASK_KEYSHIDDEN;
-            const int reqKeysHidden = requested
-                    ? requested->inputFlags&MASK_KEYSHIDDEN : 0;
-            if (keysHidden != 0 && reqKeysHidden != 0) {
-                const int oKeysHidden = o.inputFlags&MASK_KEYSHIDDEN;
-                //LOGI("isBetterThan keysHidden: cur=%d, given=%d, config=%d\n",
-                //        keysHidden, oKeysHidden, reqKeysHidden);
-                if (oKeysHidden == 0) {
-                    //LOGI("Better because 0!");
-                    return true;
-                }
-                // For compatibility, we count KEYSHIDDEN_NO as being
-                // the same as KEYSHIDDEN_SOFT.  Here we disambiguate these
-                // may making an exact match more specific.
-                if (keysHidden == reqKeysHidden && oKeysHidden != reqKeysHidden) {
-                    // The current configuration is an exact match, and
-                    // the given one is not, so the current one is better.
-                    //LOGI("Better because other not same!");
-                    return true;
-                }
+
+        if (input || o.input) {
+            if (inputFlags != o.inputFlags) {
+                if (!(inputFlags & MASK_KEYSHIDDEN)) return false;
+                if (!(o.inputFlags & MASK_KEYSHIDDEN)) return true;
             }
-            if (keyboard != 0 && (!requested || requested->keyboard != 0)) {
-                if (o.keyboard == 0) {
-                    return true;
-                }
+
+            if (keyboard != o.keyboard) {
+                if (!keyboard) return false;
+                if (!o.keyboard) return true;
             }
-            if (navigation != 0 && (!requested || requested->navigation != 0)) {
-                if (o.navigation == 0) {
-                    return true;
-                }
+
+            if (navigation != o.navigation) {
+                if (!navigation) return false;
+                if (!o.navigation) return true;
             }
         }
-        if (screenSize != 0 && (!requested || requested->screenSize != 0)) {
-            if (screenWidth != 0 && (!requested || requested->screenWidth != 0)) {
-                if (o.screenWidth == 0) {
-                    return true;
-                }
+
+        if (screenSize || o.screenSize) {
+            if (screenWidth != o.screenWidth) {
+                if (!screenWidth) return false;
+                if (!o.screenWidth) return true;
             }
-            if (screenHeight != 0 && (!requested || requested->screenHeight != 0)) {
-                if (o.screenHeight == 0) {
-                    return true;
-                }
+
+            if (screenHeight != o.screenHeight) {
+                if (!screenHeight) return false;
+                if (!o.screenHeight) return true;
             }
         }
-        if (version != 0 && (!requested || requested->version != 0)) {
-            if (sdkVersion != 0 && (!requested || requested->sdkVersion != 0)) {
-                if (o.sdkVersion == 0) {
-                    return true;
-                }
+
+        if (version || o.version) {
+            if (sdkVersion != o.sdkVersion) {
+                if (!sdkVersion) return false;
+                if (!o.sdkVersion) return true;
             }
-            if (minorVersion != 0 && (!requested || requested->minorVersion != 0)) {
-                if (o.minorVersion == 0) {
-                    return true;
-                }
+
+            if (minorVersion != o.minorVersion) {
+                if (!minorVersion) return false;
+                if (!o.minorVersion) return true;
             }
         }
         return false;
     }
-    
+
+    // Return true if 'this' is a better match than 'o' for the 'requested'
+    // configuration.  This assumes that match() has already been used to
+    // remove any configurations that don't match the requested configuration
+    // at all; if they are not first filtered, non-matching results can be
+    // considered better than matching ones.
+    // The general rule per attribute: if the request cares about an attribute
+    // (it normally does), if the two (this and o) are equal it's a tie.  If
+    // they are not equal then one must be generic because only generic and
+    // '==requested' will pass the match() call.  So if this is not generic,
+    // it wins.  If this IS generic, o wins (return false).
+    inline bool
+    isBetterThan(const ResTable_config& o,
+            const ResTable_config* requested) const {
+        if (requested) {
+            if (imsi || o.imsi) {
+                if ((mcc != o.mcc) && requested->mcc) {
+                    return (mcc);
+                }
+
+                if ((mnc != o.mnc) && requested->mnc) {
+                    return (mnc);
+                }
+            }
+
+            if (locale || o.locale) {
+                if ((language[0] != o.language[0]) && requested->language[0]) {
+                    return (language[0]);
+                }
+
+                if ((country[0] != o.country[0]) && requested->country[0]) {
+                    return (country[0]);
+                }
+            }
+
+            if (screenType || o.screenType) {
+                if ((orientation != o.orientation) && requested->orientation) {
+                    return (orientation);
+                }
+
+                if (density != o.density) {
+                    // density is tough.  Any density is potentially useful
+                    // because the system will scale it.  Scaling down
+                    // is generally better than scaling up.
+                    // Default density counts as 160dpi (the system default)
+                    // TODO - remove 160 constants
+                    int h = (density?density:160);
+                    int l = (o.density?o.density:160);
+                    bool bImBigger = true;
+                    if (l > h) {
+                        int t = h;
+                        h = l;
+                        l = t;
+                        bImBigger = false;
+                    }
+ 
+                    int reqValue = (requested->density?requested->density:160);
+                    if (reqValue >= h) {
+                        // requested value higher than both l and h, give h
+                        return bImBigger;
+                    }
+                    if (l >= reqValue) {
+                        // requested value lower than both l and h, give l
+                        return !bImBigger;
+                    }
+                    // saying that scaling down is 2x better than up
+                    if (((2 * l) - reqValue) * h > reqValue * reqValue) {
+                        return !bImBigger;
+                    } else { 
+                        return bImBigger;
+                    }
+                }
+
+                if ((touchscreen != o.touchscreen) && requested->touchscreen) {
+                    return (touchscreen);
+                }
+            }
+
+            if (input || o.input) {
+                const int keysHidden = inputFlags & MASK_KEYSHIDDEN;
+                const int oKeysHidden = o.inputFlags & MASK_KEYSHIDDEN;
+                if (keysHidden != oKeysHidden) {
+                    const int reqKeysHidden =
+                            requested->inputFlags & MASK_KEYSHIDDEN;
+                    if (reqKeysHidden) {
+
+                        if (!keysHidden) return false;
+                        if (!oKeysHidden) return true;
+                        // For compatibility, we count KEYSHIDDEN_NO as being
+                        // the same as KEYSHIDDEN_SOFT.  Here we disambiguate
+                        // these by making an exact match more specific.
+                        if (reqKeysHidden == keysHidden) return true;
+                        if (reqKeysHidden == oKeysHidden) return false;
+                    }
+                }
+
+                if ((keyboard != o.keyboard) && requested->keyboard) {
+                    return (keyboard);
+                }
+
+                if ((navigation != o.navigation) && requested->navigation) {
+                    return (navigation);
+                }
+            }
+
+            if (screenSize || o.screenSize) {
+                if ((screenWidth != o.screenWidth) && requested->screenWidth) {
+                    return (screenWidth);
+                }
+
+                if ((screenHeight != o.screenHeight) &&
+                        requested->screenHeight) {
+                    return (screenHeight);
+                }
+            }
+
+            if (version || o.version) {
+                if ((sdkVersion != o.sdkVersion) && requested->sdkVersion) {
+                    return (sdkVersion);
+                }
+
+                if ((minorVersion != o.minorVersion) &&
+                        requested->minorVersion) {
+                    return (minorVersion);
+                }
+            }
+
+            return false;
+        }
+        return isMoreSpecificThan(o);
+    }
+
     // Return true if 'this' can be considered a match for the parameters in 
     // 'settings'.
     // Note this is asymetric.  A default piece of data will match every request
@@ -1137,8 +1243,7 @@
                 && orientation != settings.orientation) {
                 return false;
             }
-            // Density not taken into account, always match, no matter what
-            // density is specified for the resource
+            // density always matches - we can scale it.  See isBetterThan
             if (settings.touchscreen != 0 && touchscreen != 0
                 && touchscreen != settings.touchscreen) {
                 return false;
diff --git a/include/utils/threads.h b/include/utils/threads.h
index 8d8d46a..b320915 100644
--- a/include/utils/threads.h
+++ b/include/utils/threads.h
@@ -79,6 +79,13 @@
     ANDROID_PRIORITY_LESS_FAVORABLE = +1,
 };
 
+enum {
+    ANDROID_TGROUP_DEFAULT          = 0,
+    ANDROID_TGROUP_BG_NONINTERACT   = 1,
+    ANDROID_TGROUP_FG_BOOST         = 2,
+    ANDROID_TGROUP_MAX              = ANDROID_TGROUP_FG_BOOST,
+};
+
 // Create and run a new thread.
 extern int androidCreateThread(android_thread_func_t, void *);
 
diff --git a/libs/audioflinger/AudioFlinger.cpp b/libs/audioflinger/AudioFlinger.cpp
index d11e13a..b56221f 100644
--- a/libs/audioflinger/AudioFlinger.cpp
+++ b/libs/audioflinger/AudioFlinger.cpp
@@ -651,27 +651,30 @@
         return BAD_VALUE;
     }
 
-    mHardwareMixerThread->setStreamVolume(stream, value);
-#ifdef WITH_A2DP
-    mA2dpMixerThread->setStreamVolume(stream, value);
-#endif
-
     status_t ret = NO_ERROR;
     if (stream == AudioSystem::VOICE_CALL ||
         stream == AudioSystem::BLUETOOTH_SCO) {
-        
+        float hwValue;
         if (stream == AudioSystem::VOICE_CALL) {
-            value = (float)AudioSystem::logToLinear(value)/100.0f;
+            hwValue = (float)AudioSystem::logToLinear(value)/100.0f;
+            // offset value to reflect actual hardware volume that never reaches 0
+            // 1% corresponds roughly to first step in VOICE_CALL stream volume setting (see AudioService.java)
+            value = 0.01 + 0.99 * value;
         } else { // (type == AudioSystem::BLUETOOTH_SCO)
-            value = 1.0f;
+            hwValue = 1.0f;
         }
 
         AutoMutex lock(mHardwareLock);
         mHardwareStatus = AUDIO_SET_VOICE_VOLUME;
-        ret = mAudioHardware->setVoiceVolume(value);
+        ret = mAudioHardware->setVoiceVolume(hwValue);
         mHardwareStatus = AUDIO_HW_IDLE;
     }
 
+    mHardwareMixerThread->setStreamVolume(stream, value);
+#ifdef WITH_A2DP
+    mA2dpMixerThread->setStreamVolume(stream, value);
+#endif
+
     return ret;
 }
 
@@ -709,7 +712,14 @@
     if (uint32_t(stream) >= AudioSystem::NUM_STREAM_TYPES) {
         return 0.0f;
     }
-    return mHardwareMixerThread->streamVolume(stream);
+    
+    float volume = mHardwareMixerThread->streamVolume(stream); 
+    // remove correction applied by setStreamVolume()
+    if (stream == AudioSystem::VOICE_CALL) {
+        volume = (volume - 0.01) / 0.99 ;
+    }
+    
+    return volume;
 }
 
 bool AudioFlinger::streamMute(int stream) const
@@ -812,17 +822,12 @@
                 if (mForcedRoute == 0 && !(mSavedRoute & AudioSystem::ROUTE_SPEAKER)) {
                     LOGV("Route forced to Speaker ON %08x", mSavedRoute | AudioSystem::ROUTE_SPEAKER);
                     mHardwareMixerThread->setStreamMute(AudioSystem::MUSIC, true);
-                    mHardwareStatus = AUDIO_HW_SET_MASTER_VOLUME;
-                    mAudioHardware->setMasterVolume(0);
                     usleep(mHardwareMixerThread->latency()*1000);
                     mHardwareStatus = AUDIO_HW_SET_ROUTING;
                     mAudioHardware->setRouting(AudioSystem::MODE_NORMAL, mSavedRoute | AudioSystem::ROUTE_SPEAKER);
                     mHardwareStatus = AUDIO_HW_IDLE;
                     // delay track start so that audio hardware has time to siwtch routes
                     usleep(kStartSleepTime);
-                    mHardwareStatus = AUDIO_HW_SET_MASTER_VOLUME;
-                    mAudioHardware->setMasterVolume(mHardwareMixerThread->masterVolume());
-                    mHardwareStatus = AUDIO_HW_IDLE;
                 }
                 mForcedRoute = AudioSystem::ROUTE_SPEAKER;
             }
@@ -1480,18 +1485,6 @@
     return status;
 }
 
-// removeTrack_l() must be called with AudioFlinger::mLock held
-void AudioFlinger::MixerThread::removeTrack_l(wp<Track> track, int name)
-{
-    sp<Track> t = track.promote();
-    if (t!=NULL && (t->mState <= TrackBase::STOPPED)) {
-        t->reset();
-        deleteTrackName_l(name);
-        removeActiveTrack_l(track);
-        mAudioFlinger->mWaitWorkCV.broadcast();
-    }
-}
-
 // destroyTrack_l() must be called with AudioFlinger::mLock held
 void AudioFlinger::MixerThread::destroyTrack_l(const sp<Track>& track)
 {
@@ -1697,7 +1690,7 @@
 
     // Check validity of returned pointer in case the track control block would have been corrupted.
     if (bufferStart < mBuffer || bufferStart > bufferEnd || bufferEnd > mBufferEnd || 
-            cblk->channels == 2 && ((unsigned long)bufferStart & 3) ) {
+        (cblk->channels == 2 && ((unsigned long)bufferStart & 3))) {
         LOGE("TrackBase::getBuffer buffer out of range:\n    start: %p, end %p , mBuffer %p mBufferEnd %p\n    \
                 server %d, serverBase %d, user %d, userBase %d, channels %d",
                 bufferStart, bufferEnd, mBuffer, mBufferEnd,
@@ -1733,7 +1726,6 @@
     wp<Track> weak(this); // never create a strong ref from the dtor
     Mutex::Autolock _l(mMixerThread->mAudioFlinger->mLock);
     mState = TERMINATED;
-    mMixerThread->removeTrack_l(weak, mName);
 }
 
 void AudioFlinger::MixerThread::Track::destroy()
diff --git a/libs/audioflinger/AudioFlinger.h b/libs/audioflinger/AudioFlinger.h
index db5cc74..c7ca9ec 100644
--- a/libs/audioflinger/AudioFlinger.h
+++ b/libs/audioflinger/AudioFlinger.h
@@ -501,7 +501,6 @@
         MixerThread& operator = (const MixerThread&);
   
         status_t    addTrack_l(const sp<Track>& track);
-        void        removeTrack_l(wp<Track> track, int name);
         void        destroyTrack_l(const sp<Track>& track);
         int         getTrackName_l();
         void        deleteTrackName_l(int name);
diff --git a/libs/audioflinger/AudioHardwareInterface.cpp b/libs/audioflinger/AudioHardwareInterface.cpp
index ac76a19..cc1bd8f 100644
--- a/libs/audioflinger/AudioHardwareInterface.cpp
+++ b/libs/audioflinger/AudioHardwareInterface.cpp
@@ -53,7 +53,7 @@
     "EARPIECE ",
     "SPEAKER ",
     "BLUETOOTH ",
-    "HEADSET "
+    "HEADSET ",
     "BLUETOOTH_A2DP "
 };
 static const char* routeNone = "NONE";
diff --git a/libs/surfaceflinger/GPUHardware/GPUHardware.cpp b/libs/surfaceflinger/GPUHardware/GPUHardware.cpp
index eb75f99..7168bf2 100644
--- a/libs/surfaceflinger/GPUHardware/GPUHardware.cpp
+++ b/libs/surfaceflinger/GPUHardware/GPUHardware.cpp
@@ -573,7 +573,11 @@
 
 sp<GPUHardwareInterface> GPUFactory::getGPU()
 {
-    return new GPUHardware();
+    sp<GPUHardwareInterface> gpu;
+    if (access("/dev/hw3d", F_OK) == 0) {
+        gpu = new GPUHardware();
+    }
+    return gpu;
 }
 
 // ---------------------------------------------------------------------------
diff --git a/libs/surfaceflinger/Layer.cpp b/libs/surfaceflinger/Layer.cpp
index f65d669..96395a8 100644
--- a/libs/surfaceflinger/Layer.cpp
+++ b/libs/surfaceflinger/Layer.cpp
@@ -108,7 +108,7 @@
     // we always force a 4-byte aligned bpr.
     uint32_t alignment = 1;
 
-    if (flags & ISurfaceComposer::eGPU) {
+    if ((flags & ISurfaceComposer::eGPU) && (mFlinger->getGPU() != 0)) {
         // FIXME: this value should come from the h/w
         alignment = 8; 
         // FIXME: this is msm7201A specific, as its GPU only supports
diff --git a/libs/surfaceflinger/SurfaceFlinger.cpp b/libs/surfaceflinger/SurfaceFlinger.cpp
index de64f55..167a59b 100644
--- a/libs/surfaceflinger/SurfaceFlinger.cpp
+++ b/libs/surfaceflinger/SurfaceFlinger.cpp
@@ -241,6 +241,9 @@
 status_t SurfaceFlinger::requestGPU(const sp<IGPUCallback>& callback,
         gpu_info_t* gpu)
 {
+    if (mGPU == 0)
+        return INVALID_OPERATION;
+
     IPCThreadState* ipc = IPCThreadState::self();
     const int pid = ipc->getCallingPid();
     status_t err = mGPU->request(pid, callback, gpu);
@@ -249,6 +252,9 @@
 
 status_t SurfaceFlinger::revokeGPU()
 {
+    if (mGPU == 0)
+        return INVALID_OPERATION;
+
     return mGPU->friendlyRevoke();
 }
 
@@ -1600,10 +1606,14 @@
             }
             return NO_ERROR;
             case 1005: // ask GPU revoke
-                mGPU->friendlyRevoke();
+                if (mGPU != 0) {
+                    mGPU->friendlyRevoke();
+                }
                 return NO_ERROR;
             case 1006: // revoke GPU
-                mGPU->unconditionalRevoke();
+                if (mGPU != 0) {
+                    mGPU->unconditionalRevoke();
+                }
                 return NO_ERROR;
             case 1007: // set mFreezeCount
                 mFreezeCount = data.readInt32();
diff --git a/libs/surfaceflinger/VRamHeap.cpp b/libs/surfaceflinger/VRamHeap.cpp
index 0ccd71f..238c602 100644
--- a/libs/surfaceflinger/VRamHeap.cpp
+++ b/libs/surfaceflinger/VRamHeap.cpp
@@ -98,7 +98,7 @@
         }
     }
 
-    if (flags & ISurfaceComposer::eGPU) {
+    if ((flags & ISurfaceComposer::eGPU) && (mFlinger->getGPU() != 0)) {
         // FIXME: this is msm7201A specific, where gpu surfaces may not be secure
         if (!(flags & ISurfaceComposer::eSecure)) {
             // if GPU doesn't work, we try eHardware
diff --git a/libs/ui/Camera.cpp b/libs/ui/Camera.cpp
index b3cbda1..41577c4 100644
--- a/libs/ui/Camera.cpp
+++ b/libs/ui/Camera.cpp
@@ -64,15 +64,22 @@
     init();
 }
 
-Camera::Camera(const sp<ICamera>& camera)
+// construct a camera client from an existing camera remote
+sp<Camera> Camera::create(const sp<ICamera>& camera)
 {
-    init();
-    // connect this client to existing camera remote
-    if (camera->connect(this) == NO_ERROR) {
-        mStatus = NO_ERROR;
-        mCamera = camera;
-        camera->asBinder()->linkToDeath(this);
+     LOGV("create");
+     if (camera == 0) {
+         LOGE("camera remote is a NULL pointer");
+         return 0;
+     }
+
+    sp<Camera> c = new Camera();
+    if (camera->connect(c) == NO_ERROR) {
+        c->mStatus = NO_ERROR;
+        c->mCamera = camera;
+        camera->asBinder()->linkToDeath(c);
     }
+    return c;
 }
 
 void Camera::init()
diff --git a/libs/utils/ResourceTypes.cpp b/libs/utils/ResourceTypes.cpp
index 2ad3bfe..3d12dca 100644
--- a/libs/utils/ResourceTypes.cpp
+++ b/libs/utils/ResourceTypes.cpp
@@ -1820,7 +1820,7 @@
             }
         }
         
-        if (bestPackage != NULL && bestItem.isBetterThan(thisConfig)) {
+        if (bestPackage != NULL && bestItem.isMoreSpecificThan(thisConfig)) {
             continue;
         }
         
diff --git a/location/data/Android.mk b/location/data/Android.mk
deleted file mode 100644
index 794e6c7..0000000
--- a/location/data/Android.mk
+++ /dev/null
@@ -1,53 +0,0 @@
-#
-# Install 3 sample gps files (nmea, location, and properties)
-# for use with the SDK 
-#
-
-# where to install the sample files on the device
-# 
-local_target_dir := $(TARGET_OUT_DATA)/location
-
-########################
-LOCAL_PATH := $(call my-dir)
-include $(CLEAR_VARS)
-
-LOCAL_MODULE := nmea
-
-LOCAL_MODULE_TAGS := tests
-
-LOCAL_MODULE_CLASS := ETC
-LOCAL_MODULE_PATH := $(local_target_dir)/gps
-
-LOCAL_SRC_FILES := $(LOCAL_MODULE)
-
-include $(BUILD_PREBUILT)
-
-########################
-include $(CLEAR_VARS)
-
-LOCAL_MODULE := location
-
-LOCAL_MODULE_TAGS := tests
-
-LOCAL_MODULE_CLASS := ETC
-LOCAL_MODULE_PATH := $(local_target_dir)/gps
-
-LOCAL_SRC_FILES := $(LOCAL_MODULE)
-
-include $(BUILD_PREBUILT)
-
-########################
-include $(CLEAR_VARS)
-
-LOCAL_MODULE := properties
-
-LOCAL_MODULE_TAGS := tests
-
-LOCAL_MODULE_CLASS := ETC
-LOCAL_MODULE_PATH := $(local_target_dir)/gps
-
-LOCAL_SRC_FILES := $(LOCAL_MODULE)
-
-include $(BUILD_PREBUILT)
-
-########################
diff --git a/location/data/kml/kml b/location/data/kml/kml
deleted file mode 100644
index e1d98b8..0000000
--- a/location/data/kml/kml
+++ /dev/null
@@ -1,2 +0,0 @@
-<coordinates>003405.000,3725.3433,12205.7921 003405.000,3725.3433,12205.7921</coordinates>
-<coordinates>003405.000,3725.3433,12205.7921 003405.000,3725.3433,12205.7921</coordinates>
diff --git a/location/data/kml/properties b/location/data/kml/properties
deleted file mode 100644
index 42d319f..0000000
--- a/location/data/kml/properties
+++ /dev/null
@@ -1,11 +0,0 @@
-requiresNetwork false
-requiresSatellite false
-requiresCell true
-hasMonetaryCost false
-supportsAltitude true
-supportsBearing false
-supportsSpeed true
-repeat true
-accuracy 2
-powerRequirement 2
-trackSpeed 100
diff --git a/location/data/location b/location/data/location
deleted file mode 100644
index 1c0c986..0000000
--- a/location/data/location
+++ /dev/null
@@ -1 +0,0 @@
-gps,1193789209,37.42238666666666666666,-122.096535,0,0,0
diff --git a/location/data/nmea b/location/data/nmea
deleted file mode 100644
index 1b6b45b..0000000
--- a/location/data/nmea
+++ /dev/null
@@ -1,162 +0,0 @@
-$GPRMC,003350.000,A,3725.3432,N,12205.7921,W,0.06,151.59,061007,,,D*7F
-$GPRMC,003355.000,A,3725.3430,N,12205.7920,W,0.18,109.49,061007,,,D*7A
-$GPRMC,003400.000,A,3725.3433,N,12205.7921,W,0.02,227.11,061007,,,D*76
-$GPRMC,003405.000,A,3725.3433,N,12205.7921,W,0.17,103.32,061007,,,D*73
-$GPRMC,003410.000,A,3725.3431,N,12205.7921,W,0.22,167.43,061007,,,D*77
-$GPRMC,003415.000,A,3725.3427,N,12205.7921,W,0.23,246.49,061007,,,D*7E
-$GPRMC,003420.000,A,3725.3423,N,12205.7917,W,0.16,74.88,061007,,,D*41
-$GPRMC,003425.000,A,3725.3426,N,12205.7919,W,0.05,124.94,061007,,,D*74
-$GPRMC,003430.000,A,3725.3429,N,12205.7919,W,0.15,77.12,061007,,,D*47
-$GPRMC,003435.000,A,3725.3432,N,12205.7921,W,0.07,94.72,061007,,,D*4B
-$GPRMC,003440.000,A,3725.3436,N,12205.7921,W,0.13,336.72,061007,,,D*73
-$GPRMC,003445.000,A,3725.3440,N,12205.7953,W,2.72,278.90,061007,,,D*70
-$GPRMC,003450.000,A,3725.3442,N,12205.7977,W,2.02,164.81,061007,,,D*79
-$GPRMC,003455.000,A,3725.3380,N,12205.8008,W,8.28,200.23,061007,,,D*70
-$GPRMC,003500.000,A,3725.3207,N,12205.8057,W,14.04,189.77,061007,,,D*45
-$GPRMC,003505.000,A,3725.3032,N,12205.8094,W,11.67,205.32,061007,,,D*4D
-$GPRMC,003510.000,A,3725.2988,N,12205.8295,W,17.09,271.31,061007,,,D*4D
-$GPRMC,003515.000,A,3725.3005,N,12205.8672,W,25.02,273.74,061007,,,D*41
-$GPRMC,003520.000,A,3725.3030,N,12205.9159,W,29.84,273.27,061007,,,D*4A
-$GPRMC,003525.000,A,3725.3061,N,12205.9683,W,28.20,274.26,061007,,,D*42
-$GPRMC,003530.000,A,3725.3092,N,12206.0150,W,25.25,274.96,061007,,,D*4A
-$GPRMC,003535.000,A,3725.3124,N,12206.0503,W,12.55,276.56,061007,,,D*4C
-$GPRMC,003540.000,A,3725.3135,N,12206.0637,W,3.99,272.32,061007,,,D*7C
-$GPRMC,003545.000,A,3725.3140,N,12206.0701,W,2.80,273.59,061007,,,D*7A
-$GPRMC,003550.000,A,3725.3143,N,12206.0734,W,0.84,266.99,061007,,,D*75
-$GPRMC,003555.000,A,3725.3142,N,12206.0731,W,0.13,157.63,061007,,,D*7E
-$GPRMC,003600.000,A,3725.3142,N,12206.0729,W,0.16,239.76,061007,,,D*7E
-$GPRMC,003605.000,A,3725.3141,N,12206.0726,W,0.15,199.57,061007,,,D*7E
-$GPRMC,003610.000,A,3725.3141,N,12206.0724,W,0.07,161.75,061007,,,D*7C
-$GPRMC,003615.000,A,3725.3141,N,12206.0721,W,0.14,171.95,061007,,,D*71
-$GPRMC,003620.000,A,3725.3141,N,12206.0718,W,0.12,188.87,061007,,,D*7E
-$GPRMC,003625.000,A,3725.3141,N,12206.0716,W,0.14,164.43,061007,,,D*79
-$GPRMC,003630.000,A,3725.3141,N,12206.0714,W,0.10,186.09,061007,,,D*79
-$GPRMC,003635.000,A,3725.3142,N,12206.0716,W,0.09,224.65,061007,,,D*74
-$GPRMC,003640.000,A,3725.3142,N,12206.0716,W,0.09,187.23,061007,,,D*7E
-$GPRMC,003645.000,A,3725.3143,N,12206.0716,W,0.14,229.41,061007,,,D*75
-$GPRMC,003650.000,A,3725.3143,N,12206.0716,W,0.14,195.40,061007,,,D*74
-$GPRMC,003655.000,A,3725.3143,N,12206.0716,W,0.51,267.41,061007,,,D*7F
-$GPRMC,003700.000,A,3725.3148,N,12206.0813,W,9.83,274.54,061007,,,D*7F
-$GPRMC,003705.000,A,3725.3247,N,12206.0930,W,15.25,357.95,061007,,,D*4A
-$GPRMC,003710.000,A,3725.3558,N,12206.0907,W,27.03,4.83,061007,,,D*44
-$GPRMC,003715.000,A,3725.3993,N,12206.0862,W,34.76,4.78,061007,,,D*4C
-$GPRMC,003720.000,A,3725.4514,N,12206.0802,W,39.38,5.62,061007,,,D*45
-$GPRMC,003725.000,A,3725.5072,N,12206.0756,W,38.59,358.11,061007,,,D*43
-$GPRMC,003730.000,A,3725.5581,N,12206.0877,W,36.13,344.59,061007,,,D*43
-$GPRMC,003735.000,A,3725.6078,N,12206.1038,W,36.78,348.75,061007,,,D*4B
-$GPRMC,003740.000,A,3725.6604,N,12206.1021,W,37.66,14.75,061007,,,D*78
-$GPRMC,003745.000,A,3725.7064,N,12206.0817,W,32.70,20.79,061007,,,D*79
-$GPRMC,003750.000,A,3725.7482,N,12206.0613,W,31.70,20.73,061007,,,D*72
-$GPRMC,003755.000,A,3725.7841,N,12206.0458,W,25.05,16.94,061007,,,D*72
-$GPRMC,003800.000,A,3725.8137,N,12206.0368,W,16.01,11.76,061007,,,D*71
-$GPRMC,003805.000,A,3725.8266,N,12206.0341,W,2.45,9.89,061007,,,D*74
-$GPRMC,003810.000,A,3725.8273,N,12206.0340,W,1.42,8.42,061007,,,D*77
-$GPRMC,003815.000,A,3725.8287,N,12206.0340,W,3.02,8.77,061007,,,D*79
-$GPRMC,003820.000,A,3725.8402,N,12206.0321,W,11.90,7.87,061007,,,D*4B
-$GPRMC,003825.000,A,3725.8520,N,12206.0422,W,12.90,274.31,061007,,,D*43
-$GPRMC,003830.000,A,3725.8386,N,12206.0610,W,17.45,193.03,061007,,,D*48
-$GPRMC,003835.000,A,3725.8082,N,12206.0693,W,25.06,193.69,061007,,,D*4B
-$GPRMC,003840.000,A,3725.7732,N,12206.0836,W,24.74,216.89,061007,,,D*4F
-$GPRMC,003845.000,A,3725.7672,N,12206.1208,W,23.64,296.05,061007,,,D*43
-$GPRMC,003850.000,A,3725.7944,N,12206.1530,W,30.80,314.88,061007,,,D*47
-$GPRMC,003855.000,A,3725.8272,N,12206.1893,W,31.57,318.18,061007,,,D*49
-$GPRMC,003900.000,A,3725.8605,N,12206.2264,W,31.13,318.65,061007,,,D*47
-$GPRMC,003905.000,A,3725.8939,N,12206.2625,W,32.39,318.52,061007,,,A*49
-$GPRMC,003910.000,A,3725.9297,N,12206.2994,W,33.37,319.89,061007,,,A*4E
-$GPRMC,003915.000,A,3725.9666,N,12206.3378,W,34.92,320.36,061007,,,A*4E
-$GPRMC,003920.000,A,3726.0048,N,12206.3777,W,35.91,319.96,061007,,,A*41
-$GPRMC,003925.000,A,3726.0439,N,12206.4186,W,36.78,319.98,061007,,,A*43
-$GPRMC,003930.000,A,3726.0837,N,12206.4602,W,37.26,320.27,061007,,,A*4A
-$GPRMC,003935.000,A,3726.1240,N,12206.5024,W,37.88,320.27,061007,,,A*43
-$GPRMC,003940.000,A,3726.1647,N,12206.5449,W,37.95,319.99,061007,,,A*4E
-$GPRMC,003945.000,A,3726.2055,N,12206.5874,W,37.24,320.06,061007,,,A*49
-$GPRMC,003950.000,A,3726.2438,N,12206.6274,W,34.50,320.25,061007,,,A*4A
-$GPRMC,003955.000,A,3726.2805,N,12206.6661,W,34.75,319.90,061007,,,A*4E
-$GPRMC,004000.000,A,3726.3181,N,12206.7054,W,35.63,320.23,061007,,,A*41
-$GPRMC,004005.000,A,3726.3570,N,12206.7462,W,36.84,320.29,061007,,,A*4F
-$GPRMC,004010.000,A,3726.3961,N,12206.7872,W,35.85,320.09,061007,,,A*4A
-$GPRMC,004015.000,A,3726.4343,N,12206.8276,W,36.84,320.17,061007,,,A*4E
-$GPRMC,004020.000,A,3726.4759,N,12206.8712,W,40.53,320.65,061007,,,A*4E
-$GPRMC,004025.000,A,3726.5190,N,12206.9164,W,39.54,320.13,061007,,,A*47
-$GPRMC,004030.000,A,3726.5607,N,12206.9605,W,38.84,319.99,061007,,,A*4E
-$GPRMC,004035.000,A,3726.6010,N,12207.0030,W,36.82,320.30,061007,,,A*41
-$GPRMC,004040.000,A,3726.6413,N,12207.0416,W,35.63,328.90,061007,,,A*4A
-$GPRMC,004045.000,A,3726.6861,N,12207.0652,W,35.49,342.93,061007,,,A*43
-$GPRMC,004050.000,A,3726.7346,N,12207.0842,W,37.15,342.57,061007,,,A*44
-$GPRMC,004055.000,A,3726.7834,N,12207.1033,W,36.68,342.14,061007,,,A*4C
-$GPRMC,004100.000,A,3726.8328,N,12207.1225,W,36.73,343.04,061007,,,D*4E
-$GPRMC,004105.000,A,3726.8795,N,12207.1405,W,33.44,343.08,061007,,,D*40
-$GPRMC,004110.000,A,3726.9211,N,12207.1570,W,28.00,343.17,061007,,,D*4B
-$GPRMC,004115.000,A,3726.9507,N,12207.1678,W,18.59,345.92,061007,,,D*41
-$GPRMC,004120.000,A,3726.9639,N,12207.1722,W,3.24,343.37,061007,,,D*7E
-$GPRMC,004125.000,A,3726.9641,N,12207.1725,W,0.21,154.73,061007,,,D*71
-$GPRMC,004130.000,A,3726.9634,N,12207.1722,W,0.16,105.89,061007,,,D*75
-$GPRMC,004135.000,A,3726.9630,N,12207.1720,W,0.04,133.97,061007,,,D*7F
-$GPRMC,004140.000,A,3726.9627,N,12207.1718,W,0.16,107.47,061007,,,D*79
-$GPRMC,004145.000,A,3726.9625,N,12207.1716,W,0.14,148.73,061007,,,D*7E
-$GPRMC,004150.000,A,3726.9621,N,12207.1715,W,0.09,142.18,061007,,,D*76
-$GPRMC,004155.000,A,3726.9620,N,12207.1714,W,0.10,95.75,061007,,,D*4B
-$GPRMC,004200.000,A,3726.9618,N,12207.1714,W,0.07,135.28,061007,,,D*76
-$GPRMC,004205.000,A,3726.9617,N,12207.1713,W,0.14,86.20,061007,,,D*48
-$GPRMC,004210.000,A,3726.9616,N,12207.1713,W,0.05,130.34,061007,,,D*74
-$GPRMC,004215.000,A,3726.9614,N,12207.1714,W,0.08,120.53,061007,,,D*79
-$GPRMC,004220.000,A,3726.9612,N,12207.1714,W,0.09,147.27,061007,,,D*7A
-$GPRMC,004225.000,A,3726.9612,N,12207.1715,W,0.12,118.20,061007,,,D*79
-$GPRMC,004230.000,A,3726.9612,N,12207.1714,W,0.12,90.61,061007,,,D*48
-$GPRMC,004235.000,A,3726.9612,N,12207.1715,W,0.10,156.15,061007,,,D*76
-$GPRMC,004240.000,A,3726.9612,N,12207.1715,W,0.13,104.74,061007,,,D*77
-$GPRMC,004245.000,A,3726.9617,N,12207.1716,W,2.21,343.16,061007,,,D*72
-$GPRMC,004250.000,A,3726.9756,N,12207.1772,W,15.37,342.52,061007,,,D*40
-$GPRMC,004255.000,A,3726.9950,N,12207.1942,W,16.40,298.08,061007,,,D*4A
-$GPRMC,004300.000,A,3726.9896,N,12207.2215,W,18.97,241.60,061007,,,D*44
-$GPRMC,004305.000,A,3726.9801,N,12207.2558,W,22.01,268.09,061007,,,D*43
-$GPRMC,004310.000,A,3726.9908,N,12207.2943,W,24.76,304.28,061007,,,D*47
-$GPRMC,004315.000,A,3727.0088,N,12207.3347,W,27.35,295.83,061007,,,D*48
-$GPRMC,004320.000,A,3727.0117,N,12207.3855,W,28.97,271.02,061007,,,D*45
-$GPRMC,004325.000,A,3727.0211,N,12207.4306,W,22.94,303.62,061007,,,D*44
-$GPRMC,004330.000,A,3727.0358,N,12207.4491,W,8.59,313.76,061007,,,D*78
-$GPRMC,004335.000,A,3727.0409,N,12207.4550,W,2.33,313.55,061007,,,D*75
-$GPRMC,004340.000,A,3727.0433,N,12207.4578,W,5.75,314.25,061007,,,D*71
-$GPRMC,004345.000,A,3727.0533,N,12207.4704,W,12.55,314.18,061007,,,D*46
-$GPRMC,004350.000,A,3727.0676,N,12207.4892,W,16.68,312.98,061007,,,D*44
-$GPRMC,004355.000,A,3727.0835,N,12207.5103,W,15.11,313.21,061007,,,D*46
-$GPRMC,004400.000,A,3727.0969,N,12207.5285,W,10.26,312.85,061007,,,D*4A
-$GPRMC,004405.000,A,3727.1006,N,12207.5334,W,0.33,319.16,061007,,,D*71
-$GPRMC,004410.000,A,3727.1007,N,12207.5333,W,0.19,144.98,061007,,,D*77
-$GPRMC,004415.000,A,3727.1005,N,12207.5330,W,0.05,106.63,061007,,,D*7C
-$GPRMC,004420.000,A,3727.1006,N,12207.5327,W,0.05,92.53,061007,,,D*40
-$GPRMC,004425.000,A,3727.1005,N,12207.5323,W,0.17,148.57,061007,,,D*73
-$GPRMC,004430.000,A,3727.1037,N,12207.5355,W,8.70,314.52,061007,,,D*70
-$GPRMC,004435.000,A,3727.1168,N,12207.5516,W,16.83,312.51,061007,,,D*49
-$GPRMC,004440.000,A,3727.1344,N,12207.5787,W,23.06,309.71,061007,,,D*4E
-$GPRMC,004445.000,A,3727.1572,N,12207.6136,W,27.67,308.29,061007,,,D*48
-$GPRMC,004450.000,A,3727.1821,N,12207.6558,W,31.56,306.08,061007,,,D*43
-$GPRMC,004455.000,A,3727.2083,N,12207.7008,W,30.81,306.19,061007,,,D*4F
-$GPRMC,004500.000,A,3727.2324,N,12207.7424,W,27.68,306.75,061007,,,D*41
-$GPRMC,004505.000,A,3727.2519,N,12207.7754,W,16.50,305.19,061007,,,D*48
-$GPRMC,004510.000,A,3727.2570,N,12207.7849,W,0.13,151.16,061007,,,D*7C
-$GPRMC,004515.000,A,3727.2619,N,12207.7927,W,14.27,311.27,061007,,,D*4A
-$GPRMC,004520.000,A,3727.2786,N,12207.8214,W,23.53,303.48,061007,,,D*42
-$GPRMC,004525.000,A,3727.2980,N,12207.8564,W,25.03,306.82,061007,,,D*4F
-$GPRMC,004530.000,A,3727.3199,N,12207.8936,W,27.48,306.29,061007,,,D*4D
-$GPRMC,004535.000,A,3727.3433,N,12207.9339,W,28.66,306.28,061007,,,D*4B
-$GPRMC,004540.000,A,3727.3666,N,12207.9740,W,28.04,306.12,061007,,,D*4C
-$GPRMC,004545.000,A,3727.3886,N,12208.0118,W,25.22,306.50,061007,,,D*4B
-$GPRMC,004550.000,A,3727.4091,N,12208.0461,W,23.34,306.68,061007,,,D*47
-$GPRMC,004555.000,A,3727.4291,N,12208.0747,W,19.76,317.26,061007,,,D*42
-$GPRMC,004600.000,A,3727.4497,N,12208.1015,W,24.00,309.28,061007,,,D*4E
-$GPRMC,004605.000,A,3727.4711,N,12208.1376,W,26.83,305.61,061007,,,D*48
-$GPRMC,004610.000,A,3727.4937,N,12208.1760,W,26.40,305.68,061007,,,D*43
-$GPRMC,004615.000,A,3727.5142,N,12208.2112,W,23.46,306.19,061007,,,D*4B
-$GPRMC,004620.000,A,3727.5326,N,12208.2431,W,21.96,304.30,061007,,,D*4F
-$GPRMC,004625.000,A,3727.5515,N,12208.2693,W,20.21,323.71,061007,,,D*4B
-$GPRMC,004630.000,A,3727.5788,N,12208.2812,W,21.00,352.36,061007,,,D*49
-$GPRMC,004635.000,A,3727.6048,N,12208.2846,W,14.79,351.69,061007,,,D*44
-$GPRMC,004640.000,A,3727.6217,N,12208.2861,W,6.38,359.46,061007,,,D*78
-$GPRMC,004645.000,A,3727.6322,N,12208.2880,W,10.02,331.10,061007,,,D*46
-$GPRMC,004650.000,A,3727.6394,N,12208.3010,W,6.76,277.11,061007,,,D*79
-$GPRMC,004655.000,A,3727.6382,N,12208.3058,W,1.58,256.67,061007,,,D*7E
-$GPRMC,004700.000,A,3727.6253,N,12208.3024,W,6.34,164.31,061007,,,A*70
-$GPRMC,004715.000,A,3727.5854,N,12208.3345,W,5.00,267.98,061007,,,A*79
-$GPRMC,004720.000,A,3727.5993,N,12208.3323,W,6.50,26.91,061007,,,A*4D
-$GPRMC,004725.000,A,3727.6123,N,12208.3159,W,13.14,44.68,061007,,,A*71
diff --git a/location/data/properties b/location/data/properties
deleted file mode 100644
index b6878af..0000000
--- a/location/data/properties
+++ /dev/null
@@ -1,10 +0,0 @@
-requiresNetwork false
-requiresSatellite false
-requiresCell false
-hasMonetaryCost false
-supportsAltitude true
-supportsBearing true
-supportsSpeed true
-repeat true
-accuracy 1
-powerRequirement 1
diff --git a/location/data/test/class b/location/data/test/class
deleted file mode 100644
index 495b172..0000000
--- a/location/data/test/class
+++ /dev/null
@@ -1 +0,0 @@
-android.test.TestLocationProvider
diff --git a/location/data/track/properties b/location/data/track/properties
deleted file mode 100644
index 1f1ed5e..0000000
--- a/location/data/track/properties
+++ /dev/null
@@ -1,10 +0,0 @@
-requiresNetwork true
-requiresSatellite false
-requiresCell false
-hasMonetaryCost false
-supportsAltitude true
-supportsBearing false
-supportsSpeed false
-repeat true
-accuracy 1
-powerRequirement 3
diff --git a/location/data/track/track b/location/data/track/track
deleted file mode 100644
index a69ba2a..0000000
--- a/location/data/track/track
+++ /dev/null
@@ -1 +0,0 @@
-00 003405.000 3725.3433 12205.7921 101.2 65.3
diff --git a/location/java/android/location/IGeocodeProvider.aidl b/location/java/android/location/IGeocodeProvider.aidl
new file mode 100644
index 0000000..e79e8d2
--- /dev/null
+++ b/location/java/android/location/IGeocodeProvider.aidl
@@ -0,0 +1,35 @@
+/*
+ * Copyright (C) 2009 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.location;
+
+import android.location.Address;
+
+/**
+ * An interface for location providers implementing the Geocoder services.
+ *
+ * {@hide}
+ */
+interface IGeocodeProvider {
+
+    String getFromLocation(double latitude, double longitude, int maxResults,
+        String language, String country, String variant, String appName, out List<Address> addrs);
+
+    String getFromLocationName(String locationName,
+        double lowerLeftLatitude, double lowerLeftLongitude,
+        double upperRightLatitude, double upperRightLongitude, int maxResults,
+        String language, String country, String variant, String appName, out List<Address> addrs);
+}
diff --git a/location/java/android/location/ILocationManager.aidl b/location/java/android/location/ILocationManager.aidl
index 86bd8b6..096622a 100644
--- a/location/java/android/location/ILocationManager.aidl
+++ b/location/java/android/location/ILocationManager.aidl
@@ -18,6 +18,7 @@
 
 import android.app.PendingIntent;
 import android.location.Address;
+import android.location.IGeocodeProvider;
 import android.location.IGpsStatusListener;
 import android.location.ILocationCollector;
 import android.location.ILocationListener;
@@ -44,7 +45,10 @@
 
     boolean addGpsStatusListener(IGpsStatusListener listener);
     void removeGpsStatusListener(IGpsStatusListener listener);
-    
+
+    // for reporting callback completion
+    void locationCallbackFinished(ILocationListener listener);
+
     boolean sendExtraCommand(String provider, String command, inout Bundle extras);
 
     void addProximityAlert(double latitude, double longitude, float distance,
@@ -77,7 +81,8 @@
     void setTestProviderStatus(String provider, int status, in Bundle extras, long updateTime);
     void clearTestProviderStatus(String provider);
 
-    /* for installing Network Location Provider */
+    /* for installing external Location Providers */
     void setNetworkLocationProvider(ILocationProvider provider);
     void setLocationCollector(ILocationCollector collector);
+    void setGeocodeProvider(IGeocodeProvider provider);
 }
diff --git a/location/java/android/location/ILocationProvider.aidl b/location/java/android/location/ILocationProvider.aidl
index 6f9daff..82533a5 100644
--- a/location/java/android/location/ILocationProvider.aidl
+++ b/location/java/android/location/ILocationProvider.aidl
@@ -16,7 +16,6 @@
 
 package android.location;
 
-import android.location.Address;
 import android.os.Bundle;
 
 /**
@@ -47,15 +46,8 @@
     void setMinTime(long minTime);
     void updateNetworkState(int state);
     boolean sendExtraCommand(String command, inout Bundle extras);
-
-    /* the following are only used for NetworkLocationProvider */
-    void updateCellLockStatus(boolean acquired);
-    void addListener(in String[] applications);
-    void removeListener(in String[] applications);
-    String getFromLocation(double latitude, double longitude, int maxResults,
-        String language, String country, String variant, String appName, out List<Address> addrs);
-    String getFromLocationName(String locationName,
-        double lowerLeftLatitude, double lowerLeftLongitude,
-        double upperRightLatitude, double upperRightLongitude, int maxResults,
-        String language, String country, String variant, String appName, out List<Address> addrs);
+    void addListener(int uid);
+    void removeListener(int uid);
+    void wakeLockAcquired();
+    void wakeLockReleased();
 }
diff --git a/location/java/android/location/LocationManager.java b/location/java/android/location/LocationManager.java
index 0c7254e..dacfeb9 100644
--- a/location/java/android/location/LocationManager.java
+++ b/location/java/android/location/LocationManager.java
@@ -26,6 +26,8 @@
 import android.util.Config;
 import android.util.Log;
 
+import com.android.internal.location.DummyLocationProvider;
+
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.Comparator;
@@ -101,9 +103,6 @@
      */
     public static final String KEY_LOCATION_CHANGED = "location";
 
-    /** @hide -- does this belong here? */
-    public static final String PROVIDER_DIR = "/data/location";
-
     /** @hide */
     public static final String SYSTEM_DIR = "/data/system/location";
 
@@ -194,6 +193,11 @@
                     mListener.onProviderDisabled((String) msg.obj);
                     break;
             }
+            try {
+                mService.locationCallbackFinished(this);
+            } catch (RemoteException e) {
+                Log.e(TAG, "locationCallbackFinished: RemoteException", e);
+            }
         }
     }
     /**
diff --git a/location/java/android/location/LocationProvider.java b/location/java/android/location/LocationProvider.java
index b1670d5..3faba58 100644
--- a/location/java/android/location/LocationProvider.java
+++ b/location/java/android/location/LocationProvider.java
@@ -47,8 +47,10 @@
      * consist only of the characters [a-zA-Z0-9].
      *
      * @throws IllegalArgumentException if name contains an illegal character
+     *
+     * {@hide}
      */
-    LocationProvider(String name) {
+    public LocationProvider(String name) {
         if (name.matches(BAD_CHARS_REGEX)) {
             throw new IllegalArgumentException("name " + name +
                 " contains an illegal character");
diff --git a/location/java/android/location/DummyLocationProvider.java b/location/java/com/android/internal/location/DummyLocationProvider.java
similarity index 95%
rename from location/java/android/location/DummyLocationProvider.java
rename to location/java/com/android/internal/location/DummyLocationProvider.java
index e1cd4e9..ff5e27b 100644
--- a/location/java/android/location/DummyLocationProvider.java
+++ b/location/java/com/android/internal/location/DummyLocationProvider.java
@@ -14,7 +14,9 @@
  * limitations under the License.
  */
 
-package android.location;
+package com.android.internal.location;
+
+import android.location.LocationProvider;
 
 /**
  * A stub implementation of LocationProvider used by LocationManager.
@@ -24,7 +26,7 @@
  * 
  * {@hide}
  */
-class DummyLocationProvider extends LocationProvider {
+public class DummyLocationProvider extends LocationProvider {
 
     private static final String TAG = "DummyLocationProvider";
 
@@ -39,7 +41,7 @@
     int mPowerRequirement;
     int mAccuracy;
 
-    /* package */ DummyLocationProvider(String name) {
+    public DummyLocationProvider(String name) {
         super(name);
     }
 
diff --git a/location/java/com/android/internal/location/GpsLocationProvider.java b/location/java/com/android/internal/location/GpsLocationProvider.java
index 8a33574..57d3c53 100644
--- a/location/java/com/android/internal/location/GpsLocationProvider.java
+++ b/location/java/com/android/internal/location/GpsLocationProvider.java
@@ -22,20 +22,22 @@
 import android.content.IntentFilter;
 import android.location.Criteria;
 import android.location.IGpsStatusListener;
-import android.location.ILocationCollector;
 import android.location.ILocationManager;
 import android.location.Location;
 import android.location.LocationManager;
 import android.location.LocationProvider;
-import android.location.LocationProviderImpl;
+import android.net.ConnectivityManager;
 import android.net.SntpClient;
 import android.os.Bundle;
 import android.os.IBinder;
 import android.os.RemoteException;
+import android.os.ServiceManager;
 import android.os.SystemClock;
 import android.util.Config;
 import android.util.Log;
+import android.util.SparseIntArray;
 
+import com.android.internal.app.IBatteryStats;
 import com.android.internal.telephony.Phone;
 import com.android.internal.telephony.TelephonyIntents;
 
@@ -99,6 +101,14 @@
     private static final int GPS_STATUS_ENGINE_ON = 3;
     private static final int GPS_STATUS_ENGINE_OFF = 4;
 
+    // these need to match GpsSuplStatusValue defines in gps.h
+    /** SUPL status event values. */
+    private static final int GPS_REQUEST_SUPL_DATA_CONN = 1;
+    private static final int GPS_RELEASE_SUPL_DATA_CONN = 2;
+    private static final int GPS_SUPL_DATA_CONNECTED = 3;
+    private static final int GPS_SUPL_DATA_CONN_DONE = 4;
+    private static final int GPS_SUPL_DATA_CONN_FAILED = 5;
+
     // these need to match GpsLocationFlags enum in gps.h
     private static final int LOCATION_INVALID = 0;
     private static final int LOCATION_HAS_LAT_LONG = 1;
@@ -122,6 +132,11 @@
     private static final int GPS_DELETE_CELLDB_INFO = 0x8000;
     private static final int GPS_DELETE_ALL = 0xFFFF;
 
+    // for mSuplDataConnectionState
+    private static final int SUPL_DATA_CONNECTION_CLOSED = 0;
+    private static final int SUPL_DATA_CONNECTION_OPENING = 1;
+    private static final int SUPL_DATA_CONNECTION_OPEN = 2;
+
     private static final String PROPERTIES_FILE = "/etc/gps.conf";
 
     private int mLocationFlags = LOCATION_INVALID;
@@ -137,8 +152,6 @@
 
     // true if we are enabled
     private boolean mEnabled;
-    // true if we are enabled for location updates
-    private boolean mLocationTracking;
     
     // true if we have network connectivity
     private boolean mNetworkAvailable;
@@ -176,6 +189,12 @@
     private String mSuplHost;
     private int mSuplPort;
     private boolean mSetSuplServer;
+    private String mSuplApn;
+    private int mSuplDataConnectionState;
+    private final ConnectivityManager mConnMgr;
+
+    private final IBatteryStats mBatteryStats;
+    private final SparseIntArray mClientUids = new SparseIntArray();
 
     // how often to request NTP time, in milliseconds
     // current setting 4 hours
@@ -184,8 +203,6 @@
     // current setting - 5 minutes
     private static final long RETRY_INTERVAL = 5*60*1000; 
 
-    private ILocationCollector mCollector;
-
     private class TelephonyBroadcastReceiver extends BroadcastReceiver {
         @Override public void onReceive(Context context, Intent intent) {
             String action = intent.getAction();
@@ -198,10 +215,12 @@
                 if (Config.LOGD) {
                     Log.d(TAG, "state: " + state +  " apnName: " + apnName + " reason: " + reason);
                 }
-                if ("CONNECTED".equals(state)) {
-                    native_set_supl_apn(apnName);
-                } else {
-                    native_set_supl_apn("");
+                if ("CONNECTED".equals(state) && apnName != null && apnName.length() > 0) {
+                    mSuplApn = apnName;
+                    if (mSuplDataConnectionState == SUPL_DATA_CONNECTION_OPENING) {
+                        native_supl_data_conn_open(mSuplApn);
+                        mSuplDataConnectionState = SUPL_DATA_CONNECTION_OPEN;
+                    }
                 }
             }
         }
@@ -220,6 +239,11 @@
         intentFilter.addAction(TelephonyIntents.ACTION_ANY_DATA_CONNECTION_STATE_CHANGED);
         context.registerReceiver(receiver, intentFilter);
 
+        mConnMgr = (ConnectivityManager)context.getSystemService(Context.CONNECTIVITY_SERVICE);
+
+        // Battery statistics service to be notified when GPS turns on or off
+        mBatteryStats = IBatteryStats.Stub.asInterface(ServiceManager.getService("batteryinfo"));
+
         mProperties = new Properties();
         try {
             File file = new File(PROPERTIES_FILE);
@@ -242,10 +266,6 @@
         }
     }
 
-    public void setLocationCollector(ILocationCollector collector) {
-        mCollector = collector;
-    }
-
     /**
      * Returns true if the provider requires access to a
      * data network (e.g., the Internet), false otherwise.
@@ -452,10 +472,7 @@
 
     @Override
     public void enableLocationTracking(boolean enable) {
-        if (mLocationTracking == enable) {
-            return;
-        }
-
+        super.enableLocationTracking(enable);
         if (enable) {
             mFixRequestTime = System.currentTimeMillis();
             mTTFF = 0;
@@ -464,12 +481,6 @@
         } else {
             stopNavigating();
         }
-        mLocationTracking = enable;
-    }
-
-    @Override
-    public boolean isLocationTracking() {
-        return mLocationTracking;
     }
 
     @Override
@@ -547,6 +558,30 @@
     }
 
     @Override
+    public void addListener(int uid) {
+        mClientUids.put(uid, 0);
+        if (mNavigating) {
+            try {
+                mBatteryStats.noteStartGps(uid);
+            } catch (RemoteException e) {
+                Log.w(TAG, "RemoteException in addListener");
+            }
+        }
+    }
+
+    @Override
+    public void removeListener(int uid) {
+        mClientUids.delete(uid);
+        if (mNavigating) {
+            try {
+                mBatteryStats.noteStopGps(uid);
+            } catch (RemoteException e) {
+                Log.w(TAG, "RemoteException in removeListener");
+            }
+        }
+    }
+
+    @Override
     public boolean sendExtraCommand(String command, Bundle extras) {
         
         if ("delete_aiding_data".equals(command)) {
@@ -675,16 +710,6 @@
             }
 
             reportLocationChanged(mLocation);
-
-            // Send to collector
-            if ((flags & LOCATION_HAS_LAT_LONG) == LOCATION_HAS_LAT_LONG
-                    && mCollector != null) {
-                try {
-                    mCollector.updateLocation(mLocation);
-                } catch (RemoteException e) {
-                    Log.w(TAG, "mCollector.updateLocation failed");
-                }
-            }
         }
 
         if (mStarted && mStatus != AVAILABLE) {
@@ -725,6 +750,20 @@
                 }
             }
 
+            try {
+                // update battery stats
+                for (int i=mClientUids.size() - 1; i >= 0; i--) {
+                    int uid = mClientUids.keyAt(i);
+                    if (mNavigating) {
+                        mBatteryStats.noteStartGps(uid);
+                    } else {
+                        mBatteryStats.noteStopGps(uid);
+                    }
+                }
+            } catch (RemoteException e) {
+                Log.w(TAG, "RemoteException in reportStatus");
+            }
+
             // send an intent to notify that the GPS has been enabled or disabled.
             Intent intent = new Intent(GPS_ENABLED_CHANGE_ACTION);
             intent.putExtra(EXTRA_ENABLED, mNavigating);
@@ -782,7 +821,44 @@
             updateStatus(TEMPORARILY_UNAVAILABLE, mSvCount);
         }
     }
-    
+
+    /**
+     * called from native code to update SUPL status
+     */
+    private void reportSuplStatus(int status) {
+        switch (status) {
+            case GPS_REQUEST_SUPL_DATA_CONN:
+                 int result = mConnMgr.startUsingNetworkFeature(
+                        ConnectivityManager.TYPE_MOBILE, Phone.FEATURE_ENABLE_SUPL);
+                if (result == Phone.APN_ALREADY_ACTIVE) {
+                    native_supl_data_conn_open(mSuplApn);
+                    mSuplDataConnectionState = SUPL_DATA_CONNECTION_OPEN;
+                } else if (result == Phone.APN_REQUEST_STARTED) {
+                    mSuplDataConnectionState = SUPL_DATA_CONNECTION_OPENING;
+                } else {
+                    native_supl_data_conn_failed();
+                }
+                break;
+            case GPS_RELEASE_SUPL_DATA_CONN:
+                if (mSuplDataConnectionState != SUPL_DATA_CONNECTION_CLOSED) {
+                    mConnMgr.stopUsingNetworkFeature(
+                            ConnectivityManager.TYPE_MOBILE, Phone.FEATURE_ENABLE_SUPL);
+                    native_supl_data_conn_closed();
+                    mSuplDataConnectionState = SUPL_DATA_CONNECTION_CLOSED;
+                }
+                break;
+            case GPS_SUPL_DATA_CONNECTED:
+                // Log.d(TAG, "GPS_SUPL_DATA_CONNECTED");
+                break;
+            case GPS_SUPL_DATA_CONN_DONE:
+                // Log.d(TAG, "GPS_SUPL_DATA_CONN_DONE");
+                break;
+            case GPS_SUPL_DATA_CONN_FAILED:
+                // Log.d(TAG, "GPS_SUPL_DATA_CONN_FAILED");
+                break;
+        }
+    }
+
     private void xtraDownloadRequest() {
         if (Config.LOGD) Log.d(TAG, "xtraDownloadRequest");
         if (mNetworkThread != null) {
@@ -1002,6 +1078,8 @@
     private native void native_inject_xtra_data(byte[] data, int length);
 
     // SUPL Support    
+    private native void native_supl_data_conn_open(String apn);
+    private native void native_supl_data_conn_closed();
+    private native void native_supl_data_conn_failed();
     private native void native_set_supl_server(int addr, int port);
-    private native void native_set_supl_apn(String apn);
 }
diff --git a/location/java/com/android/internal/location/GpsXtraDownloader.java b/location/java/com/android/internal/location/GpsXtraDownloader.java
index b8545a6..2a8be57 100644
--- a/location/java/com/android/internal/location/GpsXtraDownloader.java
+++ b/location/java/com/android/internal/location/GpsXtraDownloader.java
@@ -70,11 +70,11 @@
             if (server1 != null) mXtraServers[count++] = server1;
             if (server2 != null) mXtraServers[count++] = server2;
             if (server3 != null) mXtraServers[count++] = server3;
-        }
-        
-        // randomize first server
-        Random random = new Random();
-        mNextServerIndex = random.nextInt(count);
+
+            // randomize first server
+            Random random = new Random();
+            mNextServerIndex = random.nextInt(count);
+        }       
     }
 
     byte[] downloadXtraData() {
diff --git a/location/java/android/location/LocationProviderImpl.java b/location/java/com/android/internal/location/LocationProviderImpl.java
similarity index 79%
rename from location/java/android/location/LocationProviderImpl.java
rename to location/java/com/android/internal/location/LocationProviderImpl.java
index 2a9199e..5e9c074 100644
--- a/location/java/android/location/LocationProviderImpl.java
+++ b/location/java/com/android/internal/location/LocationProviderImpl.java
@@ -14,21 +14,19 @@
  * limitations under the License.
  */
 
-package android.location;
+package com.android.internal.location;
 
-import java.io.BufferedReader;
-import java.io.File;
-import java.io.FileReader;
-import java.io.IOException;
+import android.location.ILocationManager;
+import android.location.Location;
+import android.location.LocationProvider;
+import android.os.Bundle;
+import android.os.RemoteException;
+import android.util.Log;
+
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
 
-import android.os.Bundle;
-import android.os.RemoteException;
-import android.util.Config;
-import android.util.Log;
-
 /**
  * An abstract superclass for location provider implementations.
  * Location provider implementations are typically instantiated by the
@@ -72,49 +70,6 @@
         return sProvidersByName.get(name);
     }
 
-    public static LocationProviderImpl loadFromClass(File classFile) {
-        if (!classFile.exists()) {
-            return null;
-        }
-        if (Config.LOGD) {
-            Log.d(TAG, "Loading class specifier file " + classFile.getPath());
-        }
-        String className = null;
-        try {
-            BufferedReader br =
-                new BufferedReader(new FileReader(classFile), 8192);
-            className = br.readLine();
-            br.close();
-            Class providerClass = Class.forName(className);
-            if (Config.LOGD) {
-                Log.d(TAG, "Loading provider class " + providerClass.getName());
-            }
-            LocationProviderImpl provider =
-                (LocationProviderImpl) providerClass.newInstance();
-            if (Config.LOGD) {
-                Log.d(TAG, "Got provider instance " + provider);
-            }
-
-            return provider;
-        } catch (IOException ioe) {
-            Log.e(TAG, "IOException loading config file " +
-                  classFile.getPath(), ioe);
-        } catch (IllegalAccessException iae) {
-            Log.e(TAG, "IllegalAccessException loading class " +
-                  className, iae);
-        } catch (InstantiationException ie) {
-            Log.e(TAG, "InstantiationException loading class " +
-                  className, ie);
-        } catch (ClassNotFoundException cnfe) {
-            Log.e(TAG, "ClassNotFoundException loading class " +
-                  className, cnfe);
-        } catch (ClassCastException cce) {
-            Log.e(TAG, "ClassCastException loading class " +
-                  className, cce);
-        }
-        return null;
-    }
-
     public void reportLocationChanged(Location location) {
         try {
             mLocationManager.setLocation(location);
@@ -249,4 +204,32 @@
     public boolean sendExtraCommand(String command, Bundle extras) {
         return false;
     }
+
+    /**
+     * Informs the location provider when a new client is listening for location information
+     *
+     * @param uid the uid of the client proces
+     */
+    public void addListener(int uid) {
+    }
+
+    /**
+     * Informs the location provider when a client is no longer listening for location information
+     *
+     * @param uid the uid of the client proces
+     */
+    public void removeListener(int uid) {
+    }
+
+    /**
+     * Informs the location provider when the location manager service has acquired its wake lock
+     */
+    public void wakeLockAcquired() {
+    }
+
+    /**
+     * Informs the location provider when the location manager service has released its wake lock
+     */
+    public void wakeLockReleased() {
+    }
 }
diff --git a/location/java/com/android/internal/location/LocationProviderProxy.java b/location/java/com/android/internal/location/LocationProviderProxy.java
index 1f4940f..d3c86db 100644
--- a/location/java/com/android/internal/location/LocationProviderProxy.java
+++ b/location/java/com/android/internal/location/LocationProviderProxy.java
@@ -21,7 +21,6 @@
 import android.location.ILocationProvider;
 import android.location.Location;
 import android.location.LocationManager;
-import android.location.LocationProviderImpl;
 import android.os.Bundle;
 import android.os.RemoteException;
 import android.util.Log;
@@ -222,52 +221,35 @@
         }
     }
 
-    public void updateCellLockStatus(boolean acquired) {
+    public void addListener(int uid) {
         try {
-            mProvider.updateCellLockStatus(acquired);
-        } catch (RemoteException e) {
-            Log.e(TAG, "updateCellLockStatus failed", e);
-        }
-    }
-
-    public void addListener(String[] applications) {
-        try {
-            mProvider.addListener(applications);
+            mProvider.addListener(uid);
         } catch (RemoteException e) {
             Log.e(TAG, "addListener failed", e);
         }
     }
 
-    public void removeListener(String[] applications) {
+    public void removeListener(int uid) {
         try {
-            mProvider.removeListener(applications);
+            mProvider.removeListener(uid);
         } catch (RemoteException e) {
             Log.e(TAG, "removeListener failed", e);
         }
     }
 
-    public String getFromLocation(double latitude, double longitude, int maxResults,
-        String language, String country, String variant, String appName, List<Address> addrs) {
+    public void wakeLockAcquired() {
         try {
-            return mProvider.getFromLocation(latitude, longitude, maxResults, language, country, 
-                    variant, appName,  addrs);
+            mProvider.wakeLockAcquired();
         } catch (RemoteException e) {
-            Log.e(TAG, "getFromLocation failed", e);
-            return null;
+            Log.e(TAG, "wakeLockAcquired failed", e);
         }
     }
 
-    public String getFromLocationName(String locationName,
-        double lowerLeftLatitude, double lowerLeftLongitude,
-        double upperRightLatitude, double upperRightLongitude, int maxResults,
-        String language, String country, String variant, String appName, List<Address> addrs) {
+    public void wakeLockReleased() {
         try {
-            return mProvider.getFromLocationName(locationName, lowerLeftLatitude, 
-                    lowerLeftLongitude, upperRightLatitude, upperRightLongitude,
-                    maxResults, language, country, variant, appName, addrs);
+            mProvider.wakeLockReleased();
         } catch (RemoteException e) {
-            Log.e(TAG, "getFromLocationName failed", e);
-            return null;
+            Log.e(TAG, "wakeLockReleased failed", e);
         }
     }
 }
diff --git a/location/java/com/android/internal/location/MockProvider.java b/location/java/com/android/internal/location/MockProvider.java
index c8d5b4f..6336e2b 100644
--- a/location/java/com/android/internal/location/MockProvider.java
+++ b/location/java/com/android/internal/location/MockProvider.java
@@ -18,7 +18,6 @@
 
 import android.location.ILocationManager;
 import android.location.Location;
-import android.location.LocationProviderImpl;
 import android.os.Bundle;
 import android.util.PrintWriterPrinter;
 
diff --git a/location/java/com/android/internal/location/TrackProvider.java b/location/java/com/android/internal/location/TrackProvider.java
deleted file mode 100644
index 1686260..0000000
--- a/location/java/com/android/internal/location/TrackProvider.java
+++ /dev/null
@@ -1,732 +0,0 @@
-// Copyright 2007 The Android Open Source Project
-
-package com.android.internal.location;
-
-import org.xmlpull.v1.XmlPullParser;
-import org.xmlpull.v1.XmlPullParserException;
-import org.xmlpull.v1.XmlPullParserFactory;
-
-import java.io.BufferedReader;
-import java.io.File;
-import java.io.FileReader;
-import java.io.IOException;
-import java.io.Reader;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.StringTokenizer;
-
-import android.location.Criteria;
-import android.location.ILocationManager;
-import android.location.Location;
-import android.location.LocationProviderImpl;
-import android.os.Bundle;
-import android.util.Config;
-import android.util.Log;
-
-/**
- * A dummy provider that returns positions interpolated from a sequence
- * of caller-supplied waypoints.  The waypoints are supplied as a
- * String containing one or more numeric quadruples of the form:
- * <br>
- * <code>
- * <time in millis> <latitude> <longitude> <altitude>
- * </code>
- *
- * <p> The waypoints must be supplied in increasing timestamp order.
- *
- * <p> The time at which the provider is constructed is considered to
- * be time 0, and further requests for positions will return a
- * position that is linearly interpolated between the waypoints whose
- * timestamps are closest to the amount of wall clock time that has
- * elapsed since time 0.
- *
- * <p> Following the time of the last waypoint, the position of that
- * waypoint will continue to be returned indefinitely.
- *
- * {@hide}
- */
-public class TrackProvider extends LocationProviderImpl {
-    static final String LOG_TAG = "TrackProvider";
-
-    private static final long INTERVAL = 1000L;
-
-    private boolean mEnabled = true;
-    private TrackProviderThread mThread;
-
-    private double mLatitude;
-    private double mLongitude;
-    private boolean mHasAltitude;
-    private boolean mHasBearing;
-    private boolean mHasSpeed;
-    private double mAltitude;
-    private float mBearing;
-    private float mSpeed;
-    private Bundle mExtras;
-
-    private long mBaseTime;
-    private long mLastTime = -1L;
-    private long mTime;
-
-    private long mMinTime;
-    private long mMaxTime;
-
-    private List<Waypoint> mWaypoints = new ArrayList<Waypoint>();
-    private int mWaypointIndex = 0;
-
-    private boolean mRequiresNetwork = false;
-    private boolean mRequiresSatellite = false;
-    private boolean mRequiresCell = false;
-    private boolean mHasMonetaryCost = false;
-    private boolean mSupportsAltitude = true;
-    private boolean mSupportsSpeed = true;
-    private boolean mSupportsBearing = true;
-    private boolean mRepeat = false;
-    private int mPowerRequirement = Criteria.POWER_LOW;
-    private int mAccuracy = Criteria.ACCURACY_COARSE;
-
-    private float mTrackSpeed = 100.0f; // km/hr - default for kml tracks
-
-    private Location mInitialLocation;
-
-    private class TrackProviderThread extends Thread {
-
-        private boolean mDone = false;
-
-        public TrackProviderThread() {
-            super("TrackProviderThread");
-        }
-
-        public void run() {            
-            // thread exits after disable() is called
-            synchronized (this) {
-                while (!mDone) {
-                    try {
-                        wait(INTERVAL);
-                    } catch (InterruptedException e) {
-                    }
-                    
-                    if (!mDone) {
-                        TrackProvider.this.update();
-                    }
-                }
-            }
-        }
-        
-        synchronized void setDone() {
-            mDone = true;
-            notify();
-        }
-    }
-
-    private void close(Reader rdr) {
-        try {
-            if (rdr != null) {
-                rdr.close();
-            }
-        } catch (IOException e) {
-            Log.w(LOG_TAG, "Exception closing reader", e);
-        }
-    }
-
-    public void readTrack(File trackFile) {
-        BufferedReader br = null;
-        try {
-            br = new BufferedReader(new FileReader(trackFile), 8192);
-            String s;
-
-            long lastTime = -Long.MAX_VALUE;
-            while ((s = br.readLine()) != null) {
-                String[] tokens = s.split("\\s+");
-                if (tokens.length != 4 && tokens.length != 6) {
-                    Log.e(LOG_TAG, "Got track \"" + s +
-                        "\", wanted <time> <long> <lat> <alt> [<bearing> <speed>]");
-                    continue;
-                }
-                long time;
-                double longitude, latitude, altitude;
-                try {
-                    time = Long.parseLong(tokens[0]);
-                    longitude = Double.parseDouble(tokens[1]);
-                    latitude = Double.parseDouble(tokens[2]);
-                    altitude = Double.parseDouble(tokens[3]);
-                } catch (NumberFormatException e) {
-                    Log.e(LOG_TAG, "Got track \"" + s +
-                        "\", wanted <time> <long> <lat> <alt> " +
-                        "[<bearing> <speed>]", e);
-                    continue;
-                }
-
-                Waypoint w = new Waypoint(getName(), time, latitude, longitude, altitude);
-                if (tokens.length >= 6) {
-                    float bearing, speed;
-                    try {
-                        bearing = Float.parseFloat(tokens[4]);
-                        speed = Float.parseFloat(tokens[5]);
-                        w.setBearing(bearing);
-                        w.setSpeed(speed);
-                    } catch (NumberFormatException e) {
-                        Log.e(LOG_TAG, "Ignoring bearing and speed \"" +
-                            tokens[4] + "\", \"" + tokens[5] + "\"", e);
-                    }
-                }
-
-                if (mInitialLocation == null) {
-                    mInitialLocation = w.getLocation();
-                }
-
-                // Ignore waypoints whose time is less than or equal to 0 or
-                // the time of the previous waypoint
-                if (time < 0) {
-                    Log.e(LOG_TAG, "Ignoring waypoint at negative time=" + time);
-                    continue;
-                }
-                if (time <= lastTime) {
-                    Log.e(LOG_TAG, "Ignoring waypoint at time=" + time +
-                        " (< " + lastTime + ")");
-                    continue;
-                }
-
-                mWaypoints.add(w);
-                lastTime = time;
-            }
-
-            setTimes();
-            return;
-        } catch (IOException e) {
-            Log.e(LOG_TAG, "Exception reading track file", e);
-            mWaypoints.clear();
-        } finally {
-            close(br);
-        }
-    }
-
-    public void readKml(File kmlFile) {
-        FileReader kmlReader = null;
-        try {
-            kmlReader = new FileReader(kmlFile);
-            XmlPullParserFactory factory = XmlPullParserFactory.newInstance();
-            XmlPullParser xpp = factory.newPullParser();
-            xpp.setInput(kmlReader);
-
-            // Concatenate the text of each <coordinates> tag
-            boolean inCoordinates = false;
-            StringBuilder sb = new StringBuilder();
-            int eventType = xpp.getEventType();
-            do {
-                if (eventType == XmlPullParser.START_DOCUMENT) {
-                    // do nothing
-                } else if (eventType == XmlPullParser.END_DOCUMENT) {
-                    // do nothing
-                } else if (eventType == XmlPullParser.START_TAG) {
-                    String startTagName = xpp.getName();
-                    if (startTagName.equals("coordinates")) {
-                        inCoordinates = true;
-                    }
-                } else if (eventType == XmlPullParser.END_TAG) {
-                    String endTagName = xpp.getName();
-                    if (endTagName.equals("coordinates")) {
-                        inCoordinates = false;
-                    }
-                } else if (eventType == XmlPullParser.TEXT) {
-                    if (inCoordinates) {
-                        sb.append(xpp.getText());
-                        sb.append(' ');
-                    }
-                }
-                eventType = xpp.next();
-            } while (eventType != XmlPullParser.END_DOCUMENT);
-
-            String coordinates = sb.toString();
-
-            // Parse the "lon,lat,alt" triples and supply times
-            // for each waypoint based on a constant speed
-            Location loc = null;
-            double KM_PER_HOUR = mTrackSpeed;
-            double KM_PER_METER = 1.0 / 1000.0;
-            double MILLIS_PER_HOUR = 60.0 * 60.0 * 1000.0;
-            double MILLIS_PER_METER =
-                (1.0 / KM_PER_HOUR) * (KM_PER_METER) * (MILLIS_PER_HOUR);
-            long time = 0L;
-
-            StringTokenizer st = new StringTokenizer(coordinates, ", ");
-            while (st.hasMoreTokens()) {
-                try {
-                    String lon = st.nextToken();
-                    String lat = st.nextToken();
-                    String alt = st.nextToken();
-                    if (Config.LOGD) {
-                        Log.d(LOG_TAG,
-                            "lon=" + lon + ", lat=" + lat + ", alt=" + alt);
-                    }
-
-                    double nLongitude = Double.parseDouble(lon);
-                    double nLatitude = Double.parseDouble(lat);
-                    double nAltitude = Double.parseDouble(alt);
-
-                    Location nLoc = new Location(getName());
-                    nLoc.setLatitude(nLatitude);
-                    nLoc.setLongitude(nLongitude);
-                    if (loc != null) {
-                        double distance = loc.distanceTo(nLoc);
-                        if (Config.LOGD) {
-                            Log.d(LOG_TAG, "distance = " + distance);
-                        }
-                        time += (long) (distance * MILLIS_PER_METER);
-                    }
-
-                    Waypoint w = new Waypoint(getName(), time,
-                        nLatitude, nLongitude, nAltitude);
-                    if (supportsSpeed()) {
-                        w.setSpeed(mTrackSpeed);
-                    }
-                    if (supportsBearing()) {
-                        w.setBearing(0.0f);
-                    }
-                    mWaypoints.add(w);
-
-                    if (mInitialLocation == null) {
-                        mInitialLocation = w.getLocation();
-                    }
-
-                    loc = nLoc;
-                } catch (NumberFormatException nfe) {
-                    Log.e(LOG_TAG, "Got NumberFormatException reading KML data: " +
-                        nfe, nfe);
-                }
-            }
-
-            setTimes();
-            return;
-        } catch (IOException ioe) {
-            mWaypoints.clear();
-            Log.e(LOG_TAG, "Exception reading KML data: " + ioe, ioe);
-            // fall through
-        } catch (XmlPullParserException xppe) {
-            mWaypoints.clear();
-            Log.e(LOG_TAG, "Exception reading KML data: " + xppe, xppe);
-            // fall through
-        } finally {
-            close(kmlReader);
-        }
-    }
-
-    public void readNmea(String name, File file) {
-        BufferedReader br = null;
-        try {
-            br = new BufferedReader(new FileReader(file), 8192);
-            String s;
-
-            String provider = getName();
-            NmeaParser parser = new NmeaParser(name);
-            while ((s = br.readLine()) != null) {
-                boolean newWaypoint = parser.parseSentence(s);
-                if (newWaypoint) {
-                    Location loc = parser.getLocation();
-                    Waypoint w = new Waypoint(loc);
-                    mWaypoints.add(w);
-                    // Log.i(TAG, "Got waypoint " + w);
-                }
-            }
-
-            setTimes();
-            return;
-        } catch (IOException ioe) {
-            Log.e(LOG_TAG, "Exception reading NMEA data: " + ioe);
-            mWaypoints.clear();
-        } finally {
-            close(br);
-        }
-    }
-
-    private static boolean booleanVal(String tf) {
-        return (tf == null) || (tf.equalsIgnoreCase("true"));
-    }
-
-    private static int intVal(String val) {
-        try {
-            return (val == null) ? 0 : Integer.parseInt(val);
-        } catch (NumberFormatException nfe) {
-            return 0;
-        }
-    }
-
-    private static float floatVal(String val) {
-        try {
-            return (val == null) ? 0 : Float.parseFloat(val);
-        } catch (NumberFormatException nfe) {
-            return 0.0f;
-        }
-    }
-
-    public void readProperties(File propertiesFile) {
-        BufferedReader br = null;
-        if (!propertiesFile.exists()) {
-            return;
-        }
-        try {
-            if (Config.LOGD) {
-                Log.d(LOG_TAG, "Loading properties file " +
-                    propertiesFile.getPath());
-            }
-            br = new BufferedReader(new FileReader(propertiesFile), 8192);
-
-            String s;
-            while ((s = br.readLine()) != null) {
-                StringTokenizer st = new StringTokenizer(s);
-                String command = null;
-                String value = null;
-                if (!st.hasMoreTokens()) {
-                    continue;
-                }
-                command = st.nextToken();
-                if (st.hasMoreTokens()) {
-                    value = st.nextToken();
-                }
-
-                if (command.equalsIgnoreCase("requiresNetwork")) {
-                    setRequiresNetwork(booleanVal(value));
-                } else if (command.equalsIgnoreCase("requiresSatellite")) {
-                    setRequiresSatellite(booleanVal(value));
-                } else if (command.equalsIgnoreCase("requiresCell")) {
-                    setRequiresCell(booleanVal(value));
-                } else if (command.equalsIgnoreCase("hasMonetaryCost")) {
-                    setHasMonetaryCost(booleanVal(value));
-                } else if (command.equalsIgnoreCase("supportsAltitude")) {
-                    setSupportsAltitude(booleanVal(value));
-                } else if (command.equalsIgnoreCase("supportsBearing")) {
-                    setSupportsBearing(booleanVal(value));
-                } else if (command.equalsIgnoreCase("repeat")) {
-                    setRepeat(booleanVal(value));
-                } else if (command.equalsIgnoreCase("supportsSpeed")) {
-                    setSupportsSpeed(booleanVal(value));
-                } else if (command.equalsIgnoreCase("powerRequirement")) {
-                    setPowerRequirement(intVal(value));
-                } else if (command.equalsIgnoreCase("accuracy")) {
-                    setAccuracy(intVal(value));
-                } else if (command.equalsIgnoreCase("trackspeed")) {
-                    setTrackSpeed(floatVal(value));
-                } else {
-                    Log.e(LOG_TAG, "Unknown command \"" + command + "\"");
-                }
-            }
-        } catch (IOException ioe) {
-            Log.e(LOG_TAG, "IOException reading properties file " +
-                propertiesFile.getPath(), ioe);
-        } finally {
-            try {
-                if (br != null) {
-                    br.close();
-                }
-            } catch (IOException e) {
-                Log.w(LOG_TAG, "IOException closing properties file " +
-                    propertiesFile.getPath(), e);
-            }
-        }
-    }
-
-    public TrackProvider(String name, ILocationManager locationManager) {
-        super(name, locationManager);
-        setTimes();
-    }
-
-    public TrackProvider(String name, ILocationManager locationManager, File file) {
-        this(name, locationManager);
-
-        String filename = file.getName();
-        if (filename.endsWith("kml")) {
-            readKml(file);
-        } else if (filename.endsWith("nmea")) {
-            readNmea(getName(), file);
-        } else if (filename.endsWith("track")) {
-            readTrack(file);
-        } else {
-            Log.e(LOG_TAG, "Can't initialize TrackProvider from file " +
-                filename + " (not *kml, *nmea, or *track)");
-        }
-        setTimes();
-    }
-
-    private void setTimes() {
-        mBaseTime = System.currentTimeMillis();
-        if (mWaypoints.size() >= 2) {
-            mMinTime = mWaypoints.get(0).getTime();
-            mMaxTime = mWaypoints.get(mWaypoints.size() - 1).getTime();
-        } else {
-            mMinTime = mMaxTime = 0;
-        }
-    }
-
-    private double interp(double d0, double d1, float frac) {
-        return d0 + frac * (d1 - d0);
-    }
-
-    private void update() {
-        long time = System.currentTimeMillis() - mBaseTime;
-
-        List<Waypoint> waypoints = mWaypoints;
-        if (waypoints == null) {
-            return;
-        }
-        int size = waypoints.size();
-        if (size < 2) {
-            return;
-        }
-
-        long t = time;
-        if (t < mMinTime) {
-            t = mMinTime;
-        }
-        if (mRepeat) {
-            t -= mMinTime;
-            long deltaT = mMaxTime - mMinTime;
-            t %= 2 * deltaT;
-            if (t > deltaT) {
-                t = 2 * deltaT - t;
-            }
-            t += mMinTime;
-        } else if (t > mMaxTime) {
-            t = mMaxTime;
-        }
-
-        // Locate the time interval for the current time
-        // We slide the window since we don't expect to move
-        // much between calls
-
-        Waypoint w0 = waypoints.get(mWaypointIndex);
-        Waypoint w1 = waypoints.get(mWaypointIndex + 1);
-
-        // If the right end of the current interval is too early,
-        // move forward to the next waypoint
-        while (t > w1.getTime()) {
-            w0 = w1;
-            w1 = waypoints.get(++mWaypointIndex + 1);
-        }
-        // If the left end of the current interval is too late,
-        // move back to the previous waypoint
-        while (t < w0.getTime()) {
-            w1 = w0;
-            w0 = waypoints.get(--mWaypointIndex);
-        }
-
-        // Now we know that w0.mTime <= t <= w1.mTime
-        long w0Time = w0.getTime();
-        long w1Time = w1.getTime();
-        long dt = w1Time - w0Time;
-
-        float frac = (dt == 0) ? 0 : ((float) (t - w0Time) / dt);
-        mLatitude  = interp(w0.getLatitude(), w1.getLatitude(), frac);
-        mLongitude = interp(w0.getLongitude(), w1.getLongitude(), frac);
-        mHasAltitude = w0.hasAltitude() && w1.hasAltitude();
-        if (mSupportsAltitude && mHasAltitude) {
-            mAltitude  = interp(w0.getAltitude(), w1.getAltitude(), frac);
-        }
-        if (mSupportsBearing) {
-            mHasBearing = frac <= 0.5f ? w0.hasBearing() : w1.hasBearing();
-            if (mHasBearing) {
-                mBearing  = frac <= 0.5f ? w0.getBearing() : w1.getBearing();
-            }
-        }
-        if (mSupportsSpeed) {
-            mHasSpeed = frac <= 0.5f ? w0.hasSpeed() : w1.hasSpeed();
-            if (mHasSpeed) {
-                mSpeed  = frac <= 0.5f ? w0.getSpeed() : w1.getSpeed();
-            }
-        }
-        mLastTime = time;
-        mTime = time;
-    }
-
-    public void setRequiresNetwork(boolean requiresNetwork) {
-        mRequiresNetwork = requiresNetwork;
-    }
-
-    @Override public boolean requiresNetwork() {
-        return mRequiresNetwork;
-    }
-
-    public void setRequiresSatellite(boolean requiresSatellite) {
-        mRequiresSatellite = requiresSatellite;
-    }
-
-    @Override public boolean requiresSatellite() {
-        return mRequiresSatellite;
-    }
-
-    public void setRequiresCell(boolean requiresCell) {
-        mRequiresCell = requiresCell;
-    }
-
-    @Override public boolean requiresCell() {
-        return mRequiresCell;
-    }
-
-    public void setHasMonetaryCost(boolean hasMonetaryCost) {
-        mHasMonetaryCost = hasMonetaryCost;
-    }
-
-    @Override public boolean hasMonetaryCost() {
-        return mHasMonetaryCost;
-    }
-
-    public void setSupportsAltitude(boolean supportsAltitude) {
-        mSupportsAltitude = supportsAltitude;
-    }
-
-    @Override public boolean supportsAltitude() {
-        return mSupportsAltitude;
-    }
-
-    public void setSupportsSpeed(boolean supportsSpeed) {
-        mSupportsSpeed = supportsSpeed;
-    }
-
-    @Override public boolean supportsSpeed() {
-        return mSupportsSpeed;
-    }
-
-    public void setSupportsBearing(boolean supportsBearing) {
-        mSupportsBearing = supportsBearing;
-    }
-
-    @Override public boolean supportsBearing() {
-        return mSupportsBearing;
-    }
-
-    public void setRepeat(boolean repeat) {
-        mRepeat = repeat;
-    }
-
-    public void setPowerRequirement(int powerRequirement) {
-        if (powerRequirement < Criteria.POWER_LOW ||
-            powerRequirement > Criteria.POWER_HIGH) {
-            throw new IllegalArgumentException("powerRequirement = " +
-                powerRequirement);
-        }
-        mPowerRequirement = powerRequirement;
-    }
-
-    @Override public int getPowerRequirement() {
-        return mPowerRequirement;
-    }
-
-    public void setAccuracy(int accuracy) {
-        mAccuracy = accuracy;
-    }
-
-    @Override public int getAccuracy() {
-        return mAccuracy;
-    }
-
-    public void setTrackSpeed(float trackSpeed) {
-        mTrackSpeed = trackSpeed;
-    }
-
-    @Override public synchronized void enable() {
-       mEnabled = true;
-        mThread = new TrackProviderThread();
-        mThread.start();
-    }
-
-    @Override public synchronized void disable() {
-        mEnabled = false;
-        if (mThread != null) {
-            mThread.setDone();
-            try {
-                mThread.join();
-            } catch (InterruptedException e) {
-            }
-            mThread = null;
-        }
-    }
-
-    @Override public boolean isEnabled() {
-        return mEnabled;
-    }
-
-    @Override public int getStatus(Bundle extras) {
-        return AVAILABLE;
-    }
-
-    public Location getInitialLocation() {
-        return mInitialLocation;
-    }
-}
-
-/**
- * A simple tuple of (time stamp, latitude, longitude, altitude), plus optional
- * extras.
- *
- * {@hide}
- */
-class Waypoint {
-    public Location mLocation;
-
-    public Waypoint(Location location) {
-        mLocation = location;
-    }
-
-    public Waypoint(String providerName, long time, double latitude, double longitude,
-        double altitude) {
-        mLocation = new Location(providerName);
-        mLocation.setTime(time);
-        mLocation.setLatitude(latitude);
-        mLocation.setLongitude(longitude);
-        mLocation.setAltitude(altitude);
-    }
-
-    public long getTime() {
-        return mLocation.getTime();
-    }
-
-    public double getLatitude() {
-        return mLocation.getLatitude();
-    }
-
-    public double getLongitude() {
-        return mLocation.getLongitude();
-    }
-
-    public boolean hasAltitude() {
-        return mLocation.hasAltitude();
-    }
-
-    public double getAltitude() {
-        return mLocation.getAltitude();
-    }
-
-    public boolean hasBearing() {
-        return mLocation.hasBearing();
-    }
-
-    public void setBearing(float bearing) {
-        mLocation.setBearing(bearing);
-    }
-
-    public float getBearing() {
-        return mLocation.getBearing();
-    }
-
-    public boolean hasSpeed() {
-        return mLocation.hasSpeed();
-    }
-
-    public void setSpeed(float speed) {
-        mLocation.setSpeed(speed);
-    }
-
-    public float getSpeed() {
-        return mLocation.getSpeed();
-    }
-
-    public Bundle getExtras() {
-        return mLocation.getExtras();
-    }
-
-    public Location getLocation() {
-        return new Location(mLocation);
-    }
-
-    @Override public String toString() {
-        return "Waypoint[mLocation=" + mLocation + "]";
-    }
-}
diff --git a/media/java/android/media/AudioSystem.java b/media/java/android/media/AudioSystem.java
index d0fa795..5917ab90 100644
--- a/media/java/android/media/AudioSystem.java
+++ b/media/java/android/media/AudioSystem.java
@@ -200,7 +200,7 @@
          * param error   error code:
          * - AUDIO_STATUS_OK
          * - AUDIO_STATUS_SERVER_DIED
-         * - UDIO_STATUS_ERROR
+         * - AUDIO_STATUS_ERROR
          */
         void onError(int error);
     };
diff --git a/media/java/android/media/MediaScanner.java b/media/java/android/media/MediaScanner.java
index fc8476d..ae3e181 100644
--- a/media/java/android/media/MediaScanner.java
+++ b/media/java/android/media/MediaScanner.java
@@ -453,11 +453,12 @@
                 FileCacheEntry entry = beginFile(path, mimeType, lastModified, fileSize);
                 // rescan for metadata if file was modified since last scan
                 if (entry != null && (entry.mLastModifiedChanged || scanAlways)) {
-                    boolean ringtones = (path.indexOf(RINGTONES_DIR) > 0);
-                    boolean notifications = (path.indexOf(NOTIFICATIONS_DIR) > 0);
-                    boolean alarms = (path.indexOf(ALARMS_DIR) > 0);
-                    boolean podcasts = (path.indexOf(PODCAST_DIR) > 0);
-                    boolean music = (path.indexOf(MUSIC_DIR) > 0) ||
+                    String lowpath = path.toLowerCase();
+                    boolean ringtones = (lowpath.indexOf(RINGTONES_DIR) > 0);
+                    boolean notifications = (lowpath.indexOf(NOTIFICATIONS_DIR) > 0);
+                    boolean alarms = (lowpath.indexOf(ALARMS_DIR) > 0);
+                    boolean podcasts = (lowpath.indexOf(PODCAST_DIR) > 0);
+                    boolean music = (lowpath.indexOf(MUSIC_DIR) > 0) ||
                         (!ringtones && !notifications && !alarms && !podcasts);
 
                     if (mFileType == MediaFile.FILE_TYPE_MP3 ||
diff --git a/media/libmedia/AudioRecord.cpp b/media/libmedia/AudioRecord.cpp
index 986f88e..1720af0 100644
--- a/media/libmedia/AudioRecord.cpp
+++ b/media/libmedia/AudioRecord.cpp
@@ -73,7 +73,6 @@
         // Otherwise the callback thread will never exit.
         stop();
         if (mClientRecordThread != 0) {
-            mCblk->cv.signal();
             mClientRecordThread->requestExitAndWait();
             mClientRecordThread.clear();
         }
@@ -96,7 +95,7 @@
 {
 
     LOGV("set(): sampleRate %d, channelCount %d, frameCount %d",sampleRate, channelCount, frameCount);
-    if (mAudioFlinger != 0) {
+    if (mAudioRecord != 0) {
         return INVALID_OPERATION;
     }
 
@@ -181,7 +180,6 @@
 
     mStatus = NO_ERROR;
 
-    mAudioFlinger = audioFlinger;
     mAudioRecord = record;
     mCblkMemory = cblk;
     mCblk = static_cast<audio_track_cblk_t*>(cblk->pointer());
@@ -293,6 +291,7 @@
      }
 
     if (android_atomic_and(~1, &mActive) == 1) {
+        mCblk->cv.signal();
         mAudioRecord->stop();
         // the record head position will reset to 0, so if a marker is set, we need
         // to activate it again
@@ -375,6 +374,7 @@
     status_t result;
     audio_track_cblk_t* cblk = mCblk;
     uint32_t framesReq = audioBuffer->frameCount;
+    uint32_t waitTimeMs = (waitCount < 0) ? cblk->bufferTimeoutMs : WAIT_PERIOD_MS;
 
     audioBuffer->frameCount  = 0;
     audioBuffer->size        = 0;
@@ -391,9 +391,9 @@
             if (UNLIKELY(!waitCount))
                 return WOULD_BLOCK;
             timeout = 0;
-            result = cblk->cv.waitRelative(cblk->lock, milliseconds(WAIT_PERIOD_MS));
+            result = cblk->cv.waitRelative(cblk->lock, milliseconds(waitTimeMs));
             if (__builtin_expect(result!=NO_ERROR, false)) {
-                cblk->waitTimeMs += WAIT_PERIOD_MS;
+                cblk->waitTimeMs += waitTimeMs;
                 if (cblk->waitTimeMs >= cblk->bufferTimeoutMs) {
                     LOGW(   "obtainBuffer timed out (is the CPU pegged?) "
                             "user=%08x, server=%08x", cblk->user, cblk->server);
@@ -520,7 +520,7 @@
         status_t err = obtainBuffer(&audioBuffer, 1);
         if (err < NO_ERROR) {
             if (err != TIMED_OUT) {
-                LOGE("Error obtaining an audio buffer, giving up.");
+                LOGE_IF(err != status_t(NO_MORE_BUFFERS), "Error obtaining an audio buffer, giving up.");
                 return false;
             }
             break;
diff --git a/media/libmedia/AudioTrack.cpp b/media/libmedia/AudioTrack.cpp
index 24f7281..289bd75 100644
--- a/media/libmedia/AudioTrack.cpp
+++ b/media/libmedia/AudioTrack.cpp
@@ -92,7 +92,6 @@
         // Otherwise the callback thread will never exit.
         stop();
         if (mAudioTrackThread != 0) {
-            mCblk->cv.signal();
             mAudioTrackThread->requestExitAndWait();
             mAudioTrackThread.clear();
         }
@@ -117,7 +116,7 @@
 
     LOGV_IF(sharedBuffer != 0, "sharedBuffer: %p, size: %d", sharedBuffer->pointer(), sharedBuffer->size());
 
-    if (mAudioFlinger != 0) {
+    if (mAudioTrack != 0) {
         LOGE("Track already in use");
         return INVALID_OPERATION;
     }
@@ -228,7 +227,6 @@
 
     mStatus = NO_ERROR;
 
-    mAudioFlinger = audioFlinger;
     mAudioTrack = track;
     mCblkMemory = cblk;
     mCblk = static_cast<audio_track_cblk_t*>(cblk->pointer());
@@ -357,6 +355,7 @@
     }
 
     if (android_atomic_and(~1, &mActive) == 1) {
+        mCblk->cv.signal();
         mAudioTrack->stop();
         // Cancel loops (If we are in the middle of a loop, playback
         // would not stop until loopCount reaches 0).
@@ -596,6 +595,7 @@
     status_t result;
     audio_track_cblk_t* cblk = mCblk;
     uint32_t framesReq = audioBuffer->frameCount;
+    uint32_t waitTimeMs = (waitCount < 0) ? cblk->bufferTimeoutMs : WAIT_PERIOD_MS;
 
     audioBuffer->frameCount  = 0;
     audioBuffer->size = 0;
@@ -614,9 +614,9 @@
             if (UNLIKELY(!waitCount))
                 return WOULD_BLOCK;
             timeout = 0;
-            result = cblk->cv.waitRelative(cblk->lock, milliseconds(WAIT_PERIOD_MS));
+            result = cblk->cv.waitRelative(cblk->lock, milliseconds(waitTimeMs));
             if (__builtin_expect(result!=NO_ERROR, false)) { 
-                cblk->waitTimeMs += WAIT_PERIOD_MS;
+                cblk->waitTimeMs += waitTimeMs;
                 if (cblk->waitTimeMs >= cblk->bufferTimeoutMs) {
                     // timing out when a loop has been set and we have already written upto loop end
                     // is a normal condition: no need to wake AudioFlinger up.
@@ -798,7 +798,7 @@
         status_t err = obtainBuffer(&audioBuffer, 1);
         if (err < NO_ERROR) {
             if (err != TIMED_OUT) {
-                LOGE("Error obtaining an audio buffer, giving up.");
+                LOGE_IF(err != status_t(NO_MORE_BUFFERS), "Error obtaining an audio buffer, giving up.");
                 return false;
             }
             break;
diff --git a/media/libmedia/IAudioFlinger.cpp b/media/libmedia/IAudioFlinger.cpp
index 5cbb25c..52bd7d4 100644
--- a/media/libmedia/IAudioFlinger.cpp
+++ b/media/libmedia/IAudioFlinger.cpp
@@ -336,7 +336,7 @@
     {
         Parcel data, reply;
         data.writeInterfaceToken(IAudioFlinger::getInterfaceDescriptor());
-        remote()->transact(WAKE_UP, data, &reply);
+        remote()->transact(WAKE_UP, data, &reply, IBinder::FLAG_ONEWAY);
         return;
     }
 
diff --git a/media/libmedia/IAudioFlingerClient.cpp b/media/libmedia/IAudioFlingerClient.cpp
index 5feb11f..9d00aefb 100644
--- a/media/libmedia/IAudioFlingerClient.cpp
+++ b/media/libmedia/IAudioFlingerClient.cpp
@@ -43,7 +43,7 @@
         Parcel data, reply;
         data.writeInterfaceToken(IAudioFlingerClient::getInterfaceDescriptor());
         data.writeInt32((int)enabled);
-        remote()->transact(AUDIO_OUTPUT_CHANGED, data, &reply);
+        remote()->transact(AUDIO_OUTPUT_CHANGED, data, &reply, IBinder::FLAG_ONEWAY);
     }
 };
 
diff --git a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/MediaNames.java b/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/MediaNames.java
index 07b43bb..281828f 100755
--- a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/MediaNames.java
+++ b/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/MediaNames.java
@@ -464,6 +464,7 @@
   public static final String RECORDED_SQVGA_H263 = "/sdcard/SQVGA_H263.3gp";
   public static final String RECORDED_CIF_H263 = "/sdcard/CIF_H263.3gp";
   public static final String RECORDED_QCIF_H263 = "/sdcard/QCIF_H263.3gp";
+  public static final String RECORDED_PORTRAIT_H263 = "/sdcard/QCIF_mp4.3gp";
   
   public static final String RECORDED_HVGA_MP4 = "/sdcard/HVGA_mp4.mp4";
   public static final String RECORDED_QVGA_MP4 = "/sdcard/QVGA_mp4.mp4";
diff --git a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/MediaRecorderTest.java b/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/MediaRecorderTest.java
index 65451c5..261b4f4 100644
--- a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/MediaRecorderTest.java
+++ b/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/MediaRecorderTest.java
@@ -22,6 +22,7 @@
 import java.io.*;
 
 import android.content.Context;
+import android.hardware.Camera;
 import android.media.MediaPlayer;
 import android.media.MediaRecorder;
 import android.test.ActivityInstrumentationTestCase;
@@ -46,6 +47,7 @@
     private SurfaceHolder mSurfaceHolder = null;
     private MediaRecorder mRecorder;
     Context mContext;
+    Camera mCamera;
   
     public MediaRecorderTest() {
         super("com.android.mediaframeworktest", MediaFrameworkTest.class);
@@ -234,12 +236,32 @@
         assertTrue("QCIFH263 Video Only", videoRecordedResult);
     }
     
-    @Suppress
-    public void testPortraitH263() throws Exception {       
+    @LargeTest
+    /*
+     * This test case set the camera in portrait mode.
+     * Verification: validate the video dimension and the duration.
+     */
+    public void testPortraitH263() throws Exception {
         boolean videoRecordedResult = false;
-        recordVideo(15, 144, 176, MediaRecorder.VideoEncoder.H263, 
-               MediaRecorder.OutputFormat.MPEG_4, MediaNames.RECORDED_VIDEO_3GP, true);      
-        videoRecordedResult = validateVideo(MediaNames.RECORDED_VIDEO_3GP, 144, 176);
+        try {
+            mCamera = Camera.open();
+            Camera.Parameters parameters = mCamera.getParameters();
+            parameters.setPreviewSize(352, 288);
+            parameters.set("orientation", "portrait");
+            mCamera.setParameters(parameters);
+            mCamera.unlock();
+            mRecorder.setCamera(mCamera);
+            Thread.sleep(1000);
+            recordVideo(15, 352, 288, MediaRecorder.VideoEncoder.H263,
+                    MediaRecorder.OutputFormat.THREE_GPP, 
+                    MediaNames.RECORDED_PORTRAIT_H263, true);
+            videoRecordedResult = 
+                validateVideo(MediaNames.RECORDED_PORTRAIT_H263, 352, 288);
+            mCamera.lock();
+            mCamera.release();
+        } catch (Exception e) {
+            Log.v(TAG, e.toString());
+        }
         assertTrue("PortraitH263", videoRecordedResult);
     }
     
diff --git a/opengl/java/android/opengl/GLES10.java b/opengl/java/android/opengl/GLES10.java
new file mode 100644
index 0000000..147b60f
--- /dev/null
+++ b/opengl/java/android/opengl/GLES10.java
@@ -0,0 +1,1325 @@
+/*
+**
+** Copyright 2009, The Android Open Source Project
+**
+** Licensed under the Apache License, Version 2.0 (the "License");
+** you may not use this file except in compliance with the License.
+** You may obtain a copy of the License at
+**
+**     http://www.apache.org/licenses/LICENSE-2.0
+**
+** Unless required by applicable law or agreed to in writing, software
+** distributed under the License is distributed on an "AS IS" BASIS,
+** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+** See the License for the specific language governing permissions and
+** limitations under the License.
+*/
+
+// This source file is automatically generated
+
+package android.opengl;
+
+import java.nio.Buffer;
+
+public class GLES10 {
+    public static final int GL_ADD                                   = 0x0104;
+    public static final int GL_ALIASED_LINE_WIDTH_RANGE              = 0x846E;
+    public static final int GL_ALIASED_POINT_SIZE_RANGE              = 0x846D;
+    public static final int GL_ALPHA                                 = 0x1906;
+    public static final int GL_ALPHA_BITS                            = 0x0D55;
+    public static final int GL_ALPHA_TEST                            = 0x0BC0;
+    public static final int GL_ALWAYS                                = 0x0207;
+    public static final int GL_AMBIENT                               = 0x1200;
+    public static final int GL_AMBIENT_AND_DIFFUSE                   = 0x1602;
+    public static final int GL_AND                                   = 0x1501;
+    public static final int GL_AND_INVERTED                          = 0x1504;
+    public static final int GL_AND_REVERSE                           = 0x1502;
+    public static final int GL_BACK                                  = 0x0405;
+    public static final int GL_BLEND                                 = 0x0BE2;
+    public static final int GL_BLUE_BITS                             = 0x0D54;
+    public static final int GL_BYTE                                  = 0x1400;
+    public static final int GL_CCW                                   = 0x0901;
+    public static final int GL_CLAMP_TO_EDGE                         = 0x812F;
+    public static final int GL_CLEAR                                 = 0x1500;
+    public static final int GL_COLOR_ARRAY                           = 0x8076;
+    public static final int GL_COLOR_BUFFER_BIT                      = 0x4000;
+    public static final int GL_COLOR_LOGIC_OP                        = 0x0BF2;
+    public static final int GL_COLOR_MATERIAL                        = 0x0B57;
+    public static final int GL_COMPRESSED_TEXTURE_FORMATS            = 0x86A3;
+    public static final int GL_CONSTANT_ATTENUATION                  = 0x1207;
+    public static final int GL_COPY                                  = 0x1503;
+    public static final int GL_COPY_INVERTED                         = 0x150C;
+    public static final int GL_CULL_FACE                             = 0x0B44;
+    public static final int GL_CW                                    = 0x0900;
+    public static final int GL_DECAL                                 = 0x2101;
+    public static final int GL_DECR                                  = 0x1E03;
+    public static final int GL_DEPTH_BITS                            = 0x0D56;
+    public static final int GL_DEPTH_BUFFER_BIT                      = 0x0100;
+    public static final int GL_DEPTH_TEST                            = 0x0B71;
+    public static final int GL_DIFFUSE                               = 0x1201;
+    public static final int GL_DITHER                                = 0x0BD0;
+    public static final int GL_DONT_CARE                             = 0x1100;
+    public static final int GL_DST_ALPHA                             = 0x0304;
+    public static final int GL_DST_COLOR                             = 0x0306;
+    public static final int GL_EMISSION                              = 0x1600;
+    public static final int GL_EQUAL                                 = 0x0202;
+    public static final int GL_EQUIV                                 = 0x1509;
+    public static final int GL_EXP                                   = 0x0800;
+    public static final int GL_EXP2                                  = 0x0801;
+    public static final int GL_EXTENSIONS                            = 0x1F03;
+    public static final int GL_FALSE                                 = 0;
+    public static final int GL_FASTEST                               = 0x1101;
+    public static final int GL_FIXED                                 = 0x140C;
+    public static final int GL_FLAT                                  = 0x1D00;
+    public static final int GL_FLOAT                                 = 0x1406;
+    public static final int GL_FOG                                   = 0x0B60;
+    public static final int GL_FOG_COLOR                             = 0x0B66;
+    public static final int GL_FOG_DENSITY                           = 0x0B62;
+    public static final int GL_FOG_END                               = 0x0B64;
+    public static final int GL_FOG_HINT                              = 0x0C54;
+    public static final int GL_FOG_MODE                              = 0x0B65;
+    public static final int GL_FOG_START                             = 0x0B63;
+    public static final int GL_FRONT                                 = 0x0404;
+    public static final int GL_FRONT_AND_BACK                        = 0x0408;
+    public static final int GL_GEQUAL                                = 0x0206;
+    public static final int GL_GREATER                               = 0x0204;
+    public static final int GL_GREEN_BITS                            = 0x0D53;
+    public static final int GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES  = 0x8B9B;
+    public static final int GL_IMPLEMENTATION_COLOR_READ_TYPE_OES    = 0x8B9A;
+    public static final int GL_INCR                                  = 0x1E02;
+    public static final int GL_INVALID_ENUM                          = 0x0500;
+    public static final int GL_INVALID_OPERATION                     = 0x0502;
+    public static final int GL_INVALID_VALUE                         = 0x0501;
+    public static final int GL_INVERT                                = 0x150A;
+    public static final int GL_KEEP                                  = 0x1E00;
+    public static final int GL_LEQUAL                                = 0x0203;
+    public static final int GL_LESS                                  = 0x0201;
+    public static final int GL_LIGHT_MODEL_AMBIENT                   = 0x0B53;
+    public static final int GL_LIGHT_MODEL_TWO_SIDE                  = 0x0B52;
+    public static final int GL_LIGHT0                                = 0x4000;
+    public static final int GL_LIGHT1                                = 0x4001;
+    public static final int GL_LIGHT2                                = 0x4002;
+    public static final int GL_LIGHT3                                = 0x4003;
+    public static final int GL_LIGHT4                                = 0x4004;
+    public static final int GL_LIGHT5                                = 0x4005;
+    public static final int GL_LIGHT6                                = 0x4006;
+    public static final int GL_LIGHT7                                = 0x4007;
+    public static final int GL_LIGHTING                              = 0x0B50;
+    public static final int GL_LINE_LOOP                             = 0x0002;
+    public static final int GL_LINE_SMOOTH                           = 0x0B20;
+    public static final int GL_LINE_SMOOTH_HINT                      = 0x0C52;
+    public static final int GL_LINE_STRIP                            = 0x0003;
+    public static final int GL_LINEAR                                = 0x2601;
+    public static final int GL_LINEAR_ATTENUATION                    = 0x1208;
+    public static final int GL_LINEAR_MIPMAP_LINEAR                  = 0x2703;
+    public static final int GL_LINEAR_MIPMAP_NEAREST                 = 0x2701;
+    public static final int GL_LINES                                 = 0x0001;
+    public static final int GL_LUMINANCE                             = 0x1909;
+    public static final int GL_LUMINANCE_ALPHA                       = 0x190A;
+    public static final int GL_MAX_ELEMENTS_INDICES                  = 0x80E9;
+    public static final int GL_MAX_ELEMENTS_VERTICES                 = 0x80E8;
+    public static final int GL_MAX_LIGHTS                            = 0x0D31;
+    public static final int GL_MAX_MODELVIEW_STACK_DEPTH             = 0x0D36;
+    public static final int GL_MAX_PROJECTION_STACK_DEPTH            = 0x0D38;
+    public static final int GL_MAX_TEXTURE_SIZE                      = 0x0D33;
+    public static final int GL_MAX_TEXTURE_STACK_DEPTH               = 0x0D39;
+    public static final int GL_MAX_TEXTURE_UNITS                     = 0x84E2;
+    public static final int GL_MAX_VIEWPORT_DIMS                     = 0x0D3A;
+    public static final int GL_MODELVIEW                             = 0x1700;
+    public static final int GL_MODULATE                              = 0x2100;
+    public static final int GL_MULTISAMPLE                           = 0x809D;
+    public static final int GL_NAND                                  = 0x150E;
+    public static final int GL_NEAREST                               = 0x2600;
+    public static final int GL_NEAREST_MIPMAP_LINEAR                 = 0x2702;
+    public static final int GL_NEAREST_MIPMAP_NEAREST                = 0x2700;
+    public static final int GL_NEVER                                 = 0x0200;
+    public static final int GL_NICEST                                = 0x1102;
+    public static final int GL_NO_ERROR                              = 0;
+    public static final int GL_NOOP                                  = 0x1505;
+    public static final int GL_NOR                                   = 0x1508;
+    public static final int GL_NORMAL_ARRAY                          = 0x8075;
+    public static final int GL_NORMALIZE                             = 0x0BA1;
+    public static final int GL_NOTEQUAL                              = 0x0205;
+    public static final int GL_NUM_COMPRESSED_TEXTURE_FORMATS        = 0x86A2;
+    public static final int GL_ONE                                   = 1;
+    public static final int GL_ONE_MINUS_DST_ALPHA                   = 0x0305;
+    public static final int GL_ONE_MINUS_DST_COLOR                   = 0x0307;
+    public static final int GL_ONE_MINUS_SRC_ALPHA                   = 0x0303;
+    public static final int GL_ONE_MINUS_SRC_COLOR                   = 0x0301;
+    public static final int GL_OR                                    = 0x1507;
+    public static final int GL_OR_INVERTED                           = 0x150D;
+    public static final int GL_OR_REVERSE                            = 0x150B;
+    public static final int GL_OUT_OF_MEMORY                         = 0x0505;
+    public static final int GL_PACK_ALIGNMENT                        = 0x0D05;
+    public static final int GL_PALETTE4_R5_G6_B5_OES                 = 0x8B92;
+    public static final int GL_PALETTE4_RGB5_A1_OES                  = 0x8B94;
+    public static final int GL_PALETTE4_RGB8_OES                     = 0x8B90;
+    public static final int GL_PALETTE4_RGBA4_OES                    = 0x8B93;
+    public static final int GL_PALETTE4_RGBA8_OES                    = 0x8B91;
+    public static final int GL_PALETTE8_R5_G6_B5_OES                 = 0x8B97;
+    public static final int GL_PALETTE8_RGB5_A1_OES                  = 0x8B99;
+    public static final int GL_PALETTE8_RGB8_OES                     = 0x8B95;
+    public static final int GL_PALETTE8_RGBA4_OES                    = 0x8B98;
+    public static final int GL_PALETTE8_RGBA8_OES                    = 0x8B96;
+    public static final int GL_PERSPECTIVE_CORRECTION_HINT           = 0x0C50;
+    public static final int GL_POINT_SMOOTH                          = 0x0B10;
+    public static final int GL_POINT_SMOOTH_HINT                     = 0x0C51;
+    public static final int GL_POINTS                                = 0x0000;
+    public static final int GL_POINT_FADE_THRESHOLD_SIZE             = 0x8128;
+    public static final int GL_POINT_SIZE                            = 0x0B11;
+    public static final int GL_POLYGON_OFFSET_FILL                   = 0x8037;
+    public static final int GL_POLYGON_SMOOTH_HINT                   = 0x0C53;
+    public static final int GL_POSITION                              = 0x1203;
+    public static final int GL_PROJECTION                            = 0x1701;
+    public static final int GL_QUADRATIC_ATTENUATION                 = 0x1209;
+    public static final int GL_RED_BITS                              = 0x0D52;
+    public static final int GL_RENDERER                              = 0x1F01;
+    public static final int GL_REPEAT                                = 0x2901;
+    public static final int GL_REPLACE                               = 0x1E01;
+    public static final int GL_RESCALE_NORMAL                        = 0x803A;
+    public static final int GL_RGB                                   = 0x1907;
+    public static final int GL_RGBA                                  = 0x1908;
+    public static final int GL_SAMPLE_ALPHA_TO_COVERAGE              = 0x809E;
+    public static final int GL_SAMPLE_ALPHA_TO_ONE                   = 0x809F;
+    public static final int GL_SAMPLE_COVERAGE                       = 0x80A0;
+    public static final int GL_SCISSOR_TEST                          = 0x0C11;
+    public static final int GL_SET                                   = 0x150F;
+    public static final int GL_SHININESS                             = 0x1601;
+    public static final int GL_SHORT                                 = 0x1402;
+    public static final int GL_SMOOTH                                = 0x1D01;
+    public static final int GL_SMOOTH_LINE_WIDTH_RANGE               = 0x0B22;
+    public static final int GL_SMOOTH_POINT_SIZE_RANGE               = 0x0B12;
+    public static final int GL_SPECULAR                              = 0x1202;
+    public static final int GL_SPOT_CUTOFF                           = 0x1206;
+    public static final int GL_SPOT_DIRECTION                        = 0x1204;
+    public static final int GL_SPOT_EXPONENT                         = 0x1205;
+    public static final int GL_SRC_ALPHA                             = 0x0302;
+    public static final int GL_SRC_ALPHA_SATURATE                    = 0x0308;
+    public static final int GL_SRC_COLOR                             = 0x0300;
+    public static final int GL_STACK_OVERFLOW                        = 0x0503;
+    public static final int GL_STACK_UNDERFLOW                       = 0x0504;
+    public static final int GL_STENCIL_BITS                          = 0x0D57;
+    public static final int GL_STENCIL_BUFFER_BIT                    = 0x0400;
+    public static final int GL_STENCIL_TEST                          = 0x0B90;
+    public static final int GL_SUBPIXEL_BITS                         = 0x0D50;
+    public static final int GL_TEXTURE                               = 0x1702;
+    public static final int GL_TEXTURE_2D                            = 0x0DE1;
+    public static final int GL_TEXTURE_COORD_ARRAY                   = 0x8078;
+    public static final int GL_TEXTURE_ENV                           = 0x2300;
+    public static final int GL_TEXTURE_ENV_COLOR                     = 0x2201;
+    public static final int GL_TEXTURE_ENV_MODE                      = 0x2200;
+    public static final int GL_TEXTURE_MAG_FILTER                    = 0x2800;
+    public static final int GL_TEXTURE_MIN_FILTER                    = 0x2801;
+    public static final int GL_TEXTURE_WRAP_S                        = 0x2802;
+    public static final int GL_TEXTURE_WRAP_T                        = 0x2803;
+    public static final int GL_TEXTURE0                              = 0x84C0;
+    public static final int GL_TEXTURE1                              = 0x84C1;
+    public static final int GL_TEXTURE2                              = 0x84C2;
+    public static final int GL_TEXTURE3                              = 0x84C3;
+    public static final int GL_TEXTURE4                              = 0x84C4;
+    public static final int GL_TEXTURE5                              = 0x84C5;
+    public static final int GL_TEXTURE6                              = 0x84C6;
+    public static final int GL_TEXTURE7                              = 0x84C7;
+    public static final int GL_TEXTURE8                              = 0x84C8;
+    public static final int GL_TEXTURE9                              = 0x84C9;
+    public static final int GL_TEXTURE10                             = 0x84CA;
+    public static final int GL_TEXTURE11                             = 0x84CB;
+    public static final int GL_TEXTURE12                             = 0x84CC;
+    public static final int GL_TEXTURE13                             = 0x84CD;
+    public static final int GL_TEXTURE14                             = 0x84CE;
+    public static final int GL_TEXTURE15                             = 0x84CF;
+    public static final int GL_TEXTURE16                             = 0x84D0;
+    public static final int GL_TEXTURE17                             = 0x84D1;
+    public static final int GL_TEXTURE18                             = 0x84D2;
+    public static final int GL_TEXTURE19                             = 0x84D3;
+    public static final int GL_TEXTURE20                             = 0x84D4;
+    public static final int GL_TEXTURE21                             = 0x84D5;
+    public static final int GL_TEXTURE22                             = 0x84D6;
+    public static final int GL_TEXTURE23                             = 0x84D7;
+    public static final int GL_TEXTURE24                             = 0x84D8;
+    public static final int GL_TEXTURE25                             = 0x84D9;
+    public static final int GL_TEXTURE26                             = 0x84DA;
+    public static final int GL_TEXTURE27                             = 0x84DB;
+    public static final int GL_TEXTURE28                             = 0x84DC;
+    public static final int GL_TEXTURE29                             = 0x84DD;
+    public static final int GL_TEXTURE30                             = 0x84DE;
+    public static final int GL_TEXTURE31                             = 0x84DF;
+    public static final int GL_TRIANGLE_FAN                          = 0x0006;
+    public static final int GL_TRIANGLE_STRIP                        = 0x0005;
+    public static final int GL_TRIANGLES                             = 0x0004;
+    public static final int GL_TRUE                                  = 1;
+    public static final int GL_UNPACK_ALIGNMENT                      = 0x0CF5;
+    public static final int GL_UNSIGNED_BYTE                         = 0x1401;
+    public static final int GL_UNSIGNED_SHORT                        = 0x1403;
+    public static final int GL_UNSIGNED_SHORT_4_4_4_4                = 0x8033;
+    public static final int GL_UNSIGNED_SHORT_5_5_5_1                = 0x8034;
+    public static final int GL_UNSIGNED_SHORT_5_6_5                  = 0x8363;
+    public static final int GL_VENDOR                                = 0x1F00;
+    public static final int GL_VERSION                               = 0x1F02;
+    public static final int GL_VERTEX_ARRAY                          = 0x8074;
+    public static final int GL_XOR                                   = 0x1506;
+    public static final int GL_ZERO                                  = 0;
+
+    native private static void _nativeClassInit();
+    static {
+	    _nativeClassInit();
+    }
+
+    private static Buffer _colorPointer;
+    private static Buffer _normalPointer;
+    private static Buffer _texCoordPointer;
+    private static Buffer _vertexPointer;
+
+    // C function void glActiveTexture ( GLenum texture )
+
+    public static native void glActiveTexture(
+        int texture
+    );
+
+    // C function void glAlphaFunc ( GLenum func, GLclampf ref )
+
+    public static native void glAlphaFunc(
+        int func,
+        float ref
+    );
+
+    // C function void glAlphaFuncx ( GLenum func, GLclampx ref )
+
+    public static native void glAlphaFuncx(
+        int func,
+        int ref
+    );
+
+    // C function void glBindTexture ( GLenum target, GLuint texture )
+
+    public static native void glBindTexture(
+        int target,
+        int texture
+    );
+
+    // C function void glBlendFunc ( GLenum sfactor, GLenum dfactor )
+
+    public static native void glBlendFunc(
+        int sfactor,
+        int dfactor
+    );
+
+    // C function void glClear ( GLbitfield mask )
+
+    public static native void glClear(
+        int mask
+    );
+
+    // C function void glClearColor ( GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha )
+
+    public static native void glClearColor(
+        float red,
+        float green,
+        float blue,
+        float alpha
+    );
+
+    // C function void glClearColorx ( GLclampx red, GLclampx green, GLclampx blue, GLclampx alpha )
+
+    public static native void glClearColorx(
+        int red,
+        int green,
+        int blue,
+        int alpha
+    );
+
+    // C function void glClearDepthf ( GLclampf depth )
+
+    public static native void glClearDepthf(
+        float depth
+    );
+
+    // C function void glClearDepthx ( GLclampx depth )
+
+    public static native void glClearDepthx(
+        int depth
+    );
+
+    // C function void glClearStencil ( GLint s )
+
+    public static native void glClearStencil(
+        int s
+    );
+
+    // C function void glClientActiveTexture ( GLenum texture )
+
+    public static native void glClientActiveTexture(
+        int texture
+    );
+
+    // C function void glColor4f ( GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha )
+
+    public static native void glColor4f(
+        float red,
+        float green,
+        float blue,
+        float alpha
+    );
+
+    // C function void glColor4x ( GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha )
+
+    public static native void glColor4x(
+        int red,
+        int green,
+        int blue,
+        int alpha
+    );
+
+    // C function void glColorMask ( GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha )
+
+    public static native void glColorMask(
+        boolean red,
+        boolean green,
+        boolean blue,
+        boolean alpha
+    );
+
+    // C function void glColorPointer ( GLint size, GLenum type, GLsizei stride, const GLvoid *pointer )
+
+    private static native void glColorPointerBounds(
+        int size,
+        int type,
+        int stride,
+        java.nio.Buffer pointer,
+        int remaining
+    );
+
+    public static void glColorPointer(
+        int size,
+        int type,
+        int stride,
+        java.nio.Buffer pointer
+    ) {
+        if ((size == 4) &&
+            ((type == GL_FLOAT) ||
+             (type == GL_UNSIGNED_BYTE) ||
+             (type == GL_FIXED)) &&
+            (stride >= 0)) {
+            _colorPointer = pointer;
+        }
+        glColorPointerBounds(
+            size,
+            type,
+            stride,
+            pointer,
+            pointer.remaining()
+        );
+    }
+
+    // C function void glCompressedTexImage2D ( GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data )
+
+    public static native void glCompressedTexImage2D(
+        int target,
+        int level,
+        int internalformat,
+        int width,
+        int height,
+        int border,
+        int imageSize,
+        java.nio.Buffer data
+    );
+
+    // C function void glCompressedTexSubImage2D ( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data )
+
+    public static native void glCompressedTexSubImage2D(
+        int target,
+        int level,
+        int xoffset,
+        int yoffset,
+        int width,
+        int height,
+        int format,
+        int imageSize,
+        java.nio.Buffer data
+    );
+
+    // C function void glCopyTexImage2D ( GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border )
+
+    public static native void glCopyTexImage2D(
+        int target,
+        int level,
+        int internalformat,
+        int x,
+        int y,
+        int width,
+        int height,
+        int border
+    );
+
+    // C function void glCopyTexSubImage2D ( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height )
+
+    public static native void glCopyTexSubImage2D(
+        int target,
+        int level,
+        int xoffset,
+        int yoffset,
+        int x,
+        int y,
+        int width,
+        int height
+    );
+
+    // C function void glCullFace ( GLenum mode )
+
+    public static native void glCullFace(
+        int mode
+    );
+
+    // C function void glDeleteTextures ( GLsizei n, const GLuint *textures )
+
+    public static native void glDeleteTextures(
+        int n,
+        int[] textures,
+        int offset
+    );
+
+    // C function void glDeleteTextures ( GLsizei n, const GLuint *textures )
+
+    public static native void glDeleteTextures(
+        int n,
+        java.nio.IntBuffer textures
+    );
+
+    // C function void glDepthFunc ( GLenum func )
+
+    public static native void glDepthFunc(
+        int func
+    );
+
+    // C function void glDepthMask ( GLboolean flag )
+
+    public static native void glDepthMask(
+        boolean flag
+    );
+
+    // C function void glDepthRangef ( GLclampf zNear, GLclampf zFar )
+
+    public static native void glDepthRangef(
+        float zNear,
+        float zFar
+    );
+
+    // C function void glDepthRangex ( GLclampx zNear, GLclampx zFar )
+
+    public static native void glDepthRangex(
+        int zNear,
+        int zFar
+    );
+
+    // C function void glDisable ( GLenum cap )
+
+    public static native void glDisable(
+        int cap
+    );
+
+    // C function void glDisableClientState ( GLenum array )
+
+    public static native void glDisableClientState(
+        int array
+    );
+
+    // C function void glDrawArrays ( GLenum mode, GLint first, GLsizei count )
+
+    public static native void glDrawArrays(
+        int mode,
+        int first,
+        int count
+    );
+
+    // C function void glDrawElements ( GLenum mode, GLsizei count, GLenum type, const GLvoid *indices )
+
+    public static native void glDrawElements(
+        int mode,
+        int count,
+        int type,
+        java.nio.Buffer indices
+    );
+
+    // C function void glEnable ( GLenum cap )
+
+    public static native void glEnable(
+        int cap
+    );
+
+    // C function void glEnableClientState ( GLenum array )
+
+    public static native void glEnableClientState(
+        int array
+    );
+
+    // C function void glFinish ( void )
+
+    public static native void glFinish(
+    );
+
+    // C function void glFlush ( void )
+
+    public static native void glFlush(
+    );
+
+    // C function void glFogf ( GLenum pname, GLfloat param )
+
+    public static native void glFogf(
+        int pname,
+        float param
+    );
+
+    // C function void glFogfv ( GLenum pname, const GLfloat *params )
+
+    public static native void glFogfv(
+        int pname,
+        float[] params,
+        int offset
+    );
+
+    // C function void glFogfv ( GLenum pname, const GLfloat *params )
+
+    public static native void glFogfv(
+        int pname,
+        java.nio.FloatBuffer params
+    );
+
+    // C function void glFogx ( GLenum pname, GLfixed param )
+
+    public static native void glFogx(
+        int pname,
+        int param
+    );
+
+    // C function void glFogxv ( GLenum pname, const GLfixed *params )
+
+    public static native void glFogxv(
+        int pname,
+        int[] params,
+        int offset
+    );
+
+    // C function void glFogxv ( GLenum pname, const GLfixed *params )
+
+    public static native void glFogxv(
+        int pname,
+        java.nio.IntBuffer params
+    );
+
+    // C function void glFrontFace ( GLenum mode )
+
+    public static native void glFrontFace(
+        int mode
+    );
+
+    // C function void glFrustumf ( GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar )
+
+    public static native void glFrustumf(
+        float left,
+        float right,
+        float bottom,
+        float top,
+        float zNear,
+        float zFar
+    );
+
+    // C function void glFrustumx ( GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar )
+
+    public static native void glFrustumx(
+        int left,
+        int right,
+        int bottom,
+        int top,
+        int zNear,
+        int zFar
+    );
+
+    // C function void glGenTextures ( GLsizei n, GLuint *textures )
+
+    public static native void glGenTextures(
+        int n,
+        int[] textures,
+        int offset
+    );
+
+    // C function void glGenTextures ( GLsizei n, GLuint *textures )
+
+    public static native void glGenTextures(
+        int n,
+        java.nio.IntBuffer textures
+    );
+
+    // C function GLenum glGetError ( void )
+
+    public static native int glGetError(
+    );
+
+    // C function void glGetIntegerv ( GLenum pname, GLint *params )
+
+    public static native void glGetIntegerv(
+        int pname,
+        int[] params,
+        int offset
+    );
+
+    // C function void glGetIntegerv ( GLenum pname, GLint *params )
+
+    public static native void glGetIntegerv(
+        int pname,
+        java.nio.IntBuffer params
+    );
+
+    // C function const GLubyte * glGetString ( GLenum name )
+
+    public static native String glGetString(
+        int name
+    );
+    // C function void glHint ( GLenum target, GLenum mode )
+
+    public static native void glHint(
+        int target,
+        int mode
+    );
+
+    // C function void glLightModelf ( GLenum pname, GLfloat param )
+
+    public static native void glLightModelf(
+        int pname,
+        float param
+    );
+
+    // C function void glLightModelfv ( GLenum pname, const GLfloat *params )
+
+    public static native void glLightModelfv(
+        int pname,
+        float[] params,
+        int offset
+    );
+
+    // C function void glLightModelfv ( GLenum pname, const GLfloat *params )
+
+    public static native void glLightModelfv(
+        int pname,
+        java.nio.FloatBuffer params
+    );
+
+    // C function void glLightModelx ( GLenum pname, GLfixed param )
+
+    public static native void glLightModelx(
+        int pname,
+        int param
+    );
+
+    // C function void glLightModelxv ( GLenum pname, const GLfixed *params )
+
+    public static native void glLightModelxv(
+        int pname,
+        int[] params,
+        int offset
+    );
+
+    // C function void glLightModelxv ( GLenum pname, const GLfixed *params )
+
+    public static native void glLightModelxv(
+        int pname,
+        java.nio.IntBuffer params
+    );
+
+    // C function void glLightf ( GLenum light, GLenum pname, GLfloat param )
+
+    public static native void glLightf(
+        int light,
+        int pname,
+        float param
+    );
+
+    // C function void glLightfv ( GLenum light, GLenum pname, const GLfloat *params )
+
+    public static native void glLightfv(
+        int light,
+        int pname,
+        float[] params,
+        int offset
+    );
+
+    // C function void glLightfv ( GLenum light, GLenum pname, const GLfloat *params )
+
+    public static native void glLightfv(
+        int light,
+        int pname,
+        java.nio.FloatBuffer params
+    );
+
+    // C function void glLightx ( GLenum light, GLenum pname, GLfixed param )
+
+    public static native void glLightx(
+        int light,
+        int pname,
+        int param
+    );
+
+    // C function void glLightxv ( GLenum light, GLenum pname, const GLfixed *params )
+
+    public static native void glLightxv(
+        int light,
+        int pname,
+        int[] params,
+        int offset
+    );
+
+    // C function void glLightxv ( GLenum light, GLenum pname, const GLfixed *params )
+
+    public static native void glLightxv(
+        int light,
+        int pname,
+        java.nio.IntBuffer params
+    );
+
+    // C function void glLineWidth ( GLfloat width )
+
+    public static native void glLineWidth(
+        float width
+    );
+
+    // C function void glLineWidthx ( GLfixed width )
+
+    public static native void glLineWidthx(
+        int width
+    );
+
+    // C function void glLoadIdentity ( void )
+
+    public static native void glLoadIdentity(
+    );
+
+    // C function void glLoadMatrixf ( const GLfloat *m )
+
+    public static native void glLoadMatrixf(
+        float[] m,
+        int offset
+    );
+
+    // C function void glLoadMatrixf ( const GLfloat *m )
+
+    public static native void glLoadMatrixf(
+        java.nio.FloatBuffer m
+    );
+
+    // C function void glLoadMatrixx ( const GLfixed *m )
+
+    public static native void glLoadMatrixx(
+        int[] m,
+        int offset
+    );
+
+    // C function void glLoadMatrixx ( const GLfixed *m )
+
+    public static native void glLoadMatrixx(
+        java.nio.IntBuffer m
+    );
+
+    // C function void glLogicOp ( GLenum opcode )
+
+    public static native void glLogicOp(
+        int opcode
+    );
+
+    // C function void glMaterialf ( GLenum face, GLenum pname, GLfloat param )
+
+    public static native void glMaterialf(
+        int face,
+        int pname,
+        float param
+    );
+
+    // C function void glMaterialfv ( GLenum face, GLenum pname, const GLfloat *params )
+
+    public static native void glMaterialfv(
+        int face,
+        int pname,
+        float[] params,
+        int offset
+    );
+
+    // C function void glMaterialfv ( GLenum face, GLenum pname, const GLfloat *params )
+
+    public static native void glMaterialfv(
+        int face,
+        int pname,
+        java.nio.FloatBuffer params
+    );
+
+    // C function void glMaterialx ( GLenum face, GLenum pname, GLfixed param )
+
+    public static native void glMaterialx(
+        int face,
+        int pname,
+        int param
+    );
+
+    // C function void glMaterialxv ( GLenum face, GLenum pname, const GLfixed *params )
+
+    public static native void glMaterialxv(
+        int face,
+        int pname,
+        int[] params,
+        int offset
+    );
+
+    // C function void glMaterialxv ( GLenum face, GLenum pname, const GLfixed *params )
+
+    public static native void glMaterialxv(
+        int face,
+        int pname,
+        java.nio.IntBuffer params
+    );
+
+    // C function void glMatrixMode ( GLenum mode )
+
+    public static native void glMatrixMode(
+        int mode
+    );
+
+    // C function void glMultMatrixf ( const GLfloat *m )
+
+    public static native void glMultMatrixf(
+        float[] m,
+        int offset
+    );
+
+    // C function void glMultMatrixf ( const GLfloat *m )
+
+    public static native void glMultMatrixf(
+        java.nio.FloatBuffer m
+    );
+
+    // C function void glMultMatrixx ( const GLfixed *m )
+
+    public static native void glMultMatrixx(
+        int[] m,
+        int offset
+    );
+
+    // C function void glMultMatrixx ( const GLfixed *m )
+
+    public static native void glMultMatrixx(
+        java.nio.IntBuffer m
+    );
+
+    // C function void glMultiTexCoord4f ( GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q )
+
+    public static native void glMultiTexCoord4f(
+        int target,
+        float s,
+        float t,
+        float r,
+        float q
+    );
+
+    // C function void glMultiTexCoord4x ( GLenum target, GLfixed s, GLfixed t, GLfixed r, GLfixed q )
+
+    public static native void glMultiTexCoord4x(
+        int target,
+        int s,
+        int t,
+        int r,
+        int q
+    );
+
+    // C function void glNormal3f ( GLfloat nx, GLfloat ny, GLfloat nz )
+
+    public static native void glNormal3f(
+        float nx,
+        float ny,
+        float nz
+    );
+
+    // C function void glNormal3x ( GLfixed nx, GLfixed ny, GLfixed nz )
+
+    public static native void glNormal3x(
+        int nx,
+        int ny,
+        int nz
+    );
+
+    // C function void glNormalPointer ( GLenum type, GLsizei stride, const GLvoid *pointer )
+
+    private static native void glNormalPointerBounds(
+        int type,
+        int stride,
+        java.nio.Buffer pointer,
+        int remaining
+    );
+
+    public static void glNormalPointer(
+        int type,
+        int stride,
+        java.nio.Buffer pointer
+    ) {
+        if (((type == GL_FLOAT) ||
+             (type == GL_BYTE) ||
+             (type == GL_SHORT) ||
+             (type == GL_FIXED)) &&
+            (stride >= 0)) {
+            _normalPointer = pointer;
+        }
+        glNormalPointerBounds(
+            type,
+            stride,
+            pointer,
+            pointer.remaining()
+        );
+    }
+
+    // C function void glOrthof ( GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar )
+
+    public static native void glOrthof(
+        float left,
+        float right,
+        float bottom,
+        float top,
+        float zNear,
+        float zFar
+    );
+
+    // C function void glOrthox ( GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar )
+
+    public static native void glOrthox(
+        int left,
+        int right,
+        int bottom,
+        int top,
+        int zNear,
+        int zFar
+    );
+
+    // C function void glPixelStorei ( GLenum pname, GLint param )
+
+    public static native void glPixelStorei(
+        int pname,
+        int param
+    );
+
+    // C function void glPointSize ( GLfloat size )
+
+    public static native void glPointSize(
+        float size
+    );
+
+    // C function void glPointSizex ( GLfixed size )
+
+    public static native void glPointSizex(
+        int size
+    );
+
+    // C function void glPolygonOffset ( GLfloat factor, GLfloat units )
+
+    public static native void glPolygonOffset(
+        float factor,
+        float units
+    );
+
+    // C function void glPolygonOffsetx ( GLfixed factor, GLfixed units )
+
+    public static native void glPolygonOffsetx(
+        int factor,
+        int units
+    );
+
+    // C function void glPopMatrix ( void )
+
+    public static native void glPopMatrix(
+    );
+
+    // C function void glPushMatrix ( void )
+
+    public static native void glPushMatrix(
+    );
+
+    // C function void glReadPixels ( GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels )
+
+    public static native void glReadPixels(
+        int x,
+        int y,
+        int width,
+        int height,
+        int format,
+        int type,
+        java.nio.Buffer pixels
+    );
+
+    // C function void glRotatef ( GLfloat angle, GLfloat x, GLfloat y, GLfloat z )
+
+    public static native void glRotatef(
+        float angle,
+        float x,
+        float y,
+        float z
+    );
+
+    // C function void glRotatex ( GLfixed angle, GLfixed x, GLfixed y, GLfixed z )
+
+    public static native void glRotatex(
+        int angle,
+        int x,
+        int y,
+        int z
+    );
+
+    // C function void glSampleCoverage ( GLclampf value, GLboolean invert )
+
+    public static native void glSampleCoverage(
+        float value,
+        boolean invert
+    );
+
+    // C function void glSampleCoveragex ( GLclampx value, GLboolean invert )
+
+    public static native void glSampleCoveragex(
+        int value,
+        boolean invert
+    );
+
+    // C function void glScalef ( GLfloat x, GLfloat y, GLfloat z )
+
+    public static native void glScalef(
+        float x,
+        float y,
+        float z
+    );
+
+    // C function void glScalex ( GLfixed x, GLfixed y, GLfixed z )
+
+    public static native void glScalex(
+        int x,
+        int y,
+        int z
+    );
+
+    // C function void glScissor ( GLint x, GLint y, GLsizei width, GLsizei height )
+
+    public static native void glScissor(
+        int x,
+        int y,
+        int width,
+        int height
+    );
+
+    // C function void glShadeModel ( GLenum mode )
+
+    public static native void glShadeModel(
+        int mode
+    );
+
+    // C function void glStencilFunc ( GLenum func, GLint ref, GLuint mask )
+
+    public static native void glStencilFunc(
+        int func,
+        int ref,
+        int mask
+    );
+
+    // C function void glStencilMask ( GLuint mask )
+
+    public static native void glStencilMask(
+        int mask
+    );
+
+    // C function void glStencilOp ( GLenum fail, GLenum zfail, GLenum zpass )
+
+    public static native void glStencilOp(
+        int fail,
+        int zfail,
+        int zpass
+    );
+
+    // C function void glTexCoordPointer ( GLint size, GLenum type, GLsizei stride, const GLvoid *pointer )
+
+    private static native void glTexCoordPointerBounds(
+        int size,
+        int type,
+        int stride,
+        java.nio.Buffer pointer,
+        int remaining
+    );
+
+    public static void glTexCoordPointer(
+        int size,
+        int type,
+        int stride,
+        java.nio.Buffer pointer
+    ) {
+        if (((size == 2) ||
+             (size == 3) ||
+             (size == 4)) &&
+            ((type == GL_FLOAT) ||
+             (type == GL_BYTE) ||
+             (type == GL_SHORT) ||
+             (type == GL_FIXED)) &&
+            (stride >= 0)) {
+            _texCoordPointer = pointer;
+        }
+        glTexCoordPointerBounds(
+            size,
+            type,
+            stride,
+            pointer,
+            pointer.remaining()
+        );
+    }
+
+    // C function void glTexEnvf ( GLenum target, GLenum pname, GLfloat param )
+
+    public static native void glTexEnvf(
+        int target,
+        int pname,
+        float param
+    );
+
+    // C function void glTexEnvfv ( GLenum target, GLenum pname, const GLfloat *params )
+
+    public static native void glTexEnvfv(
+        int target,
+        int pname,
+        float[] params,
+        int offset
+    );
+
+    // C function void glTexEnvfv ( GLenum target, GLenum pname, const GLfloat *params )
+
+    public static native void glTexEnvfv(
+        int target,
+        int pname,
+        java.nio.FloatBuffer params
+    );
+
+    // C function void glTexEnvx ( GLenum target, GLenum pname, GLfixed param )
+
+    public static native void glTexEnvx(
+        int target,
+        int pname,
+        int param
+    );
+
+    // C function void glTexEnvxv ( GLenum target, GLenum pname, const GLfixed *params )
+
+    public static native void glTexEnvxv(
+        int target,
+        int pname,
+        int[] params,
+        int offset
+    );
+
+    // C function void glTexEnvxv ( GLenum target, GLenum pname, const GLfixed *params )
+
+    public static native void glTexEnvxv(
+        int target,
+        int pname,
+        java.nio.IntBuffer params
+    );
+
+    // C function void glTexImage2D ( GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels )
+
+    public static native void glTexImage2D(
+        int target,
+        int level,
+        int internalformat,
+        int width,
+        int height,
+        int border,
+        int format,
+        int type,
+        java.nio.Buffer pixels
+    );
+
+    // C function void glTexParameterf ( GLenum target, GLenum pname, GLfloat param )
+
+    public static native void glTexParameterf(
+        int target,
+        int pname,
+        float param
+    );
+
+    // C function void glTexParameterx ( GLenum target, GLenum pname, GLfixed param )
+
+    public static native void glTexParameterx(
+        int target,
+        int pname,
+        int param
+    );
+
+    // C function void glTexSubImage2D ( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels )
+
+    public static native void glTexSubImage2D(
+        int target,
+        int level,
+        int xoffset,
+        int yoffset,
+        int width,
+        int height,
+        int format,
+        int type,
+        java.nio.Buffer pixels
+    );
+
+    // C function void glTranslatef ( GLfloat x, GLfloat y, GLfloat z )
+
+    public static native void glTranslatef(
+        float x,
+        float y,
+        float z
+    );
+
+    // C function void glTranslatex ( GLfixed x, GLfixed y, GLfixed z )
+
+    public static native void glTranslatex(
+        int x,
+        int y,
+        int z
+    );
+
+    // C function void glVertexPointer ( GLint size, GLenum type, GLsizei stride, const GLvoid *pointer )
+
+    private static native void glVertexPointerBounds(
+        int size,
+        int type,
+        int stride,
+        java.nio.Buffer pointer,
+        int remaining
+    );
+
+    public static void glVertexPointer(
+        int size,
+        int type,
+        int stride,
+        java.nio.Buffer pointer
+    ) {
+        if (((size == 2) ||
+             (size == 3) ||
+             (size == 4)) &&
+            ((type == GL_FLOAT) ||
+             (type == GL_BYTE) ||
+             (type == GL_SHORT) ||
+             (type == GL_FIXED)) &&
+            (stride >= 0)) {
+            _vertexPointer = pointer;
+        }
+        glVertexPointerBounds(
+            size,
+            type,
+            stride,
+            pointer,
+            pointer.remaining()
+        );
+    }
+
+    // C function void glViewport ( GLint x, GLint y, GLsizei width, GLsizei height )
+
+    public static native void glViewport(
+        int x,
+        int y,
+        int width,
+        int height
+    );
+
+}
diff --git a/opengl/java/android/opengl/GLES10Ext.java b/opengl/java/android/opengl/GLES10Ext.java
new file mode 100644
index 0000000..81fc59e
--- /dev/null
+++ b/opengl/java/android/opengl/GLES10Ext.java
@@ -0,0 +1,44 @@
+/*
+**
+** Copyright 2009, The Android Open Source Project
+**
+** Licensed under the Apache License, Version 2.0 (the "License");
+** you may not use this file except in compliance with the License.
+** You may obtain a copy of the License at
+**
+**     http://www.apache.org/licenses/LICENSE-2.0
+**
+** Unless required by applicable law or agreed to in writing, software
+** distributed under the License is distributed on an "AS IS" BASIS,
+** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+** See the License for the specific language governing permissions and 
+** limitations under the License.
+*/
+
+// This source file is automatically generated
+
+package android.opengl;
+
+public class GLES10Ext {
+    native private static void _nativeClassInit();
+    static {
+	    _nativeClassInit();
+    }
+    
+    // C function GLbitfield glQueryMatrixxOES ( GLfixed *mantissa, GLint *exponent )
+
+    public static native int glQueryMatrixxOES(
+        int[] mantissa,
+        int mantissaOffset,
+        int[] exponent,
+        int exponentOffset
+    );
+
+    // C function GLbitfield glQueryMatrixxOES ( GLfixed *mantissa, GLint *exponent )
+
+    public static native int glQueryMatrixxOES(
+        java.nio.IntBuffer mantissa,
+        java.nio.IntBuffer exponent
+    );
+
+}
diff --git a/opengl/java/android/opengl/GLES11.java b/opengl/java/android/opengl/GLES11.java
new file mode 100644
index 0000000..3399af7
--- /dev/null
+++ b/opengl/java/android/opengl/GLES11.java
@@ -0,0 +1,707 @@
+/*
+**
+** Copyright 2009, The Android Open Source Project
+**
+** Licensed under the Apache License, Version 2.0 (the "License");
+** you may not use this file except in compliance with the License.
+** You may obtain a copy of the License at
+**
+**     http://www.apache.org/licenses/LICENSE-2.0
+**
+** Unless required by applicable law or agreed to in writing, software
+** distributed under the License is distributed on an "AS IS" BASIS,
+** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+** See the License for the specific language governing permissions and
+** limitations under the License.
+*/
+
+// This source file is automatically generated
+
+package android.opengl;
+
+import java.nio.Buffer;
+
+public class GLES11 extends GLES10 {
+    public static final int GL_ACTIVE_TEXTURE                          = 0x84E0;
+    public static final int GL_ADD_SIGNED                              = 0x8574;
+    public static final int GL_ALPHA_SCALE                             = 0x0D1C;
+    public static final int GL_ALPHA_TEST_FUNC                         = 0x0BC1;
+    public static final int GL_ALPHA_TEST_REF                          = 0x0BC2;
+    public static final int GL_ARRAY_BUFFER                            = 0x8892;
+    public static final int GL_ARRAY_BUFFER_BINDING                    = 0x8894;
+    public static final int GL_BLEND_DST                               = 0x0BE0;
+    public static final int GL_BLEND_SRC                               = 0x0BE1;
+    public static final int GL_BUFFER_ACCESS                           = 0x88BB;
+    public static final int GL_BUFFER_SIZE                             = 0x8764;
+    public static final int GL_BUFFER_USAGE                            = 0x8765;
+    public static final int GL_CLIENT_ACTIVE_TEXTURE                   = 0x84E1;
+    public static final int GL_CLIP_PLANE0                             = 0x3000;
+    public static final int GL_CLIP_PLANE1                             = 0x3001;
+    public static final int GL_CLIP_PLANE2                             = 0x3002;
+    public static final int GL_CLIP_PLANE3                             = 0x3003;
+    public static final int GL_CLIP_PLANE4                             = 0x3004;
+    public static final int GL_CLIP_PLANE5                             = 0x3005;
+    public static final int GL_COLOR_ARRAY_BUFFER_BINDING              = 0x8898;
+    public static final int GL_COLOR_ARRAY_POINTER                     = 0x8090;
+    public static final int GL_COLOR_ARRAY_SIZE                        = 0x8081;
+    public static final int GL_COLOR_ARRAY_STRIDE                      = 0x8083;
+    public static final int GL_COLOR_ARRAY_TYPE                        = 0x8082;
+    public static final int GL_COLOR_CLEAR_VALUE                       = 0x0C22;
+    public static final int GL_COLOR_WRITEMASK                         = 0x0C23;
+    public static final int GL_COMBINE                                 = 0x8570;
+    public static final int GL_COMBINE_ALPHA                           = 0x8572;
+    public static final int GL_COMBINE_RGB                             = 0x8571;
+    public static final int GL_CONSTANT                                = 0x8576;
+    public static final int GL_COORD_REPLACE_OES                       = 0x8862;
+    public static final int GL_CULL_FACE_MODE                          = 0x0B45;
+    public static final int GL_CURRENT_COLOR                           = 0x0B00;
+    public static final int GL_CURRENT_NORMAL                          = 0x0B02;
+    public static final int GL_CURRENT_TEXTURE_COORDS                  = 0x0B03;
+    public static final int GL_DEPTH_CLEAR_VALUE                       = 0x0B73;
+    public static final int GL_DEPTH_FUNC                              = 0x0B74;
+    public static final int GL_DEPTH_RANGE                             = 0x0B70;
+    public static final int GL_DEPTH_WRITEMASK                         = 0x0B72;
+    public static final int GL_DOT3_RGB                                = 0x86AE;
+    public static final int GL_DOT3_RGBA                               = 0x86AF;
+    public static final int GL_DYNAMIC_DRAW                            = 0x88E8;
+    public static final int GL_ELEMENT_ARRAY_BUFFER                    = 0x8893;
+    public static final int GL_ELEMENT_ARRAY_BUFFER_BINDING            = 0x8895;
+    public static final int GL_FRONT_FACE                              = 0x0B46;
+    public static final int GL_GENERATE_MIPMAP                         = 0x8191;
+    public static final int GL_GENERATE_MIPMAP_HINT                    = 0x8192;
+    public static final int GL_INTERPOLATE                             = 0x8575;
+    public static final int GL_LINE_WIDTH                              = 0x0B21;
+    public static final int GL_LOGIC_OP_MODE                           = 0x0BF0;
+    public static final int GL_MATRIX_MODE                             = 0x0BA0;
+    public static final int GL_MAX_CLIP_PLANES                         = 0x0D32;
+    public static final int GL_MODELVIEW_MATRIX                        = 0x0BA6;
+    public static final int GL_MODELVIEW_MATRIX_FLOAT_AS_INT_BITS_OES  = 0x898D;
+    public static final int GL_MODELVIEW_STACK_DEPTH                   = 0x0BA3;
+    public static final int GL_NORMAL_ARRAY_BUFFER_BINDING             = 0x8897;
+    public static final int GL_NORMAL_ARRAY_POINTER                    = 0x808F;
+    public static final int GL_NORMAL_ARRAY_STRIDE                     = 0x807F;
+    public static final int GL_NORMAL_ARRAY_TYPE                       = 0x807E;
+    public static final int GL_OPERAND0_ALPHA                          = 0x8598;
+    public static final int GL_OPERAND0_RGB                            = 0x8590;
+    public static final int GL_OPERAND1_ALPHA                          = 0x8599;
+    public static final int GL_OPERAND1_RGB                            = 0x8591;
+    public static final int GL_OPERAND2_ALPHA                          = 0x859A;
+    public static final int GL_OPERAND2_RGB                            = 0x8592;
+    public static final int GL_POINT_DISTANCE_ATTENUATION              = 0x8129;
+    public static final int GL_POINT_FADE_THRESHOLD_SIZE               = 0x8128;
+    public static final int GL_POINT_SIZE                              = 0x0B11;
+    public static final int GL_POINT_SIZE_ARRAY_BUFFER_BINDING_OES     = 0x8B9F;
+    public static final int GL_POINT_SIZE_ARRAY_OES                    = 0x8B9C;
+    public static final int GL_POINT_SIZE_ARRAY_POINTER_OES            = 0x898C;
+    public static final int GL_POINT_SIZE_ARRAY_STRIDE_OES             = 0x898B;
+    public static final int GL_POINT_SIZE_ARRAY_TYPE_OES               = 0x898A;
+    public static final int GL_POINT_SIZE_MAX                          = 0x8127;
+    public static final int GL_POINT_SIZE_MIN                          = 0x8126;
+    public static final int GL_POINT_SPRITE_OES                        = 0x8861;
+    public static final int GL_POLYGON_OFFSET_FACTOR                   = 0x8038;
+    public static final int GL_POLYGON_OFFSET_UNITS                    = 0x2A00;
+    public static final int GL_PREVIOUS                                = 0x8578;
+    public static final int GL_PRIMARY_COLOR                           = 0x8577;
+    public static final int GL_PROJECTION_MATRIX                       = 0x0BA7;
+    public static final int GL_PROJECTION_MATRIX_FLOAT_AS_INT_BITS_OES = 0x898E;
+    public static final int GL_PROJECTION_STACK_DEPTH                  = 0x0BA4;
+    public static final int GL_RGB_SCALE                               = 0x8573;
+    public static final int GL_SAMPLE_BUFFERS                          = 0x80A8;
+    public static final int GL_SAMPLE_COVERAGE_INVERT                  = 0x80AB;
+    public static final int GL_SAMPLE_COVERAGE_VALUE                   = 0x80AA;
+    public static final int GL_SAMPLES                                 = 0x80A9;
+    public static final int GL_SCISSOR_BOX                             = 0x0C10;
+    public static final int GL_SHADE_MODEL                             = 0x0B54;
+    public static final int GL_SRC0_ALPHA                              = 0x8588;
+    public static final int GL_SRC0_RGB                                = 0x8580;
+    public static final int GL_SRC1_ALPHA                              = 0x8589;
+    public static final int GL_SRC1_RGB                                = 0x8581;
+    public static final int GL_SRC2_ALPHA                              = 0x858A;
+    public static final int GL_SRC2_RGB                                = 0x8582;
+    public static final int GL_STATIC_DRAW                             = 0x88E4;
+    public static final int GL_STENCIL_CLEAR_VALUE                     = 0x0B91;
+    public static final int GL_STENCIL_FAIL                            = 0x0B94;
+    public static final int GL_STENCIL_FUNC                            = 0x0B92;
+    public static final int GL_STENCIL_PASS_DEPTH_FAIL                 = 0x0B95;
+    public static final int GL_STENCIL_PASS_DEPTH_PASS                 = 0x0B96;
+    public static final int GL_STENCIL_REF                             = 0x0B97;
+    public static final int GL_STENCIL_VALUE_MASK                      = 0x0B93;
+    public static final int GL_STENCIL_WRITEMASK                       = 0x0B98;
+    public static final int GL_SUBTRACT                                = 0x84E7;
+    public static final int GL_TEXTURE_BINDING_2D                      = 0x8069;
+    public static final int GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING      = 0x889A;
+    public static final int GL_TEXTURE_COORD_ARRAY_POINTER             = 0x8092;
+    public static final int GL_TEXTURE_COORD_ARRAY_SIZE                = 0x8088;
+    public static final int GL_TEXTURE_COORD_ARRAY_STRIDE              = 0x808A;
+    public static final int GL_TEXTURE_COORD_ARRAY_TYPE                = 0x8089;
+    public static final int GL_TEXTURE_MATRIX                          = 0x0BA8;
+    public static final int GL_TEXTURE_MATRIX_FLOAT_AS_INT_BITS_OES    = 0x898F;
+    public static final int GL_TEXTURE_STACK_DEPTH                     = 0x0BA5;
+    public static final int GL_VERTEX_ARRAY_BUFFER_BINDING             = 0x8896;
+    public static final int GL_VERTEX_ARRAY_POINTER                    = 0x808E;
+    public static final int GL_VERTEX_ARRAY_SIZE                       = 0x807A;
+    public static final int GL_VERTEX_ARRAY_STRIDE                     = 0x807C;
+    public static final int GL_VERTEX_ARRAY_TYPE                       = 0x807B;
+    public static final int GL_VIEWPORT                                = 0x0BA2;
+    public static final int GL_WRITE_ONLY                              = 0x88B9;
+
+    native private static void _nativeClassInit();
+    static {
+	    _nativeClassInit();
+    }
+
+    // C function void glBindBuffer ( GLenum target, GLuint buffer )
+
+    public static native void glBindBuffer(
+        int target,
+        int buffer
+    );
+
+    // C function void glBufferData ( GLenum target, GLsizeiptr size, const GLvoid *data, GLenum usage )
+
+    public static native void glBufferData(
+        int target,
+        int size,
+        java.nio.Buffer data,
+        int usage
+    );
+
+    // C function void glBufferSubData ( GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid *data )
+
+    public static native void glBufferSubData(
+        int target,
+        int offset,
+        int size,
+        java.nio.Buffer data
+    );
+
+    // C function void glClipPlanef ( GLenum plane, const GLfloat *equation )
+
+    public static native void glClipPlanef(
+        int plane,
+        float[] equation,
+        int offset
+    );
+
+    // C function void glClipPlanef ( GLenum plane, const GLfloat *equation )
+
+    public static native void glClipPlanef(
+        int plane,
+        java.nio.FloatBuffer equation
+    );
+
+    // C function void glClipPlanex ( GLenum plane, const GLfixed *equation )
+
+    public static native void glClipPlanex(
+        int plane,
+        int[] equation,
+        int offset
+    );
+
+    // C function void glClipPlanex ( GLenum plane, const GLfixed *equation )
+
+    public static native void glClipPlanex(
+        int plane,
+        java.nio.IntBuffer equation
+    );
+
+    // C function void glColor4ub ( GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha )
+
+    public static native void glColor4ub(
+        byte red,
+        byte green,
+        byte blue,
+        byte alpha
+    );
+
+    // C function void glColorPointer ( GLint size, GLenum type, GLsizei stride, GLint offset )
+
+    public static native void glColorPointer(
+        int size,
+        int type,
+        int stride,
+        int offset
+    );
+
+    // C function void glDeleteBuffers ( GLsizei n, const GLuint *buffers )
+
+    public static native void glDeleteBuffers(
+        int n,
+        int[] buffers,
+        int offset
+    );
+
+    // C function void glDeleteBuffers ( GLsizei n, const GLuint *buffers )
+
+    public static native void glDeleteBuffers(
+        int n,
+        java.nio.IntBuffer buffers
+    );
+
+    // C function void glDrawElements ( GLenum mode, GLsizei count, GLenum type, GLint offset )
+
+    public static native void glDrawElements(
+        int mode,
+        int count,
+        int type,
+        int offset
+    );
+
+    // C function void glGenBuffers ( GLsizei n, GLuint *buffers )
+
+    public static native void glGenBuffers(
+        int n,
+        int[] buffers,
+        int offset
+    );
+
+    // C function void glGenBuffers ( GLsizei n, GLuint *buffers )
+
+    public static native void glGenBuffers(
+        int n,
+        java.nio.IntBuffer buffers
+    );
+
+    // C function void glGetBooleanv ( GLenum pname, GLboolean *params )
+
+    public static native void glGetBooleanv(
+        int pname,
+        boolean[] params,
+        int offset
+    );
+
+    // C function void glGetBooleanv ( GLenum pname, GLboolean *params )
+
+    public static native void glGetBooleanv(
+        int pname,
+        java.nio.IntBuffer params
+    );
+
+    // C function void glGetBufferParameteriv ( GLenum target, GLenum pname, GLint *params )
+
+    public static native void glGetBufferParameteriv(
+        int target,
+        int pname,
+        int[] params,
+        int offset
+    );
+
+    // C function void glGetBufferParameteriv ( GLenum target, GLenum pname, GLint *params )
+
+    public static native void glGetBufferParameteriv(
+        int target,
+        int pname,
+        java.nio.IntBuffer params
+    );
+
+    // C function void glGetClipPlanef ( GLenum pname, GLfloat *eqn )
+
+    public static native void glGetClipPlanef(
+        int pname,
+        float[] eqn,
+        int offset
+    );
+
+    // C function void glGetClipPlanef ( GLenum pname, GLfloat *eqn )
+
+    public static native void glGetClipPlanef(
+        int pname,
+        java.nio.FloatBuffer eqn
+    );
+
+    // C function void glGetClipPlanex ( GLenum pname, GLfixed *eqn )
+
+    public static native void glGetClipPlanex(
+        int pname,
+        int[] eqn,
+        int offset
+    );
+
+    // C function void glGetClipPlanex ( GLenum pname, GLfixed *eqn )
+
+    public static native void glGetClipPlanex(
+        int pname,
+        java.nio.IntBuffer eqn
+    );
+
+    // C function void glGetFixedv ( GLenum pname, GLfixed *params )
+
+    public static native void glGetFixedv(
+        int pname,
+        int[] params,
+        int offset
+    );
+
+    // C function void glGetFixedv ( GLenum pname, GLfixed *params )
+
+    public static native void glGetFixedv(
+        int pname,
+        java.nio.IntBuffer params
+    );
+
+    // C function void glGetFloatv ( GLenum pname, GLfloat *params )
+
+    public static native void glGetFloatv(
+        int pname,
+        float[] params,
+        int offset
+    );
+
+    // C function void glGetFloatv ( GLenum pname, GLfloat *params )
+
+    public static native void glGetFloatv(
+        int pname,
+        java.nio.FloatBuffer params
+    );
+
+    // C function void glGetLightfv ( GLenum light, GLenum pname, GLfloat *params )
+
+    public static native void glGetLightfv(
+        int light,
+        int pname,
+        float[] params,
+        int offset
+    );
+
+    // C function void glGetLightfv ( GLenum light, GLenum pname, GLfloat *params )
+
+    public static native void glGetLightfv(
+        int light,
+        int pname,
+        java.nio.FloatBuffer params
+    );
+
+    // C function void glGetLightxv ( GLenum light, GLenum pname, GLfixed *params )
+
+    public static native void glGetLightxv(
+        int light,
+        int pname,
+        int[] params,
+        int offset
+    );
+
+    // C function void glGetLightxv ( GLenum light, GLenum pname, GLfixed *params )
+
+    public static native void glGetLightxv(
+        int light,
+        int pname,
+        java.nio.IntBuffer params
+    );
+
+    // C function void glGetMaterialfv ( GLenum face, GLenum pname, GLfloat *params )
+
+    public static native void glGetMaterialfv(
+        int face,
+        int pname,
+        float[] params,
+        int offset
+    );
+
+    // C function void glGetMaterialfv ( GLenum face, GLenum pname, GLfloat *params )
+
+    public static native void glGetMaterialfv(
+        int face,
+        int pname,
+        java.nio.FloatBuffer params
+    );
+
+    // C function void glGetMaterialxv ( GLenum face, GLenum pname, GLfixed *params )
+
+    public static native void glGetMaterialxv(
+        int face,
+        int pname,
+        int[] params,
+        int offset
+    );
+
+    // C function void glGetMaterialxv ( GLenum face, GLenum pname, GLfixed *params )
+
+    public static native void glGetMaterialxv(
+        int face,
+        int pname,
+        java.nio.IntBuffer params
+    );
+
+    // C function void glGetTexEnvfv ( GLenum env, GLenum pname, GLfloat *params )
+
+    public static native void glGetTexEnvfv(
+        int env,
+        int pname,
+        float[] params,
+        int offset
+    );
+
+    // C function void glGetTexEnvfv ( GLenum env, GLenum pname, GLfloat *params )
+
+    public static native void glGetTexEnvfv(
+        int env,
+        int pname,
+        java.nio.FloatBuffer params
+    );
+
+    // C function void glGetTexEnviv ( GLenum env, GLenum pname, GLint *params )
+
+    public static native void glGetTexEnviv(
+        int env,
+        int pname,
+        int[] params,
+        int offset
+    );
+
+    // C function void glGetTexEnviv ( GLenum env, GLenum pname, GLint *params )
+
+    public static native void glGetTexEnviv(
+        int env,
+        int pname,
+        java.nio.IntBuffer params
+    );
+
+    // C function void glGetTexEnvxv ( GLenum env, GLenum pname, GLfixed *params )
+
+    public static native void glGetTexEnvxv(
+        int env,
+        int pname,
+        int[] params,
+        int offset
+    );
+
+    // C function void glGetTexEnvxv ( GLenum env, GLenum pname, GLfixed *params )
+
+    public static native void glGetTexEnvxv(
+        int env,
+        int pname,
+        java.nio.IntBuffer params
+    );
+
+    // C function void glGetTexParameterfv ( GLenum target, GLenum pname, GLfloat *params )
+
+    public static native void glGetTexParameterfv(
+        int target,
+        int pname,
+        float[] params,
+        int offset
+    );
+
+    // C function void glGetTexParameterfv ( GLenum target, GLenum pname, GLfloat *params )
+
+    public static native void glGetTexParameterfv(
+        int target,
+        int pname,
+        java.nio.FloatBuffer params
+    );
+
+    // C function void glGetTexParameteriv ( GLenum target, GLenum pname, GLint *params )
+
+    public static native void glGetTexParameteriv(
+        int target,
+        int pname,
+        int[] params,
+        int offset
+    );
+
+    // C function void glGetTexParameteriv ( GLenum target, GLenum pname, GLint *params )
+
+    public static native void glGetTexParameteriv(
+        int target,
+        int pname,
+        java.nio.IntBuffer params
+    );
+
+    // C function void glGetTexParameterxv ( GLenum target, GLenum pname, GLfixed *params )
+
+    public static native void glGetTexParameterxv(
+        int target,
+        int pname,
+        int[] params,
+        int offset
+    );
+
+    // C function void glGetTexParameterxv ( GLenum target, GLenum pname, GLfixed *params )
+
+    public static native void glGetTexParameterxv(
+        int target,
+        int pname,
+        java.nio.IntBuffer params
+    );
+
+    // C function GLboolean glIsBuffer ( GLuint buffer )
+
+    public static native boolean glIsBuffer(
+        int buffer
+    );
+
+    // C function GLboolean glIsEnabled ( GLenum cap )
+
+    public static native boolean glIsEnabled(
+        int cap
+    );
+
+    // C function GLboolean glIsTexture ( GLuint texture )
+
+    public static native boolean glIsTexture(
+        int texture
+    );
+
+    // C function void glNormalPointer ( GLenum type, GLsizei stride, GLint offset )
+
+    public static native void glNormalPointer(
+        int type,
+        int stride,
+        int offset
+    );
+
+    // C function void glPointParameterf ( GLenum pname, GLfloat param )
+
+    public static native void glPointParameterf(
+        int pname,
+        float param
+    );
+
+    // C function void glPointParameterfv ( GLenum pname, const GLfloat *params )
+
+    public static native void glPointParameterfv(
+        int pname,
+        float[] params,
+        int offset
+    );
+
+    // C function void glPointParameterfv ( GLenum pname, const GLfloat *params )
+
+    public static native void glPointParameterfv(
+        int pname,
+        java.nio.FloatBuffer params
+    );
+
+    // C function void glPointParameterx ( GLenum pname, GLfixed param )
+
+    public static native void glPointParameterx(
+        int pname,
+        int param
+    );
+
+    // C function void glPointParameterxv ( GLenum pname, const GLfixed *params )
+
+    public static native void glPointParameterxv(
+        int pname,
+        int[] params,
+        int offset
+    );
+
+    // C function void glPointParameterxv ( GLenum pname, const GLfixed *params )
+
+    public static native void glPointParameterxv(
+        int pname,
+        java.nio.IntBuffer params
+    );
+
+    // C function void glPointSizePointerOES ( GLenum type, GLsizei stride, const GLvoid *pointer )
+
+    public static native void glPointSizePointerOES(
+        int type,
+        int stride,
+        java.nio.Buffer pointer
+    );
+
+    // C function void glTexCoordPointer ( GLint size, GLenum type, GLsizei stride, GLint offset )
+
+    public static native void glTexCoordPointer(
+        int size,
+        int type,
+        int stride,
+        int offset
+    );
+
+    // C function void glTexEnvi ( GLenum target, GLenum pname, GLint param )
+
+    public static native void glTexEnvi(
+        int target,
+        int pname,
+        int param
+    );
+
+    // C function void glTexEnviv ( GLenum target, GLenum pname, const GLint *params )
+
+    public static native void glTexEnviv(
+        int target,
+        int pname,
+        int[] params,
+        int offset
+    );
+
+    // C function void glTexEnviv ( GLenum target, GLenum pname, const GLint *params )
+
+    public static native void glTexEnviv(
+        int target,
+        int pname,
+        java.nio.IntBuffer params
+    );
+
+    // C function void glTexParameterfv ( GLenum target, GLenum pname, const GLfloat *params )
+
+    public static native void glTexParameterfv(
+        int target,
+        int pname,
+        float[] params,
+        int offset
+    );
+
+    // C function void glTexParameterfv ( GLenum target, GLenum pname, const GLfloat *params )
+
+    public static native void glTexParameterfv(
+        int target,
+        int pname,
+        java.nio.FloatBuffer params
+    );
+
+    // C function void glTexParameteri ( GLenum target, GLenum pname, GLint param )
+
+    public static native void glTexParameteri(
+        int target,
+        int pname,
+        int param
+    );
+
+    // C function void glTexParameteriv ( GLenum target, GLenum pname, const GLint *params )
+
+    public static native void glTexParameteriv(
+        int target,
+        int pname,
+        int[] params,
+        int offset
+    );
+
+    // C function void glTexParameteriv ( GLenum target, GLenum pname, const GLint *params )
+
+    public static native void glTexParameteriv(
+        int target,
+        int pname,
+        java.nio.IntBuffer params
+    );
+
+    // C function void glTexParameterxv ( GLenum target, GLenum pname, const GLfixed *params )
+
+    public static native void glTexParameterxv(
+        int target,
+        int pname,
+        int[] params,
+        int offset
+    );
+
+    // C function void glTexParameterxv ( GLenum target, GLenum pname, const GLfixed *params )
+
+    public static native void glTexParameterxv(
+        int target,
+        int pname,
+        java.nio.IntBuffer params
+    );
+
+    // C function void glVertexPointer ( GLint size, GLenum type, GLsizei stride, GLint offset )
+
+    public static native void glVertexPointer(
+        int size,
+        int type,
+        int stride,
+        int offset
+    );
+
+}
diff --git a/opengl/java/android/opengl/GLES11Ext.java b/opengl/java/android/opengl/GLES11Ext.java
new file mode 100644
index 0000000..4384e9e
--- /dev/null
+++ b/opengl/java/android/opengl/GLES11Ext.java
@@ -0,0 +1,1076 @@
+/*
+**
+** Copyright 2009, The Android Open Source Project
+**
+** Licensed under the Apache License, Version 2.0 (the "License");
+** you may not use this file except in compliance with the License.
+** You may obtain a copy of the License at
+**
+**     http://www.apache.org/licenses/LICENSE-2.0
+**
+** Unless required by applicable law or agreed to in writing, software
+** distributed under the License is distributed on an "AS IS" BASIS,
+** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+** See the License for the specific language governing permissions and 
+** limitations under the License.
+*/
+
+// This source file is automatically generated
+
+package android.opengl;
+
+public class GLES11Ext {
+    public static final int GL_BLEND_EQUATION_RGB_OES                               = 0x8009;
+    public static final int GL_BLEND_EQUATION_ALPHA_OES                             = 0x883D;
+    public static final int GL_BLEND_DST_RGB_OES                                    = 0x80C8;
+    public static final int GL_BLEND_SRC_RGB_OES                                    = 0x80C9;
+    public static final int GL_BLEND_DST_ALPHA_OES                                  = 0x80CA;
+    public static final int GL_BLEND_SRC_ALPHA_OES                                  = 0x80CB;
+    public static final int GL_BLEND_EQUATION_OES                                   = 0x8009;
+    public static final int GL_FUNC_ADD_OES                                         = 0x8006;
+    public static final int GL_FUNC_SUBTRACT_OES                                    = 0x800A;
+    public static final int GL_FUNC_REVERSE_SUBTRACT_OES                            = 0x800B;
+    public static final int GL_ETC1_RGB8_OES                                        = 0x8D64;
+    public static final int GL_DEPTH_COMPONENT24_OES                                = 0x81A6;
+    public static final int GL_DEPTH_COMPONENT32_OES                                = 0x81A7;
+    public static final int GL_TEXTURE_CROP_RECT_OES                                = 0x8B9D;
+    public static final int GL_FIXED_OES                                            = 0x140C;
+    public static final int GL_NONE_OES                                             = 0;
+    public static final int GL_FRAMEBUFFER_OES                                      = 0x8D40;
+    public static final int GL_RENDERBUFFER_OES                                     = 0x8D41;
+    public static final int GL_RGBA4_OES                                            = 0x8056;
+    public static final int GL_RGB5_A1_OES                                          = 0x8057;
+    public static final int GL_RGB565_OES                                           = 0x8D62;
+    public static final int GL_DEPTH_COMPONENT16_OES                                = 0x81A5;
+    public static final int GL_RENDERBUFFER_WIDTH_OES                               = 0x8D42;
+    public static final int GL_RENDERBUFFER_HEIGHT_OES                              = 0x8D43;
+    public static final int GL_RENDERBUFFER_INTERNAL_FORMAT_OES                     = 0x8D44;
+    public static final int GL_RENDERBUFFER_RED_SIZE_OES                            = 0x8D50;
+    public static final int GL_RENDERBUFFER_GREEN_SIZE_OES                          = 0x8D51;
+    public static final int GL_RENDERBUFFER_BLUE_SIZE_OES                           = 0x8D52;
+    public static final int GL_RENDERBUFFER_ALPHA_SIZE_OES                          = 0x8D53;
+    public static final int GL_RENDERBUFFER_DEPTH_SIZE_OES                          = 0x8D54;
+    public static final int GL_RENDERBUFFER_STENCIL_SIZE_OES                        = 0x8D55;
+    public static final int GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE_OES               = 0x8CD0;
+    public static final int GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME_OES               = 0x8CD1;
+    public static final int GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL_OES             = 0x8CD2;
+    public static final int GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE_OES     = 0x8CD3;
+    public static final int GL_COLOR_ATTACHMENT0_OES                                = 0x8CE0;
+    public static final int GL_DEPTH_ATTACHMENT_OES                                 = 0x8D00;
+    public static final int GL_STENCIL_ATTACHMENT_OES                               = 0x8D20;
+    public static final int GL_FRAMEBUFFER_COMPLETE_OES                             = 0x8CD5;
+    public static final int GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_OES                = 0x8CD6;
+    public static final int GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_OES        = 0x8CD7;
+    public static final int GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_OES                = 0x8CD9;
+    public static final int GL_FRAMEBUFFER_INCOMPLETE_FORMATS_OES                   = 0x8CDA;
+    public static final int GL_FRAMEBUFFER_UNSUPPORTED_OES                          = 0x8CDD;
+    public static final int GL_FRAMEBUFFER_BINDING_OES                              = 0x8CA6;
+    public static final int GL_RENDERBUFFER_BINDING_OES                             = 0x8CA7;
+    public static final int GL_MAX_RENDERBUFFER_SIZE_OES                            = 0x84E8;
+    public static final int GL_INVALID_FRAMEBUFFER_OPERATION_OES                    = 0x0506;
+    public static final int GL_WRITE_ONLY_OES                                       = 0x88B9;
+    public static final int GL_BUFFER_ACCESS_OES                                    = 0x88BB;
+    public static final int GL_BUFFER_MAPPED_OES                                    = 0x88BC;
+    public static final int GL_BUFFER_MAP_POINTER_OES                               = 0x88BD;
+    public static final int GL_MODELVIEW_MATRIX_FLOAT_AS_INT_BITS_OES               = 0x898D;
+    public static final int GL_PROJECTION_MATRIX_FLOAT_AS_INT_BITS_OES              = 0x898E;
+    public static final int GL_TEXTURE_MATRIX_FLOAT_AS_INT_BITS_OES                 = 0x898F;
+    public static final int GL_MAX_VERTEX_UNITS_OES                                 = 0x86A4;
+    public static final int GL_MAX_PALETTE_MATRICES_OES                             = 0x8842;
+    public static final int GL_MATRIX_PALETTE_OES                                   = 0x8840;
+    public static final int GL_MATRIX_INDEX_ARRAY_OES                               = 0x8844;
+    public static final int GL_WEIGHT_ARRAY_OES                                     = 0x86AD;
+    public static final int GL_CURRENT_PALETTE_MATRIX_OES                           = 0x8843;
+    public static final int GL_MATRIX_INDEX_ARRAY_SIZE_OES                          = 0x8846;
+    public static final int GL_MATRIX_INDEX_ARRAY_TYPE_OES                          = 0x8847;
+    public static final int GL_MATRIX_INDEX_ARRAY_STRIDE_OES                        = 0x8848;
+    public static final int GL_MATRIX_INDEX_ARRAY_POINTER_OES                       = 0x8849;
+    public static final int GL_MATRIX_INDEX_ARRAY_BUFFER_BINDING_OES                = 0x8B9E;
+    public static final int GL_WEIGHT_ARRAY_SIZE_OES                                = 0x86AB;
+    public static final int GL_WEIGHT_ARRAY_TYPE_OES                                = 0x86A9;
+    public static final int GL_WEIGHT_ARRAY_STRIDE_OES                              = 0x86AA;
+    public static final int GL_WEIGHT_ARRAY_POINTER_OES                             = 0x86AC;
+    public static final int GL_WEIGHT_ARRAY_BUFFER_BINDING_OES                      = 0x889E;
+    public static final int GL_DEPTH_STENCIL_OES                                    = 0x84F9;
+    public static final int GL_UNSIGNED_INT_24_8_OES                                = 0x84FA;
+    public static final int GL_DEPTH24_STENCIL8_OES                                 = 0x88F0;
+    public static final int GL_RGB8_OES                                             = 0x8051;
+    public static final int GL_RGBA8_OES                                            = 0x8058;
+    public static final int GL_STENCIL_INDEX1_OES                                   = 0x8D46;
+    public static final int GL_STENCIL_INDEX4_OES                                   = 0x8D47;
+    public static final int GL_STENCIL_INDEX8_OES                                   = 0x8D48;
+    public static final int GL_INCR_WRAP_OES                                        = 0x8507;
+    public static final int GL_DECR_WRAP_OES                                        = 0x8508;
+    public static final int GL_NORMAL_MAP_OES                                       = 0x8511;
+    public static final int GL_REFLECTION_MAP_OES                                   = 0x8512;
+    public static final int GL_TEXTURE_CUBE_MAP_OES                                 = 0x8513;
+    public static final int GL_TEXTURE_BINDING_CUBE_MAP_OES                         = 0x8514;
+    public static final int GL_TEXTURE_CUBE_MAP_POSITIVE_X_OES                      = 0x8515;
+    public static final int GL_TEXTURE_CUBE_MAP_NEGATIVE_X_OES                      = 0x8516;
+    public static final int GL_TEXTURE_CUBE_MAP_POSITIVE_Y_OES                      = 0x8517;
+    public static final int GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_OES                      = 0x8518;
+    public static final int GL_TEXTURE_CUBE_MAP_POSITIVE_Z_OES                      = 0x8519;
+    public static final int GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_OES                      = 0x851A;
+    public static final int GL_MAX_CUBE_MAP_TEXTURE_SIZE_OES                        = 0x851C;
+    public static final int GL_TEXTURE_GEN_MODE_OES                                 = 0x2500;
+    public static final int GL_TEXTURE_GEN_STR_OES                                  = 0x8D60;
+    public static final int GL_MIRRORED_REPEAT_OES                                  = 0x8370;
+    public static final int GL_3DC_X_AMD                                            = 0x87F9;
+    public static final int GL_3DC_XY_AMD                                           = 0x87FA;
+    public static final int GL_ATC_RGB_AMD                                          = 0x8C92;
+    public static final int GL_ATC_RGBA_EXPLICIT_ALPHA_AMD                          = 0x8C93;
+    public static final int GL_ATC_RGBA_INTERPOLATED_ALPHA_AMD                      = 0x87EE;
+    public static final int GL_TEXTURE_MAX_ANISOTROPY_EXT                           = 0x84FE;
+    public static final int GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT                       = 0x84FF;
+    public static final int GL_BGRA                                                 = 0x80E1;
+
+    native private static void _nativeClassInit();
+    static {
+	    _nativeClassInit();
+    }
+    
+    // C function void glBlendEquationSeparateOES ( GLenum modeRGB, GLenum modeAlpha )
+
+    public static native void glBlendEquationSeparateOES(
+        int modeRGB,
+        int modeAlpha
+    );
+
+    // C function void glBlendFuncSeparateOES ( GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha )
+
+    public static native void glBlendFuncSeparateOES(
+        int srcRGB,
+        int dstRGB,
+        int srcAlpha,
+        int dstAlpha
+    );
+
+    // C function void glBlendEquationOES ( GLenum mode )
+
+    public static native void glBlendEquationOES(
+        int mode
+    );
+
+    // C function void glDrawTexsOES ( GLshort x, GLshort y, GLshort z, GLshort width, GLshort height )
+
+    public static native void glDrawTexsOES(
+        short x,
+        short y,
+        short z,
+        short width,
+        short height
+    );
+
+    // C function void glDrawTexiOES ( GLint x, GLint y, GLint z, GLint width, GLint height )
+
+    public static native void glDrawTexiOES(
+        int x,
+        int y,
+        int z,
+        int width,
+        int height
+    );
+
+    // C function void glDrawTexxOES ( GLfixed x, GLfixed y, GLfixed z, GLfixed width, GLfixed height )
+
+    public static native void glDrawTexxOES(
+        int x,
+        int y,
+        int z,
+        int width,
+        int height
+    );
+
+    // C function void glDrawTexsvOES ( const GLshort *coords )
+
+    public static native void glDrawTexsvOES(
+        short[] coords,
+        int offset
+    );
+
+    // C function void glDrawTexsvOES ( const GLshort *coords )
+
+    public static native void glDrawTexsvOES(
+        java.nio.ShortBuffer coords
+    );
+
+    // C function void glDrawTexivOES ( const GLint *coords )
+
+    public static native void glDrawTexivOES(
+        int[] coords,
+        int offset
+    );
+
+    // C function void glDrawTexivOES ( const GLint *coords )
+
+    public static native void glDrawTexivOES(
+        java.nio.IntBuffer coords
+    );
+
+    // C function void glDrawTexxvOES ( const GLfixed *coords )
+
+    public static native void glDrawTexxvOES(
+        int[] coords,
+        int offset
+    );
+
+    // C function void glDrawTexxvOES ( const GLfixed *coords )
+
+    public static native void glDrawTexxvOES(
+        java.nio.IntBuffer coords
+    );
+
+    // C function void glDrawTexfOES ( GLfloat x, GLfloat y, GLfloat z, GLfloat width, GLfloat height )
+
+    public static native void glDrawTexfOES(
+        float x,
+        float y,
+        float z,
+        float width,
+        float height
+    );
+
+    // C function void glDrawTexfvOES ( const GLfloat *coords )
+
+    public static native void glDrawTexfvOES(
+        float[] coords,
+        int offset
+    );
+
+    // C function void glDrawTexfvOES ( const GLfloat *coords )
+
+    public static native void glDrawTexfvOES(
+        java.nio.FloatBuffer coords
+    );
+
+    // C function void glEGLImageTargetTexture2DOES ( GLenum target, GLeglImageOES image )
+
+    public static native void glEGLImageTargetTexture2DOES(
+        int target,
+        java.nio.Buffer image
+    );
+
+    // C function void glEGLImageTargetRenderbufferStorageOES ( GLenum target, GLeglImageOES image )
+
+    public static native void glEGLImageTargetRenderbufferStorageOES(
+        int target,
+        java.nio.Buffer image
+    );
+
+    // C function void glAlphaFuncxOES ( GLenum func, GLclampx ref )
+
+    public static native void glAlphaFuncxOES(
+        int func,
+        int ref
+    );
+
+    // C function void glClearColorxOES ( GLclampx red, GLclampx green, GLclampx blue, GLclampx alpha )
+
+    public static native void glClearColorxOES(
+        int red,
+        int green,
+        int blue,
+        int alpha
+    );
+
+    // C function void glClearDepthxOES ( GLclampx depth )
+
+    public static native void glClearDepthxOES(
+        int depth
+    );
+
+    // C function void glClipPlanexOES ( GLenum plane, const GLfixed *equation )
+
+    public static native void glClipPlanexOES(
+        int plane,
+        int[] equation,
+        int offset
+    );
+
+    // C function void glClipPlanexOES ( GLenum plane, const GLfixed *equation )
+
+    public static native void glClipPlanexOES(
+        int plane,
+        java.nio.IntBuffer equation
+    );
+
+    // C function void glColor4xOES ( GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha )
+
+    public static native void glColor4xOES(
+        int red,
+        int green,
+        int blue,
+        int alpha
+    );
+
+    // C function void glDepthRangexOES ( GLclampx zNear, GLclampx zFar )
+
+    public static native void glDepthRangexOES(
+        int zNear,
+        int zFar
+    );
+
+    // C function void glFogxOES ( GLenum pname, GLfixed param )
+
+    public static native void glFogxOES(
+        int pname,
+        int param
+    );
+
+    // C function void glFogxvOES ( GLenum pname, const GLfixed *params )
+
+    public static native void glFogxvOES(
+        int pname,
+        int[] params,
+        int offset
+    );
+
+    // C function void glFogxvOES ( GLenum pname, const GLfixed *params )
+
+    public static native void glFogxvOES(
+        int pname,
+        java.nio.IntBuffer params
+    );
+
+    // C function void glFrustumxOES ( GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar )
+
+    public static native void glFrustumxOES(
+        int left,
+        int right,
+        int bottom,
+        int top,
+        int zNear,
+        int zFar
+    );
+
+    // C function void glGetClipPlanexOES ( GLenum pname, GLfixed *eqn )
+
+    public static native void glGetClipPlanexOES(
+        int pname,
+        int[] eqn,
+        int offset
+    );
+
+    // C function void glGetClipPlanexOES ( GLenum pname, GLfixed *eqn )
+
+    public static native void glGetClipPlanexOES(
+        int pname,
+        java.nio.IntBuffer eqn
+    );
+
+    // C function void glGetFixedvOES ( GLenum pname, GLfixed *params )
+
+    public static native void glGetFixedvOES(
+        int pname,
+        int[] params,
+        int offset
+    );
+
+    // C function void glGetFixedvOES ( GLenum pname, GLfixed *params )
+
+    public static native void glGetFixedvOES(
+        int pname,
+        java.nio.IntBuffer params
+    );
+
+    // C function void glGetLightxvOES ( GLenum light, GLenum pname, GLfixed *params )
+
+    public static native void glGetLightxvOES(
+        int light,
+        int pname,
+        int[] params,
+        int offset
+    );
+
+    // C function void glGetLightxvOES ( GLenum light, GLenum pname, GLfixed *params )
+
+    public static native void glGetLightxvOES(
+        int light,
+        int pname,
+        java.nio.IntBuffer params
+    );
+
+    // C function void glGetMaterialxvOES ( GLenum face, GLenum pname, GLfixed *params )
+
+    public static native void glGetMaterialxvOES(
+        int face,
+        int pname,
+        int[] params,
+        int offset
+    );
+
+    // C function void glGetMaterialxvOES ( GLenum face, GLenum pname, GLfixed *params )
+
+    public static native void glGetMaterialxvOES(
+        int face,
+        int pname,
+        java.nio.IntBuffer params
+    );
+
+    // C function void glGetTexEnvxvOES ( GLenum env, GLenum pname, GLfixed *params )
+
+    public static native void glGetTexEnvxvOES(
+        int env,
+        int pname,
+        int[] params,
+        int offset
+    );
+
+    // C function void glGetTexEnvxvOES ( GLenum env, GLenum pname, GLfixed *params )
+
+    public static native void glGetTexEnvxvOES(
+        int env,
+        int pname,
+        java.nio.IntBuffer params
+    );
+
+    // C function void glGetTexParameterxvOES ( GLenum target, GLenum pname, GLfixed *params )
+
+    public static native void glGetTexParameterxvOES(
+        int target,
+        int pname,
+        int[] params,
+        int offset
+    );
+
+    // C function void glGetTexParameterxvOES ( GLenum target, GLenum pname, GLfixed *params )
+
+    public static native void glGetTexParameterxvOES(
+        int target,
+        int pname,
+        java.nio.IntBuffer params
+    );
+
+    // C function void glLightModelxOES ( GLenum pname, GLfixed param )
+
+    public static native void glLightModelxOES(
+        int pname,
+        int param
+    );
+
+    // C function void glLightModelxvOES ( GLenum pname, const GLfixed *params )
+
+    public static native void glLightModelxvOES(
+        int pname,
+        int[] params,
+        int offset
+    );
+
+    // C function void glLightModelxvOES ( GLenum pname, const GLfixed *params )
+
+    public static native void glLightModelxvOES(
+        int pname,
+        java.nio.IntBuffer params
+    );
+
+    // C function void glLightxOES ( GLenum light, GLenum pname, GLfixed param )
+
+    public static native void glLightxOES(
+        int light,
+        int pname,
+        int param
+    );
+
+    // C function void glLightxvOES ( GLenum light, GLenum pname, const GLfixed *params )
+
+    public static native void glLightxvOES(
+        int light,
+        int pname,
+        int[] params,
+        int offset
+    );
+
+    // C function void glLightxvOES ( GLenum light, GLenum pname, const GLfixed *params )
+
+    public static native void glLightxvOES(
+        int light,
+        int pname,
+        java.nio.IntBuffer params
+    );
+
+    // C function void glLineWidthxOES ( GLfixed width )
+
+    public static native void glLineWidthxOES(
+        int width
+    );
+
+    // C function void glLoadMatrixxOES ( const GLfixed *m )
+
+    public static native void glLoadMatrixxOES(
+        int[] m,
+        int offset
+    );
+
+    // C function void glLoadMatrixxOES ( const GLfixed *m )
+
+    public static native void glLoadMatrixxOES(
+        java.nio.IntBuffer m
+    );
+
+    // C function void glMaterialxOES ( GLenum face, GLenum pname, GLfixed param )
+
+    public static native void glMaterialxOES(
+        int face,
+        int pname,
+        int param
+    );
+
+    // C function void glMaterialxvOES ( GLenum face, GLenum pname, const GLfixed *params )
+
+    public static native void glMaterialxvOES(
+        int face,
+        int pname,
+        int[] params,
+        int offset
+    );
+
+    // C function void glMaterialxvOES ( GLenum face, GLenum pname, const GLfixed *params )
+
+    public static native void glMaterialxvOES(
+        int face,
+        int pname,
+        java.nio.IntBuffer params
+    );
+
+    // C function void glMultMatrixxOES ( const GLfixed *m )
+
+    public static native void glMultMatrixxOES(
+        int[] m,
+        int offset
+    );
+
+    // C function void glMultMatrixxOES ( const GLfixed *m )
+
+    public static native void glMultMatrixxOES(
+        java.nio.IntBuffer m
+    );
+
+    // C function void glMultiTexCoord4xOES ( GLenum target, GLfixed s, GLfixed t, GLfixed r, GLfixed q )
+
+    public static native void glMultiTexCoord4xOES(
+        int target,
+        int s,
+        int t,
+        int r,
+        int q
+    );
+
+    // C function void glNormal3xOES ( GLfixed nx, GLfixed ny, GLfixed nz )
+
+    public static native void glNormal3xOES(
+        int nx,
+        int ny,
+        int nz
+    );
+
+    // C function void glOrthoxOES ( GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar )
+
+    public static native void glOrthoxOES(
+        int left,
+        int right,
+        int bottom,
+        int top,
+        int zNear,
+        int zFar
+    );
+
+    // C function void glPointParameterxOES ( GLenum pname, GLfixed param )
+
+    public static native void glPointParameterxOES(
+        int pname,
+        int param
+    );
+
+    // C function void glPointParameterxvOES ( GLenum pname, const GLfixed *params )
+
+    public static native void glPointParameterxvOES(
+        int pname,
+        int[] params,
+        int offset
+    );
+
+    // C function void glPointParameterxvOES ( GLenum pname, const GLfixed *params )
+
+    public static native void glPointParameterxvOES(
+        int pname,
+        java.nio.IntBuffer params
+    );
+
+    // C function void glPointSizexOES ( GLfixed size )
+
+    public static native void glPointSizexOES(
+        int size
+    );
+
+    // C function void glPolygonOffsetxOES ( GLfixed factor, GLfixed units )
+
+    public static native void glPolygonOffsetxOES(
+        int factor,
+        int units
+    );
+
+    // C function void glRotatexOES ( GLfixed angle, GLfixed x, GLfixed y, GLfixed z )
+
+    public static native void glRotatexOES(
+        int angle,
+        int x,
+        int y,
+        int z
+    );
+
+    // C function void glSampleCoveragexOES ( GLclampx value, GLboolean invert )
+
+    public static native void glSampleCoveragexOES(
+        int value,
+        boolean invert
+    );
+
+    // C function void glScalexOES ( GLfixed x, GLfixed y, GLfixed z )
+
+    public static native void glScalexOES(
+        int x,
+        int y,
+        int z
+    );
+
+    // C function void glTexEnvxOES ( GLenum target, GLenum pname, GLfixed param )
+
+    public static native void glTexEnvxOES(
+        int target,
+        int pname,
+        int param
+    );
+
+    // C function void glTexEnvxvOES ( GLenum target, GLenum pname, const GLfixed *params )
+
+    public static native void glTexEnvxvOES(
+        int target,
+        int pname,
+        int[] params,
+        int offset
+    );
+
+    // C function void glTexEnvxvOES ( GLenum target, GLenum pname, const GLfixed *params )
+
+    public static native void glTexEnvxvOES(
+        int target,
+        int pname,
+        java.nio.IntBuffer params
+    );
+
+    // C function void glTexParameterxOES ( GLenum target, GLenum pname, GLfixed param )
+
+    public static native void glTexParameterxOES(
+        int target,
+        int pname,
+        int param
+    );
+
+    // C function void glTexParameterxvOES ( GLenum target, GLenum pname, const GLfixed *params )
+
+    public static native void glTexParameterxvOES(
+        int target,
+        int pname,
+        int[] params,
+        int offset
+    );
+
+    // C function void glTexParameterxvOES ( GLenum target, GLenum pname, const GLfixed *params )
+
+    public static native void glTexParameterxvOES(
+        int target,
+        int pname,
+        java.nio.IntBuffer params
+    );
+
+    // C function void glTranslatexOES ( GLfixed x, GLfixed y, GLfixed z )
+
+    public static native void glTranslatexOES(
+        int x,
+        int y,
+        int z
+    );
+
+    // C function GLboolean glIsRenderbufferOES ( GLuint renderbuffer )
+
+    public static native boolean glIsRenderbufferOES(
+        int renderbuffer
+    );
+
+    // C function void glBindRenderbufferOES ( GLenum target, GLuint renderbuffer )
+
+    public static native void glBindRenderbufferOES(
+        int target,
+        int renderbuffer
+    );
+
+    // C function void glDeleteRenderbuffersOES ( GLsizei n, const GLuint *renderbuffers )
+
+    public static native void glDeleteRenderbuffersOES(
+        int n,
+        int[] renderbuffers,
+        int offset
+    );
+
+    // C function void glDeleteRenderbuffersOES ( GLsizei n, const GLuint *renderbuffers )
+
+    public static native void glDeleteRenderbuffersOES(
+        int n,
+        java.nio.IntBuffer renderbuffers
+    );
+
+    // C function void glGenRenderbuffersOES ( GLsizei n, GLuint *renderbuffers )
+
+    public static native void glGenRenderbuffersOES(
+        int n,
+        int[] renderbuffers,
+        int offset
+    );
+
+    // C function void glGenRenderbuffersOES ( GLsizei n, GLuint *renderbuffers )
+
+    public static native void glGenRenderbuffersOES(
+        int n,
+        java.nio.IntBuffer renderbuffers
+    );
+
+    // C function void glRenderbufferStorageOES ( GLenum target, GLenum internalformat, GLsizei width, GLsizei height )
+
+    public static native void glRenderbufferStorageOES(
+        int target,
+        int internalformat,
+        int width,
+        int height
+    );
+
+    // C function void glGetRenderbufferParameterivOES ( GLenum target, GLenum pname, GLint *params )
+
+    public static native void glGetRenderbufferParameterivOES(
+        int target,
+        int pname,
+        int[] params,
+        int offset
+    );
+
+    // C function void glGetRenderbufferParameterivOES ( GLenum target, GLenum pname, GLint *params )
+
+    public static native void glGetRenderbufferParameterivOES(
+        int target,
+        int pname,
+        java.nio.IntBuffer params
+    );
+
+    // C function GLboolean glIsFramebufferOES ( GLuint framebuffer )
+
+    public static native boolean glIsFramebufferOES(
+        int framebuffer
+    );
+
+    // C function void glBindFramebufferOES ( GLenum target, GLuint framebuffer )
+
+    public static native void glBindFramebufferOES(
+        int target,
+        int framebuffer
+    );
+
+    // C function void glDeleteFramebuffersOES ( GLsizei n, const GLuint *framebuffers )
+
+    public static native void glDeleteFramebuffersOES(
+        int n,
+        int[] framebuffers,
+        int offset
+    );
+
+    // C function void glDeleteFramebuffersOES ( GLsizei n, const GLuint *framebuffers )
+
+    public static native void glDeleteFramebuffersOES(
+        int n,
+        java.nio.IntBuffer framebuffers
+    );
+
+    // C function void glGenFramebuffersOES ( GLsizei n, GLuint *framebuffers )
+
+    public static native void glGenFramebuffersOES(
+        int n,
+        int[] framebuffers,
+        int offset
+    );
+
+    // C function void glGenFramebuffersOES ( GLsizei n, GLuint *framebuffers )
+
+    public static native void glGenFramebuffersOES(
+        int n,
+        java.nio.IntBuffer framebuffers
+    );
+
+    // C function GLenum glCheckFramebufferStatusOES ( GLenum target )
+
+    public static native int glCheckFramebufferStatusOES(
+        int target
+    );
+
+    // C function void glFramebufferRenderbufferOES ( GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer )
+
+    public static native void glFramebufferRenderbufferOES(
+        int target,
+        int attachment,
+        int renderbuffertarget,
+        int renderbuffer
+    );
+
+    // C function void glFramebufferTexture2DOES ( GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level )
+
+    public static native void glFramebufferTexture2DOES(
+        int target,
+        int attachment,
+        int textarget,
+        int texture,
+        int level
+    );
+
+    // C function void glGetFramebufferAttachmentParameterivOES ( GLenum target, GLenum attachment, GLenum pname, GLint *params )
+
+    public static native void glGetFramebufferAttachmentParameterivOES(
+        int target,
+        int attachment,
+        int pname,
+        int[] params,
+        int offset
+    );
+
+    // C function void glGetFramebufferAttachmentParameterivOES ( GLenum target, GLenum attachment, GLenum pname, GLint *params )
+
+    public static native void glGetFramebufferAttachmentParameterivOES(
+        int target,
+        int attachment,
+        int pname,
+        java.nio.IntBuffer params
+    );
+
+    // C function void glGenerateMipmapOES ( GLenum target )
+
+    public static native void glGenerateMipmapOES(
+        int target
+    );
+
+    // C function void glCurrentPaletteMatrixOES ( GLuint matrixpaletteindex )
+
+    public static native void glCurrentPaletteMatrixOES(
+        int matrixpaletteindex
+    );
+
+    // C function void glLoadPaletteFromModelViewMatrixOES ( void )
+
+    public static native void glLoadPaletteFromModelViewMatrixOES(
+    );
+
+    // C function void glMatrixIndexPointerOES ( GLint size, GLenum type, GLsizei stride, const GLvoid *pointer )
+
+    public static native void glMatrixIndexPointerOES(
+        int size,
+        int type,
+        int stride,
+        java.nio.Buffer pointer
+    );
+
+    // C function void glWeightPointerOES ( GLint size, GLenum type, GLsizei stride, const GLvoid *pointer )
+
+    public static native void glWeightPointerOES(
+        int size,
+        int type,
+        int stride,
+        java.nio.Buffer pointer
+    );
+
+    // C function void glDepthRangefOES ( GLclampf zNear, GLclampf zFar )
+
+    public static native void glDepthRangefOES(
+        float zNear,
+        float zFar
+    );
+
+    // C function void glFrustumfOES ( GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar )
+
+    public static native void glFrustumfOES(
+        float left,
+        float right,
+        float bottom,
+        float top,
+        float zNear,
+        float zFar
+    );
+
+    // C function void glOrthofOES ( GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar )
+
+    public static native void glOrthofOES(
+        float left,
+        float right,
+        float bottom,
+        float top,
+        float zNear,
+        float zFar
+    );
+
+    // C function void glClipPlanefOES ( GLenum plane, const GLfloat *equation )
+
+    public static native void glClipPlanefOES(
+        int plane,
+        float[] equation,
+        int offset
+    );
+
+    // C function void glClipPlanefOES ( GLenum plane, const GLfloat *equation )
+
+    public static native void glClipPlanefOES(
+        int plane,
+        java.nio.FloatBuffer equation
+    );
+
+    // C function void glGetClipPlanefOES ( GLenum pname, GLfloat *eqn )
+
+    public static native void glGetClipPlanefOES(
+        int pname,
+        float[] eqn,
+        int offset
+    );
+
+    // C function void glGetClipPlanefOES ( GLenum pname, GLfloat *eqn )
+
+    public static native void glGetClipPlanefOES(
+        int pname,
+        java.nio.FloatBuffer eqn
+    );
+
+    // C function void glClearDepthfOES ( GLclampf depth )
+
+    public static native void glClearDepthfOES(
+        float depth
+    );
+
+    // C function void glTexGenfOES ( GLenum coord, GLenum pname, GLfloat param )
+
+    public static native void glTexGenfOES(
+        int coord,
+        int pname,
+        float param
+    );
+
+    // C function void glTexGenfvOES ( GLenum coord, GLenum pname, const GLfloat *params )
+
+    public static native void glTexGenfvOES(
+        int coord,
+        int pname,
+        float[] params,
+        int offset
+    );
+
+    // C function void glTexGenfvOES ( GLenum coord, GLenum pname, const GLfloat *params )
+
+    public static native void glTexGenfvOES(
+        int coord,
+        int pname,
+        java.nio.FloatBuffer params
+    );
+
+    // C function void glTexGeniOES ( GLenum coord, GLenum pname, GLint param )
+
+    public static native void glTexGeniOES(
+        int coord,
+        int pname,
+        int param
+    );
+
+    // C function void glTexGenivOES ( GLenum coord, GLenum pname, const GLint *params )
+
+    public static native void glTexGenivOES(
+        int coord,
+        int pname,
+        int[] params,
+        int offset
+    );
+
+    // C function void glTexGenivOES ( GLenum coord, GLenum pname, const GLint *params )
+
+    public static native void glTexGenivOES(
+        int coord,
+        int pname,
+        java.nio.IntBuffer params
+    );
+
+    // C function void glTexGenxOES ( GLenum coord, GLenum pname, GLfixed param )
+
+    public static native void glTexGenxOES(
+        int coord,
+        int pname,
+        int param
+    );
+
+    // C function void glTexGenxvOES ( GLenum coord, GLenum pname, const GLfixed *params )
+
+    public static native void glTexGenxvOES(
+        int coord,
+        int pname,
+        int[] params,
+        int offset
+    );
+
+    // C function void glTexGenxvOES ( GLenum coord, GLenum pname, const GLfixed *params )
+
+    public static native void glTexGenxvOES(
+        int coord,
+        int pname,
+        java.nio.IntBuffer params
+    );
+
+    // C function void glGetTexGenfvOES ( GLenum coord, GLenum pname, GLfloat *params )
+
+    public static native void glGetTexGenfvOES(
+        int coord,
+        int pname,
+        float[] params,
+        int offset
+    );
+
+    // C function void glGetTexGenfvOES ( GLenum coord, GLenum pname, GLfloat *params )
+
+    public static native void glGetTexGenfvOES(
+        int coord,
+        int pname,
+        java.nio.FloatBuffer params
+    );
+
+    // C function void glGetTexGenivOES ( GLenum coord, GLenum pname, GLint *params )
+
+    public static native void glGetTexGenivOES(
+        int coord,
+        int pname,
+        int[] params,
+        int offset
+    );
+
+    // C function void glGetTexGenivOES ( GLenum coord, GLenum pname, GLint *params )
+
+    public static native void glGetTexGenivOES(
+        int coord,
+        int pname,
+        java.nio.IntBuffer params
+    );
+
+    // C function void glGetTexGenxvOES ( GLenum coord, GLenum pname, GLfixed *params )
+
+    public static native void glGetTexGenxvOES(
+        int coord,
+        int pname,
+        int[] params,
+        int offset
+    );
+
+    // C function void glGetTexGenxvOES ( GLenum coord, GLenum pname, GLfixed *params )
+
+    public static native void glGetTexGenxvOES(
+        int coord,
+        int pname,
+        java.nio.IntBuffer params
+    );
+
+}
diff --git a/opengl/libagl/egl.cpp b/opengl/libagl/egl.cpp
index 3b4c041..c44478d 100644
--- a/opengl/libagl/egl.cpp
+++ b/opengl/libagl/egl.cpp
@@ -1,17 +1,17 @@
-/* 
+/*
 **
 ** Copyright 2007 The Android Open Source Project
 **
-** Licensed under the Apache License Version 2.0(the "License"); 
-** you may not use this file except in compliance with the License. 
-** You may obtain a copy of the License at 
+** Licensed under the Apache License Version 2.0(the "License");
+** you may not use this file except in compliance with the License.
+** You may obtain a copy of the License at
 **
-**     http://www.apache.org/licenses/LICENSE-2.0 
+**     http://www.apache.org/licenses/LICENSE-2.0
 **
-** Unless required by applicable law or agreed to in writing software 
-** distributed under the License is distributed on an "AS IS" BASIS 
-** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND either express or implied. 
-** See the License for the specific language governing permissions and 
+** Unless required by applicable law or agreed to in writing software
+** distributed under the License is distributed on an "AS IS" BASIS
+** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND either express or implied.
+** See the License for the specific language governing permissions and
 ** limitations under the License.
 */
 
@@ -478,22 +478,38 @@
 };
 
 static const extention_map_t gExtentionMap[] = {
-    { "glDrawTexsOES",              (void(*)())&glDrawTexsOES },
-    { "glDrawTexiOES",              (void(*)())&glDrawTexiOES },
-    { "glDrawTexfOES",              (void(*)())&glDrawTexfOES },
-    { "glDrawTexxOES",              (void(*)())&glDrawTexxOES },
-    { "glDrawTexsvOES",             (void(*)())&glDrawTexsvOES },
-    { "glDrawTexivOES",             (void(*)())&glDrawTexivOES },
-    { "glDrawTexfvOES",             (void(*)())&glDrawTexfvOES },
-    { "glDrawTexxvOES",             (void(*)())&glDrawTexxvOES },
-    { "glQueryMatrixxOES",          (void(*)())&glQueryMatrixxOES },
-    { "glClipPlanef",               (void(*)())&glClipPlanef },
-    { "glClipPlanex",               (void(*)())&glClipPlanex },
-    { "glBindBuffer",               (void(*)())&glBindBuffer },
-    { "glBufferData",               (void(*)())&glBufferData },
-    { "glBufferSubData",            (void(*)())&glBufferSubData },
-    { "glDeleteBuffers",            (void(*)())&glDeleteBuffers },
-    { "glGenBuffers",               (void(*)())&glGenBuffers },
+    { "glDrawTexsOES",
+            (__eglMustCastToProperFunctionPointerType)&glDrawTexsOES },
+    { "glDrawTexiOES",
+            (__eglMustCastToProperFunctionPointerType)&glDrawTexiOES },
+    { "glDrawTexfOES",
+            (__eglMustCastToProperFunctionPointerType)&glDrawTexfOES },
+    { "glDrawTexxOES",
+            (__eglMustCastToProperFunctionPointerType)&glDrawTexxOES },
+    { "glDrawTexsvOES",
+            (__eglMustCastToProperFunctionPointerType)&glDrawTexsvOES },
+    { "glDrawTexivOES",
+            (__eglMustCastToProperFunctionPointerType)&glDrawTexivOES },
+    { "glDrawTexfvOES",
+            (__eglMustCastToProperFunctionPointerType)&glDrawTexfvOES },
+    { "glDrawTexxvOES",
+            (__eglMustCastToProperFunctionPointerType)&glDrawTexxvOES },
+    { "glQueryMatrixxOES",
+            (__eglMustCastToProperFunctionPointerType)&glQueryMatrixxOES },
+    { "glClipPlanef",
+            (__eglMustCastToProperFunctionPointerType)&glClipPlanef },
+    { "glClipPlanex",
+            (__eglMustCastToProperFunctionPointerType)&glClipPlanex },
+    { "glBindBuffer",
+            (__eglMustCastToProperFunctionPointerType)&glBindBuffer },
+    { "glBufferData",
+            (__eglMustCastToProperFunctionPointerType)&glBufferData },
+    { "glBufferSubData",
+            (__eglMustCastToProperFunctionPointerType)&glBufferSubData },
+    { "glDeleteBuffers",
+            (__eglMustCastToProperFunctionPointerType)&glDeleteBuffers },
+    { "glGenBuffers",
+            (__eglMustCastToProperFunctionPointerType)&glGenBuffers },
 };
 
 /* 
@@ -1299,6 +1315,8 @@
         }
     }
 
+    // TODO: call connect / disconnect on the surface
+
     ogles_context_t* gl = (ogles_context_t*)ctx;
     if (makeCurrent(gl) == 0) {
         if (ctx) {
diff --git a/opengl/libs/Android.mk b/opengl/libs/Android.mk
index 2ecc776..d636d73 100644
--- a/opengl/libs/Android.mk
+++ b/opengl/libs/Android.mk
@@ -35,7 +35,6 @@
 
 LOCAL_SRC_FILES:= 	\
 	GLES_CM/gl.cpp.arm 		\
-	GLES_CM/gl_logger.cpp 	\
 #
 
 LOCAL_SHARED_LIBRARIES += libcutils libutils libui libEGL
diff --git a/opengl/libs/EGL/egl.cpp b/opengl/libs/EGL/egl.cpp
index 0b4bcce..5ed3ecc 100644
--- a/opengl/libs/EGL/egl.cpp
+++ b/opengl/libs/EGL/egl.cpp
@@ -14,7 +14,7 @@
  ** limitations under the License.
  */
 
-#define LOG_TAG "GLLogger"
+#define LOG_TAG "libEGL"
 
 #include <ctype.h>
 #include <string.h>
@@ -69,9 +69,9 @@
 
 struct egl_display_t : public egl_object_t<'_dpy'>
 {
-    EGLDisplay  dpys[2];
-    EGLConfig*  configs[2];
-    EGLint      numConfigs[2];
+    EGLDisplay  dpys[IMPL_NUM_DRIVERS_IMPLEMENTATIONS];
+    EGLConfig*  configs[IMPL_NUM_DRIVERS_IMPLEMENTATIONS];
+    EGLint      numConfigs[IMPL_NUM_DRIVERS_IMPLEMENTATIONS];
     EGLint      numTotalConfigs;
     char const* extensionsString;
     volatile int32_t refs;
@@ -81,7 +81,7 @@
         char const * clientApi;
         char const * extensions;
     };
-    strings_t   queryString[2];
+    strings_t   queryString[IMPL_NUM_DRIVERS_IMPLEMENTATIONS];
 };
 
 struct egl_surface_t : public egl_object_t<'_srf'>
@@ -143,6 +143,7 @@
 
 static char const * const gl_names[] = {
     #include "gl_entries.in"
+    #include "glext_entries.in"
     NULL
 };
 
@@ -156,7 +157,7 @@
 
 // ----------------------------------------------------------------------------
 
-egl_connection_t gEGLImpl[2];
+egl_connection_t gEGLImpl[IMPL_NUM_DRIVERS_IMPLEMENTATIONS];
 static egl_display_t gDisplay[NUM_DISPLAYS];
 static pthread_mutex_t gThreadLocalStorageKeyMutex = PTHREAD_MUTEX_INITIALIZER;
 static pthread_key_t gEGLThreadLocalStorageKey = -1;
@@ -272,35 +273,81 @@
 static __attribute__((noinline))
 void *load_driver(const char* driver, gl_hooks_t* hooks)
 {
+    //LOGD("%s", driver);
+    char scrap[256];
     void* dso = dlopen(driver, RTLD_NOW | RTLD_LOCAL);
     LOGE_IF(!dso,
             "couldn't load <%s> library (%s)",
             driver, dlerror());
 
     if (dso) {
-        void** curr;
+        // first find the symbol for eglGetProcAddress
+        
+        typedef __eglMustCastToProperFunctionPointerType (*getProcAddressType)(
+                const char*);
+        
+        getProcAddressType getProcAddress = 
+            (getProcAddressType)dlsym(dso, "eglGetProcAddress");
+        
+        LOGE_IF(!getProcAddress, 
+                "can't find eglGetProcAddress() in %s", driver);        
+        
+        __eglMustCastToProperFunctionPointerType* curr;
         char const * const * api;
-        gl_hooks_t::gl_t* gl = &hooks->gl;
-        curr = (void**)gl;
-        api = gl_names;
+
+        gl_hooks_t::egl_t* egl = &hooks->egl;
+        curr = (__eglMustCastToProperFunctionPointerType*)egl;
+        api = egl_names;
         while (*api) {
-            void* f = dlsym(dso, *api);
-            //LOGD("<%s> @ 0x%p", *api, f);
+            char const * name = *api;
+            __eglMustCastToProperFunctionPointerType f = 
+                (__eglMustCastToProperFunctionPointerType)dlsym(dso, name);
             if (f == NULL) {
-                //LOGW("<%s> not found in %s", *api, driver);
-                f = (void*)gl_unimplemented;
+                // couldn't find the entry-point, use eglGetProcAddress()
+                f = getProcAddress(name);
+                if (f == NULL) {
+                    f = (__eglMustCastToProperFunctionPointerType)0;
+                }
             }
             *curr++ = f;
             api++;
         }
-        gl_hooks_t::egl_t* egl = &hooks->egl;
-        curr = (void**)egl;
-        api = egl_names;
+
+        gl_hooks_t::gl_t* gl = &hooks->gl;
+        curr = (__eglMustCastToProperFunctionPointerType*)gl;
+        api = gl_names;
         while (*api) {
-            void* f = dlsym(dso, *api);
+            char const * name = *api;
+            __eglMustCastToProperFunctionPointerType f = 
+                (__eglMustCastToProperFunctionPointerType)dlsym(dso, name);
             if (f == NULL) {
-                //LOGW("<%s> not found in %s", *api, driver);
-                f = (void*)0;
+                // couldn't find the entry-point, use eglGetProcAddress()
+                f = getProcAddress(name);
+            }
+            if (f == NULL) {
+                // Try without the OES postfix
+                ssize_t index = ssize_t(strlen(name)) - 3;
+                if ((index>0 && (index<255)) && (!strcmp(name+index, "OES"))) {
+                    strncpy(scrap, name, index);
+                    scrap[index] = 0;
+                    f = (__eglMustCastToProperFunctionPointerType)dlsym(dso, scrap);
+                    //LOGD_IF(f, "found <%s> instead", scrap);
+                }
+            }
+            if (f == NULL) {
+                // Try with the OES postfix
+                ssize_t index = ssize_t(strlen(name)) - 3;
+                if ((index>0 && (index<252)) && (strcmp(name+index, "OES"))) {
+                    strncpy(scrap, name, index);
+                    scrap[index] = 0;
+                    strcat(scrap, "OES");
+                    f = (__eglMustCastToProperFunctionPointerType)dlsym(dso, scrap);
+                    //LOGD_IF(f, "found <%s> instead", scrap);
+                }
+            }
+            if (f == NULL) {
+                //LOGD("%s", name);
+                f = (__eglMustCastToProperFunctionPointerType)gl_unimplemented;
             }
             *curr++ = f;
             api++;
@@ -429,18 +476,19 @@
     return (index >= NUM_DISPLAYS) ? NULL : &gDisplay[index];
 }
 
-static inline
-egl_surface_t* get_surface(EGLSurface surface)
-{
-    egl_surface_t* s = (egl_surface_t *)surface;
-    return s;
+template<typename NATIVE, typename EGL>
+static inline NATIVE* egl_to_native_cast(EGL arg) {
+    return reinterpret_cast<NATIVE*>(arg);
 }
 
 static inline
-egl_context_t* get_context(EGLContext context)
-{
-    egl_context_t* c = (egl_context_t *)context;
-    return c;
+egl_surface_t* get_surface(EGLSurface surface) {   
+    return egl_to_native_cast<egl_surface_t>(surface);
+}
+
+static inline
+egl_context_t* get_context(EGLContext context) {
+    return egl_to_native_cast<egl_context_t>(context);
 }
 
 static egl_connection_t* validate_display_config(
@@ -451,7 +499,7 @@
     if (!dp) return setError(EGL_BAD_DISPLAY, (egl_connection_t*)NULL);
 
     impl = uintptr_t(config)>>24;
-    if (uint32_t(impl) >= 2) {
+    if (uint32_t(impl) >= IMPL_NUM_DRIVERS_IMPLEMENTATIONS) {
         return setError(EGL_BAD_CONFIG, (egl_connection_t*)NULL);
     } 
     index = uintptr_t(config) & 0xFFFFFF;
@@ -491,13 +539,8 @@
     return EGL_TRUE;
 }
 
-// ----------------------------------------------------------------------------
-}; // namespace android
-// ----------------------------------------------------------------------------
 
-using namespace android;
-
-EGLDisplay eglGetDisplay(NativeDisplayType display)
+EGLDisplay egl_init_displays(NativeDisplayType display)
 {
     if (sEarlyInitState) {
         return EGL_NO_DISPLAY;
@@ -510,7 +553,7 @@
     
     EGLDisplay dpy = EGLDisplay(uintptr_t(display) + 1LU);
     egl_display_t* d = &gDisplay[index];
-        
+
     // dynamically load all our EGL implementations for that display
     // and call into the real eglGetGisplay()
     egl_connection_t* cnx = &gEGLImpl[IMPL_SOFTWARE];
@@ -573,6 +616,18 @@
     return dpy;
 }
 
+
+// ----------------------------------------------------------------------------
+}; // namespace android
+// ----------------------------------------------------------------------------
+
+using namespace android;
+
+EGLDisplay eglGetDisplay(NativeDisplayType display)
+{
+    return egl_init_displays(display);
+}
+
 // ----------------------------------------------------------------------------
 // Initialization
 // ----------------------------------------------------------------------------
@@ -594,7 +649,7 @@
     // build our own extension string first, based on the extension we know
     // and the extension supported by our client implementation
     dp->extensionsString = strdup(gExtensionString);
-    for (int i=0 ; i<2 ; i++) {
+    for (int i=0 ; i<IMPL_NUM_DRIVERS_IMPLEMENTATIONS ; i++) {
         egl_connection_t* const cnx = &gEGLImpl[i];
         cnx->major = -1;
         cnx->minor = -1;
@@ -624,7 +679,7 @@
     }
 
     EGLBoolean res = EGL_FALSE;
-    for (int i=0 ; i<2 ; i++) {
+    for (int i=0 ; i<IMPL_NUM_DRIVERS_IMPLEMENTATIONS ; i++) {
         egl_connection_t* const cnx = &gEGLImpl[i];
         if (cnx->dso && cnx->major>=0 && cnx->minor>=0) {
             EGLint n;
@@ -663,7 +718,7 @@
         return EGL_TRUE;
         
     EGLBoolean res = EGL_FALSE;
-    for (int i=0 ; i<2 ; i++) {
+    for (int i=0 ; i<IMPL_NUM_DRIVERS_IMPLEMENTATIONS ; i++) {
         egl_connection_t* const cnx = &gEGLImpl[i];
         if (cnx->dso) {
             cnx->hooks->egl.eglTerminate(dp->dpys[i]);
@@ -706,7 +761,7 @@
         return EGL_TRUE;
     }
     GLint n = 0;
-    for (int j=0 ; j<2 ; j++) {
+    for (int j=0 ; j<IMPL_NUM_DRIVERS_IMPLEMENTATIONS ; j++) {
         for (int i=0 ; i<dp->numConfigs[j] && config_size ; i++) {
             *configs++ = MAKE_CONFIG(j, i);
             config_size--;
@@ -794,7 +849,7 @@
         return res;
     }
 
-    for (int i=0 ; i<2 ; i++) {
+    for (int i=0 ; i<IMPL_NUM_DRIVERS_IMPLEMENTATIONS ; i++) {
         egl_connection_t* const cnx = &gEGLImpl[i];
         if (cnx->dso) {
             if (cnx->hooks->egl.eglChooseConfig(
@@ -1107,7 +1162,7 @@
 EGLint eglGetError(void)
 {
     EGLint result = EGL_SUCCESS;
-    for (int i=0 ; i<2 ; i++) {
+    for (int i=0 ; i<IMPL_NUM_DRIVERS_IMPLEMENTATIONS ; i++) {
         EGLint err = EGL_SUCCESS;
         egl_connection_t* const cnx = &gEGLImpl[i];
         if (cnx->dso)
@@ -1120,8 +1175,15 @@
     return result;
 }
 
-void (*eglGetProcAddress(const char *procname))()
+__eglMustCastToProperFunctionPointerType eglGetProcAddress(const char *procname)
 {
+    // eglGetProcAddress() could be the very first function called
+    // in which case we must make sure we've initialized ourselves, this
+    // happens the first time egl_get_display() is called.
+    
+    if (egl_init_displays(EGL_DEFAULT_DISPLAY) == EGL_NO_DISPLAY)
+        return NULL;
+
     __eglMustCastToProperFunctionPointerType addr;
     addr = findProcAddress(procname, gExtentionMap, NELEM(gExtentionMap));
     if (addr) return addr;
@@ -1133,7 +1195,7 @@
     
     addr = 0;
     int slot = -1;
-    for (int i=0 ; i<2 ; i++) {
+    for (int i=0 ; i<IMPL_NUM_DRIVERS_IMPLEMENTATIONS ; i++) {
         egl_connection_t* const cnx = &gEGLImpl[i];
         if (cnx->dso) {
             if (cnx->hooks->egl.eglGetProcAddress) {
@@ -1266,7 +1328,7 @@
     if (!dp) return setError(EGL_BAD_DISPLAY, EGL_FALSE);
 
     EGLBoolean res = EGL_TRUE;
-    for (int i=0 ; i<2 ; i++) {
+    for (int i=0 ; i<IMPL_NUM_DRIVERS_IMPLEMENTATIONS ; i++) {
         egl_connection_t* const cnx = &gEGLImpl[i];
         if (cnx->dso) {
             if (cnx->hooks->egl.eglSwapInterval) {
@@ -1309,7 +1371,7 @@
 {
     // bind this API on all EGLs
     EGLBoolean res = EGL_TRUE;
-    for (int i=0 ; i<2 ; i++) {
+    for (int i=0 ; i<IMPL_NUM_DRIVERS_IMPLEMENTATIONS ; i++) {
         egl_connection_t* const cnx = &gEGLImpl[i];
         if (cnx->dso) {
             if (cnx->hooks->egl.eglBindAPI) {
@@ -1324,7 +1386,7 @@
 
 EGLenum eglQueryAPI(void)
 {
-    for (int i=0 ; i<2 ; i++) {
+    for (int i=0 ; i<IMPL_NUM_DRIVERS_IMPLEMENTATIONS ; i++) {
         egl_connection_t* const cnx = &gEGLImpl[i];
         if (cnx->dso) {
             if (cnx->hooks->egl.eglQueryAPI) {
@@ -1340,7 +1402,7 @@
 
 EGLBoolean eglReleaseThread(void)
 {
-    for (int i=0 ; i<2 ; i++) {
+    for (int i=0 ; i<IMPL_NUM_DRIVERS_IMPLEMENTATIONS ; i++) {
         egl_connection_t* const cnx = &gEGLImpl[i];
         if (cnx->dso) {
             if (cnx->hooks->egl.eglReleaseThread) {
diff --git a/opengl/libs/GLES_CM/gl.cpp b/opengl/libs/GLES_CM/gl.cpp
index 865cf44..0057168 100644
--- a/opengl/libs/GLES_CM/gl.cpp
+++ b/opengl/libs/GLES_CM/gl.cpp
@@ -29,6 +29,7 @@
 #include <cutils/properties.h>
 
 #include "hooks.h"
+#include "egl_impl.h"
 
 using namespace android;
 
@@ -57,13 +58,6 @@
 // Actual GL entry-points
 // ----------------------------------------------------------------------------
 
-#if GL_LOGGER
-#   include "gl_logger.h"
-#   define GL_LOGGER_IMPL(_x) _x
-#else
-#   define GL_LOGGER_IMPL(_x)
-#endif
-
 #undef API_ENTRY
 #undef CALL_GL_API
 #undef CALL_GL_API_RETURN
@@ -96,21 +90,36 @@
 
     #define CALL_GL_API(_api, ...)                                      \
         gl_hooks_t::gl_t const * const _c = &getGlThreadSpecific()->gl; \
-        GL_LOGGER_IMPL( log_##_api(__VA_ARGS__); )                      \
         _c->_api(__VA_ARGS__)
     
     #define CALL_GL_API_RETURN(_api, ...)                               \
         gl_hooks_t::gl_t const * const _c = &getGlThreadSpecific()->gl; \
-        GL_LOGGER_IMPL( log_##_api(__VA_ARGS__); )                      \
         return _c->_api(__VA_ARGS__)
 
 #endif
 
+
 extern "C" {
 #include "gl_api.in"
+#include "glext_api.in"
 }
 
 #undef API_ENTRY
 #undef CALL_GL_API
 #undef CALL_GL_API_RETURN
 
+
+/*
+ * These GL calls are special because they need to call into EGL to retrieve
+ * some informations before they can execute.
+ */
+
+
+void glEGLImageTargetTexture2DOES(GLenum target, GLeglImageOES image)
+{
+}
+
+void glEGLImageTargetRenderbufferStorageOES(GLenum target, GLeglImageOES image)
+{
+}
+
diff --git a/opengl/libs/GLES_CM/gl_api.in b/opengl/libs/GLES_CM/gl_api.in
index 9234ef2..5437d47 100644
--- a/opengl/libs/GLES_CM/gl_api.in
+++ b/opengl/libs/GLES_CM/gl_api.in
@@ -1,532 +1,285 @@
-void API_ENTRY(glActiveTexture)(GLenum texture) {
-    CALL_GL_API(glActiveTexture, texture);
-}
-
 void API_ENTRY(glAlphaFunc)(GLenum func, GLclampf ref) {
     CALL_GL_API(glAlphaFunc, func, ref);
 }
-
-void API_ENTRY(glAlphaFuncx)(GLenum func, GLclampx ref) {
-    CALL_GL_API(glAlphaFuncx, func, ref);
-}
-
-void API_ENTRY(glBindTexture)(GLenum target, GLuint texture) {
-    CALL_GL_API(glBindTexture, target, texture);
-}
-
-void API_ENTRY(glBlendFunc)(GLenum sfactor, GLenum dfactor) {
-    CALL_GL_API(glBlendFunc, sfactor, dfactor);
-}
-
-void API_ENTRY(glClear)(GLbitfield mask) {
-    CALL_GL_API(glClear, mask);
-}
-
 void API_ENTRY(glClearColor)(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha) {
     CALL_GL_API(glClearColor, red, green, blue, alpha);
 }
-
-void API_ENTRY(glClearColorx)(GLclampx red, GLclampx green, GLclampx blue, GLclampx alpha) {
-    CALL_GL_API(glClearColorx, red, green, blue, alpha);
-}
-
 void API_ENTRY(glClearDepthf)(GLclampf depth) {
     CALL_GL_API(glClearDepthf, depth);
 }
-
-void API_ENTRY(glClearDepthx)(GLclampx depth) {
-    CALL_GL_API(glClearDepthx, depth);
-}
-
-void API_ENTRY(glClearStencil)(GLint s) {
-    CALL_GL_API(glClearStencil, s);
-}
-
-void API_ENTRY(glClientActiveTexture)(GLenum texture) {
-    CALL_GL_API(glClientActiveTexture, texture);
-}
-
-void API_ENTRY(glColor4f)(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha) {
-    CALL_GL_API(glColor4f, red, green, blue, alpha);
-}
-
-void API_ENTRY(glColor4x)(GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha) {
-    CALL_GL_API(glColor4x, red, green, blue, alpha);
-}
-
-void API_ENTRY(glColorMask)(GLboolean r, GLboolean g, GLboolean b, GLboolean a) {
-    CALL_GL_API(glColorMask, r, g, b, a);
-}
-
-void API_ENTRY(glColorPointer)(GLint size, GLenum type, GLsizei stride, const GLvoid *ptr)
-{
-    CALL_GL_API(glColorPointer, size, type, stride, ptr);
-}
-
-void API_ENTRY(glCompressedTexImage2D)(GLenum target, GLint level, GLenum internalformat,
-                            GLsizei width, GLsizei height, GLint border,
-                            GLsizei imageSize, const GLvoid *data) {
-    CALL_GL_API(glCompressedTexImage2D, target, level, internalformat,
-            width, height, border, imageSize, data);
-}
-
-void API_ENTRY(glCompressedTexSubImage2D)( GLenum target, GLint level, GLint xoffset,
-                                GLint yoffset, GLsizei width, GLsizei height,
-                                GLenum format, GLsizei imageSize,
-                                const GLvoid *data) {
-    CALL_GL_API(glCompressedTexSubImage2D, target, level, xoffset, yoffset,
-            width, height, format, imageSize, data);
-}
-
-void API_ENTRY(glCopyTexImage2D)(  GLenum target, GLint level, GLenum internalformat,
-                        GLint x, GLint y, GLsizei width, GLsizei height,
-                        GLint border) {
-    CALL_GL_API(glCopyTexImage2D, target, level, internalformat, x, y,
-            width, height, border);
-}
-
-void API_ENTRY(glCopyTexSubImage2D)(   GLenum target, GLint level, GLint xoffset,
-                            GLint yoffset, GLint x, GLint y, GLsizei width,
-                            GLsizei height) {
-    CALL_GL_API(glCopyTexSubImage2D, target, level, xoffset, yoffset, x, y,
-            width, height);
-}
-
-void API_ENTRY(glCullFace)(GLenum mode) {
-    CALL_GL_API(glCullFace, mode);
-}
-
-void API_ENTRY(glDeleteTextures)(GLsizei n, const GLuint *textures) {
-    CALL_GL_API(glDeleteTextures, n, textures);
-}
-
-void API_ENTRY(glDepthFunc)(GLenum func) {
-    CALL_GL_API(glDepthFunc, func);
-}
-
-void API_ENTRY(glDepthMask)(GLboolean flag) {
-    CALL_GL_API(glDepthMask, flag);
-}
-
-void API_ENTRY(glDepthRangef)(GLclampf zNear, GLclampf zFar) {
-    CALL_GL_API(glDepthRangef, zNear, zFar);
-}
-
-void API_ENTRY(glDepthRangex)(GLclampx zNear, GLclampx zFar) {
-    CALL_GL_API(glDepthRangex, zNear, zFar);
-}
-
-void API_ENTRY(glDisable)(GLenum cap) {
-    CALL_GL_API(glDisable, cap);
-}
-
-void API_ENTRY(glDisableClientState)(GLenum array) {
-    CALL_GL_API(glDisableClientState, array);
-}
-
-void API_ENTRY(glDrawArrays)(GLenum mode, GLint first, GLsizei count) {
-    CALL_GL_API(glDrawArrays, mode, first, count);
-}
-
-void API_ENTRY(glDrawElements)(GLenum mode, GLsizei count,
-                    GLenum type, const GLvoid *indices) {
-    CALL_GL_API(glDrawElements, mode, count, type, indices);
-}
-
-void API_ENTRY(glEnable)(GLenum cap) {
-    CALL_GL_API(glEnable, cap);
-}
-
-void API_ENTRY(glEnableClientState)(GLenum array) {
-    CALL_GL_API(glEnableClientState, array);
-}
-
-void API_ENTRY(glFinish)(void) {
-    CALL_GL_API(glFinish);
-}
-
-void API_ENTRY(glFlush)(void) {
-    CALL_GL_API(glFlush);
-}
-
-void API_ENTRY(glFogf)(GLenum pname, GLfloat param) {
-    CALL_GL_API(glFogf, pname, param);
-}
-
-void API_ENTRY(glFogfv)(GLenum pname, const GLfloat *params) {
-    CALL_GL_API(glFogfv, pname, params);
-}
-
-void API_ENTRY(glFogx)(GLenum pname, GLfixed param) {
-    CALL_GL_API(glFogx, pname, param);
-}
-
-void API_ENTRY(glFogxv)(GLenum pname, const GLfixed *params) {
-    CALL_GL_API(glFogxv, pname, params);
-}
-
-void API_ENTRY(glFrontFace)(GLenum mode) {
-    CALL_GL_API(glFrontFace, mode);
-}
-
-void API_ENTRY(glFrustumf)(GLfloat left, GLfloat right,
-                GLfloat bottom, GLfloat top,
-                GLfloat zNear, GLfloat zFar) {
-    CALL_GL_API(glFrustumf, left, right, bottom, top, zNear, zFar);
-}
-
-void API_ENTRY(glFrustumx)(GLfixed left, GLfixed right,
-                GLfixed bottom, GLfixed top,
-                GLfixed zNear, GLfixed zFar) {
-    CALL_GL_API(glFrustumx, left, right, bottom, top, zNear, zFar);
-}
-
-void API_ENTRY(glGenTextures)(GLsizei n, GLuint *textures) {
-    CALL_GL_API(glGenTextures, n, textures);
-}
-
-GLenum API_ENTRY(glGetError)(void) {
-    CALL_GL_API_RETURN(glGetError);
-}
-
-void API_ENTRY(glGetIntegerv)(GLenum pname, GLint *params) {
-    CALL_GL_API(glGetIntegerv, pname, params);
-}
-
-const GLubyte * API_ENTRY(glGetString)(GLenum name) {
-    CALL_GL_API_RETURN(glGetString, name);
-}
-
-void API_ENTRY(glHint)(GLenum target, GLenum mode) {
-    CALL_GL_API(glHint, target, mode);
-}
-
-void API_ENTRY(glLightModelf)(GLenum pname, GLfloat param) {
-    CALL_GL_API(glLightModelf, pname, param);
-}
-
-void API_ENTRY(glLightModelfv)(GLenum pname, const GLfloat *params) {
-    CALL_GL_API(glLightModelfv, pname, params);
-}
-
-void API_ENTRY(glLightModelx)(GLenum pname, GLfixed param) {
-    CALL_GL_API(glLightModelx, pname, param);
-}
-
-void API_ENTRY(glLightModelxv)(GLenum pname, const GLfixed *params) {
-    CALL_GL_API(glLightModelxv, pname, params);
-}
-
-void API_ENTRY(glLightf)(GLenum light, GLenum pname, GLfloat param) {
-    CALL_GL_API(glLightf, light, pname, param);
-}
-
-void API_ENTRY(glLightfv)(GLenum light, GLenum pname, const GLfloat *params) {
-    CALL_GL_API(glLightfv, light, pname, params);
-}
-
-void API_ENTRY(glLightx)(GLenum light, GLenum pname, GLfixed param) {
-    CALL_GL_API(glLightx, light, pname, param);
-}
-
-void API_ENTRY(glLightxv)(GLenum light, GLenum pname, const GLfixed *params) {
-    CALL_GL_API(glLightxv, light, pname, params);
-}
-
-void API_ENTRY(glLineWidth)(GLfloat width) {
-    CALL_GL_API(glLineWidth, width);
-}
-
-void API_ENTRY(glLineWidthx)(GLfixed width) {
-    CALL_GL_API(glLineWidthx, width);
-}
-
-void API_ENTRY(glLoadIdentity)(void) {
-    CALL_GL_API(glLoadIdentity);
-}
-
-void API_ENTRY(glLoadMatrixf)(const GLfloat *m) {
-    CALL_GL_API(glLoadMatrixf, m);
-}
-
-void API_ENTRY(glLoadMatrixx)(const GLfixed *m) {
-    CALL_GL_API(glLoadMatrixx, m);
-}
-
-void API_ENTRY(glLogicOp)(GLenum opcode) {
-    CALL_GL_API(glLogicOp, opcode);
-}
-
-void API_ENTRY(glMaterialf)(GLenum face, GLenum pname, GLfloat param) {
-    CALL_GL_API(glMaterialf, face, pname, param);
-}
-
-void API_ENTRY(glMaterialfv)(GLenum face, GLenum pname, const GLfloat *params) {
-    CALL_GL_API(glMaterialfv, face, pname, params);
-}
-
-void API_ENTRY(glMaterialx)(GLenum face, GLenum pname, GLfixed param) {
-    CALL_GL_API(glMaterialx, face, pname, param);
-}
-
-void API_ENTRY(glMaterialxv)(GLenum face, GLenum pname, const GLfixed *params) {
-    CALL_GL_API(glMaterialxv, face, pname, params);
-}
-
-void API_ENTRY(glMatrixMode)(GLenum mode) {
-    CALL_GL_API(glMatrixMode, mode);
-}
-
-void API_ENTRY(glMultMatrixf)(const GLfloat *m) {
-    CALL_GL_API(glMultMatrixf, m);
-}
-
-void API_ENTRY(glMultMatrixx)(const GLfixed *m) {
-    CALL_GL_API(glMultMatrixx, m);
-}
-
-void API_ENTRY(glMultiTexCoord4f)(GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q) {
-    CALL_GL_API(glMultiTexCoord4f, target, s, t, r, q);
-}
-
-void API_ENTRY(glMultiTexCoord4x)(GLenum target, GLfixed s, GLfixed t, GLfixed r, GLfixed q) {
-    CALL_GL_API(glMultiTexCoord4x, target, s, t, r, q);
-}
-
-void API_ENTRY(glNormal3f)(GLfloat nx, GLfloat ny, GLfloat nz) {
-    CALL_GL_API(glNormal3f, nx, ny, nz);
-}
-
-void API_ENTRY(glNormal3x)(GLfixed nx, GLfixed ny, GLfixed nz) {
-    CALL_GL_API(glNormal3x, nx, ny, nz);
-}
-
-void API_ENTRY(glNormalPointer)(GLenum type, GLsizei stride, const GLvoid *pointer) {
-    CALL_GL_API(glNormalPointer, type, stride, pointer);
-}
-
-void API_ENTRY(glOrthof)(  GLfloat left, GLfloat right,
-                GLfloat bottom, GLfloat top,
-                GLfloat zNear, GLfloat zFar) {
-    CALL_GL_API(glOrthof, left, right, bottom, top, zNear, zFar);
-}
-
-void API_ENTRY(glOrthox)(  GLfixed left, GLfixed right,
-                GLfixed bottom, GLfixed top,
-                GLfixed zNear, GLfixed zFar) {
-    CALL_GL_API(glOrthox, left, right, bottom, top, zNear, zFar);
-}
-
-void API_ENTRY(glPixelStorei)(GLenum pname, GLint param) {
-    CALL_GL_API(glPixelStorei, pname, param);
-}
-
-void API_ENTRY(glPointSize)(GLfloat size) {
-    CALL_GL_API(glPointSize, size);
-}
-
-void API_ENTRY(glPointSizex)(GLfixed size) {
-    CALL_GL_API(glPointSizex, size);
-}
-
-void API_ENTRY(glPolygonOffset)(GLfloat factor, GLfloat units) {
-    CALL_GL_API(glPolygonOffset, factor, units);
-}
-
-void API_ENTRY(glPolygonOffsetx)(GLfixed factor, GLfixed units) {
-    CALL_GL_API(glPolygonOffsetx, factor, units);
-}
-
-void API_ENTRY(glPopMatrix)(void) {
-    CALL_GL_API(glPopMatrix);
-}
-
-void API_ENTRY(glPushMatrix)(void) {
-    CALL_GL_API(glPushMatrix);
-}
-
-void API_ENTRY(glReadPixels)(  GLint x, GLint y, GLsizei width, GLsizei height,
-                    GLenum format, GLenum type, GLvoid *pixels) {
-    CALL_GL_API(glReadPixels, x, y, width, height, format, type, pixels);
-}
-
-void API_ENTRY(glRotatef)(GLfloat angle, GLfloat x, GLfloat y, GLfloat z) {
-    CALL_GL_API(glRotatef, angle, x, y, z);
-}
-
-void API_ENTRY(glRotatex)(GLfixed angle, GLfixed x, GLfixed y, GLfixed z) {
-    CALL_GL_API(glRotatex, angle, x, y, z);
-}
-
-void API_ENTRY(glSampleCoverage)(GLclampf value, GLboolean invert) {
-    CALL_GL_API(glSampleCoverage, value, invert);
-}
-
-void API_ENTRY(glSampleCoveragex)(GLclampx value, GLboolean invert) {
-    CALL_GL_API(glSampleCoveragex, value, invert);
-}
-
-void API_ENTRY(glScalef)(GLfloat x, GLfloat y, GLfloat z) {
-    CALL_GL_API(glScalef, x, y, z);
-}
-
-void API_ENTRY(glScalex)(GLfixed x, GLfixed y, GLfixed z) {
-    CALL_GL_API(glScalex, x, y, z);
-}
-
-void API_ENTRY(glScissor)(GLint x, GLint y, GLsizei width, GLsizei height) {
-    CALL_GL_API(glScissor, x, y, width, height);
-}
-
-void API_ENTRY(glShadeModel)(GLenum mode) {
-    CALL_GL_API(glShadeModel, mode);
-}
-
-void API_ENTRY(glStencilFunc)(GLenum func, GLint ref, GLuint mask) {
-    CALL_GL_API(glStencilFunc, func, ref, mask);
-}
-
-void API_ENTRY(glStencilMask)(GLuint mask) {
-    CALL_GL_API(glStencilMask, mask);
-}
-
-void API_ENTRY(glStencilOp)(GLenum fail, GLenum zfail, GLenum zpass) {
-    CALL_GL_API(glStencilOp, fail, zfail, zpass);
-}
-
-void API_ENTRY(glTexCoordPointer)( GLint size, GLenum type,
-                        GLsizei stride, const GLvoid *pointer) {
-    CALL_GL_API(glTexCoordPointer, size, type, stride, pointer);
-}
-
-void API_ENTRY(glTexEnvf)(GLenum target, GLenum pname, GLfloat param) {
-    CALL_GL_API(glTexEnvf, target, pname, param);
-}
-
-void API_ENTRY(glTexEnvfv)(GLenum target, GLenum pname, const GLfloat *params) {
-    CALL_GL_API(glTexEnvfv, target, pname, params);
-}
-
-void API_ENTRY(glTexEnvx)(GLenum target, GLenum pname, GLfixed param) {
-    CALL_GL_API(glTexEnvx, target, pname, param);
-}
-
-void API_ENTRY(glTexEnvxv)(GLenum target, GLenum pname, const GLfixed *params) {
-    CALL_GL_API(glTexEnvxv, target, pname, params);
-}
-
-void API_ENTRY(glTexImage2D)(  GLenum target, GLint level, GLint internalformat,
-                    GLsizei width, GLsizei height, GLint border, GLenum format,
-                    GLenum type, const GLvoid *pixels) {
-    CALL_GL_API(glTexImage2D, target, level, internalformat, width, height,
-            border, format, type, pixels);
-}
-
-void API_ENTRY(glTexParameterf)(GLenum target, GLenum pname, GLfloat param) {
-    CALL_GL_API(glTexParameterf, target, pname, param);
-}
-
-void API_ENTRY(glTexParameterx)(GLenum target, GLenum pname, GLfixed param) {
-    CALL_GL_API(glTexParameterx, target, pname, param);
-}
-
-void API_ENTRY(glTexSubImage2D)(   GLenum target, GLint level, GLint xoffset,
-                        GLint yoffset, GLsizei width, GLsizei height,
-                        GLenum format, GLenum type, const GLvoid *pixels) {
-    CALL_GL_API(glTexSubImage2D, target, level, xoffset, yoffset,
-            width, height, format, type, pixels);
-}
-
-void API_ENTRY(glTranslatef)(GLfloat x, GLfloat y, GLfloat z) {
-    CALL_GL_API(glTranslatef, x, y, z);
-}
-
-void API_ENTRY(glTranslatex)(GLfixed x, GLfixed y, GLfixed z) {
-    CALL_GL_API(glTranslatex, x, y, z);
-}
-
-void API_ENTRY(glVertexPointer)(   GLint size, GLenum type,
-                        GLsizei stride, const GLvoid *pointer) {
-    CALL_GL_API(glVertexPointer, size, type, stride, pointer);
-}
-
-void API_ENTRY(glViewport)(GLint x, GLint y, GLsizei width, GLsizei height) {
-    CALL_GL_API(glViewport, x, y, width, height);
-}
-
-// ES 1.1
 void API_ENTRY(glClipPlanef)(GLenum plane, const GLfloat *equation) {
     CALL_GL_API(glClipPlanef, plane, equation);
 }
-void API_ENTRY(glClipPlanex)(GLenum plane, const GLfixed *equation) {
-    CALL_GL_API(glClipPlanex, plane, equation);
+void API_ENTRY(glColor4f)(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha) {
+    CALL_GL_API(glColor4f, red, green, blue, alpha);
 }
-void API_ENTRY(glBindBuffer)(GLenum target, GLuint buffer) {
-    CALL_GL_API(glBindBuffer, target, buffer);
+void API_ENTRY(glDepthRangef)(GLclampf zNear, GLclampf zFar) {
+    CALL_GL_API(glDepthRangef, zNear, zFar);
 }
-void API_ENTRY(glBufferData)(GLenum target, GLsizeiptr size, const GLvoid* data, GLenum usage) {
-    CALL_GL_API(glBufferData, target, size, data, usage);
+void API_ENTRY(glFogf)(GLenum pname, GLfloat param) {
+    CALL_GL_API(glFogf, pname, param);
 }
-void API_ENTRY(glBufferSubData)(GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid* data) {
-    CALL_GL_API(glBufferSubData, target, offset, size, data);
+void API_ENTRY(glFogfv)(GLenum pname, const GLfloat *params) {
+    CALL_GL_API(glFogfv, pname, params);
 }
-void API_ENTRY(glDeleteBuffers)(GLsizei n, const GLuint* buffers) {
-    CALL_GL_API(glDeleteBuffers, n, buffers);
-}
-void API_ENTRY(glGenBuffers)(GLsizei n, GLuint* buffers) {
-    CALL_GL_API(glGenBuffers, n, buffers);
-}
-void API_ENTRY(glGetBooleanv)(GLenum pname, GLboolean *params) {
-    CALL_GL_API(glGetBooleanv, pname, params);
-}
-void API_ENTRY(glGetFixedv)(GLenum pname, GLfixed *params) {
-    CALL_GL_API(glGetFixedv, pname, params);
-}
-void API_ENTRY(glGetFloatv)(GLenum pname, GLfloat *params) {
-    CALL_GL_API(glGetFloatv, pname, params);
-}
-void API_ENTRY(glGetPointerv)(GLenum pname, void **params) {
-    CALL_GL_API(glGetPointerv, pname, params);
-}
-void API_ENTRY(glGetBufferParameteriv)(GLenum target, GLenum pname, GLint *params) {
-    CALL_GL_API(glGetBufferParameteriv, target, pname, params);
+void API_ENTRY(glFrustumf)(GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar) {
+    CALL_GL_API(glFrustumf, left, right, bottom, top, zNear, zFar);
 }
 void API_ENTRY(glGetClipPlanef)(GLenum pname, GLfloat eqn[4]) {
     CALL_GL_API(glGetClipPlanef, pname, eqn);
 }
-void API_ENTRY(glGetClipPlanex)(GLenum pname, GLfixed eqn[4]) {
-    CALL_GL_API(glGetClipPlanex, pname, eqn);
-}
-void API_ENTRY(glGetLightxv)(GLenum light, GLenum pname, GLfixed *params) {
-    CALL_GL_API(glGetLightxv, light, pname, params);
+void API_ENTRY(glGetFloatv)(GLenum pname, GLfloat *params) {
+    CALL_GL_API(glGetFloatv, pname, params);
 }
 void API_ENTRY(glGetLightfv)(GLenum light, GLenum pname, GLfloat *params) {
     CALL_GL_API(glGetLightfv, light, pname, params);
 }
-void API_ENTRY(glGetMaterialxv)(GLenum face, GLenum pname, GLfixed *params) {
-    CALL_GL_API(glGetMaterialxv, face, pname, params);
-}
 void API_ENTRY(glGetMaterialfv)(GLenum face, GLenum pname, GLfloat *params) {
     CALL_GL_API(glGetMaterialfv, face, pname, params);
 }
 void API_ENTRY(glGetTexEnvfv)(GLenum env, GLenum pname, GLfloat *params) {
     CALL_GL_API(glGetTexEnvfv, env, pname, params);
 }
+void API_ENTRY(glGetTexParameterfv)(GLenum target, GLenum pname, GLfloat *params) {
+    CALL_GL_API(glGetTexParameterfv, target, pname, params);
+}
+void API_ENTRY(glLightModelf)(GLenum pname, GLfloat param) {
+    CALL_GL_API(glLightModelf, pname, param);
+}
+void API_ENTRY(glLightModelfv)(GLenum pname, const GLfloat *params) {
+    CALL_GL_API(glLightModelfv, pname, params);
+}
+void API_ENTRY(glLightf)(GLenum light, GLenum pname, GLfloat param) {
+    CALL_GL_API(glLightf, light, pname, param);
+}
+void API_ENTRY(glLightfv)(GLenum light, GLenum pname, const GLfloat *params) {
+    CALL_GL_API(glLightfv, light, pname, params);
+}
+void API_ENTRY(glLineWidth)(GLfloat width) {
+    CALL_GL_API(glLineWidth, width);
+}
+void API_ENTRY(glLoadMatrixf)(const GLfloat *m) {
+    CALL_GL_API(glLoadMatrixf, m);
+}
+void API_ENTRY(glMaterialf)(GLenum face, GLenum pname, GLfloat param) {
+    CALL_GL_API(glMaterialf, face, pname, param);
+}
+void API_ENTRY(glMaterialfv)(GLenum face, GLenum pname, const GLfloat *params) {
+    CALL_GL_API(glMaterialfv, face, pname, params);
+}
+void API_ENTRY(glMultMatrixf)(const GLfloat *m) {
+    CALL_GL_API(glMultMatrixf, m);
+}
+void API_ENTRY(glMultiTexCoord4f)(GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q) {
+    CALL_GL_API(glMultiTexCoord4f, target, s, t, r, q);
+}
+void API_ENTRY(glNormal3f)(GLfloat nx, GLfloat ny, GLfloat nz) {
+    CALL_GL_API(glNormal3f, nx, ny, nz);
+}
+void API_ENTRY(glOrthof)(GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar) {
+    CALL_GL_API(glOrthof, left, right, bottom, top, zNear, zFar);
+}
+void API_ENTRY(glPointParameterf)(GLenum pname, GLfloat param) {
+    CALL_GL_API(glPointParameterf, pname, param);
+}
+void API_ENTRY(glPointParameterfv)(GLenum pname, const GLfloat *params) {
+    CALL_GL_API(glPointParameterfv, pname, params);
+}
+void API_ENTRY(glPointSize)(GLfloat size) {
+    CALL_GL_API(glPointSize, size);
+}
+void API_ENTRY(glPolygonOffset)(GLfloat factor, GLfloat units) {
+    CALL_GL_API(glPolygonOffset, factor, units);
+}
+void API_ENTRY(glRotatef)(GLfloat angle, GLfloat x, GLfloat y, GLfloat z) {
+    CALL_GL_API(glRotatef, angle, x, y, z);
+}
+void API_ENTRY(glScalef)(GLfloat x, GLfloat y, GLfloat z) {
+    CALL_GL_API(glScalef, x, y, z);
+}
+void API_ENTRY(glTexEnvf)(GLenum target, GLenum pname, GLfloat param) {
+    CALL_GL_API(glTexEnvf, target, pname, param);
+}
+void API_ENTRY(glTexEnvfv)(GLenum target, GLenum pname, const GLfloat *params) {
+    CALL_GL_API(glTexEnvfv, target, pname, params);
+}
+void API_ENTRY(glTexParameterf)(GLenum target, GLenum pname, GLfloat param) {
+    CALL_GL_API(glTexParameterf, target, pname, param);
+}
+void API_ENTRY(glTexParameterfv)(GLenum target, GLenum pname, const GLfloat *params) {
+    CALL_GL_API(glTexParameterfv, target, pname, params);
+}
+void API_ENTRY(glTranslatef)(GLfloat x, GLfloat y, GLfloat z) {
+    CALL_GL_API(glTranslatef, x, y, z);
+}
+void API_ENTRY(glActiveTexture)(GLenum texture) {
+    CALL_GL_API(glActiveTexture, texture);
+}
+void API_ENTRY(glAlphaFuncx)(GLenum func, GLclampx ref) {
+    CALL_GL_API(glAlphaFuncx, func, ref);
+}
+void API_ENTRY(glBindBuffer)(GLenum target, GLuint buffer) {
+    CALL_GL_API(glBindBuffer, target, buffer);
+}
+void API_ENTRY(glBindTexture)(GLenum target, GLuint texture) {
+    CALL_GL_API(glBindTexture, target, texture);
+}
+void API_ENTRY(glBlendFunc)(GLenum sfactor, GLenum dfactor) {
+    CALL_GL_API(glBlendFunc, sfactor, dfactor);
+}
+void API_ENTRY(glBufferData)(GLenum target, GLsizeiptr size, const GLvoid *data, GLenum usage) {
+    CALL_GL_API(glBufferData, target, size, data, usage);
+}
+void API_ENTRY(glBufferSubData)(GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid *data) {
+    CALL_GL_API(glBufferSubData, target, offset, size, data);
+}
+void API_ENTRY(glClear)(GLbitfield mask) {
+    CALL_GL_API(glClear, mask);
+}
+void API_ENTRY(glClearColorx)(GLclampx red, GLclampx green, GLclampx blue, GLclampx alpha) {
+    CALL_GL_API(glClearColorx, red, green, blue, alpha);
+}
+void API_ENTRY(glClearDepthx)(GLclampx depth) {
+    CALL_GL_API(glClearDepthx, depth);
+}
+void API_ENTRY(glClearStencil)(GLint s) {
+    CALL_GL_API(glClearStencil, s);
+}
+void API_ENTRY(glClientActiveTexture)(GLenum texture) {
+    CALL_GL_API(glClientActiveTexture, texture);
+}
+void API_ENTRY(glClipPlanex)(GLenum plane, const GLfixed *equation) {
+    CALL_GL_API(glClipPlanex, plane, equation);
+}
+void API_ENTRY(glColor4ub)(GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha) {
+    CALL_GL_API(glColor4ub, red, green, blue, alpha);
+}
+void API_ENTRY(glColor4x)(GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha) {
+    CALL_GL_API(glColor4x, red, green, blue, alpha);
+}
+void API_ENTRY(glColorMask)(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha) {
+    CALL_GL_API(glColorMask, red, green, blue, alpha);
+}
+void API_ENTRY(glColorPointer)(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer) {
+    CALL_GL_API(glColorPointer, size, type, stride, pointer);
+}
+void API_ENTRY(glCompressedTexImage2D)(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data) {
+    CALL_GL_API(glCompressedTexImage2D, target, level, internalformat, width, height, border, imageSize, data);
+}
+void API_ENTRY(glCompressedTexSubImage2D)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data) {
+    CALL_GL_API(glCompressedTexSubImage2D, target, level, xoffset, yoffset, width, height, format, imageSize, data);
+}
+void API_ENTRY(glCopyTexImage2D)(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border) {
+    CALL_GL_API(glCopyTexImage2D, target, level, internalformat, x, y, width, height, border);
+}
+void API_ENTRY(glCopyTexSubImage2D)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height) {
+    CALL_GL_API(glCopyTexSubImage2D, target, level, xoffset, yoffset, x, y, width, height);
+}
+void API_ENTRY(glCullFace)(GLenum mode) {
+    CALL_GL_API(glCullFace, mode);
+}
+void API_ENTRY(glDeleteBuffers)(GLsizei n, const GLuint *buffers) {
+    CALL_GL_API(glDeleteBuffers, n, buffers);
+}
+void API_ENTRY(glDeleteTextures)(GLsizei n, const GLuint *textures) {
+    CALL_GL_API(glDeleteTextures, n, textures);
+}
+void API_ENTRY(glDepthFunc)(GLenum func) {
+    CALL_GL_API(glDepthFunc, func);
+}
+void API_ENTRY(glDepthMask)(GLboolean flag) {
+    CALL_GL_API(glDepthMask, flag);
+}
+void API_ENTRY(glDepthRangex)(GLclampx zNear, GLclampx zFar) {
+    CALL_GL_API(glDepthRangex, zNear, zFar);
+}
+void API_ENTRY(glDisable)(GLenum cap) {
+    CALL_GL_API(glDisable, cap);
+}
+void API_ENTRY(glDisableClientState)(GLenum array) {
+    CALL_GL_API(glDisableClientState, array);
+}
+void API_ENTRY(glDrawArrays)(GLenum mode, GLint first, GLsizei count) {
+    CALL_GL_API(glDrawArrays, mode, first, count);
+}
+void API_ENTRY(glDrawElements)(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices) {
+    CALL_GL_API(glDrawElements, mode, count, type, indices);
+}
+void API_ENTRY(glEnable)(GLenum cap) {
+    CALL_GL_API(glEnable, cap);
+}
+void API_ENTRY(glEnableClientState)(GLenum array) {
+    CALL_GL_API(glEnableClientState, array);
+}
+void API_ENTRY(glFinish)(void) {
+    CALL_GL_API(glFinish);
+}
+void API_ENTRY(glFlush)(void) {
+    CALL_GL_API(glFlush);
+}
+void API_ENTRY(glFogx)(GLenum pname, GLfixed param) {
+    CALL_GL_API(glFogx, pname, param);
+}
+void API_ENTRY(glFogxv)(GLenum pname, const GLfixed *params) {
+    CALL_GL_API(glFogxv, pname, params);
+}
+void API_ENTRY(glFrontFace)(GLenum mode) {
+    CALL_GL_API(glFrontFace, mode);
+}
+void API_ENTRY(glFrustumx)(GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar) {
+    CALL_GL_API(glFrustumx, left, right, bottom, top, zNear, zFar);
+}
+void API_ENTRY(glGetBooleanv)(GLenum pname, GLboolean *params) {
+    CALL_GL_API(glGetBooleanv, pname, params);
+}
+void API_ENTRY(glGetBufferParameteriv)(GLenum target, GLenum pname, GLint *params) {
+    CALL_GL_API(glGetBufferParameteriv, target, pname, params);
+}
+void API_ENTRY(glGetClipPlanex)(GLenum pname, GLfixed eqn[4]) {
+    CALL_GL_API(glGetClipPlanex, pname, eqn);
+}
+void API_ENTRY(glGenBuffers)(GLsizei n, GLuint *buffers) {
+    CALL_GL_API(glGenBuffers, n, buffers);
+}
+void API_ENTRY(glGenTextures)(GLsizei n, GLuint *textures) {
+    CALL_GL_API(glGenTextures, n, textures);
+}
+GLenum API_ENTRY(glGetError)(void) {
+    CALL_GL_API_RETURN(glGetError);
+}
+void API_ENTRY(glGetFixedv)(GLenum pname, GLfixed *params) {
+    CALL_GL_API(glGetFixedv, pname, params);
+}
+void API_ENTRY(glGetIntegerv)(GLenum pname, GLint *params) {
+    CALL_GL_API(glGetIntegerv, pname, params);
+}
+void API_ENTRY(glGetLightxv)(GLenum light, GLenum pname, GLfixed *params) {
+    CALL_GL_API(glGetLightxv, light, pname, params);
+}
+void API_ENTRY(glGetMaterialxv)(GLenum face, GLenum pname, GLfixed *params) {
+    CALL_GL_API(glGetMaterialxv, face, pname, params);
+}
+void API_ENTRY(glGetPointerv)(GLenum pname, void **params) {
+    CALL_GL_API(glGetPointerv, pname, params);
+}
+const GLubyte * API_ENTRY(glGetString)(GLenum name) {
+    CALL_GL_API_RETURN(glGetString, name);
+}
 void API_ENTRY(glGetTexEnviv)(GLenum env, GLenum pname, GLint *params) {
     CALL_GL_API(glGetTexEnviv, env, pname, params);
 }
 void API_ENTRY(glGetTexEnvxv)(GLenum env, GLenum pname, GLfixed *params) {
     CALL_GL_API(glGetTexEnvxv, env, pname, params);
 }
-void API_ENTRY(glGetTexParameterfv)(GLenum target, GLenum pname, GLfloat *params) {
-    CALL_GL_API(glGetTexParameterfv, target, pname, params);
-}
 void API_ENTRY(glGetTexParameteriv)(GLenum target, GLenum pname, GLint *params) {
     CALL_GL_API(glGetTexParameteriv, target, pname, params);
 }
 void API_ENTRY(glGetTexParameterxv)(GLenum target, GLenum pname, GLfixed *params) {
     CALL_GL_API(glGetTexParameterxv, target, pname, params);
 }
+void API_ENTRY(glHint)(GLenum target, GLenum mode) {
+    CALL_GL_API(glHint, target, mode);
+}
 GLboolean API_ENTRY(glIsBuffer)(GLuint buffer) {
     CALL_GL_API_RETURN(glIsBuffer, buffer);
 }
@@ -536,11 +289,56 @@
 GLboolean API_ENTRY(glIsTexture)(GLuint texture) {
     CALL_GL_API_RETURN(glIsTexture, texture);
 }
-void API_ENTRY(glPointParameterf)(GLenum pname, GLfloat param) {
-    CALL_GL_API(glPointParameterf, pname, param);
+void API_ENTRY(glLightModelx)(GLenum pname, GLfixed param) {
+    CALL_GL_API(glLightModelx, pname, param);
 }
-void API_ENTRY(glPointParameterfv)(GLenum pname, const GLfloat *params) {
-    CALL_GL_API(glPointParameterfv, pname, params);
+void API_ENTRY(glLightModelxv)(GLenum pname, const GLfixed *params) {
+    CALL_GL_API(glLightModelxv, pname, params);
+}
+void API_ENTRY(glLightx)(GLenum light, GLenum pname, GLfixed param) {
+    CALL_GL_API(glLightx, light, pname, param);
+}
+void API_ENTRY(glLightxv)(GLenum light, GLenum pname, const GLfixed *params) {
+    CALL_GL_API(glLightxv, light, pname, params);
+}
+void API_ENTRY(glLineWidthx)(GLfixed width) {
+    CALL_GL_API(glLineWidthx, width);
+}
+void API_ENTRY(glLoadIdentity)(void) {
+    CALL_GL_API(glLoadIdentity);
+}
+void API_ENTRY(glLoadMatrixx)(const GLfixed *m) {
+    CALL_GL_API(glLoadMatrixx, m);
+}
+void API_ENTRY(glLogicOp)(GLenum opcode) {
+    CALL_GL_API(glLogicOp, opcode);
+}
+void API_ENTRY(glMaterialx)(GLenum face, GLenum pname, GLfixed param) {
+    CALL_GL_API(glMaterialx, face, pname, param);
+}
+void API_ENTRY(glMaterialxv)(GLenum face, GLenum pname, const GLfixed *params) {
+    CALL_GL_API(glMaterialxv, face, pname, params);
+}
+void API_ENTRY(glMatrixMode)(GLenum mode) {
+    CALL_GL_API(glMatrixMode, mode);
+}
+void API_ENTRY(glMultMatrixx)(const GLfixed *m) {
+    CALL_GL_API(glMultMatrixx, m);
+}
+void API_ENTRY(glMultiTexCoord4x)(GLenum target, GLfixed s, GLfixed t, GLfixed r, GLfixed q) {
+    CALL_GL_API(glMultiTexCoord4x, target, s, t, r, q);
+}
+void API_ENTRY(glNormal3x)(GLfixed nx, GLfixed ny, GLfixed nz) {
+    CALL_GL_API(glNormal3x, nx, ny, nz);
+}
+void API_ENTRY(glNormalPointer)(GLenum type, GLsizei stride, const GLvoid *pointer) {
+    CALL_GL_API(glNormalPointer, type, stride, pointer);
+}
+void API_ENTRY(glOrthox)(GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar) {
+    CALL_GL_API(glOrthox, left, right, bottom, top, zNear, zFar);
+}
+void API_ENTRY(glPixelStorei)(GLenum pname, GLint param) {
+    CALL_GL_API(glPixelStorei, pname, param);
 }
 void API_ENTRY(glPointParameterx)(GLenum pname, GLfixed param) {
     CALL_GL_API(glPointParameterx, pname, param);
@@ -548,59 +346,90 @@
 void API_ENTRY(glPointParameterxv)(GLenum pname, const GLfixed *params) {
     CALL_GL_API(glPointParameterxv, pname, params);
 }
-void API_ENTRY(glColor4ub)(GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha) {
-    CALL_GL_API(glColor4ub, red, green, blue, alpha);
+void API_ENTRY(glPointSizex)(GLfixed size) {
+    CALL_GL_API(glPointSizex, size);
+}
+void API_ENTRY(glPolygonOffsetx)(GLfixed factor, GLfixed units) {
+    CALL_GL_API(glPolygonOffsetx, factor, units);
+}
+void API_ENTRY(glPopMatrix)(void) {
+    CALL_GL_API(glPopMatrix);
+}
+void API_ENTRY(glPushMatrix)(void) {
+    CALL_GL_API(glPushMatrix);
+}
+void API_ENTRY(glReadPixels)(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels) {
+    CALL_GL_API(glReadPixels, x, y, width, height, format, type, pixels);
+}
+void API_ENTRY(glRotatex)(GLfixed angle, GLfixed x, GLfixed y, GLfixed z) {
+    CALL_GL_API(glRotatex, angle, x, y, z);
+}
+void API_ENTRY(glSampleCoverage)(GLclampf value, GLboolean invert) {
+    CALL_GL_API(glSampleCoverage, value, invert);
+}
+void API_ENTRY(glSampleCoveragex)(GLclampx value, GLboolean invert) {
+    CALL_GL_API(glSampleCoveragex, value, invert);
+}
+void API_ENTRY(glScalex)(GLfixed x, GLfixed y, GLfixed z) {
+    CALL_GL_API(glScalex, x, y, z);
+}
+void API_ENTRY(glScissor)(GLint x, GLint y, GLsizei width, GLsizei height) {
+    CALL_GL_API(glScissor, x, y, width, height);
+}
+void API_ENTRY(glShadeModel)(GLenum mode) {
+    CALL_GL_API(glShadeModel, mode);
+}
+void API_ENTRY(glStencilFunc)(GLenum func, GLint ref, GLuint mask) {
+    CALL_GL_API(glStencilFunc, func, ref, mask);
+}
+void API_ENTRY(glStencilMask)(GLuint mask) {
+    CALL_GL_API(glStencilMask, mask);
+}
+void API_ENTRY(glStencilOp)(GLenum fail, GLenum zfail, GLenum zpass) {
+    CALL_GL_API(glStencilOp, fail, zfail, zpass);
+}
+void API_ENTRY(glTexCoordPointer)(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer) {
+    CALL_GL_API(glTexCoordPointer, size, type, stride, pointer);
 }
 void API_ENTRY(glTexEnvi)(GLenum target, GLenum pname, GLint param) {
     CALL_GL_API(glTexEnvi, target, pname, param);
 }
+void API_ENTRY(glTexEnvx)(GLenum target, GLenum pname, GLfixed param) {
+    CALL_GL_API(glTexEnvx, target, pname, param);
+}
 void API_ENTRY(glTexEnviv)(GLenum target, GLenum pname, const GLint *params) {
     CALL_GL_API(glTexEnviv, target, pname, params);
 }
-
-void API_ENTRY(glTexParameterfv)(GLenum target, GLenum pname, const GLfloat *params) {
-    CALL_GL_API(glTexParameterfv, target, pname, params);
+void API_ENTRY(glTexEnvxv)(GLenum target, GLenum pname, const GLfixed *params) {
+    CALL_GL_API(glTexEnvxv, target, pname, params);
 }
-
-void API_ENTRY(glTexParameteriv)(GLenum target, GLenum pname, const GLint *params) {
-    CALL_GL_API(glTexParameteriv, target, pname, params);
+void API_ENTRY(glTexImage2D)(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels) {
+    CALL_GL_API(glTexImage2D, target, level, internalformat, width, height, border, format, type, pixels);
 }
-
 void API_ENTRY(glTexParameteri)(GLenum target, GLenum pname, GLint param) {
     CALL_GL_API(glTexParameteri, target, pname, param);
 }
+void API_ENTRY(glTexParameterx)(GLenum target, GLenum pname, GLfixed param) {
+    CALL_GL_API(glTexParameterx, target, pname, param);
+}
+void API_ENTRY(glTexParameteriv)(GLenum target, GLenum pname, const GLint *params) {
+    CALL_GL_API(glTexParameteriv, target, pname, params);
+}
 void API_ENTRY(glTexParameterxv)(GLenum target, GLenum pname, const GLfixed *params) {
     CALL_GL_API(glTexParameterxv, target, pname, params);
 }
+void API_ENTRY(glTexSubImage2D)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels) {
+    CALL_GL_API(glTexSubImage2D, target, level, xoffset, yoffset, width, height, format, type, pixels);
+}
+void API_ENTRY(glTranslatex)(GLfixed x, GLfixed y, GLfixed z) {
+    CALL_GL_API(glTranslatex, x, y, z);
+}
+void API_ENTRY(glVertexPointer)(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer) {
+    CALL_GL_API(glVertexPointer, size, type, stride, pointer);
+}
+void API_ENTRY(glViewport)(GLint x, GLint y, GLsizei width, GLsizei height) {
+    CALL_GL_API(glViewport, x, y, width, height);
+}
 void API_ENTRY(glPointSizePointerOES)(GLenum type, GLsizei stride, const GLvoid *pointer) {
     CALL_GL_API(glPointSizePointerOES, type, stride, pointer);
 }
-
-// Extensions
-void API_ENTRY(glDrawTexsOES)(GLshort x , GLshort y, GLshort z, GLshort w, GLshort h) {
-    CALL_GL_API(glDrawTexsOES, x, y, z, w, h);
-}
-void API_ENTRY(glDrawTexiOES)(GLint x, GLint y, GLint z, GLint w, GLint h) {
-    CALL_GL_API(glDrawTexiOES, x, y, z, w, h);
-}
-void API_ENTRY(glDrawTexfOES)(GLfloat x, GLfloat y, GLfloat z, GLfloat w, GLfloat h) {
-    CALL_GL_API(glDrawTexfOES, x, y, z, w, h);
-}
-void API_ENTRY(glDrawTexxOES)(GLfixed x, GLfixed y, GLfixed z, GLfixed w, GLfixed h) {
-    CALL_GL_API(glDrawTexxOES, x, y, z, w, h);
-}
-void API_ENTRY(glDrawTexsvOES)(const GLshort* coords) {
-    CALL_GL_API(glDrawTexsvOES, coords);
-}
-void API_ENTRY(glDrawTexivOES)(const GLint* coords) {
-    CALL_GL_API(glDrawTexivOES, coords);
-}
-void API_ENTRY(glDrawTexfvOES)(const GLfloat* coords) {
-    CALL_GL_API(glDrawTexfvOES, coords);
-}
-void API_ENTRY(glDrawTexxvOES)(const GLfixed* coords) {
-    CALL_GL_API(glDrawTexxvOES, coords);
-}
-GLbitfield API_ENTRY(glQueryMatrixxOES)(GLfixed* mantissa, GLint* exponent) {
-    CALL_GL_API_RETURN(glQueryMatrixxOES, mantissa, exponent);
-}
diff --git a/opengl/libs/GLES_CM/gl_logger.cpp b/opengl/libs/GLES_CM/gl_logger.cpp
deleted file mode 100644
index 27be5c9..0000000
--- a/opengl/libs/GLES_CM/gl_logger.cpp
+++ /dev/null
@@ -1,1060 +0,0 @@
-/*
- ** Copyright 2007, The Android Open Source Project
- **
- ** Licensed under the Apache License, Version 2.0 (the "License");
- ** you may not use this file except in compliance with the License.
- ** You may obtain a copy of the License at
- **
- **     http://www.apache.org/licenses/LICENSE-2.0
- **
- ** Unless required by applicable law or agreed to in writing, software
- ** distributed under the License is distributed on an "AS IS" BASIS,
- ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- ** See the License for the specific language governing permissions and
- ** limitations under the License.
- */
-
-#define LOG_TAG "GLLogger"
-
-#include <ctype.h>
-#include <string.h>
-#include <errno.h>
-#include <dlfcn.h>
-
-#include <sys/ioctl.h>
-
-#include <EGL/egl.h>
-#include <EGL/eglext.h>
-#include <GLES/gl.h>
-#include <GLES/glext.h>
-
-#include <cutils/log.h>
-#include <cutils/atomic.h>
-#include <cutils/properties.h>
-
-#include <utils/String8.h>
-
-#include "gl_logger.h"
-
-#undef NELEM
-#define NELEM(x) (sizeof(x)/sizeof(*(x)))
-
-// ----------------------------------------------------------------------------
-namespace android {
-// ----------------------------------------------------------------------------
-
-template<typename T>
-static int binarySearch(T const sortedArray[], int first, int last, EGLint key)
-{
-   while (first <= last) {
-       int mid = (first + last) / 2;
-       if (key > sortedArray[mid].key) {
-           first = mid + 1;
-       } else if (key < sortedArray[mid].key) {
-           last = mid - 1;
-       } else {
-           return mid;
-       }
-   }
-   return -1;
-}
-
-struct pair_t {
-    const char* name;
-    int         key;
-};
-
-static const pair_t gEnumMap[] = {
-    #define GLENUM(NAME, VALUE) { #NAME, VALUE },
-    #include "gl_enums.in"
-    #undef GLENUM
-};
-
-// ----------------------------------------------------------------------------
-
-template<typename TYPE>
-class GLLogValue {
-public:
-    GLLogValue(TYPE value) : mValue(value) { }
-    const TYPE& getValue() const { return mValue; }
-    String8 toString() const {
-        return convertToString(mValue);
-    }
-private:
-    const TYPE& mValue;
-    String8 convertToString(unsigned int v) const {
-        char buf[16];
-        snprintf(buf, 16, "%u", v);
-        return String8(buf);
-    }
-    String8 convertToString(unsigned long v) const {
-        char buf[16];
-        snprintf(buf, 16, "%lu", v);
-        return String8(buf);
-    }
-    String8 convertToString(int v) const {
-        char buf[16];
-        snprintf(buf, 16, "%d", v);
-        return String8(buf);
-    }
-    String8 convertToString(long v) const {
-        char buf[16];
-        snprintf(buf, 16, "%ld", v);
-        return String8(buf);
-    }
-    String8 convertToString(float v) const {
-        char buf[16];
-        snprintf(buf, 16, "%f", v);
-        return String8(buf);
-    }
-    String8 convertToString(void const* v) const {
-        char buf[16];
-        snprintf(buf, 16, "%p", v);
-        return String8(buf);
-    }
-};
-
-class GLLogEnum : public GLLogValue<GLenum> {
-public:
-    GLLogEnum(GLenum v) : GLLogValue<GLenum>(v) { }
-    String8 toString() const {
-        GLenum v = getValue();
-        int i = binarySearch<pair_t>(gEnumMap, 0, NELEM(gEnumMap)-1, v);
-        if (i >= 0) {
-            return String8(gEnumMap[i].name);
-        } else {
-            char buf[16];
-            snprintf(buf, 16, "0x%04x", v);
-            return String8(buf);
-        }
-    }
-};
-
-class GLLogClearBitfield : public GLLogValue<GLbitfield> {
-public:
-    GLLogClearBitfield(GLbitfield v) : GLLogValue<GLbitfield>(v) { }
-    String8 toString() const {
-        char buf[16];
-        snprintf(buf, 16, "0x%08x", getValue());
-        return String8(buf);
-    }
-};
-
-class GLLogBool : public GLLogValue<GLboolean> {
-public:
-    GLLogBool(GLboolean v) : GLLogValue<GLboolean>(v) { }
-    String8 toString() const {
-        GLboolean v = getValue();
-        if (v == GL_TRUE)   return String8("GL_TRUE");
-        if (v == GL_FALSE)  return String8("GL_FALSE");
-        return GLLogValue<GLboolean>::toString();
-    }
-};
-
-class GLLogFixed : public GLLogValue<GLfixed> {
-public:
-    GLLogFixed(GLfixed v) : GLLogValue<GLfixed>(v) { }
-    String8 toString() const {
-        char buf[16];
-        snprintf(buf, 16, "0x%08x", getValue());
-        return String8(buf);
-    }
-};
-
-
-template <typename TYPE>
-class GLLogBuffer : public GLLogValue<TYPE *> {
-public:
-    GLLogBuffer(TYPE* buffer, size_t count = -1)
-        : GLLogValue<TYPE*>(buffer)
-    { // output buffer
-    }
-    GLLogBuffer(TYPE const* buffer, size_t count = -1)
-    : GLLogValue<TYPE*>(const_cast<TYPE*>(buffer))
-    { // input buffer
-    }
-};
-
-class GLLog
-{
-public:
-    GLLog(const char* name) : mNumParams(0) {
-        mString.append(name);
-        mString.append("(");
-    }
-
-    ~GLLog() {
-        LOGD("%s);", mString.string());
-    }
-
-    GLLog& operator << (unsigned char v) {
-        return *this << GLLogValue<unsigned int>(v);
-    }
-    GLLog& operator << (short v) {
-        return *this << GLLogValue<unsigned int>(v);
-    }
-    GLLog& operator << (unsigned int v) {
-        return *this << GLLogValue<unsigned int>(v);
-    }
-    GLLog& operator << (int v) {
-        return *this << GLLogValue<int>(v);
-    }
-    GLLog& operator << (long v) {
-        return *this << GLLogValue<long>(v);
-    }
-    GLLog& operator << (unsigned long v) {
-        return *this << GLLogValue<unsigned long>(v);
-    }
-    GLLog& operator << (float v) {
-        return *this << GLLogValue<float>(v);
-    }
-    GLLog& operator << (const void* v) {
-        return *this << GLLogValue<const void* >(v);
-    }
-
-    template <typename TYPE>
-    GLLog& operator << (const TYPE& rhs) {
-        if (mNumParams > 0)
-            mString.append(", ");
-        mString.append(rhs.toString());
-        mNumParams++;
-        return *this;
-    }
-
-    const String8& string() const { return mString; }
-private:
-    GLLog(const GLLog&);
-
-    String8 mString;
-    int mNumParams;
-};
-
-#define API_ENTRY(api)                      log_##api
-#define CALL_GL_API(_x, ...)
-#define CALL_GL_API_RETURN(_x, ...)         return(0);
-
-void API_ENTRY(glActiveTexture)(GLenum texture) {
-    CALL_GL_API(glActiveTexture, texture);
-    GLLog("glActiveTexture") << GLLogEnum(texture);
-}
-
-void API_ENTRY(glAlphaFunc)(GLenum func, GLclampf ref) {
-    CALL_GL_API(glAlphaFunc, func, ref);
-    GLLog("glAlphaFunc") << GLLogEnum(func) << ref;
-}
-
-void API_ENTRY(glAlphaFuncx)(GLenum func, GLclampx ref) {
-    CALL_GL_API(glAlphaFuncx, func, ref);
-    GLLog("glAlphaFuncx") << GLLogEnum(func) << GLLogFixed(ref);
-}
-
-void API_ENTRY(glBindTexture)(GLenum target, GLuint texture) {
-    CALL_GL_API(glBindTexture, target, texture);
-    GLLog("glBindTexture") << GLLogEnum(target) << texture;
-}
-
-void API_ENTRY(glBlendFunc)(GLenum sfactor, GLenum dfactor) {
-    CALL_GL_API(glBlendFunc, sfactor, dfactor);
-    GLLog("glBlendFunc") << GLLogEnum(sfactor) << GLLogEnum(dfactor);
-}
-
-void API_ENTRY(glClear)(GLbitfield mask) {
-    CALL_GL_API(glClear, mask);
-    GLLog("glClear") << GLLogClearBitfield(mask);
-}
-
-void API_ENTRY(glClearColor)(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha) {
-    CALL_GL_API(glClearColor, red, green, blue, alpha);
-    GLLog("glClearColor") << red << green << blue << alpha;
-}
-
-void API_ENTRY(glClearColorx)(GLclampx red, GLclampx green, GLclampx blue, GLclampx alpha) {
-    CALL_GL_API(glClearColorx, red, green, blue, alpha);
-    GLLog("glClearColorx") << GLLogFixed(red) << GLLogFixed(green) << GLLogFixed(blue) << GLLogFixed(alpha);
-}
-
-void API_ENTRY(glClearDepthf)(GLclampf depth) {
-    CALL_GL_API(glClearDepthf, depth);
-    GLLog("glClearDepthf") << depth;
-}
-
-void API_ENTRY(glClearDepthx)(GLclampx depth) {
-    CALL_GL_API(glClearDepthx, depth);
-    GLLog("glClearDepthx") << GLLogFixed(depth);
-}
-
-void API_ENTRY(glClearStencil)(GLint s) {
-    CALL_GL_API(glClearStencil, s);
-    GLLog("glClearStencil") << s;
-}
-
-void API_ENTRY(glClientActiveTexture)(GLenum texture) {
-    CALL_GL_API(glClientActiveTexture, texture);
-    GLLog("glClientActiveTexture") << GLLogEnum(texture);
-}
-
-void API_ENTRY(glColor4f)(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha) {
-    CALL_GL_API(glColor4f, red, green, blue, alpha);
-    GLLog("glColor4f") << red << green << blue << alpha;
-}
-
-void API_ENTRY(glColor4x)(GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha) {
-    CALL_GL_API(glColor4x, red, green, blue, alpha);
-    GLLog("glColor4x") << GLLogFixed(red) << GLLogFixed(green) << GLLogFixed(blue) << GLLogFixed(alpha);
-}
-
-void API_ENTRY(glColorMask)(GLboolean r, GLboolean g, GLboolean b, GLboolean a) {
-    CALL_GL_API(glColorMask, r, g, b, a);
-    GLLog("glColorMask") << GLLogBool(r) << GLLogBool(g) << GLLogBool(b) << GLLogBool(a);
-}
-
-void API_ENTRY(glColorPointer)(GLint size, GLenum type, GLsizei stride, const GLvoid *ptr)
-{
-    CALL_GL_API(glColorPointer, size, type, stride, ptr);
-    GLLog("glColorPointer") << size << GLLogEnum(type) << stride << ptr;
-}
-
-void API_ENTRY(glCompressedTexImage2D)(GLenum target, GLint level, GLenum internalformat,
-                            GLsizei width, GLsizei height, GLint border,
-                            GLsizei imageSize, const GLvoid *data) {
-    CALL_GL_API(glCompressedTexImage2D, target, level, internalformat,
-            width, height, border, imageSize, data);
-    GLLog("glCompressedTexImage2D")
-                << GLLogEnum(target) << level << GLLogEnum(internalformat)
-                << width << height << border << imageSize << data;
-}
-
-void API_ENTRY(glCompressedTexSubImage2D)( GLenum target, GLint level, GLint xoffset,
-                                GLint yoffset, GLsizei width, GLsizei height,
-                                GLenum format, GLsizei imageSize,
-                                const GLvoid *data) {
-    CALL_GL_API(glCompressedTexSubImage2D, target, level, xoffset, yoffset,
-            width, height, format, imageSize, data);
-    GLLog("glCompressedTexSubImage2D")
-            << GLLogEnum(target) << level << xoffset << yoffset
-            << width << height << GLLogEnum(format) << imageSize << data;
-}
-
-void API_ENTRY(glCopyTexImage2D)(  GLenum target, GLint level, GLenum internalformat,
-                        GLint x, GLint y, GLsizei width, GLsizei height,
-                        GLint border) {
-    CALL_GL_API(glCopyTexImage2D, target, level, internalformat, x, y,
-            width, height, border);
-    GLLog("glCopyTexImage2D")
-            << GLLogEnum(target) << level << GLLogEnum(internalformat)
-            << x << y << width << height << border;
-}
-
-void API_ENTRY(glCopyTexSubImage2D)(   GLenum target, GLint level, GLint xoffset,
-                            GLint yoffset, GLint x, GLint y, GLsizei width,
-                            GLsizei height) {
-    CALL_GL_API(glCopyTexSubImage2D, target, level, xoffset, yoffset, x, y,
-            width, height);
-    GLLog("glCopyTexSubImage2D")
-            << GLLogEnum(target) << level << xoffset << yoffset
-            << x << y << width << height;
-}
-
-void API_ENTRY(glCullFace)(GLenum mode) {
-    CALL_GL_API(glCullFace, mode);
-    GLLog("glCullFace") << GLLogEnum(mode);
-}
-
-void API_ENTRY(glDeleteTextures)(GLsizei n, const GLuint *textures) {
-    CALL_GL_API(glDeleteTextures, n, textures);
-    GLLog("glDeleteTextures") << n << GLLogBuffer<GLuint>(textures, n);
-}
-
-void API_ENTRY(glDepthFunc)(GLenum func) {
-    CALL_GL_API(glDepthFunc, func);
-    GLLog("glDepthFunc") << GLLogEnum(func);
-}
-
-void API_ENTRY(glDepthMask)(GLboolean flag) {
-    CALL_GL_API(glDepthMask, flag);
-    GLLog("glDepthMask") << GLLogBool(flag);
-}
-
-void API_ENTRY(glDepthRangef)(GLclampf zNear, GLclampf zFar) {
-    CALL_GL_API(glDepthRangef, zNear, zFar);
-    GLLog("glDepthRangef") << zNear << zFar;
-}
-
-void API_ENTRY(glDepthRangex)(GLclampx zNear, GLclampx zFar) {
-    CALL_GL_API(glDepthRangex, zNear, zFar);
-    GLLog("glDepthRangex") << GLLogFixed(zNear) << GLLogFixed(zFar);
-}
-
-void API_ENTRY(glDisable)(GLenum cap) {
-    CALL_GL_API(glDisable, cap);
-    GLLog("glDisable") << GLLogEnum(cap);
-}
-
-void API_ENTRY(glDisableClientState)(GLenum array) {
-    CALL_GL_API(glDisableClientState, array);
-    GLLog("glDisableClientState") << GLLogEnum(array);
-}
-
-void API_ENTRY(glDrawArrays)(GLenum mode, GLint first, GLsizei count) {
-    CALL_GL_API(glDrawArrays, mode, first, count);
-    GLLog("glDrawArrays") << GLLogEnum(mode) << first << count;
-}
-
-void API_ENTRY(glDrawElements)(GLenum mode, GLsizei count,
-                    GLenum type, const GLvoid *indices) {
-    CALL_GL_API(glDrawElements, mode, count, type, indices);
-    GLLog log("glDrawElements");
-    log << GLLogEnum(mode) << count << GLLogEnum(type);
-    if (type == GL_UNSIGNED_BYTE) {
-        log << GLLogBuffer<GLubyte>(static_cast<const GLubyte*>(indices), count);
-    } else {
-        log << GLLogBuffer<GLushort>(static_cast<const GLushort*>(indices), count);
-    }
-    log;
-}
-
-void API_ENTRY(glEnable)(GLenum cap) {
-    CALL_GL_API(glEnable, cap);
-    GLLog("glEnable") << GLLogEnum(cap);
-}
-
-void API_ENTRY(glEnableClientState)(GLenum array) {
-    CALL_GL_API(glEnableClientState, array);
-    GLLog("glEnableClientState") << GLLogEnum(array);
-}
-
-void API_ENTRY(glFinish)(void) {
-    CALL_GL_API(glFinish);
-    GLLog("glFinish");
-}
-
-void API_ENTRY(glFlush)(void) {
-    CALL_GL_API(glFlush);
-    GLLog("glFlush");
-}
-
-void API_ENTRY(glFogf)(GLenum pname, GLfloat param) {
-    CALL_GL_API(glFogf, pname, param);
-    GLLog("glFogf") << GLLogEnum(pname) << param;
-}
-
-void API_ENTRY(glFogfv)(GLenum pname, const GLfloat *params) {
-    CALL_GL_API(glFogfv, pname, params);
-    // XXX: we need to compute the size of this buffer
-    GLLog("glFogfv") << GLLogEnum(pname) << GLLogBuffer<GLfloat>(params);
-}
-
-void API_ENTRY(glFogx)(GLenum pname, GLfixed param) {
-    CALL_GL_API(glFogx, pname, param);
-    GLLog("glFogx") << GLLogEnum(pname) << GLLogFixed(param);
-}
-
-void API_ENTRY(glFogxv)(GLenum pname, const GLfixed *params) {
-    CALL_GL_API(glFogxv, pname, params);
-    // XXX: we need to compute the size of this buffer
-    GLLog("glFogfx") << GLLogEnum(pname) << GLLogBuffer<GLfixed>(params);
-}
-
-void API_ENTRY(glFrontFace)(GLenum mode) {
-    CALL_GL_API(glFrontFace, mode);
-    GLLog("glFrontFace") << GLLogEnum(mode);
- }
-
-void API_ENTRY(glFrustumf)(GLfloat left, GLfloat right,
-                GLfloat bottom, GLfloat top,
-                GLfloat zNear, GLfloat zFar) {
-    CALL_GL_API(glFrustumf, left, right, bottom, top, zNear, zFar);
-    GLLog("glFrustumf") << left << right << bottom << top << zNear << zFar;
-}
-
-void API_ENTRY(glFrustumx)(GLfixed left, GLfixed right,
-                GLfixed bottom, GLfixed top,
-                GLfixed zNear, GLfixed zFar) {
-    CALL_GL_API(glFrustumx, left, right, bottom, top, zNear, zFar);
-    GLLog("glFrustumx")
-            << GLLogFixed(left) << GLLogFixed(right)
-            << GLLogFixed(bottom) << GLLogFixed(top)
-            << GLLogFixed(zNear) << GLLogFixed(zFar);
-}
-
-void API_ENTRY(glGenTextures)(GLsizei n, GLuint *textures) {
-    CALL_GL_API(glGenTextures, n, textures);
-    GLLog("glGenTextures") << n << GLLogBuffer<GLuint>(textures, n);
-}
-
-GLenum API_ENTRY(glGetError)(void) {
-    GLLog("glGetError");
-    CALL_GL_API_RETURN(glGetError);
-}
-
-void API_ENTRY(glGetIntegerv)(GLenum pname, GLint *params) {
-    CALL_GL_API(glGetIntegerv, pname, params);
-    // XXX: we need to compute the size of this buffer
-    GLLog("glGetIntegerv") << GLLogEnum(pname) << GLLogBuffer<GLint>(params);
-}
-
-const GLubyte * API_ENTRY(glGetString)(GLenum name) {
-    GLLog("glGetString") << GLLogEnum(name);
-    CALL_GL_API_RETURN(glGetString, name);
-}
-
-void API_ENTRY(glHint)(GLenum target, GLenum mode) {
-    CALL_GL_API(glHint, target, mode);
-    GLLog("GLenum") << GLLogEnum(target) << GLLogEnum(mode);
-}
-
-void API_ENTRY(glLightModelf)(GLenum pname, GLfloat param) {
-    CALL_GL_API(glLightModelf, pname, param);
-    GLLog("glLightModelf") << GLLogEnum(pname) << param;
-}
-
-void API_ENTRY(glLightModelfv)(GLenum pname, const GLfloat *params) {
-    CALL_GL_API(glLightModelfv, pname, params);
-    // XXX: we need to compute the size of this buffer
-    GLLog("glLightModelfv") << GLLogEnum(pname) << GLLogBuffer<GLfloat>(params);
-}
-
-void API_ENTRY(glLightModelx)(GLenum pname, GLfixed param) {
-    CALL_GL_API(glLightModelx, pname, param);
-    GLLog("glLightModelx") << GLLogEnum(pname) << GLLogFixed(param);
-}
-
-void API_ENTRY(glLightModelxv)(GLenum pname, const GLfixed *params) {
-    CALL_GL_API(glLightModelxv, pname, params);
-    // XXX: we need to compute the size of this buffer
-    GLLog("glLightModelxv") << GLLogEnum(pname) << GLLogBuffer<GLfixed>(params);
-}
-
-void API_ENTRY(glLightf)(GLenum light, GLenum pname, GLfloat param) {
-    CALL_GL_API(glLightf, light, pname, param);
-    GLLog("glLightf") << GLLogEnum(light) << GLLogEnum(pname) << param;
-}
-
-void API_ENTRY(glLightfv)(GLenum light, GLenum pname, const GLfloat *params) {
-    CALL_GL_API(glLightfv, light, pname, params);
-    // XXX: we need to compute the size of this buffer
-    GLLog("glLightfv") << GLLogEnum(light) << GLLogEnum(pname) << GLLogBuffer<GLfloat>(params);
-}
-
-void API_ENTRY(glLightx)(GLenum light, GLenum pname, GLfixed param) {
-   CALL_GL_API(glLightx, light, pname, param);
-   GLLog("glLightx") << GLLogEnum(light) << GLLogEnum(pname) << GLLogFixed(param);
-}
-
-void API_ENTRY(glLightxv)(GLenum light, GLenum pname, const GLfixed *params) {
-    CALL_GL_API(glLightxv, light, pname, params);
-    // XXX: we need to compute the size of this buffer
-    GLLog("glLightxv") << GLLogEnum(light) << GLLogEnum(pname) << GLLogBuffer<GLfixed>(params);
-}
-
-void API_ENTRY(glLineWidth)(GLfloat width) {
-    CALL_GL_API(glLineWidth, width);
-    GLLog("glLineWidth") << width;
-}
-
-void API_ENTRY(glLineWidthx)(GLfixed width) {
-    CALL_GL_API(glLineWidthx, width);
-    GLLog("glLineWidth") << GLLogFixed(width);
-}
-
-void API_ENTRY(glLoadIdentity)(void) {
-    CALL_GL_API(glLoadIdentity);
-    GLLog("glLoadIdentity");
-}
-
-void API_ENTRY(glLoadMatrixf)(const GLfloat *m) {
-    CALL_GL_API(glLoadMatrixf, m);
-    GLLog("glLoadMatrixf") << GLLogBuffer<GLfloat>(m, 16);
-}
-
-void API_ENTRY(glLoadMatrixx)(const GLfixed *m) {
-    CALL_GL_API(glLoadMatrixx, m);
-    GLLog("glLoadMatrixx") << GLLogBuffer<GLfixed>(m, 16);
-}
-
-void API_ENTRY(glLogicOp)(GLenum opcode) {
-    CALL_GL_API(glLogicOp, opcode);
-    GLLog("glLogicOp") << GLLogEnum(opcode);
-}
-
-void API_ENTRY(glMaterialf)(GLenum face, GLenum pname, GLfloat param) {
-    CALL_GL_API(glMaterialf, face, pname, param);
-    GLLog("glMaterialf") << GLLogEnum(face) << GLLogEnum(pname) << param;
-}
-
-void API_ENTRY(glMaterialfv)(GLenum face, GLenum pname, const GLfloat *params) {
-    CALL_GL_API(glMaterialfv, face, pname, params);
-    // XXX: we need to compute the size of this buffer
-    GLLog("glMaterialfv") << GLLogEnum(face) << GLLogEnum(pname) << GLLogBuffer<GLfloat>(params);
-}
-
-void API_ENTRY(glMaterialx)(GLenum face, GLenum pname, GLfixed param) {
-    CALL_GL_API(glMaterialx, face, pname, param);
-    GLLog("glMaterialx") << GLLogEnum(face) << GLLogEnum(pname) << GLLogFixed(param);
-}
-
-void API_ENTRY(glMaterialxv)(GLenum face, GLenum pname, const GLfixed *params) {
-    CALL_GL_API(glMaterialxv, face, pname, params);
-    // XXX: we need to compute the size of this buffer
-    GLLog("glMaterialxv") << GLLogEnum(face) << GLLogEnum(pname) << GLLogBuffer<GLfixed>(params);
-}
-
-void API_ENTRY(glMatrixMode)(GLenum mode) {
-    CALL_GL_API(glMatrixMode, mode);
-    GLLog("glMatrixMode") << GLLogEnum(mode);
-}
-
-void API_ENTRY(glMultMatrixf)(const GLfloat *m) {
-    CALL_GL_API(glMultMatrixf, m);
-    GLLog("glMultMatrixf") << GLLogBuffer<GLfloat>(m, 16);
-}
-
-void API_ENTRY(glMultMatrixx)(const GLfixed *m) {
-    CALL_GL_API(glMultMatrixx, m);
-    GLLog("glMultMatrixx") << GLLogBuffer<GLfixed>(m, 16);
-}
-
-void API_ENTRY(glMultiTexCoord4f)(GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q) {
-    CALL_GL_API(glMultiTexCoord4f, target, s, t, r, q);
-    GLLog("glMultiTexCoord4f") << GLLogEnum(target) << s << t << r << q;
-}
-
-void API_ENTRY(glMultiTexCoord4x)(GLenum target, GLfixed s, GLfixed t, GLfixed r, GLfixed q) {
-    CALL_GL_API(glMultiTexCoord4x, target, s, t, r, q);
-    GLLog("glMultiTexCoord4x") << GLLogEnum(target)
-        << GLLogFixed(s) << GLLogFixed(t) << GLLogFixed(r) << GLLogFixed(q);
-}
-
-void API_ENTRY(glNormal3f)(GLfloat nx, GLfloat ny, GLfloat nz) {
-    CALL_GL_API(glNormal3f, nx, ny, nz);
-    GLLog("glNormal3f") << nx << ny << nz;
-}
-
-void API_ENTRY(glNormal3x)(GLfixed nx, GLfixed ny, GLfixed nz) {
-    CALL_GL_API(glNormal3x, nx, ny, nz);
-    GLLog("glNormal3x") << GLLogFixed(nx) << GLLogFixed(ny) << GLLogFixed(nz);
-}
-
-void API_ENTRY(glNormalPointer)(GLenum type, GLsizei stride, const GLvoid *pointer) {
-    CALL_GL_API(glNormalPointer, type, stride, pointer);
-    GLLog("glNormalPointer") << GLLogEnum(type) << stride << pointer;
-}
-
-void API_ENTRY(glOrthof)(  GLfloat left, GLfloat right,
-                GLfloat bottom, GLfloat top,
-                GLfloat zNear, GLfloat zFar) {
-    CALL_GL_API(glOrthof, left, right, bottom, top, zNear, zFar);
-    GLLog("glOrthof") << left << right << bottom << top << zNear << zFar;
-}
-
-void API_ENTRY(glOrthox)(  GLfixed left, GLfixed right,
-                GLfixed bottom, GLfixed top,
-                GLfixed zNear, GLfixed zFar) {
-    CALL_GL_API(glOrthox, left, right, bottom, top, zNear, zFar);
-    GLLog("glOrthox") << GLLogFixed(left) << GLLogFixed(right)
-            << GLLogFixed(bottom) << GLLogFixed(top)
-            << GLLogFixed(zNear) << GLLogFixed(zFar);
-}
-
-void API_ENTRY(glPixelStorei)(GLenum pname, GLint param) {
-    CALL_GL_API(glPixelStorei, pname, param);
-    GLLog("glPixelStorei") << GLLogEnum(pname) << param;
-}
-
-void API_ENTRY(glPointSize)(GLfloat size) {
-    CALL_GL_API(glPointSize, size);
-    GLLog("glPointSize") << size;
-}
-
-void API_ENTRY(glPointSizex)(GLfixed size) {
-    CALL_GL_API(glPointSizex, size);
-    GLLog("glPointSizex") << GLLogFixed(size);
-}
-
-void API_ENTRY(glPolygonOffset)(GLfloat factor, GLfloat units) {
-    CALL_GL_API(glPolygonOffset, factor, units);
-    GLLog("glPolygonOffset") << factor << units;
-}
-
-void API_ENTRY(glPolygonOffsetx)(GLfixed factor, GLfixed units) {
-    CALL_GL_API(glPolygonOffsetx, factor, units);
-    GLLog("glPolygonOffsetx") << GLLogFixed(factor) << GLLogFixed(units);
-}
-
-void API_ENTRY(glPopMatrix)(void) {
-    CALL_GL_API(glPopMatrix);
-    GLLog("glPopMatrix");
-}
-
-void API_ENTRY(glPushMatrix)(void) {
-    CALL_GL_API(glPushMatrix);
-    GLLog("glPushMatrix");
-}
-
-void API_ENTRY(glReadPixels)(  GLint x, GLint y, GLsizei width, GLsizei height,
-                    GLenum format, GLenum type, GLvoid *pixels) {
-    CALL_GL_API(glReadPixels, x, y, width, height, format, type, pixels);
-    // XXX: we need to compute the size of this buffer
-    GLLog("glReadPixels") << x << y << width << height << GLLogEnum(format) << GLLogEnum(type)
-            << GLLogBuffer<unsigned char>(static_cast<unsigned char *>(pixels));
-}
-
-void API_ENTRY(glRotatef)(GLfloat angle, GLfloat x, GLfloat y, GLfloat z) {
-    CALL_GL_API(glRotatef, angle, x, y, z);
-    GLLog("glRotatef") << angle << x << y << z;
-}
-
-void API_ENTRY(glRotatex)(GLfixed angle, GLfixed x, GLfixed y, GLfixed z) {
-    CALL_GL_API(glRotatex, angle, x, y, z);
-    GLLog("glRotatex") << GLLogFixed(angle) << GLLogFixed(x) << GLLogFixed(y) << GLLogFixed(z);
-}
-
-void API_ENTRY(glSampleCoverage)(GLclampf value, GLboolean invert) {
-    CALL_GL_API(glSampleCoverage, value, invert);
-    GLLog("glSampleCoverage") << value << GLLogBool(invert);
-}
-
-void API_ENTRY(glSampleCoveragex)(GLclampx value, GLboolean invert) {
-    CALL_GL_API(glSampleCoveragex, value, invert);
-    GLLog("glSampleCoveragex") << GLLogFixed(value) << GLLogBool(invert);
-}
-
-void API_ENTRY(glScalef)(GLfloat x, GLfloat y, GLfloat z) {
-    CALL_GL_API(glScalef, x, y, z);
-    GLLog("glScalef") << x << y << z;
-}
-
-void API_ENTRY(glScalex)(GLfixed x, GLfixed y, GLfixed z) {
-    CALL_GL_API(glScalex, x, y, z);
-    GLLog("glScalex") << GLLogFixed(x) << GLLogFixed(y) << GLLogFixed(z);
-}
-
-void API_ENTRY(glScissor)(GLint x, GLint y, GLsizei width, GLsizei height) {
-    CALL_GL_API(glScissor, x, y, width, height);
-    GLLog("glScissor") << x << y << width << height;
-}
-
-void API_ENTRY(glShadeModel)(GLenum mode) {
-    CALL_GL_API(glShadeModel, mode);
-    GLLog("glShadeModel") << GLLogEnum(mode);
-}
-
-void API_ENTRY(glStencilFunc)(GLenum func, GLint ref, GLuint mask) {
-    CALL_GL_API(glStencilFunc, func, ref, mask);
-    GLLog("glStencilFunc") << GLLogEnum(func) << ref << mask;
-}
-
-void API_ENTRY(glStencilMask)(GLuint mask) {
-    CALL_GL_API(glStencilMask, mask);
-    GLLog("glStencilMask") << mask;
-}
-
-void API_ENTRY(glStencilOp)(GLenum fail, GLenum zfail, GLenum zpass) {
-    CALL_GL_API(glStencilOp, fail, zfail, zpass);
-    GLLog("glStencilOp") << GLLogEnum(fail) << GLLogEnum(zfail) << GLLogEnum(zpass);
-}
-
-void API_ENTRY(glTexCoordPointer)( GLint size, GLenum type,
-                        GLsizei stride, const GLvoid *pointer) {
-    CALL_GL_API(glTexCoordPointer, size, type, stride, pointer);
-    GLLog("glTexCoordPointer") << size << GLLogEnum(type) << stride << pointer;
-}
-
-void API_ENTRY(glTexEnvf)(GLenum target, GLenum pname, GLfloat param) {
-    CALL_GL_API(glTexEnvf, target, pname, param);
-    GLLog("glTexEnvf") << GLLogEnum(target) << GLLogEnum(pname) << param;
-}
-
-void API_ENTRY(glTexEnvfv)(GLenum target, GLenum pname, const GLfloat *params) {
-    CALL_GL_API(glTexEnvfv, target, pname, params);
-    // XXX: we need to compute the size of this buffer
-    GLLog("glTexEnvx") << GLLogEnum(target) << GLLogEnum(pname) << GLLogBuffer<GLfloat>(params);
-}
-
-void API_ENTRY(glTexEnvx)(GLenum target, GLenum pname, GLfixed param) {
-    CALL_GL_API(glTexEnvx, target, pname, param);
-    GLLog("glTexEnvx") << GLLogEnum(target) << GLLogEnum(pname) << GLLogFixed(param);
-}
-
-void API_ENTRY(glTexEnvxv)(GLenum target, GLenum pname, const GLfixed *params) {
-    CALL_GL_API(glTexEnvxv, target, pname, params);
-    // XXX: we need to compute the size of this buffer
-    GLLog("glTexEnvxv") << GLLogEnum(target) << GLLogEnum(pname) << GLLogBuffer<GLfixed>(params);
-}
-
-void API_ENTRY(glTexImage2D)(  GLenum target, GLint level, GLint internalformat,
-                    GLsizei width, GLsizei height, GLint border, GLenum format,
-                    GLenum type, const GLvoid *pixels) {
-    CALL_GL_API(glTexImage2D, target, level, internalformat, width, height,
-            border, format, type, pixels);
-    GLLog("glTexImage2D") << GLLogEnum(target) << level << GLLogEnum(internalformat)
-            << width << height << border << GLLogEnum(format) << GLLogEnum(type)
-            << GLLogBuffer<unsigned char>( static_cast<const unsigned char *>(pixels));
-}
-
-void API_ENTRY(glTexParameterf)(GLenum target, GLenum pname, GLfloat param) {
-    CALL_GL_API(glTexParameterf, target, pname, param);
-    GLLog("glTexParameterf") << GLLogEnum(target) << GLLogEnum(pname) << param;
-}
-
-void API_ENTRY(glTexParameterx)(GLenum target, GLenum pname, GLfixed param) {
-    CALL_GL_API(glTexParameterx, target, pname, param);
-    GLLog("glTexParameterx") << GLLogEnum(target) << GLLogEnum(pname) << GLLogFixed(param);
-}
-
-void API_ENTRY(glTexSubImage2D)(   GLenum target, GLint level, GLint xoffset,
-                        GLint yoffset, GLsizei width, GLsizei height,
-                        GLenum format, GLenum type, const GLvoid *pixels) {
-    CALL_GL_API(glTexSubImage2D, target, level, xoffset, yoffset,
-            width, height, format, type, pixels);
-    GLLog("glTexSubImage2D") << GLLogEnum(target) << level << xoffset << yoffset
-            << width << height << GLLogEnum(format) << GLLogEnum(type)
-            << GLLogBuffer<unsigned char>( static_cast<const unsigned char *>(pixels));
-}
-
-void API_ENTRY(glTranslatef)(GLfloat x, GLfloat y, GLfloat z) {
-    CALL_GL_API(glTranslatef, x, y, z);
-    GLLog("glTranslatef") << x << y << z;
-}
-
-void API_ENTRY(glTranslatex)(GLfixed x, GLfixed y, GLfixed z) {
-    CALL_GL_API(glTranslatex, x, y, z);
-    GLLog("glTranslatex") << GLLogFixed(x) << GLLogFixed(y) << GLLogFixed(z);
-}
-
-void API_ENTRY(glVertexPointer)(   GLint size, GLenum type,
-                        GLsizei stride, const GLvoid *pointer) {
-    CALL_GL_API(glVertexPointer, size, type, stride, pointer);
-    GLLog("glVertexPointer") << size << GLLogEnum(type) << stride << pointer;
-}
-
-void API_ENTRY(glViewport)(GLint x, GLint y, GLsizei width, GLsizei height) {
-    CALL_GL_API(glViewport, x, y, width, height);
-    GLLog("glViewport") << x << y << width << height;
-}
-
-// ES 1.1
-void API_ENTRY(glClipPlanef)(GLenum plane, const GLfloat *equation) {
-    CALL_GL_API(glClipPlanef, plane, equation);
-    GLLog("glClipPlanef") << GLLogEnum(plane) << GLLogBuffer<GLfloat>(equation, 4);
-}
-void API_ENTRY(glClipPlanex)(GLenum plane, const GLfixed *equation) {
-    CALL_GL_API(glClipPlanex, plane, equation);
-    GLLog("glClipPlanex") << GLLogEnum(plane) << GLLogBuffer<GLfixed>(equation, 4);
-}
-void API_ENTRY(glBindBuffer)(GLenum target, GLuint buffer) {
-    CALL_GL_API(glBindBuffer, target, buffer);
-    GLLog("glBindBuffer") << GLLogEnum(target) << buffer;
-}
-void API_ENTRY(glBufferData)(GLenum target, GLsizeiptr size, const GLvoid* data, GLenum usage) {
-    CALL_GL_API(glBufferData, target, size, data, usage);
-    GLLog("glBufferData") << GLLogEnum(target) << size
-        << GLLogBuffer<unsigned char>(static_cast<const unsigned char*>(data), size);
-}
-void API_ENTRY(glBufferSubData)(GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid* data) {
-    CALL_GL_API(glBufferSubData, target, offset, size, data);
-    GLLog("glBufferSubData") << GLLogEnum(target) << offset << size
-        << GLLogBuffer<unsigned char>(static_cast<const unsigned char*>(data), size);
-}
-void API_ENTRY(glDeleteBuffers)(GLsizei n, const GLuint* buffers) {
-    CALL_GL_API(glDeleteBuffers, n, buffers);
-    GLLog("glDeleteBuffers") << n << GLLogBuffer<GLuint>(buffers, n);
-}
-void API_ENTRY(glGenBuffers)(GLsizei n, GLuint* buffers) {
-    CALL_GL_API(glGenBuffers, n, buffers);
-    GLLog("glGenBuffers") << n << GLLogBuffer<GLuint>(buffers, n);
-}
-void API_ENTRY(glGetBooleanv)(GLenum pname, GLboolean *params) {
-    CALL_GL_API(glGetBooleanv, pname, params);
-    // XXX: we need to compute the size of this buffer
-    GLLog("glGetBooleanv") << GLLogEnum(pname) << GLLogBuffer<GLboolean>(params);
-}
-void API_ENTRY(glGetFixedv)(GLenum pname, GLfixed *params) {
-    CALL_GL_API(glGetFixedv, pname, params);
-    // XXX: we need to compute the size of this buffer
-    GLLog("glGetFixedv") << GLLogEnum(pname) << GLLogBuffer<GLfixed>(params);
-}
-void API_ENTRY(glGetFloatv)(GLenum pname, GLfloat *params) {
-    CALL_GL_API(glGetFloatv, pname, params);
-    // XXX: we need to compute the size of this buffer
-    GLLog("glGetFloatv") << GLLogEnum(pname) << GLLogBuffer<GLfloat>(params);
-}
-void API_ENTRY(glGetPointerv)(GLenum pname, void **params) {
-    CALL_GL_API(glGetPointerv, pname, params);
-    // XXX: we need to compute the size of this buffer
-    GLLog("glGetPointerv") << GLLogEnum(pname) << GLLogBuffer<void*>(params);
-}
-void API_ENTRY(glGetBufferParameteriv)(GLenum target, GLenum pname, GLint *params) {
-    // XXX: we need to compute the size of this buffer
-    CALL_GL_API(glGetBufferParameteriv, target, pname, params);
-    GLLog("glGetBufferParameteriv") << GLLogEnum(target) << GLLogEnum(pname) << GLLogBuffer<GLint>(params);
-}
-void API_ENTRY(glGetClipPlanef)(GLenum pname, GLfloat eqn[4]) {
-    CALL_GL_API(glGetClipPlanef, pname, eqn);
-    GLLog("glGetClipPlanef") << GLLogEnum(pname) << GLLogBuffer<GLfloat>(eqn, 4);
-}
-void API_ENTRY(glGetClipPlanex)(GLenum pname, GLfixed eqn[4]) {
-    CALL_GL_API(glGetClipPlanex, pname, eqn);
-    GLLog("glGetClipPlanex") << GLLogEnum(pname) << GLLogBuffer<GLfixed>(eqn, 4);
-}
-void API_ENTRY(glGetLightxv)(GLenum light, GLenum pname, GLfixed *params) {
-    CALL_GL_API(glGetLightxv, light, pname, params);
-    // XXX: we need to compute the size of this buffer
-    GLLog("glGetLightxv") << GLLogEnum(light) << GLLogEnum(pname) << GLLogBuffer<GLfixed>(params);
-}
-void API_ENTRY(glGetLightfv)(GLenum light, GLenum pname, GLfloat *params) {
-    CALL_GL_API(glGetLightfv, light, pname, params);
-    // XXX: we need to compute the size of this buffer
-    GLLog("glGetLightfv") << GLLogEnum(light) << GLLogEnum(pname) << GLLogBuffer<GLfloat>(params);
-}
-void API_ENTRY(glGetMaterialxv)(GLenum face, GLenum pname, GLfixed *params) {
-    CALL_GL_API(glGetMaterialxv, face, pname, params);
-    // XXX: we need to compute the size of this buffer
-    GLLog("glGetMaterialxv") << GLLogEnum(face) << GLLogEnum(pname) << GLLogBuffer<GLfixed>(params);
-}
-void API_ENTRY(glGetMaterialfv)(GLenum face, GLenum pname, GLfloat *params) {
-    CALL_GL_API(glGetMaterialfv, face, pname, params);
-    // XXX: we need to compute the size of this buffer
-    GLLog("glGetMaterialfv") << GLLogEnum(face) << GLLogEnum(pname) << GLLogBuffer<GLfloat>(params);
-}
-void API_ENTRY(glGetTexEnvfv)(GLenum env, GLenum pname, GLfloat *params) {
-    CALL_GL_API(glGetTexEnvfv, env, pname, params);
-    // XXX: we need to compute the size of this buffer
-    GLLog("glGetTexEnvfv") << GLLogEnum(env) << GLLogEnum(pname) << GLLogBuffer<GLfloat>(params);
-}
-void API_ENTRY(glGetTexEnviv)(GLenum env, GLenum pname, GLint *params) {
-    CALL_GL_API(glGetTexEnviv, env, pname, params);
-    // XXX: we need to compute the size of this buffer
-    GLLog("glGetTexEnviv") << GLLogEnum(env) << GLLogEnum(pname) << GLLogBuffer<GLint>(params);
-}
-void API_ENTRY(glGetTexEnvxv)(GLenum env, GLenum pname, GLfixed *params) {
-    CALL_GL_API(glGetTexEnvxv, env, pname, params);
-    // XXX: we need to compute the size of this buffer
-    GLLog("glGetTexEnvxv") << GLLogEnum(env) << GLLogEnum(pname) << GLLogBuffer<GLfixed>(params);
-}
-void API_ENTRY(glGetTexParameterfv)(GLenum target, GLenum pname, GLfloat *params) {
-    CALL_GL_API(glGetTexParameterfv, target, pname, params);
-    // XXX: we need to compute the size of this buffer
-    GLLog("glGetTexParameterfv") << GLLogEnum(target) << GLLogEnum(pname) << GLLogBuffer<GLfloat>(params);
-}
-void API_ENTRY(glGetTexParameteriv)(GLenum target, GLenum pname, GLint *params) {
-    CALL_GL_API(glGetTexParameteriv, target, pname, params);
-    // XXX: we need to compute the size of this buffer
-    GLLog("glGetTexParameteriv") << GLLogEnum(target) << GLLogEnum(pname) << GLLogBuffer<GLint>(params);
-}
-void API_ENTRY(glGetTexParameterxv)(GLenum target, GLenum pname, GLfixed *params) {
-    CALL_GL_API(glGetTexParameterxv, target, pname, params);
-    // XXX: we need to compute the size of this buffer
-    GLLog("glGetTexParameterxv") << GLLogEnum(target) << GLLogEnum(pname) << GLLogBuffer<GLfixed>(params);
-}
-GLboolean API_ENTRY(glIsBuffer)(GLuint buffer) {
-    GLLog("glIsBuffer") << buffer;
-    CALL_GL_API_RETURN(glIsBuffer, buffer);
-}
-GLboolean API_ENTRY(glIsEnabled)(GLenum cap) {
-    GLLog("glIsEnabled") << GLLogEnum(cap);
-    CALL_GL_API_RETURN(glIsEnabled, cap);
-}
-GLboolean API_ENTRY(glIsTexture)(GLuint texture) {
-    GLLog("glIsTexture") << texture;
-    CALL_GL_API_RETURN(glIsTexture, texture);
-}
-void API_ENTRY(glPointParameterf)(GLenum pname, GLfloat param) {
-    CALL_GL_API(glPointParameterf, pname, param);
-    GLLog("glPointParameterf") << GLLogEnum(pname) << param;
-}
-void API_ENTRY(glPointParameterfv)(GLenum pname, const GLfloat *params) {
-    CALL_GL_API(glPointParameterfv, pname, params);
-    // XXX: we need to compute the size of this buffer
-    GLLog("glPointParameterfv") << GLLogEnum(pname) << GLLogBuffer<GLfloat>(params);
-}
-void API_ENTRY(glPointParameterx)(GLenum pname, GLfixed param) {
-    CALL_GL_API(glPointParameterx, pname, param);
-    GLLog("glPointParameterx") << GLLogEnum(pname) << GLLogFixed(param);
-}
-void API_ENTRY(glPointParameterxv)(GLenum pname, const GLfixed *params) {
-    CALL_GL_API(glPointParameterxv, pname, params);
-    // XXX: we need to compute the size of this buffer
-    GLLog("glPointParameterxv") << GLLogEnum(pname) << GLLogBuffer<GLfixed>(params);
-}
-void API_ENTRY(glColor4ub)(GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha) {
-    CALL_GL_API(glColor4ub, red, green, blue, alpha);
-    GLLog("glColor4ub") << red << green << blue << alpha;
-}
-void API_ENTRY(glTexEnvi)(GLenum target, GLenum pname, GLint param) {
-    CALL_GL_API(glTexEnvi, target, pname, param);
-    GLLog("glTexEnvi") << GLLogEnum(target) << GLLogEnum(pname) << param;
-}
-void API_ENTRY(glTexEnviv)(GLenum target, GLenum pname, const GLint *params) {
-    CALL_GL_API(glTexEnviv, target, pname, params);
-    // XXX: we need to compute the size of this buffer
-    GLLog("glTexEnviv") << GLLogEnum(target) << GLLogEnum(pname) << GLLogBuffer<GLint>(params);
-}
-
-void API_ENTRY(glTexParameterfv)(GLenum target, GLenum pname, const GLfloat *params) {
-    CALL_GL_API(glTexParameterfv, target, pname, params);
-    // XXX: we need to compute the size of this buffer
-    GLLog("glTexParameterfv") << GLLogEnum(target) << GLLogEnum(pname) << GLLogBuffer<GLfloat>(params);
-}
-
-void API_ENTRY(glTexParameteriv)(GLenum target, GLenum pname, const GLint *params) {
-    CALL_GL_API(glTexParameteriv, target, pname, params);
-    // XXX: we need to compute the size of this buffer
-    GLLog("glTexParameteriv") << GLLogEnum(target) << GLLogEnum(pname) << GLLogBuffer<GLint>(params);
-}
-
-void API_ENTRY(glTexParameteri)(GLenum target, GLenum pname, GLint param) {
-    CALL_GL_API(glTexParameteri, target, pname, param);
-    GLLog("glTexParameteri") << GLLogEnum(target) << GLLogEnum(pname) << param;
-}
-void API_ENTRY(glTexParameterxv)(GLenum target, GLenum pname, const GLfixed *params) {
-    CALL_GL_API(glTexParameterxv, target, pname, params);
-    // XXX: we need to compute the size of this buffer
-    GLLog("glTexParameterxv") << GLLogEnum(target) << GLLogEnum(pname) << GLLogBuffer<GLfixed>(params);
-}
-void API_ENTRY(glPointSizePointerOES)(GLenum type, GLsizei stride, const GLvoid *pointer) {
-    CALL_GL_API(glPointSizePointerOES, type, stride, pointer);
-    GLLog("glPointSizePointerOES") << GLLogEnum(type) << stride << pointer;
-}
-
-// Extensions
-void API_ENTRY(glDrawTexsOES)(GLshort x , GLshort y, GLshort z, GLshort w, GLshort h) {
-    CALL_GL_API(glDrawTexsOES, x, y, z, w, h);
-    GLLog("glDrawTexsOES") << x << y << z << w << h;
-}
-void API_ENTRY(glDrawTexiOES)(GLint x, GLint y, GLint z, GLint w, GLint h) {
-    CALL_GL_API(glDrawTexiOES, x, y, z, w, h);
-    GLLog("glDrawTexiOES") << x << y << z << w << h;
-}
-void API_ENTRY(glDrawTexfOES)(GLfloat x, GLfloat y, GLfloat z, GLfloat w, GLfloat h) {
-    CALL_GL_API(glDrawTexfOES, x, y, z, w, h);
-    GLLog("glDrawTexfOES") << x << y << z << w << h;
-}
-void API_ENTRY(glDrawTexxOES)(GLfixed x, GLfixed y, GLfixed z, GLfixed w, GLfixed h) {
-    CALL_GL_API(glDrawTexxOES, x, y, z, w, h);
-    GLLog("glDrawTexfOES") << GLLogFixed(x) << GLLogFixed(y) << GLLogFixed(z) << GLLogFixed(w) << GLLogFixed(h);
-}
-void API_ENTRY(glDrawTexsvOES)(const GLshort* coords) {
-    CALL_GL_API(glDrawTexsvOES, coords);
-    GLLog("glDrawTexsvOES") << GLLogBuffer<GLshort>(coords, 5);
-}
-void API_ENTRY(glDrawTexivOES)(const GLint* coords) {
-    CALL_GL_API(glDrawTexivOES, coords);
-    GLLog("glDrawTexivOES") << GLLogBuffer<GLint>(coords, 5);
-}
-void API_ENTRY(glDrawTexfvOES)(const GLfloat* coords) {
-    CALL_GL_API(glDrawTexfvOES, coords);
-    GLLog("glDrawTexfvOES") << GLLogBuffer<GLfloat>(coords, 5);
-}
-void API_ENTRY(glDrawTexxvOES)(const GLfixed* coords) {
-    CALL_GL_API(glDrawTexxvOES, coords);
-    GLLog("glDrawTexxvOES") << GLLogBuffer<GLfixed>(coords, 5);
-}
-GLbitfield API_ENTRY(glQueryMatrixxOES)(GLfixed* mantissa, GLint* exponent) {
-    GLLog("glQueryMatrixxOES") << GLLogBuffer<GLfixed>(mantissa, 16) << GLLogBuffer<GLfixed>(exponent, 16);
-    CALL_GL_API_RETURN(glQueryMatrixxOES, mantissa, exponent);
-}
-
-// ----------------------------------------------------------------------------
-}; // namespace android
-// ----------------------------------------------------------------------------
diff --git a/opengl/libs/GLES_CM/glext_api.in b/opengl/libs/GLES_CM/glext_api.in
new file mode 100644
index 0000000..2c8648e
--- /dev/null
+++ b/opengl/libs/GLES_CM/glext_api.in
@@ -0,0 +1,270 @@
+void API_ENTRY(glBlendEquationSeparateOES)(GLenum modeRGB, GLenum modeAlpha) {
+    CALL_GL_API(glBlendEquationSeparateOES, modeRGB, modeAlpha);
+}
+void API_ENTRY(glBlendFuncSeparateOES)(GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha) {
+    CALL_GL_API(glBlendFuncSeparateOES, srcRGB, dstRGB, srcAlpha, dstAlpha);
+}
+void API_ENTRY(glBlendEquationOES)(GLenum mode) {
+    CALL_GL_API(glBlendEquationOES, mode);
+}
+void API_ENTRY(glDrawTexsOES)(GLshort x, GLshort y, GLshort z, GLshort width, GLshort height) {
+    CALL_GL_API(glDrawTexsOES, x, y, z, width, height);
+}
+void API_ENTRY(glDrawTexiOES)(GLint x, GLint y, GLint z, GLint width, GLint height) {
+    CALL_GL_API(glDrawTexiOES, x, y, z, width, height);
+}
+void API_ENTRY(glDrawTexxOES)(GLfixed x, GLfixed y, GLfixed z, GLfixed width, GLfixed height) {
+    CALL_GL_API(glDrawTexxOES, x, y, z, width, height);
+}
+void API_ENTRY(glDrawTexsvOES)(const GLshort *coords) {
+    CALL_GL_API(glDrawTexsvOES, coords);
+}
+void API_ENTRY(glDrawTexivOES)(const GLint *coords) {
+    CALL_GL_API(glDrawTexivOES, coords);
+}
+void API_ENTRY(glDrawTexxvOES)(const GLfixed *coords) {
+    CALL_GL_API(glDrawTexxvOES, coords);
+}
+void API_ENTRY(glDrawTexfOES)(GLfloat x, GLfloat y, GLfloat z, GLfloat width, GLfloat height) {
+    CALL_GL_API(glDrawTexfOES, x, y, z, width, height);
+}
+void API_ENTRY(glDrawTexfvOES)(const GLfloat *coords) {
+    CALL_GL_API(glDrawTexfvOES, coords);
+}
+void API_ENTRY(__glEGLImageTargetTexture2DOES)(GLenum target, GLeglImageOES image) {
+    CALL_GL_API(glEGLImageTargetTexture2DOES, target, image);
+}
+void API_ENTRY(__glEGLImageTargetRenderbufferStorageOES)(GLenum target, GLeglImageOES image) {
+    CALL_GL_API(glEGLImageTargetRenderbufferStorageOES, target, image);
+}
+void API_ENTRY(glAlphaFuncxOES)(GLenum func, GLclampx ref) {
+    CALL_GL_API(glAlphaFuncxOES, func, ref);
+}
+void API_ENTRY(glClearColorxOES)(GLclampx red, GLclampx green, GLclampx blue, GLclampx alpha) {
+    CALL_GL_API(glClearColorxOES, red, green, blue, alpha);
+}
+void API_ENTRY(glClearDepthxOES)(GLclampx depth) {
+    CALL_GL_API(glClearDepthxOES, depth);
+}
+void API_ENTRY(glClipPlanexOES)(GLenum plane, const GLfixed *equation) {
+    CALL_GL_API(glClipPlanexOES, plane, equation);
+}
+void API_ENTRY(glColor4xOES)(GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha) {
+    CALL_GL_API(glColor4xOES, red, green, blue, alpha);
+}
+void API_ENTRY(glDepthRangexOES)(GLclampx zNear, GLclampx zFar) {
+    CALL_GL_API(glDepthRangexOES, zNear, zFar);
+}
+void API_ENTRY(glFogxOES)(GLenum pname, GLfixed param) {
+    CALL_GL_API(glFogxOES, pname, param);
+}
+void API_ENTRY(glFogxvOES)(GLenum pname, const GLfixed *params) {
+    CALL_GL_API(glFogxvOES, pname, params);
+}
+void API_ENTRY(glFrustumxOES)(GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar) {
+    CALL_GL_API(glFrustumxOES, left, right, bottom, top, zNear, zFar);
+}
+void API_ENTRY(glGetClipPlanexOES)(GLenum pname, GLfixed eqn[4]) {
+    CALL_GL_API(glGetClipPlanexOES, pname, eqn);
+}
+void API_ENTRY(glGetFixedvOES)(GLenum pname, GLfixed *params) {
+    CALL_GL_API(glGetFixedvOES, pname, params);
+}
+void API_ENTRY(glGetLightxvOES)(GLenum light, GLenum pname, GLfixed *params) {
+    CALL_GL_API(glGetLightxvOES, light, pname, params);
+}
+void API_ENTRY(glGetMaterialxvOES)(GLenum face, GLenum pname, GLfixed *params) {
+    CALL_GL_API(glGetMaterialxvOES, face, pname, params);
+}
+void API_ENTRY(glGetTexEnvxvOES)(GLenum env, GLenum pname, GLfixed *params) {
+    CALL_GL_API(glGetTexEnvxvOES, env, pname, params);
+}
+void API_ENTRY(glGetTexParameterxvOES)(GLenum target, GLenum pname, GLfixed *params) {
+    CALL_GL_API(glGetTexParameterxvOES, target, pname, params);
+}
+void API_ENTRY(glLightModelxOES)(GLenum pname, GLfixed param) {
+    CALL_GL_API(glLightModelxOES, pname, param);
+}
+void API_ENTRY(glLightModelxvOES)(GLenum pname, const GLfixed *params) {
+    CALL_GL_API(glLightModelxvOES, pname, params);
+}
+void API_ENTRY(glLightxOES)(GLenum light, GLenum pname, GLfixed param) {
+    CALL_GL_API(glLightxOES, light, pname, param);
+}
+void API_ENTRY(glLightxvOES)(GLenum light, GLenum pname, const GLfixed *params) {
+    CALL_GL_API(glLightxvOES, light, pname, params);
+}
+void API_ENTRY(glLineWidthxOES)(GLfixed width) {
+    CALL_GL_API(glLineWidthxOES, width);
+}
+void API_ENTRY(glLoadMatrixxOES)(const GLfixed *m) {
+    CALL_GL_API(glLoadMatrixxOES, m);
+}
+void API_ENTRY(glMaterialxOES)(GLenum face, GLenum pname, GLfixed param) {
+    CALL_GL_API(glMaterialxOES, face, pname, param);
+}
+void API_ENTRY(glMaterialxvOES)(GLenum face, GLenum pname, const GLfixed *params) {
+    CALL_GL_API(glMaterialxvOES, face, pname, params);
+}
+void API_ENTRY(glMultMatrixxOES)(const GLfixed *m) {
+    CALL_GL_API(glMultMatrixxOES, m);
+}
+void API_ENTRY(glMultiTexCoord4xOES)(GLenum target, GLfixed s, GLfixed t, GLfixed r, GLfixed q) {
+    CALL_GL_API(glMultiTexCoord4xOES, target, s, t, r, q);
+}
+void API_ENTRY(glNormal3xOES)(GLfixed nx, GLfixed ny, GLfixed nz) {
+    CALL_GL_API(glNormal3xOES, nx, ny, nz);
+}
+void API_ENTRY(glOrthoxOES)(GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar) {
+    CALL_GL_API(glOrthoxOES, left, right, bottom, top, zNear, zFar);
+}
+void API_ENTRY(glPointParameterxOES)(GLenum pname, GLfixed param) {
+    CALL_GL_API(glPointParameterxOES, pname, param);
+}
+void API_ENTRY(glPointParameterxvOES)(GLenum pname, const GLfixed *params) {
+    CALL_GL_API(glPointParameterxvOES, pname, params);
+}
+void API_ENTRY(glPointSizexOES)(GLfixed size) {
+    CALL_GL_API(glPointSizexOES, size);
+}
+void API_ENTRY(glPolygonOffsetxOES)(GLfixed factor, GLfixed units) {
+    CALL_GL_API(glPolygonOffsetxOES, factor, units);
+}
+void API_ENTRY(glRotatexOES)(GLfixed angle, GLfixed x, GLfixed y, GLfixed z) {
+    CALL_GL_API(glRotatexOES, angle, x, y, z);
+}
+void API_ENTRY(glSampleCoveragexOES)(GLclampx value, GLboolean invert) {
+    CALL_GL_API(glSampleCoveragexOES, value, invert);
+}
+void API_ENTRY(glScalexOES)(GLfixed x, GLfixed y, GLfixed z) {
+    CALL_GL_API(glScalexOES, x, y, z);
+}
+void API_ENTRY(glTexEnvxOES)(GLenum target, GLenum pname, GLfixed param) {
+    CALL_GL_API(glTexEnvxOES, target, pname, param);
+}
+void API_ENTRY(glTexEnvxvOES)(GLenum target, GLenum pname, const GLfixed *params) {
+    CALL_GL_API(glTexEnvxvOES, target, pname, params);
+}
+void API_ENTRY(glTexParameterxOES)(GLenum target, GLenum pname, GLfixed param) {
+    CALL_GL_API(glTexParameterxOES, target, pname, param);
+}
+void API_ENTRY(glTexParameterxvOES)(GLenum target, GLenum pname, const GLfixed *params) {
+    CALL_GL_API(glTexParameterxvOES, target, pname, params);
+}
+void API_ENTRY(glTranslatexOES)(GLfixed x, GLfixed y, GLfixed z) {
+    CALL_GL_API(glTranslatexOES, x, y, z);
+}
+GLboolean API_ENTRY(glIsRenderbufferOES)(GLuint renderbuffer) {
+    CALL_GL_API_RETURN(glIsRenderbufferOES, renderbuffer);
+}
+void API_ENTRY(glBindRenderbufferOES)(GLenum target, GLuint renderbuffer) {
+    CALL_GL_API(glBindRenderbufferOES, target, renderbuffer);
+}
+void API_ENTRY(glDeleteRenderbuffersOES)(GLsizei n, const GLuint* renderbuffers) {
+    CALL_GL_API(glDeleteRenderbuffersOES, n, renderbuffers);
+}
+void API_ENTRY(glGenRenderbuffersOES)(GLsizei n, GLuint* renderbuffers) {
+    CALL_GL_API(glGenRenderbuffersOES, n, renderbuffers);
+}
+void API_ENTRY(glRenderbufferStorageOES)(GLenum target, GLenum internalformat, GLsizei width, GLsizei height) {
+    CALL_GL_API(glRenderbufferStorageOES, target, internalformat, width, height);
+}
+void API_ENTRY(glGetRenderbufferParameterivOES)(GLenum target, GLenum pname, GLint* params) {
+    CALL_GL_API(glGetRenderbufferParameterivOES, target, pname, params);
+}
+GLboolean API_ENTRY(glIsFramebufferOES)(GLuint framebuffer) {
+    CALL_GL_API_RETURN(glIsFramebufferOES, framebuffer);
+}
+void API_ENTRY(glBindFramebufferOES)(GLenum target, GLuint framebuffer) {
+    CALL_GL_API(glBindFramebufferOES, target, framebuffer);
+}
+void API_ENTRY(glDeleteFramebuffersOES)(GLsizei n, const GLuint* framebuffers) {
+    CALL_GL_API(glDeleteFramebuffersOES, n, framebuffers);
+}
+void API_ENTRY(glGenFramebuffersOES)(GLsizei n, GLuint* framebuffers) {
+    CALL_GL_API(glGenFramebuffersOES, n, framebuffers);
+}
+GLenum API_ENTRY(glCheckFramebufferStatusOES)(GLenum target) {
+    CALL_GL_API_RETURN(glCheckFramebufferStatusOES, target);
+}
+void API_ENTRY(glFramebufferRenderbufferOES)(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer) {
+    CALL_GL_API(glFramebufferRenderbufferOES, target, attachment, renderbuffertarget, renderbuffer);
+}
+void API_ENTRY(glFramebufferTexture2DOES)(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level) {
+    CALL_GL_API(glFramebufferTexture2DOES, target, attachment, textarget, texture, level);
+}
+void API_ENTRY(glGetFramebufferAttachmentParameterivOES)(GLenum target, GLenum attachment, GLenum pname, GLint* params) {
+    CALL_GL_API(glGetFramebufferAttachmentParameterivOES, target, attachment, pname, params);
+}
+void API_ENTRY(glGenerateMipmapOES)(GLenum target) {
+    CALL_GL_API(glGenerateMipmapOES, target);
+}
+void* API_ENTRY(glMapBufferOES)(GLenum target, GLenum access) {
+    CALL_GL_API_RETURN(glMapBufferOES, target, access);
+}
+GLboolean API_ENTRY(glUnmapBufferOES)(GLenum target) {
+    CALL_GL_API_RETURN(glUnmapBufferOES, target);
+}
+void API_ENTRY(glGetBufferPointervOES)(GLenum target, GLenum pname, void** params) {
+    CALL_GL_API(glGetBufferPointervOES, target, pname, params);
+}
+void API_ENTRY(glCurrentPaletteMatrixOES)(GLuint matrixpaletteindex) {
+    CALL_GL_API(glCurrentPaletteMatrixOES, matrixpaletteindex);
+}
+void API_ENTRY(glLoadPaletteFromModelViewMatrixOES)(void) {
+    CALL_GL_API(glLoadPaletteFromModelViewMatrixOES);
+}
+void API_ENTRY(glMatrixIndexPointerOES)(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer) {
+    CALL_GL_API(glMatrixIndexPointerOES, size, type, stride, pointer);
+}
+void API_ENTRY(glWeightPointerOES)(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer) {
+    CALL_GL_API(glWeightPointerOES, size, type, stride, pointer);
+}
+GLbitfield API_ENTRY(glQueryMatrixxOES)(GLfixed mantissa[16], GLint exponent[16]) {
+    CALL_GL_API_RETURN(glQueryMatrixxOES, mantissa, exponent);
+}
+void API_ENTRY(glDepthRangefOES)(GLclampf zNear, GLclampf zFar) {
+    CALL_GL_API(glDepthRangefOES, zNear, zFar);
+}
+void API_ENTRY(glFrustumfOES)(GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar) {
+    CALL_GL_API(glFrustumfOES, left, right, bottom, top, zNear, zFar);
+}
+void API_ENTRY(glOrthofOES)(GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar) {
+    CALL_GL_API(glOrthofOES, left, right, bottom, top, zNear, zFar);
+}
+void API_ENTRY(glClipPlanefOES)(GLenum plane, const GLfloat *equation) {
+    CALL_GL_API(glClipPlanefOES, plane, equation);
+}
+void API_ENTRY(glGetClipPlanefOES)(GLenum pname, GLfloat eqn[4]) {
+    CALL_GL_API(glGetClipPlanefOES, pname, eqn);
+}
+void API_ENTRY(glClearDepthfOES)(GLclampf depth) {
+    CALL_GL_API(glClearDepthfOES, depth);
+}
+void API_ENTRY(glTexGenfOES)(GLenum coord, GLenum pname, GLfloat param) {
+    CALL_GL_API(glTexGenfOES, coord, pname, param);
+}
+void API_ENTRY(glTexGenfvOES)(GLenum coord, GLenum pname, const GLfloat *params) {
+    CALL_GL_API(glTexGenfvOES, coord, pname, params);
+}
+void API_ENTRY(glTexGeniOES)(GLenum coord, GLenum pname, GLint param) {
+    CALL_GL_API(glTexGeniOES, coord, pname, param);
+}
+void API_ENTRY(glTexGenivOES)(GLenum coord, GLenum pname, const GLint *params) {
+    CALL_GL_API(glTexGenivOES, coord, pname, params);
+}
+void API_ENTRY(glTexGenxOES)(GLenum coord, GLenum pname, GLfixed param) {
+    CALL_GL_API(glTexGenxOES, coord, pname, param);
+}
+void API_ENTRY(glTexGenxvOES)(GLenum coord, GLenum pname, const GLfixed *params) {
+    CALL_GL_API(glTexGenxvOES, coord, pname, params);
+}
+void API_ENTRY(glGetTexGenfvOES)(GLenum coord, GLenum pname, GLfloat *params) {
+    CALL_GL_API(glGetTexGenfvOES, coord, pname, params);
+}
+void API_ENTRY(glGetTexGenivOES)(GLenum coord, GLenum pname, GLint *params) {
+    CALL_GL_API(glGetTexGenivOES, coord, pname, params);
+}
+void API_ENTRY(glGetTexGenxvOES)(GLenum coord, GLenum pname, GLfixed *params) {
+    CALL_GL_API(glGetTexGenxvOES, coord, pname, params);
+}
diff --git a/opengl/libs/egl_entries.in b/opengl/libs/egl_entries.in
index 33b4c65..3b4551b 100644
--- a/opengl/libs/egl_entries.in
+++ b/opengl/libs/egl_entries.in
@@ -43,3 +43,10 @@
 /* EGL 1.3 */
 
 /* EGL 1.4 */
+
+/* EGL_EGLEXT_VERSION 3 */
+
+EGL_ENTRY(EGLBoolean,  eglLockSurfaceKHR,   EGLDisplay, EGLSurface, const EGLint *)
+EGL_ENTRY(EGLBoolean,  eglUnlockSurfaceKHR, EGLDisplay, EGLSurface)
+EGL_ENTRY(EGLImageKHR, eglCreateImageKHR,   EGLDisplay, EGLContext, EGLenum, EGLClientBuffer, const EGLint *)
+EGL_ENTRY(EGLBoolean,  eglDestroyImageKHR,  EGLDisplay, EGLImageKHR)
diff --git a/opengl/libs/gl_entries.in b/opengl/libs/gl_entries.in
index b97e8fe..d7cc5da 100644
--- a/opengl/libs/gl_entries.in
+++ b/opengl/libs/gl_entries.in
@@ -1,159 +1,145 @@
-GL_ENTRY(void, glColor4f, GLfloat, GLfloat, GLfloat, GLfloat)
-GL_ENTRY(void, glColor4x, GLfixed, GLfixed, GLfixed, GLfixed)
-GL_ENTRY(void, glNormal3f, GLfloat, GLfloat, GLfloat)
-GL_ENTRY(void, glNormal3x, GLfixed, GLfixed, GLfixed)
-GL_ENTRY(void, glCullFace, GLenum)
-GL_ENTRY(void, glFrontFace, GLenum)
-GL_ENTRY(void, glDisable, GLenum)
-GL_ENTRY(void, glEnable, GLenum)
-GL_ENTRY(void, glFinish, void)
-GL_ENTRY(void, glFlush, void)
-GL_ENTRY(GLenum, glGetError, void)
-GL_ENTRY(const GLubyte*, glGetString, GLenum)
-GL_ENTRY(void, glGetIntegerv, GLenum, GLint *)
-GL_ENTRY(void, glColorMask, GLboolean, GLboolean, GLboolean, GLboolean)
-GL_ENTRY(void, glDepthMask, GLboolean)
-GL_ENTRY(void, glStencilMask, GLuint)
-GL_ENTRY(void, glDepthFunc, GLenum)
-GL_ENTRY(void, glDepthRangef, GLclampf zNear, GLclampf zFar)
-GL_ENTRY(void, glDepthRangex, GLclampx zNear, GLclampx zFar)
-GL_ENTRY(void, glPolygonOffset, GLfloat factor, GLfloat units)
-GL_ENTRY(void, glPolygonOffsetx, GLfixed factor, GLfixed units)
-GL_ENTRY(void, glLogicOp, GLenum opcode)
-GL_ENTRY(void, glAlphaFuncx, GLenum func, GLclampx ref)
 GL_ENTRY(void, glAlphaFunc, GLenum func, GLclampf ref)
-GL_ENTRY(void, glBlendFunc, GLenum sfactor, GLenum dfactor)
-GL_ENTRY(void, glClear, GLbitfield mask)
-GL_ENTRY(void, glClearColor, GLclampf r, GLclampf g, GLclampf b, GLclampf a)
-GL_ENTRY(void, glClearColorx, GLclampx r, GLclampx g, GLclampx b, GLclampx a)
+GL_ENTRY(void, glClearColor, GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha)
 GL_ENTRY(void, glClearDepthf, GLclampf depth)
+GL_ENTRY(void, glClipPlanef, GLenum plane, const GLfloat *equation)
+GL_ENTRY(void, glColor4f, GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha)
+GL_ENTRY(void, glDepthRangef, GLclampf zNear, GLclampf zFar)
+GL_ENTRY(void, glFogf, GLenum pname, GLfloat param)
+GL_ENTRY(void, glFogfv, GLenum pname, const GLfloat *params)
+GL_ENTRY(void, glFrustumf, GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar)
+GL_ENTRY(void, glGetClipPlanef, GLenum pname, GLfloat eqn[4])
+GL_ENTRY(void, glGetFloatv, GLenum pname, GLfloat *params)
+GL_ENTRY(void, glGetLightfv, GLenum light, GLenum pname, GLfloat *params)
+GL_ENTRY(void, glGetMaterialfv, GLenum face, GLenum pname, GLfloat *params)
+GL_ENTRY(void, glGetTexEnvfv, GLenum env, GLenum pname, GLfloat *params)
+GL_ENTRY(void, glGetTexParameterfv, GLenum target, GLenum pname, GLfloat *params)
+GL_ENTRY(void, glLightModelf, GLenum pname, GLfloat param)
+GL_ENTRY(void, glLightModelfv, GLenum pname, const GLfloat *params)
+GL_ENTRY(void, glLightf, GLenum light, GLenum pname, GLfloat param)
+GL_ENTRY(void, glLightfv, GLenum light, GLenum pname, const GLfloat *params)
+GL_ENTRY(void, glLineWidth, GLfloat width)
+GL_ENTRY(void, glLoadMatrixf, const GLfloat *m)
+GL_ENTRY(void, glMaterialf, GLenum face, GLenum pname, GLfloat param)
+GL_ENTRY(void, glMaterialfv, GLenum face, GLenum pname, const GLfloat *params)
+GL_ENTRY(void, glMultMatrixf, const GLfloat *m)
+GL_ENTRY(void, glMultiTexCoord4f, GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q)
+GL_ENTRY(void, glNormal3f, GLfloat nx, GLfloat ny, GLfloat nz)
+GL_ENTRY(void, glOrthof, GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar)
+GL_ENTRY(void, glPointParameterf, GLenum pname, GLfloat param)
+GL_ENTRY(void, glPointParameterfv, GLenum pname, const GLfloat *params)
+GL_ENTRY(void, glPointSize, GLfloat size)
+GL_ENTRY(void, glPolygonOffset, GLfloat factor, GLfloat units)
+GL_ENTRY(void, glRotatef, GLfloat angle, GLfloat x, GLfloat y, GLfloat z)
+GL_ENTRY(void, glScalef, GLfloat x, GLfloat y, GLfloat z)
+GL_ENTRY(void, glTexEnvf, GLenum target, GLenum pname, GLfloat param)
+GL_ENTRY(void, glTexEnvfv, GLenum target, GLenum pname, const GLfloat *params)
+GL_ENTRY(void, glTexParameterf, GLenum target, GLenum pname, GLfloat param)
+GL_ENTRY(void, glTexParameterfv, GLenum target, GLenum pname, const GLfloat *params)
+GL_ENTRY(void, glTranslatef, GLfloat x, GLfloat y, GLfloat z)
+GL_ENTRY(void, glActiveTexture, GLenum texture)
+GL_ENTRY(void, glAlphaFuncx, GLenum func, GLclampx ref)
+GL_ENTRY(void, glBindBuffer, GLenum target, GLuint buffer)
+GL_ENTRY(void, glBindTexture, GLenum target, GLuint texture)
+GL_ENTRY(void, glBlendFunc, GLenum sfactor, GLenum dfactor)
+GL_ENTRY(void, glBufferData, GLenum target, GLsizeiptr size, const GLvoid *data, GLenum usage)
+GL_ENTRY(void, glBufferSubData, GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid *data)
+GL_ENTRY(void, glClear, GLbitfield mask)
+GL_ENTRY(void, glClearColorx, GLclampx red, GLclampx green, GLclampx blue, GLclampx alpha)
 GL_ENTRY(void, glClearDepthx, GLclampx depth)
 GL_ENTRY(void, glClearStencil, GLint s)
-GL_ENTRY(void, glPointSize, GLfloat)
-GL_ENTRY(void, glPointSizex, GLfixed)
-GL_ENTRY(void, glSampleCoverage, GLclampf value, GLboolean invert)
-GL_ENTRY(void, glSampleCoveragex, GLclampx value, GLboolean invert)
-GL_ENTRY(void, glStencilFunc, GLenum func, GLint ref, GLuint mask)
-GL_ENTRY(void, glStencilOp, GLenum fail, GLenum zfail, GLenum zpass)
-GL_ENTRY(void, glScissor, GLint x, GLint y, GLsizei width, GLsizei height)
-GL_ENTRY(void, glHint, GLenum, GLenum mode)
-GL_ENTRY(void, glLineWidth, GLfloat width)
+GL_ENTRY(void, glClientActiveTexture, GLenum texture)
+GL_ENTRY(void, glClipPlanex, GLenum plane, const GLfixed *equation)
+GL_ENTRY(void, glColor4ub, GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha)
+GL_ENTRY(void, glColor4x, GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha)
+GL_ENTRY(void, glColorMask, GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha)
+GL_ENTRY(void, glColorPointer, GLint size, GLenum type, GLsizei stride, const GLvoid *pointer)
+GL_ENTRY(void, glCompressedTexImage2D, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data)
+GL_ENTRY(void, glCompressedTexSubImage2D, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data)
+GL_ENTRY(void, glCopyTexImage2D, GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border)
+GL_ENTRY(void, glCopyTexSubImage2D, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height)
+GL_ENTRY(void, glCullFace, GLenum mode)
+GL_ENTRY(void, glDeleteBuffers, GLsizei n, const GLuint *buffers)
+GL_ENTRY(void, glDeleteTextures, GLsizei n, const GLuint *textures)
+GL_ENTRY(void, glDepthFunc, GLenum func)
+GL_ENTRY(void, glDepthMask, GLboolean flag)
+GL_ENTRY(void, glDepthRangex, GLclampx zNear, GLclampx zFar)
+GL_ENTRY(void, glDisable, GLenum cap)
+GL_ENTRY(void, glDisableClientState, GLenum array)
+GL_ENTRY(void, glDrawArrays, GLenum mode, GLint first, GLsizei count)
+GL_ENTRY(void, glDrawElements, GLenum mode, GLsizei count, GLenum type, const GLvoid *indices)
+GL_ENTRY(void, glEnable, GLenum cap)
+GL_ENTRY(void, glEnableClientState, GLenum array)
+GL_ENTRY(void, glFinish, void)
+GL_ENTRY(void, glFlush, void)
+GL_ENTRY(void, glFogx, GLenum pname, GLfixed param)
+GL_ENTRY(void, glFogxv, GLenum pname, const GLfixed *params)
+GL_ENTRY(void, glFrontFace, GLenum mode)
+GL_ENTRY(void, glFrustumx, GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar)
+GL_ENTRY(void, glGetBooleanv, GLenum pname, GLboolean *params)
+GL_ENTRY(void, glGetBufferParameteriv, GLenum target, GLenum pname, GLint *params)
+GL_ENTRY(void, glGetClipPlanex, GLenum pname, GLfixed eqn[4])
+GL_ENTRY(void, glGenBuffers, GLsizei n, GLuint *buffers)
+GL_ENTRY(void, glGenTextures, GLsizei n, GLuint *textures)
+GL_ENTRY(GLenum, glGetError, void)
+GL_ENTRY(void, glGetFixedv, GLenum pname, GLfixed *params)
+GL_ENTRY(void, glGetIntegerv, GLenum pname, GLint *params)
+GL_ENTRY(void, glGetLightxv, GLenum light, GLenum pname, GLfixed *params)
+GL_ENTRY(void, glGetMaterialxv, GLenum face, GLenum pname, GLfixed *params)
+GL_ENTRY(void, glGetPointerv, GLenum pname, void **params)
+GL_ENTRY(const GLubyte *, glGetString, GLenum name)
+GL_ENTRY(void, glGetTexEnviv, GLenum env, GLenum pname, GLint *params)
+GL_ENTRY(void, glGetTexEnvxv, GLenum env, GLenum pname, GLfixed *params)
+GL_ENTRY(void, glGetTexParameteriv, GLenum target, GLenum pname, GLint *params)
+GL_ENTRY(void, glGetTexParameterxv, GLenum target, GLenum pname, GLfixed *params)
+GL_ENTRY(void, glHint, GLenum target, GLenum mode)
+GL_ENTRY(GLboolean, glIsBuffer, GLuint buffer)
+GL_ENTRY(GLboolean, glIsEnabled, GLenum cap)
+GL_ENTRY(GLboolean, glIsTexture, GLuint texture)
+GL_ENTRY(void, glLightModelx, GLenum pname, GLfixed param)
+GL_ENTRY(void, glLightModelxv, GLenum pname, const GLfixed *params)
+GL_ENTRY(void, glLightx, GLenum light, GLenum pname, GLfixed param)
+GL_ENTRY(void, glLightxv, GLenum light, GLenum pname, const GLfixed *params)
 GL_ENTRY(void, glLineWidthx, GLfixed width)
-GL_ENTRY(void, glShadeModel, GLenum)
-GL_ENTRY(void, glLightModelf, GLenum, GLfloat)
-GL_ENTRY(void, glLightModelfv, GLenum, const GLfloat *)
-GL_ENTRY(void, glLightModelx, GLenum, GLfixed)
-GL_ENTRY(void, glLightModelxv, GLenum, const GLfixed *)
-GL_ENTRY(void, glLightf, GLenum, GLenum, GLfloat)
-GL_ENTRY(void, glLightfv, GLenum, GLenum, const GLfloat *)
-GL_ENTRY(void, glLightx, GLenum, GLenum, GLfixed)
-GL_ENTRY(void, glLightxv, GLenum, GLenum, const GLfixed *)
-GL_ENTRY(void, glMaterialf, GLenum, GLenum, GLfloat)
-GL_ENTRY(void, glMaterialfv, GLenum, GLenum, const GLfloat *)
-GL_ENTRY(void, glMaterialx, GLenum, GLenum, GLfixed)
-GL_ENTRY(void, glMaterialxv, GLenum, GLenum, const GLfixed *)
-GL_ENTRY(void, glFogf, GLenum, GLfloat)
-GL_ENTRY(void, glFogfv, GLenum, const GLfloat *)
-GL_ENTRY(void, glFogx, GLenum, GLfixed)
-GL_ENTRY(void, glFogxv, GLenum, const GLfixed *)
-GL_ENTRY(void, glVertexPointer, GLint, GLenum, GLsizei, const GLvoid *)
-GL_ENTRY(void, glColorPointer, GLint, GLenum, GLsizei, const GLvoid *)
-GL_ENTRY(void, glNormalPointer, GLenum, GLsizei, const GLvoid *)
-GL_ENTRY(void, glTexCoordPointer, GLint, GLenum, GLsizei, const GLvoid *)
-GL_ENTRY(void, glEnableClientState, GLenum)
-GL_ENTRY(void, glDisableClientState, GLenum)
-GL_ENTRY(void, glClientActiveTexture, GLenum)
-GL_ENTRY(void, glDrawArrays, GLenum, GLint first, GLsizei)
-GL_ENTRY(void, glDrawElements, GLenum, GLsizei, GLenum, const GLvoid *)
 GL_ENTRY(void, glLoadIdentity, void)
-GL_ENTRY(void, glLoadMatrixf, const GLfloat*)
-GL_ENTRY(void, glLoadMatrixx, const GLfixed*)
+GL_ENTRY(void, glLoadMatrixx, const GLfixed *m)
+GL_ENTRY(void, glLogicOp, GLenum opcode)
+GL_ENTRY(void, glMaterialx, GLenum face, GLenum pname, GLfixed param)
+GL_ENTRY(void, glMaterialxv, GLenum face, GLenum pname, const GLfixed *params)
 GL_ENTRY(void, glMatrixMode, GLenum mode)
-GL_ENTRY(void, glMultMatrixf, const GLfloat*)
-GL_ENTRY(void, glMultMatrixx, const GLfixed*)
+GL_ENTRY(void, glMultMatrixx, const GLfixed *m)
+GL_ENTRY(void, glMultiTexCoord4x, GLenum target, GLfixed s, GLfixed t, GLfixed r, GLfixed q)
+GL_ENTRY(void, glNormal3x, GLfixed nx, GLfixed ny, GLfixed nz)
+GL_ENTRY(void, glNormalPointer, GLenum type, GLsizei stride, const GLvoid *pointer)
+GL_ENTRY(void, glOrthox, GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar)
+GL_ENTRY(void, glPixelStorei, GLenum pname, GLint param)
+GL_ENTRY(void, glPointParameterx, GLenum pname, GLfixed param)
+GL_ENTRY(void, glPointParameterxv, GLenum pname, const GLfixed *params)
+GL_ENTRY(void, glPointSizex, GLfixed size)
+GL_ENTRY(void, glPolygonOffsetx, GLfixed factor, GLfixed units)
 GL_ENTRY(void, glPopMatrix, void)
 GL_ENTRY(void, glPushMatrix, void)
-GL_ENTRY(void, glFrustumf, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat)
-GL_ENTRY(void, glFrustumx, GLfixed, GLfixed, GLfixed, GLfixed, GLfixed, GLfixed)
-GL_ENTRY(void, glOrthof, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat)
-GL_ENTRY(void, glOrthox, GLfixed, GLfixed, GLfixed, GLfixed, GLfixed, GLfixed)
-GL_ENTRY(void, glRotatef, GLfloat, GLfloat, GLfloat, GLfloat)
-GL_ENTRY(void, glRotatex, GLfixed, GLfixed, GLfixed, GLfixed)
-GL_ENTRY(void, glScalef, GLfloat, GLfloat, GLfloat)
-GL_ENTRY(void, glScalex, GLfixed, GLfixed, GLfixed)
-GL_ENTRY(void, glTranslatef, GLfloat, GLfloat, GLfloat)
-GL_ENTRY(void, glTranslatex, GLfixed, GLfixed, GLfixed)
-GL_ENTRY(void, glViewport, GLint, GLint, GLsizei, GLsizei)
-GL_ENTRY(void, glActiveTexture, GLenum)
-GL_ENTRY(void, glBindTexture, GLenum, GLuint)
-GL_ENTRY(void, glGenTextures, GLsizei, GLuint*)
-GL_ENTRY(void, glDeleteTextures, GLsizei n, const GLuint *)
-GL_ENTRY(void, glMultiTexCoord4f, GLenum, GLfloat, GLfloat, GLfloat, GLfloat)
-GL_ENTRY(void, glMultiTexCoord4x, GLenum, GLfixed, GLfixed, GLfixed, GLfixed)
-GL_ENTRY(void, glPixelStorei, GLenum, GLint)
-GL_ENTRY(void, glTexEnvf, GLenum, GLenum, GLfloat)
-GL_ENTRY(void, glTexEnvfv, GLenum, GLenum, const GLfloat*)
-GL_ENTRY(void, glTexEnvx, GLenum, GLenum, GLfixed)
-GL_ENTRY(void, glTexEnvxv, GLenum, GLenum, const GLfixed*)
-GL_ENTRY(void, glTexParameterf, GLenum, GLenum, GLfloat)
-GL_ENTRY(void, glTexParameterx, GLenum, GLenum, GLfixed)
-GL_ENTRY(void, glCompressedTexImage2D,    GLenum, GLint, GLenum, GLsizei, GLsizei, GLint, GLsizei, const GLvoid*)
-GL_ENTRY(void, glCompressedTexSubImage2D, GLenum, GLint, GLint, GLint, GLsizei, GLsizei, GLenum, GLsizei, const GLvoid*)
-GL_ENTRY(void, glCopyTexImage2D, GLenum, GLint, GLenum, GLint, GLint, GLsizei, GLsizei, GLint)
-GL_ENTRY(void, glCopyTexSubImage2D, GLenum, GLint, GLint, GLint, GLint, GLint, GLsizei, GLsizei)
-GL_ENTRY(void, glTexImage2D, GLenum, GLint, GLint, GLsizei, GLsizei, GLint, GLenum, GLenum, const GLvoid*)
-GL_ENTRY(void, glTexSubImage2D, GLenum, GLint, GLint, GLint, GLsizei, GLsizei, GLenum, GLenum, const GLvoid*)
-GL_ENTRY(void, glReadPixels, GLint, GLint, GLsizei, GLsizei, GLenum, GLenum, GLvoid *)
-
-// 1.1 additions
-GL_ENTRY(void, glClipPlanef, GLenum plane, const GLfloat*)
-GL_ENTRY(void, glClipPlanex, GLenum plane, const GLfixed*)
-GL_ENTRY(void, glBindBuffer, GLenum, GLuint)
-GL_ENTRY(void, glBufferData, GLenum, GLsizeiptr, const GLvoid*, GLenum)
-GL_ENTRY(void, glBufferSubData, GLenum, GLintptr, GLsizeiptr, const GLvoid*)
-GL_ENTRY(void, glDeleteBuffers, GLsizei, const GLuint*)
-GL_ENTRY(void, glGenBuffers, GLsizei, GLuint*)
-GL_ENTRY(void, glGetBooleanv, GLenum, GLboolean *)
-GL_ENTRY(void, glGetFixedv, GLenum, GLfixed *)
-GL_ENTRY(void, glGetFloatv, GLenum, GLfloat *)
-GL_ENTRY(void, glGetPointerv, GLenum, void **)
-GL_ENTRY(void, glGetBufferParameteriv, GLenum, GLenum, GLint *)
-GL_ENTRY(void, glGetClipPlanef, GLenum, GLfloat[4])
-GL_ENTRY(void, glGetClipPlanex, GLenum, GLfixed[4])
-GL_ENTRY(void, glGetLightxv, GLenum, GLenum, GLfixed *)
-GL_ENTRY(void, glGetLightfv, GLenum, GLenum, GLfloat *)
-GL_ENTRY(void, glGetMaterialxv, GLenum, GLenum, GLfixed *)
-GL_ENTRY(void, glGetMaterialfv, GLenum, GLenum, GLfloat *)
-GL_ENTRY(void, glGetTexEnvfv, GLenum, GLenum, GLfloat *)
-GL_ENTRY(void, glGetTexEnviv, GLenum, GLenum, GLint *)
-GL_ENTRY(void, glGetTexEnvxv, GLenum, GLenum, GLfixed *)
-GL_ENTRY(void, glGetTexParameterfv, GLenum, GLenum, GLfloat *)
-GL_ENTRY(void, glGetTexParameteriv, GLenum, GLenum, GLint *)
-GL_ENTRY(void, glGetTexParameterxv, GLenum, GLenum, GLfixed *)
-GL_ENTRY(GLboolean, glIsBuffer, GLuint)
-GL_ENTRY(GLboolean, glIsEnabled, GLenum)
-GL_ENTRY(GLboolean, glIsTexture, GLuint)
-GL_ENTRY(void, glPointParameterf, GLenum, GLfloat)
-GL_ENTRY(void, glPointParameterfv, GLenum, const GLfloat *)
-GL_ENTRY(void, glPointParameterx, GLenum, GLfixed)
-GL_ENTRY(void, glPointParameterxv, GLenum, const GLfixed *)
-GL_ENTRY(void, glColor4ub, GLubyte, GLubyte, GLubyte, GLubyte)
-GL_ENTRY(void, glTexEnvi, GLenum, GLenum, GLint)
-GL_ENTRY(void, glTexEnviv, GLenum, GLenum, const GLint *)
-GL_ENTRY(void, glTexParameterfv, GLenum, GLenum, const GLfloat *)
-GL_ENTRY(void, glTexParameteriv, GLenum, GLenum, const GLint *)
-GL_ENTRY(void, glTexParameteri, GLenum, GLenum, GLint)
-GL_ENTRY(void, glTexParameterxv, GLenum, GLenum, const GLfixed *)
-GL_ENTRY(void, glPointSizePointerOES, GLenum type, GLsizei stride, const GLvoid*)
-
-// Extensions
-GL_ENTRY(void, glDrawTexsOES, GLshort, GLshort, GLshort, GLshort, GLshort)
-GL_ENTRY(void, glDrawTexiOES, GLint, GLint, GLint, GLint, GLint)
-GL_ENTRY(void, glDrawTexfOES, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat)
-GL_ENTRY(void, glDrawTexxOES, GLfixed, GLfixed, GLfixed, GLfixed, GLfixed)
-GL_ENTRY(void, glDrawTexsvOES, const GLshort*)
-GL_ENTRY(void, glDrawTexivOES, const GLint*)
-GL_ENTRY(void, glDrawTexfvOES, const GLfloat*)
-GL_ENTRY(void, glDrawTexxvOES, const GLfixed*)
-GL_ENTRY(GLbitfield, glQueryMatrixxOES, GLfixed* mantissa, GLint* exponent)
-
+GL_ENTRY(void, glReadPixels, GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels)
+GL_ENTRY(void, glRotatex, GLfixed angle, GLfixed x, GLfixed y, GLfixed z)
+GL_ENTRY(void, glSampleCoverage, GLclampf value, GLboolean invert)
+GL_ENTRY(void, glSampleCoveragex, GLclampx value, GLboolean invert)
+GL_ENTRY(void, glScalex, GLfixed x, GLfixed y, GLfixed z)
+GL_ENTRY(void, glScissor, GLint x, GLint y, GLsizei width, GLsizei height)
+GL_ENTRY(void, glShadeModel, GLenum mode)
+GL_ENTRY(void, glStencilFunc, GLenum func, GLint ref, GLuint mask)
+GL_ENTRY(void, glStencilMask, GLuint mask)
+GL_ENTRY(void, glStencilOp, GLenum fail, GLenum zfail, GLenum zpass)
+GL_ENTRY(void, glTexCoordPointer, GLint size, GLenum type, GLsizei stride, const GLvoid *pointer)
+GL_ENTRY(void, glTexEnvi, GLenum target, GLenum pname, GLint param)
+GL_ENTRY(void, glTexEnvx, GLenum target, GLenum pname, GLfixed param)
+GL_ENTRY(void, glTexEnviv, GLenum target, GLenum pname, const GLint *params)
+GL_ENTRY(void, glTexEnvxv, GLenum target, GLenum pname, const GLfixed *params)
+GL_ENTRY(void, glTexImage2D, GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels)
+GL_ENTRY(void, glTexParameteri, GLenum target, GLenum pname, GLint param)
+GL_ENTRY(void, glTexParameterx, GLenum target, GLenum pname, GLfixed param)
+GL_ENTRY(void, glTexParameteriv, GLenum target, GLenum pname, const GLint *params)
+GL_ENTRY(void, glTexParameterxv, GLenum target, GLenum pname, const GLfixed *params)
+GL_ENTRY(void, glTexSubImage2D, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels)
+GL_ENTRY(void, glTranslatex, GLfixed x, GLfixed y, GLfixed z)
+GL_ENTRY(void, glVertexPointer, GLint size, GLenum type, GLsizei stride, const GLvoid *pointer)
+GL_ENTRY(void, glViewport, GLint x, GLint y, GLsizei width, GLsizei height)
+GL_ENTRY(void, glPointSizePointerOES, GLenum type, GLsizei stride, const GLvoid *pointer)
diff --git a/opengl/libs/gl_logger.h b/opengl/libs/gl_logger.h
deleted file mode 100644
index ce85dd1..0000000
--- a/opengl/libs/gl_logger.h
+++ /dev/null
@@ -1,26 +0,0 @@
-/* 
- ** Copyright 2007, The Android Open Source Project
- **
- ** Licensed under the Apache License, Version 2.0 (the "License"); 
- ** you may not use this file except in compliance with the License. 
- ** You may obtain a copy of the License at 
- **
- **     http://www.apache.org/licenses/LICENSE-2.0 
- **
- ** Unless required by applicable law or agreed to in writing, software 
- ** distributed under the License is distributed on an "AS IS" BASIS, 
- ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
- ** See the License for the specific language governing permissions and 
- ** limitations under the License.
- */
-
-#ifndef ANDROID_GL_LOGGER_H
-#define ANDROID_GL_LOGGER_H
-
-namespace android {
-#define GL_ENTRY(r, api, ...) r log_##api(__VA_ARGS__);
-#include "gl_entries.in"
-#undef GL_ENTRY
-}; // namespace android
-
-#endif /* ANDROID_GL_LOGGER_H */
diff --git a/opengl/libs/glext_entries.in b/opengl/libs/glext_entries.in
new file mode 100644
index 0000000..dd09c71
--- /dev/null
+++ b/opengl/libs/glext_entries.in
@@ -0,0 +1,90 @@
+GL_ENTRY(void, glBlendEquationSeparateOES, GLenum modeRGB, GLenum modeAlpha)
+GL_ENTRY(void, glBlendFuncSeparateOES, GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha)
+GL_ENTRY(void, glBlendEquationOES, GLenum mode)
+GL_ENTRY(void, glDrawTexsOES, GLshort x, GLshort y, GLshort z, GLshort width, GLshort height)
+GL_ENTRY(void, glDrawTexiOES, GLint x, GLint y, GLint z, GLint width, GLint height)
+GL_ENTRY(void, glDrawTexxOES, GLfixed x, GLfixed y, GLfixed z, GLfixed width, GLfixed height)
+GL_ENTRY(void, glDrawTexsvOES, const GLshort *coords)
+GL_ENTRY(void, glDrawTexivOES, const GLint *coords)
+GL_ENTRY(void, glDrawTexxvOES, const GLfixed *coords)
+GL_ENTRY(void, glDrawTexfOES, GLfloat x, GLfloat y, GLfloat z, GLfloat width, GLfloat height)
+GL_ENTRY(void, glDrawTexfvOES, const GLfloat *coords)
+GL_ENTRY(void, glEGLImageTargetTexture2DOES, GLenum target, GLeglImageOES image)
+GL_ENTRY(void, glEGLImageTargetRenderbufferStorageOES, GLenum target, GLeglImageOES image)
+GL_ENTRY(void, glAlphaFuncxOES, GLenum func, GLclampx ref)
+GL_ENTRY(void, glClearColorxOES, GLclampx red, GLclampx green, GLclampx blue, GLclampx alpha)
+GL_ENTRY(void, glClearDepthxOES, GLclampx depth)
+GL_ENTRY(void, glClipPlanexOES, GLenum plane, const GLfixed *equation)
+GL_ENTRY(void, glColor4xOES, GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha)
+GL_ENTRY(void, glDepthRangexOES, GLclampx zNear, GLclampx zFar)
+GL_ENTRY(void, glFogxOES, GLenum pname, GLfixed param)
+GL_ENTRY(void, glFogxvOES, GLenum pname, const GLfixed *params)
+GL_ENTRY(void, glFrustumxOES, GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar)
+GL_ENTRY(void, glGetClipPlanexOES, GLenum pname, GLfixed eqn[4])
+GL_ENTRY(void, glGetFixedvOES, GLenum pname, GLfixed *params)
+GL_ENTRY(void, glGetLightxvOES, GLenum light, GLenum pname, GLfixed *params)
+GL_ENTRY(void, glGetMaterialxvOES, GLenum face, GLenum pname, GLfixed *params)
+GL_ENTRY(void, glGetTexEnvxvOES, GLenum env, GLenum pname, GLfixed *params)
+GL_ENTRY(void, glGetTexParameterxvOES, GLenum target, GLenum pname, GLfixed *params)
+GL_ENTRY(void, glLightModelxOES, GLenum pname, GLfixed param)
+GL_ENTRY(void, glLightModelxvOES, GLenum pname, const GLfixed *params)
+GL_ENTRY(void, glLightxOES, GLenum light, GLenum pname, GLfixed param)
+GL_ENTRY(void, glLightxvOES, GLenum light, GLenum pname, const GLfixed *params)
+GL_ENTRY(void, glLineWidthxOES, GLfixed width)
+GL_ENTRY(void, glLoadMatrixxOES, const GLfixed *m)
+GL_ENTRY(void, glMaterialxOES, GLenum face, GLenum pname, GLfixed param)
+GL_ENTRY(void, glMaterialxvOES, GLenum face, GLenum pname, const GLfixed *params)
+GL_ENTRY(void, glMultMatrixxOES, const GLfixed *m)
+GL_ENTRY(void, glMultiTexCoord4xOES, GLenum target, GLfixed s, GLfixed t, GLfixed r, GLfixed q)
+GL_ENTRY(void, glNormal3xOES, GLfixed nx, GLfixed ny, GLfixed nz)
+GL_ENTRY(void, glOrthoxOES, GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar)
+GL_ENTRY(void, glPointParameterxOES, GLenum pname, GLfixed param)
+GL_ENTRY(void, glPointParameterxvOES, GLenum pname, const GLfixed *params)
+GL_ENTRY(void, glPointSizexOES, GLfixed size)
+GL_ENTRY(void, glPolygonOffsetxOES, GLfixed factor, GLfixed units)
+GL_ENTRY(void, glRotatexOES, GLfixed angle, GLfixed x, GLfixed y, GLfixed z)
+GL_ENTRY(void, glSampleCoveragexOES, GLclampx value, GLboolean invert)
+GL_ENTRY(void, glScalexOES, GLfixed x, GLfixed y, GLfixed z)
+GL_ENTRY(void, glTexEnvxOES, GLenum target, GLenum pname, GLfixed param)
+GL_ENTRY(void, glTexEnvxvOES, GLenum target, GLenum pname, const GLfixed *params)
+GL_ENTRY(void, glTexParameterxOES, GLenum target, GLenum pname, GLfixed param)
+GL_ENTRY(void, glTexParameterxvOES, GLenum target, GLenum pname, const GLfixed *params)
+GL_ENTRY(void, glTranslatexOES, GLfixed x, GLfixed y, GLfixed z)
+GL_ENTRY(GLboolean, glIsRenderbufferOES, GLuint renderbuffer)
+GL_ENTRY(void, glBindRenderbufferOES, GLenum target, GLuint renderbuffer)
+GL_ENTRY(void, glDeleteRenderbuffersOES, GLsizei n, const GLuint* renderbuffers)
+GL_ENTRY(void, glGenRenderbuffersOES, GLsizei n, GLuint* renderbuffers)
+GL_ENTRY(void, glRenderbufferStorageOES, GLenum target, GLenum internalformat, GLsizei width, GLsizei height)
+GL_ENTRY(void, glGetRenderbufferParameterivOES, GLenum target, GLenum pname, GLint* params)
+GL_ENTRY(GLboolean, glIsFramebufferOES, GLuint framebuffer)
+GL_ENTRY(void, glBindFramebufferOES, GLenum target, GLuint framebuffer)
+GL_ENTRY(void, glDeleteFramebuffersOES, GLsizei n, const GLuint* framebuffers)
+GL_ENTRY(void, glGenFramebuffersOES, GLsizei n, GLuint* framebuffers)
+GL_ENTRY(GLenum, glCheckFramebufferStatusOES, GLenum target)
+GL_ENTRY(void, glFramebufferRenderbufferOES, GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer)
+GL_ENTRY(void, glFramebufferTexture2DOES, GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level)
+GL_ENTRY(void, glGetFramebufferAttachmentParameterivOES, GLenum target, GLenum attachment, GLenum pname, GLint* params)
+GL_ENTRY(void, glGenerateMipmapOES, GLenum target)
+GL_ENTRY(void*, glMapBufferOES, GLenum target, GLenum access)
+GL_ENTRY(GLboolean, glUnmapBufferOES, GLenum target)
+GL_ENTRY(void, glGetBufferPointervOES, GLenum target, GLenum pname, void** params)
+GL_ENTRY(void, glCurrentPaletteMatrixOES, GLuint matrixpaletteindex)
+GL_ENTRY(void, glLoadPaletteFromModelViewMatrixOES, void)
+GL_ENTRY(void, glMatrixIndexPointerOES, GLint size, GLenum type, GLsizei stride, const GLvoid *pointer)
+GL_ENTRY(void, glWeightPointerOES, GLint size, GLenum type, GLsizei stride, const GLvoid *pointer)
+GL_ENTRY(GLbitfield, glQueryMatrixxOES, GLfixed mantissa[16], GLint exponent[16])
+GL_ENTRY(void, glDepthRangefOES, GLclampf zNear, GLclampf zFar)
+GL_ENTRY(void, glFrustumfOES, GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar)
+GL_ENTRY(void, glOrthofOES, GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar)
+GL_ENTRY(void, glClipPlanefOES, GLenum plane, const GLfloat *equation)
+GL_ENTRY(void, glGetClipPlanefOES, GLenum pname, GLfloat eqn[4])
+GL_ENTRY(void, glClearDepthfOES, GLclampf depth)
+GL_ENTRY(void, glTexGenfOES, GLenum coord, GLenum pname, GLfloat param)
+GL_ENTRY(void, glTexGenfvOES, GLenum coord, GLenum pname, const GLfloat *params)
+GL_ENTRY(void, glTexGeniOES, GLenum coord, GLenum pname, GLint param)
+GL_ENTRY(void, glTexGenivOES, GLenum coord, GLenum pname, const GLint *params)
+GL_ENTRY(void, glTexGenxOES, GLenum coord, GLenum pname, GLfixed param)
+GL_ENTRY(void, glTexGenxvOES, GLenum coord, GLenum pname, const GLfixed *params)
+GL_ENTRY(void, glGetTexGenfvOES, GLenum coord, GLenum pname, GLfloat *params)
+GL_ENTRY(void, glGetTexGenivOES, GLenum coord, GLenum pname, GLint *params)
+GL_ENTRY(void, glGetTexGenxvOES, GLenum coord, GLenum pname, GLfixed *params)
diff --git a/opengl/libs/hooks.h b/opengl/libs/hooks.h
index 63fb017..fd97254 100644
--- a/opengl/libs/hooks.h
+++ b/opengl/libs/hooks.h
@@ -22,9 +22,10 @@
 #include <errno.h>
 
 #include <EGL/egl.h>
+#include <EGL/eglext.h>
 #include <GLES/gl.h>
+#include <GLES/glext.h>
 
-#define GL_LOGGER                   0
 #if !defined(__arm__)
 #define USE_SLOW_BINDING            1
 #else
@@ -35,7 +36,7 @@
 #define MAX_NUMBER_OF_GL_EXTENSIONS 32
 
 
-#if defined(HAVE_ANDROID_OS) && !USE_SLOW_BINDING && !GL_LOGGER && __OPTIMIZE__
+#if defined(HAVE_ANDROID_OS) && !USE_SLOW_BINDING && __OPTIMIZE__
 #define USE_FAST_TLS_KEY            1
 #else
 #define USE_FAST_TLS_KEY            0
@@ -55,7 +56,10 @@
 enum {
     IMPL_HARDWARE = 0,
     IMPL_SOFTWARE,
-    IMPL_CONTEXT_LOST,
+    
+    IMPL_NUM_DRIVERS_IMPLEMENTATIONS,
+
+    IMPL_CONTEXT_LOST = IMPL_NUM_DRIVERS_IMPLEMENTATIONS,
     IMPL_NO_CONTEXT,
     
     IMPL_NUM_IMPLEMENTATIONS
@@ -73,6 +77,7 @@
 struct gl_hooks_t {
     struct gl_t {
         #include "gl_entries.in"
+        #include "glext_entries.in"
     } gl;
     struct egl_t {
         #include "egl_entries.in"
diff --git a/opengl/libs/tools/genfiles b/opengl/libs/tools/genfiles
new file mode 100755
index 0000000..107768b
--- /dev/null
+++ b/opengl/libs/tools/genfiles
@@ -0,0 +1,20 @@
+#! /bin/sh
+#
+# Copyright (C) 2008 Google Inc.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+./glapigen ../../include/GLES/gl.h > ../GLES_CM/gl_api.in 
+./glentrygen ../../include/GLES/gl.h > ../gl_entries.in 
+./glapigen ../../include/GLES/glext.h > ../GLES_CM/glext_api.in 
+./glentrygen ../../include/GLES/glext.h > ../glext_entries.in 
diff --git a/opengl/libs/tools/glapigen b/opengl/libs/tools/glapigen
new file mode 100755
index 0000000..a2c3a7b
--- /dev/null
+++ b/opengl/libs/tools/glapigen
@@ -0,0 +1,72 @@
+#! /usr/bin/perl
+#
+# Copyright (C) 2008 Google Inc.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+use strict;
+
+while (my $line = <>) {
+  next if $line =~ /^\//;
+  next if $line =~ /^#/;
+  next if $line =~ /^\s*$/;
+  if ($line !~ /^GL_API\s+(.+)\s+GL_APIENTRY\s+([\w]+)\s*\(([^\)]+)\);/) {
+    next;
+  }
+  my $type = $1;
+  my $name = $2;
+  my $args = $3;
+
+  #printf("%s", $line);
+  
+  my $prefix = "";
+  if ($name eq "glEGLImageTargetTexture2DOES") {
+    $prefix = "__";
+  }
+  if ($name eq "glEGLImageTargetRenderbufferStorageOES") {
+    $prefix = "__";
+  }
+  
+  printf("%s API_ENTRY(%s%s)(%s)", $type, $prefix, $name, $args);
+  
+  printf(" {\n");
+  if ($type eq "void") {
+    printf("    CALL_GL_API(%s", $name);
+  } else {
+    printf("    CALL_GL_API_RETURN(%s", $name);
+  }
+  my @args = split ',', $args;
+  my $len = scalar(@args);
+  for (my $num = 0; $num < $len; $num++) {
+    if ($args[$num] ne "void") {
+      print ", ";
+      #
+      # extract the name from the parameter
+      # type name
+      # const type *name
+      # type *name
+      # type name[4]
+      #
+      if ($args[$num] =~ /(\S+\s)+\**\s*([\w]+)/) {
+        printf("%s", $2);
+      }
+    }
+  }
+  printf(");\n");
+  printf("}\n");
+}
+
+
+
+
+
diff --git a/opengl/libs/tools/glentrygen b/opengl/libs/tools/glentrygen
new file mode 100755
index 0000000..5e0f7b6
--- /dev/null
+++ b/opengl/libs/tools/glentrygen
@@ -0,0 +1,31 @@
+#! /usr/bin/perl
+#
+# Copyright (C) 2008 Google Inc.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+use strict;
+
+while (my $line = <>) {
+  next if $line =~ /^\//;
+  next if $line =~ /^#/;
+  next if $line =~ /^\s*$/;
+  if ($line !~ /^GL_API\s+(.+)\s+GL_APIENTRY\s+([\w]+)\s*\(([^\)]+)\);/) {
+    next;
+  }
+  my $type = $1;
+  my $name = $2;
+  my $args = $3;
+
+  printf("GL_ENTRY(%s, %s, %s)\n", $type, $name, $args);
+}
diff --git a/opengl/tools/glgen/.gitignore b/opengl/tools/glgen/.gitignore
new file mode 100644
index 0000000..007ec65
--- /dev/null
+++ b/opengl/tools/glgen/.gitignore
@@ -0,0 +1,2 @@
+generated
+out
diff --git a/opengl/tools/glgen/gen b/opengl/tools/glgen/gen
index c060040c..011a6ed 100755
--- a/opengl/tools/glgen/gen
+++ b/opengl/tools/glgen/gen
@@ -1,28 +1,58 @@
-#!/bin/sh
+#!/bin/bash
+set -u
+set -e
 rm -rf out generated
 
 mkdir out
 mkdir -p out/javax/microedition/khronos/opengles
 mkdir -p out/com/google/android/gles_jni
 mkdir -p out/android/graphics
+mkdir -p out/android/opengl
 
 echo "package android.graphics;" > out/android/graphics/Canvas.java
 echo "public interface Canvas {}" >> out/android/graphics/Canvas.java
 
 GLFILE=out/javax/microedition/khronos/opengles/GL.java
-cp stubs/GLHeader.java-if $GLFILE
+cp stubs/jsr239/GLHeader.java-if $GLFILE
 
-GLGEN_FILES="CFunc.java CType.java CodeEmitter.java GenerateGL.java JFunc.java JType.java JniCodeEmitter.java ParameterChecker.java"
+GLGEN_FILES="CFunc.java CType.java CodeEmitter.java GenerateGL.java GenerateGLES.java GLESCodeEmitter.java JFunc.java JniCodeEmitter.java JType.java Jsr239CodeEmitter.java ParameterChecker.java"
 
 pushd src > /dev/null
 javac ${GLGEN_FILES}
+JAVAC_RESULT=$?
+if [ $JAVAC_RESULT -ne 0 ]; then
+    echo "Could not compile glgen."
+    exit $JAVAC_RESULT
+fi
 popd > /dev/null
-java -classpath src GenerateGL -c glspec-1.0 glspec-1.0ext glspec-1.1 glspec-1.1ext glspec-1.1extpack glspec-checks
+
+echo "Generating JSR239-like APIs"
+java -classpath src GenerateGL -c specs/jsr239/glspec-1.0 specs/jsr239/glspec-1.0ext specs/jsr239/glspec-1.1 specs/jsr239/glspec-1.1ext specs/jsr239/glspec-1.1extpack specs/jsr239/glspec-checks
+JAVA_RESULT=$?
+if [ $JAVA_RESULT -ne 0 ]; then
+    echo "Could not run GenerateGL."
+    exit $JAVA_RESULT
+fi
+
+echo "Generating static OpenGLES 1.1 bindings"
+java -classpath src GenerateGLES
+JAVA_RESULT=$?
+if [ $JAVA_RESULT -ne 0 ]; then
+    echo "Could not run GenerateGLES."
+    exit $JAVA_RESULT
+fi
+
+rm src/*.class
 
 pushd out > /dev/null
 mkdir classes
-javac -d classes com/google/android/gles_jni/GLImpl.java javax/microedition/khronos/opengles/GL10.java javax/microedition/khronos/opengles/GL10Ext.java javax/microedition/khronos/opengles/GL11.java javax/microedition/khronos/opengles/GL11Ext.java javax/microedition/khronos/opengles/GL11ExtensionPack.java
+javac -d classes com/google/android/gles_jni/GLImpl.java javax/microedition/khronos/opengles/GL10.java javax/microedition/khronos/opengles/GL10Ext.java javax/microedition/khronos/opengles/GL11.java javax/microedition/khronos/opengles/GL11Ext.java javax/microedition/khronos/opengles/GL11ExtensionPack.java android/opengl/GLES10.java android/opengl/GLES10Ext.java android/opengl/GLES11.java android/opengl/GLES11Ext.java
 popd > /dev/null
+JAVA_RESULT=$?
+if [ $JAVA_RESULT -ne 0 ]; then
+    echo "Could not compile generated classes."
+    exit $JAVA_RESULT
+fi
 
 rm -rf generated
 mkdir -p generated/C
@@ -30,81 +60,44 @@
 cp -r out/com generated
 cp -r out/javax generated
 
+cp out/android_opengl_*.cpp generated/C
+mkdir -p generated/android/opengl
+cp -r out/android/opengl generated/android
+
 rm -rf out
 KEEP_GENERATED=0
+SAID_PLEASE=0
 
-# com_google_android_gles_jni_GLImpl.cpp
-if cmp ../../../../../frameworks/base/core/jni/com_google_android_gles_jni_GLImpl.cpp generated/C/com_google_android_gles_jni_GLImpl.cpp ; then
-echo com_google_android_gles_jni_GLImpl.cpp unchanged
-else
-echo Please p4 edit ../../../../../frameworks/base/core/jni/com_google_android_gles_jni_GLImpl.cpp
-echo Please cp generated/C/com_google_android_gles_jni_GLImpl.cpp ../../../../../frameworks/base/core/jni
-KEEP_GENERATED=1
-fi
+# compareGenerated destDir generatedDir file
+compareGenerated() {
+    if cmp -s $1/$3 $2/$3 ; then
+        echo "#    " $3 unchanged
+    else
+        if [ $SAID_PLEASE == "0" ] ; then
+            echo Please evaluate the following commands:
+            echo
+            SAID_PLEASE=1
+        fi
+        echo "    " cp $2/$3 $1
+        echo "    " git add $1/$3
+        KEEP_GENERATED=1
+    fi
+}
 
-# GLImpl.java
-if cmp ../../java/com/google/android/gles_jni/GLImpl.java generated/com/google/android/gles_jni/GLImpl.java ; then
-echo GLImpl.java unchanged
-else
-echo Please edit ../../java/com/google/android/gles_jni/GLImpl.java
-echo Please cp generated/com/google/android/gles_jni/GLImpl.java ../../java/com/google/android/gles_jni
-KEEP_GENERATED=1
-fi
+compareGenerated ../../../core/jni generated/C com_google_android_gles_jni_GLImpl.cpp
+compareGenerated ../../java/com/google/android/gles_jni generated/com/google/android/gles_jni GLImpl.java
 
-# GL.java
-if cmp ../../java/javax/microedition/khronos/opengles/GL.java generated/javax/microedition/khronos/opengles/GL.java ; then
-echo GL.java unchanged
-else
-echo Please edit ../../java/javax/microedition/khronos/opengles/GL.java
-echo Please cp generated/javax/microedition/khronos/opengles/GL.java ../../java/javax/microedition/khronos/opengles/GL.java
-KEEP_GENERATED=1
-fi
+for x in GL.java GL10.java GL10Ext.java GL11.java GL11Ext.java GL11ExtensionPack.java
+do
+    compareGenerated ../../java/javax/microedition/khronos/opengles generated/javax/microedition/khronos/opengles $x
+done
 
-# GL10.java
-if cmp ../../java/javax/microedition/khronos/opengles/GL10.java generated/javax/microedition/khronos/opengles/GL10.java ; then
-echo GL10.java unchanged
-else
-echo Please edit ../../java/javax/microedition/khronos/opengles/GL10.java
-echo Please cp generated/javax/microedition/khronos/opengles/GL10.java ../../java/javax/microedition/khronos/opengles/GL10.java
-KEEP_GENERATED=1
-fi
-
-# GL10Ext.java
-if cmp ../../java/javax/microedition/khronos/opengles/GL10Ext.java generated/javax/microedition/khronos/opengles/GL10Ext.java ; then
-echo GL10Ext.java unchanged
-else
-echo Please edit ../../java/javax/microedition/khronos/opengles/GL10Ext.java
-echo Please cp generated/javax/microedition/khronos/opengles/GL10Ext.java ../../java/javax/microedition/khronos/opengles/GL10Ext.java
-KEEP_GENERATED=1
-fi
-
-# GL11.java
-if cmp ../../java/javax/microedition/khronos/opengles/GL11.java generated/javax/microedition/khronos/opengles/GL11.java ; then
-echo GL11.java unchanged
-else
-echo Please edit ../../java/javax/microedition/khronos/opengles/GL11.java
-echo Please cp generated/javax/microedition/khronos/opengles/GL11.java ../../java/javax/microedition/khronos/opengles/GL11.java
-KEEP_GENERATED=1
-fi
-
-# GL11Ext.java
-if cmp ../../java/javax/microedition/khronos/opengles/GL11Ext.java generated/javax/microedition/khronos/opengles/GL11Ext.java ; then
-echo GL11Ext.java unchanged
-else
-echo Please edit ../../java/javax/microedition/khronos/opengles/GL11Ext.java
-echo Please cp generated/javax/microedition/khronos/opengles/GL11Ext.java ../../java/javax/microedition/khronos/opengles/GL11Ext.java
-KEEP_GENERATED=1
-fi
-
-# GL11ExtensionPack.java
-if cmp ../../java/javax/microedition/khronos/opengles/GL11ExtensionPack.java generated/javax/microedition/khronos/opengles/GL11ExtensionPack.java ; then
-echo GL11ExtensionPack.java unchanged
-else
-echo Please edit ../../java/javax/microedition/khronos/opengles/GL11ExtensionPack.java
-echo Please cp generated/javax/microedition/khronos/opengles/GL11ExtensionPack.java ../../java/javax/microedition/khronos/opengles/GL11ExtensionPack.java
-KEEP_GENERATED=1
-fi
+for x in GLES10 GLES10Ext GLES11 GLES11Ext
+do
+    compareGenerated ../../java/android/opengl generated/android/opengl ${x}.java
+    compareGenerated ../../../core/jni generated/C android_opengl_${x}.cpp
+done
 
 if [ $KEEP_GENERATED == "0" ] ; then
-rm -rf generated
+    rm -rf generated
 fi
diff --git a/opengl/tools/glgen/specs/gles11/GLES10.spec b/opengl/tools/glgen/specs/gles11/GLES10.spec
new file mode 100644
index 0000000..8e1152d
--- /dev/null
+++ b/opengl/tools/glgen/specs/gles11/GLES10.spec
@@ -0,0 +1,106 @@
+void glActiveTexture ( GLenum texture )
+void glAlphaFunc ( GLenum func, GLclampf ref )
+void glAlphaFuncx ( GLenum func, GLclampx ref )
+void glBindTexture ( GLenum target, GLuint texture )
+void glBlendFunc ( GLenum sfactor, GLenum dfactor )
+void glClear ( GLbitfield mask )
+void glClearColor ( GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha )
+void glClearColorx ( GLclampx red, GLclampx green, GLclampx blue, GLclampx alpha )
+void glClearDepthf ( GLclampf depth )
+void glClearDepthx ( GLclampx depth )
+void glClearStencil ( GLint s )
+void glClientActiveTexture ( GLenum texture )
+void glColor4f ( GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha )
+void glColor4x ( GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha )
+void glColorMask ( GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha )
+void glColorPointer ( GLint size, GLenum type, GLsizei stride, const GLvoid *pointer )
+void glCompressedTexImage2D ( GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data )
+void glCompressedTexSubImage2D ( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data )
+void glCopyTexImage2D ( GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border )
+void glCopyTexSubImage2D ( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height )
+void glCullFace ( GLenum mode )
+void glDeleteTextures ( GLsizei n, const GLuint *textures )
+void glDepthFunc ( GLenum func )
+void glDepthMask ( GLboolean flag )
+void glDepthRangef ( GLclampf zNear, GLclampf zFar )
+void glDepthRangex ( GLclampx zNear, GLclampx zFar )
+void glDisable ( GLenum cap )
+void glDisableClientState ( GLenum array )
+void glDrawArrays ( GLenum mode, GLint first, GLsizei count )
+void glDrawElements ( GLenum mode, GLsizei count, GLenum type, const GLvoid *indices )
+void glEnable ( GLenum cap )
+void glEnableClientState ( GLenum array )
+void glFinish ( void )
+void glFlush ( void )
+void glFogf ( GLenum pname, GLfloat param )
+void glFogfv ( GLenum pname, const GLfloat *params )
+void glFogx ( GLenum pname, GLfixed param )
+void glFogxv ( GLenum pname, const GLfixed *params )
+void glFrontFace ( GLenum mode )
+void glFrustumf ( GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar )
+void glFrustumx ( GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar )
+void glGenTextures ( GLsizei n, GLuint *textures )
+GLenum glGetError ( void )
+void glGetIntegerv ( GLenum pname, GLint *params )
+const GLubyte * glGetString ( GLenum name )
+void glHint ( GLenum target, GLenum mode )
+void glLightModelf ( GLenum pname, GLfloat param )
+void glLightModelfv ( GLenum pname, const GLfloat *params )
+void glLightModelx ( GLenum pname, GLfixed param )
+void glLightModelxv ( GLenum pname, const GLfixed *params )
+void glLightf ( GLenum light, GLenum pname, GLfloat param )
+void glLightfv ( GLenum light, GLenum pname, const GLfloat *params )
+void glLightx ( GLenum light, GLenum pname, GLfixed param )
+void glLightxv ( GLenum light, GLenum pname, const GLfixed *params )
+void glLineWidth ( GLfloat width )
+void glLineWidthx ( GLfixed width )
+void glLoadIdentity ( void )
+void glLoadMatrixf ( const GLfloat *m )
+void glLoadMatrixx ( const GLfixed *m )
+void glLogicOp ( GLenum opcode )
+void glMaterialf ( GLenum face, GLenum pname, GLfloat param )
+void glMaterialfv ( GLenum face, GLenum pname, const GLfloat *params )
+void glMaterialx ( GLenum face, GLenum pname, GLfixed param )
+void glMaterialxv ( GLenum face, GLenum pname, const GLfixed *params )
+void glMatrixMode ( GLenum mode )
+void glMultMatrixf ( const GLfloat *m )
+void glMultMatrixx ( const GLfixed *m )
+void glMultiTexCoord4f ( GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q )
+void glMultiTexCoord4x ( GLenum target, GLfixed s, GLfixed t, GLfixed r, GLfixed q )
+void glNormal3f ( GLfloat nx, GLfloat ny, GLfloat nz )
+void glNormal3x ( GLfixed nx, GLfixed ny, GLfixed nz )
+void glNormalPointer ( GLenum type, GLsizei stride, const GLvoid *pointer )
+void glOrthof ( GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar )
+void glOrthox ( GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar )
+void glPixelStorei ( GLenum pname, GLint param )
+void glPointSize ( GLfloat size )
+void glPointSizex ( GLfixed size )
+void glPolygonOffset ( GLfloat factor, GLfloat units )
+void glPolygonOffsetx ( GLfixed factor, GLfixed units )
+void glPopMatrix ( void )
+void glPushMatrix ( void )
+void glReadPixels ( GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels )
+void glRotatef ( GLfloat angle, GLfloat x, GLfloat y, GLfloat z )
+void glRotatex ( GLfixed angle, GLfixed x, GLfixed y, GLfixed z )
+void glSampleCoverage ( GLclampf value, GLboolean invert )
+void glSampleCoveragex ( GLclampx value, GLboolean invert )
+void glScalef ( GLfloat x, GLfloat y, GLfloat z )
+void glScalex ( GLfixed x, GLfixed y, GLfixed z )
+void glScissor ( GLint x, GLint y, GLsizei width, GLsizei height )
+void glShadeModel ( GLenum mode )
+void glStencilFunc ( GLenum func, GLint ref, GLuint mask )
+void glStencilMask ( GLuint mask )
+void glStencilOp ( GLenum fail, GLenum zfail, GLenum zpass )
+void glTexCoordPointer ( GLint size, GLenum type, GLsizei stride, const GLvoid *pointer )
+void glTexEnvf ( GLenum target, GLenum pname, GLfloat param )
+void glTexEnvfv ( GLenum target, GLenum pname, const GLfloat *params )
+void glTexEnvx ( GLenum target, GLenum pname, GLfixed param )
+void glTexEnvxv ( GLenum target, GLenum pname, const GLfixed *params )
+void glTexImage2D ( GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels )
+void glTexParameterf ( GLenum target, GLenum pname, GLfloat param )
+void glTexParameterx ( GLenum target, GLenum pname, GLfixed param )
+void glTexSubImage2D ( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels )
+void glTranslatef ( GLfloat x, GLfloat y, GLfloat z )
+void glTranslatex ( GLfixed x, GLfixed y, GLfixed z )
+void glVertexPointer ( GLint size, GLenum type, GLsizei stride, const GLvoid *pointer )
+void glViewport ( GLint x, GLint y, GLsizei width, GLsizei height )
diff --git a/opengl/tools/glgen/specs/gles11/GLES10Ext.spec b/opengl/tools/glgen/specs/gles11/GLES10Ext.spec
new file mode 100644
index 0000000..53f6c65
--- /dev/null
+++ b/opengl/tools/glgen/specs/gles11/GLES10Ext.spec
@@ -0,0 +1 @@
+GLbitfield glQueryMatrixxOES ( GLfixed *mantissa, GLint *exponent )
diff --git a/opengl/tools/glgen/specs/gles11/GLES11.spec b/opengl/tools/glgen/specs/gles11/GLES11.spec
new file mode 100644
index 0000000..5527c18
--- /dev/null
+++ b/opengl/tools/glgen/specs/gles11/GLES11.spec
@@ -0,0 +1,44 @@
+void glBindBuffer ( GLenum target, GLuint buffer )
+void glBufferData ( GLenum target, GLsizeiptr size, const GLvoid *data, GLenum usage )
+void glBufferSubData ( GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid *data )
+void glClipPlanef ( GLenum plane, const GLfloat *equation )
+void glClipPlanex ( GLenum plane, const GLfixed *equation )
+void glColor4ub ( GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha )
+void glColorPointer ( GLint size, GLenum type, GLsizei stride, GLint offset )
+void glDeleteBuffers ( GLsizei n, const GLuint *buffers )
+void glDrawElements ( GLenum mode, GLsizei count, GLenum type, GLint offset )
+void glGenBuffers ( GLsizei n, GLuint *buffers )
+void glGetBooleanv ( GLenum pname, GLboolean *params )
+void glGetBufferParameteriv ( GLenum target, GLenum pname, GLint *params )
+void glGetClipPlanef ( GLenum pname, GLfloat *eqn )
+void glGetClipPlanex ( GLenum pname, GLfixed *eqn )
+void glGetFixedv ( GLenum pname, GLfixed *params )
+void glGetFloatv ( GLenum pname, GLfloat *params )
+void glGetLightfv ( GLenum light, GLenum pname, GLfloat *params )
+void glGetLightxv ( GLenum light, GLenum pname, GLfixed *params )
+void glGetMaterialfv ( GLenum face, GLenum pname, GLfloat *params )
+void glGetMaterialxv ( GLenum face, GLenum pname, GLfixed *params )
+// void glGetPointerv ( GLenum pname, void **params )
+void glGetTexEnvfv ( GLenum env, GLenum pname, GLfloat *params )
+void glGetTexEnviv ( GLenum env, GLenum pname, GLint *params )
+void glGetTexEnvxv ( GLenum env, GLenum pname, GLfixed *params )
+void glGetTexParameterfv ( GLenum target, GLenum pname, GLfloat *params )
+void glGetTexParameteriv ( GLenum target, GLenum pname, GLint *params )
+void glGetTexParameterxv ( GLenum target, GLenum pname, GLfixed *params )
+GLboolean glIsBuffer ( GLuint buffer )
+GLboolean glIsEnabled ( GLenum cap )
+GLboolean glIsTexture ( GLuint texture )
+void glNormalPointer ( GLenum type, GLsizei stride, GLint offset )
+void glPointParameterf ( GLenum pname, GLfloat param )
+void glPointParameterfv ( GLenum pname, const GLfloat *params )
+void glPointParameterx ( GLenum pname, GLfixed param )
+void glPointParameterxv ( GLenum pname, const GLfixed *params )
+void glPointSizePointerOES ( GLenum type, GLsizei stride, const GLvoid *pointer )
+void glTexCoordPointer ( GLint size, GLenum type, GLsizei stride, GLint offset )
+void glTexEnvi ( GLenum target, GLenum pname, GLint param )
+void glTexEnviv ( GLenum target, GLenum pname, const GLint *params )
+void glTexParameterfv ( GLenum target, GLenum pname, const GLfloat *params )
+void glTexParameteri ( GLenum target, GLenum pname, GLint param )
+void glTexParameteriv ( GLenum target, GLenum pname, const GLint *params )
+void glTexParameterxv ( GLenum target, GLenum pname, const GLfixed *params )
+void glVertexPointer ( GLint size, GLenum type, GLsizei stride, GLint offset )
diff --git a/opengl/tools/glgen/specs/gles11/GLES11Ext.spec b/opengl/tools/glgen/specs/gles11/GLES11Ext.spec
new file mode 100644
index 0000000..cd7333a
--- /dev/null
+++ b/opengl/tools/glgen/specs/gles11/GLES11Ext.spec
@@ -0,0 +1,90 @@
+void glBlendEquationSeparateOES ( GLenum modeRGB, GLenum modeAlpha )
+void glBlendFuncSeparateOES ( GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha )
+void glBlendEquationOES ( GLenum mode )
+void glDrawTexsOES ( GLshort x, GLshort y, GLshort z, GLshort width, GLshort height )
+void glDrawTexiOES ( GLint x, GLint y, GLint z, GLint width, GLint height )
+void glDrawTexxOES ( GLfixed x, GLfixed y, GLfixed z, GLfixed width, GLfixed height )
+void glDrawTexsvOES ( const GLshort *coords )
+void glDrawTexivOES ( const GLint *coords )
+void glDrawTexxvOES ( const GLfixed *coords )
+void glDrawTexfOES ( GLfloat x, GLfloat y, GLfloat z, GLfloat width, GLfloat height )
+void glDrawTexfvOES ( const GLfloat *coords )
+void glEGLImageTargetTexture2DOES ( GLenum target, GLeglImageOES image )
+void glEGLImageTargetRenderbufferStorageOES ( GLenum target, GLeglImageOES image )
+void glAlphaFuncxOES ( GLenum func, GLclampx ref )
+void glClearColorxOES ( GLclampx red, GLclampx green, GLclampx blue, GLclampx alpha )
+void glClearDepthxOES ( GLclampx depth )
+void glClipPlanexOES ( GLenum plane, const GLfixed *equation )
+void glColor4xOES ( GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha )
+void glDepthRangexOES ( GLclampx zNear, GLclampx zFar )
+void glFogxOES ( GLenum pname, GLfixed param )
+void glFogxvOES ( GLenum pname, const GLfixed *params )
+void glFrustumxOES ( GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar )
+void glGetClipPlanexOES ( GLenum pname, GLfixed *eqn )
+void glGetFixedvOES ( GLenum pname, GLfixed *params )
+void glGetLightxvOES ( GLenum light, GLenum pname, GLfixed *params )
+void glGetMaterialxvOES ( GLenum face, GLenum pname, GLfixed *params )
+void glGetTexEnvxvOES ( GLenum env, GLenum pname, GLfixed *params )
+void glGetTexParameterxvOES ( GLenum target, GLenum pname, GLfixed *params )
+void glLightModelxOES ( GLenum pname, GLfixed param )
+void glLightModelxvOES ( GLenum pname, const GLfixed *params )
+void glLightxOES ( GLenum light, GLenum pname, GLfixed param )
+void glLightxvOES ( GLenum light, GLenum pname, const GLfixed *params )
+void glLineWidthxOES ( GLfixed width )
+void glLoadMatrixxOES ( const GLfixed *m )
+void glMaterialxOES ( GLenum face, GLenum pname, GLfixed param )
+void glMaterialxvOES ( GLenum face, GLenum pname, const GLfixed *params )
+void glMultMatrixxOES ( const GLfixed *m )
+void glMultiTexCoord4xOES ( GLenum target, GLfixed s, GLfixed t, GLfixed r, GLfixed q )
+void glNormal3xOES ( GLfixed nx, GLfixed ny, GLfixed nz )
+void glOrthoxOES ( GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar )
+void glPointParameterxOES ( GLenum pname, GLfixed param )
+void glPointParameterxvOES ( GLenum pname, const GLfixed *params )
+void glPointSizexOES ( GLfixed size )
+void glPolygonOffsetxOES ( GLfixed factor, GLfixed units )
+void glRotatexOES ( GLfixed angle, GLfixed x, GLfixed y, GLfixed z )
+void glSampleCoveragexOES ( GLclampx value, GLboolean invert )
+void glScalexOES ( GLfixed x, GLfixed y, GLfixed z )
+void glTexEnvxOES ( GLenum target, GLenum pname, GLfixed param )
+void glTexEnvxvOES ( GLenum target, GLenum pname, const GLfixed *params )
+void glTexParameterxOES ( GLenum target, GLenum pname, GLfixed param )
+void glTexParameterxvOES ( GLenum target, GLenum pname, const GLfixed *params )
+void glTranslatexOES ( GLfixed x, GLfixed y, GLfixed z )
+GLboolean glIsRenderbufferOES ( GLuint renderbuffer )
+void glBindRenderbufferOES ( GLenum target, GLuint renderbuffer )
+void glDeleteRenderbuffersOES ( GLsizei n, const GLuint *renderbuffers )
+void glGenRenderbuffersOES ( GLsizei n, GLuint *renderbuffers )
+void glRenderbufferStorageOES ( GLenum target, GLenum internalformat, GLsizei width, GLsizei height )
+void glGetRenderbufferParameterivOES ( GLenum target, GLenum pname, GLint *params )
+GLboolean glIsFramebufferOES ( GLuint framebuffer )
+void glBindFramebufferOES ( GLenum target, GLuint framebuffer )
+void glDeleteFramebuffersOES ( GLsizei n, const GLuint *framebuffers )
+void glGenFramebuffersOES ( GLsizei n, GLuint *framebuffers )
+GLenum glCheckFramebufferStatusOES ( GLenum target )
+void glFramebufferRenderbufferOES ( GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer )
+void glFramebufferTexture2DOES ( GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level )
+void glGetFramebufferAttachmentParameterivOES ( GLenum target, GLenum attachment, GLenum pname, GLint *params )
+void glGenerateMipmapOES ( GLenum target )
+// Hard to export to Java:
+// void *glMapBufferOES ( GLenum target, GLenum access )
+// GLboolean glUnmapBufferOES ( GLenum target )
+// void glGetBufferPointervOES ( GLenum target, GLenum pname, void **params )
+void glCurrentPaletteMatrixOES ( GLuint matrixpaletteindex )
+void glLoadPaletteFromModelViewMatrixOES ( void )
+void glMatrixIndexPointerOES ( GLint size, GLenum type, GLsizei stride, const GLvoid *pointer )
+void glWeightPointerOES ( GLint size, GLenum type, GLsizei stride, const GLvoid *pointer )
+void glDepthRangefOES ( GLclampf zNear, GLclampf zFar )
+void glFrustumfOES ( GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar )
+void glOrthofOES ( GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar )
+void glClipPlanefOES ( GLenum plane, const GLfloat *equation )
+void glGetClipPlanefOES ( GLenum pname, GLfloat *eqn )
+void glClearDepthfOES ( GLclampf depth )
+void glTexGenfOES ( GLenum coord, GLenum pname, GLfloat param )
+void glTexGenfvOES ( GLenum coord, GLenum pname, const GLfloat *params )
+void glTexGeniOES ( GLenum coord, GLenum pname, GLint param )
+void glTexGenivOES ( GLenum coord, GLenum pname, const GLint *params )
+void glTexGenxOES ( GLenum coord, GLenum pname, GLfixed param )
+void glTexGenxvOES ( GLenum coord, GLenum pname, const GLfixed *params )
+void glGetTexGenfvOES ( GLenum coord, GLenum pname, GLfloat *params )
+void glGetTexGenivOES ( GLenum coord, GLenum pname, GLint *params )
+void glGetTexGenxvOES ( GLenum coord, GLenum pname, GLfixed *params )
diff --git a/opengl/tools/glgen/specs/gles11/checks.spec b/opengl/tools/glgen/specs/gles11/checks.spec
new file mode 100644
index 0000000..97dac2e
--- /dev/null
+++ b/opengl/tools/glgen/specs/gles11/checks.spec
@@ -0,0 +1,61 @@
+glClipPlanef check eqn 4

+glClipPlanex check eqn 4

+glGetClipPlanefOES check eqn 4

+glGetClipPlanexOES check eqn 4

+glDeleteBuffers check buffers n 

+glDeleteTextures check textures n

+glDrawElements check_AIOOBE indices count

+glFog ifcheck params 1 pname GL_FOG_MODE,GL_FOG_DENSITY,GL_FOG_START,GL_FOG_END ifcheck params 4 pname GL_FOG_COLOR

+glGenBuffers check buffers n

+glGenTextures check textures n

+glGetClipPlane check eqn 4

+glGetIntegerv ifcheck params 1 pname GL_ALPHA_BITS,GL_ALPHA_TEST_FUNC,GL_ALPHA_TEST_REF,GL_BLEND_DST,GL_BLUE_BITS,GL_COLOR_ARRAY_BUFFER_BINDING,GL_COLOR_ARRAY_SIZE,GL_COLOR_ARRAY_STRIDE,GL_COLOR_ARRAY_TYPE,GL_CULL_FACE,GL_DEPTH_BITS,GL_DEPTH_CLEAR_VALUE,GL_DEPTH_FUNC,GL_DEPTH_WRITEMASK,GL_FOG_DENSITY,GL_FOG_END,GL_FOG_MODE,GL_FOG_START,GL_FRONT_FACE,GL_GREEN_BITS,GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES,GL_IMPLEMENTATION_COLOR_READ_TYPE_OES,GL_LIGHT_MODEL_TWO_SIDE,GL_LINE_SMOOTH_HINT,GL_LINE_WIDTH,GL_LOGIC_OP_MODE,GL_MATRIX_INDEX_ARRAY_BUFFER_BINDING_OES,GL_MATRIX_INDEX_ARRAY_SIZE_OES,GL_MATRIX_INDEX_ARRAY_STRIDE_OES,GL_MATRIX_INDEX_ARRAY_TYPE_OES,GL_MATRIX_MODE,GL_MAX_CLIP_PLANES,GL_MAX_ELEMENTS_INDICES,GL_MAX_ELEMENTS_VERTICES,GL_MAX_LIGHTS,GL_MAX_MODELVIEW_STACK_DEPTH,GL_MAX_PALETTE_MATRICES_OES,GL_MAX_PROJECTION_STACK_DEPTH,GL_MAX_TEXTURE_SIZE,GL_MAX_TEXTURE_STACK_DEPTH,GL_MAX_TEXTURE_UNITS,GL_MAX_VERTEX_UNITS_OES,GL_MODELVIEW_STACK_DEPTH,GL_NORMAL_ARRAY_BUFFER_BINDING,GL_NORMAL_ARRAY_STRIDE,GL_NORMAL_ARRAY_TYPE,GL_NUM_COMPRESSED_TEXTURE_FORMATS,GL_PACK_ALIGNMENT,GL_PERSPECTIVE_CORRECTION_HINT,GL_POINT_SIZE,GL_POINT_SIZE_ARRAY_BUFFER_BINDING_OES,GL_POINT_SIZE_ARRAY_STRIDE_OES,GL_POINT_SIZE_ARRAY_TYPE_OES,GL_POINT_SMOOTH_HINT,GL_POLYGON_OFFSET_FACTOR,GL_POLYGON_OFFSET_UNITS,GL_PROJECTION_STACK_DEPTH,GL_RED_BITS,GL_SHADE_MODEL,GL_STENCIL_BITS,GL_STENCIL_CLEAR_VALUE,GL_STENCIL_FAIL,GL_STENCIL_FUNC,GL_STENCIL_PASS_DEPTH_FAIL,GL_STENCIL_PASS_DEPTH_PASS,GL_STENCIL_REF,GL_STENCIL_VALUE_MASK,GL_STENCIL_WRITEMASK,GL_SUBPIXEL_BITS,GL_TEXTURE_BINDING_2D,GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING,GL_TEXTURE_COORD_ARRAY_SIZE,GL_TEXTURE_COORD_ARRAY_STRIDE,GL_TEXTURE_COORD_ARRAY_TYPE,GL_TEXTURE_STACK_DEPTH,GL_UNPACK_ALIGNMENT,GL_VERTEX_ARRAY_BUFFER_BINDING,GL_VERTEX_ARRAY_SIZE,GL_VERTEX_ARRAY_STRIDE,GL_VERTEX_ARRAY_TYPE,GL_WEIGHT_ARRAY_BUFFER_BINDING_OES,GL_WEIGHT_ARRAY_SIZE_OES,GL_WEIGHT_ARRAY_STRIDE_OES,GL_WEIGHT_ARRAY_TYPE_OES ifcheck params 2 pname GL_ALIASED_POINT_SIZE_RANGE,GL_ALIASED_LINE_WIDTH_RANGE,GL_DEPTH_RANGE,GL_MAX_VIEWPORT_DIMS,GL_SMOOTH_LINE_WIDTH_RANGE,GL_SMOOTH_POINT_SIZE_RANGE ifcheck params 4 pname GL_COLOR_CLEAR_VALUE,GL_COLOR_WRITEMASK,GL_SCISSOR_BOX,GL_VIEWPORT ifcheck params 16 pname GL_MODELVIEW_MATRIX,GL_MODELVIEW_MATRIX_FLOAT_AS_INT_BITS_OES,GL_PROJECTION_MATRIX,GL_PROJECTION_MATRIX_FLOAT_AS_INT_BITS_OES,GL_TEXTURE_MATRIX,GL_TEXTURE_MATRIX_FLOAT_AS_INT_BITS_OES ifcheck params _NUM_COMPRESSED_TEXTURE_FORMATS pname GL_COMPRESSED_TEXTURE_FORMATS,GL_FOG_COLOR,GL_LIGHT_MODEL_AMBIENT

+glGetLight ifcheck params 1 pname GL_SPOT_EXPONENT,GL_SPOT_CUTOFF,GL_CONSTANT_ATTENUATION,GL_LINEAR_ATTENUATION,GL_QUADRATIC_ATTENUATION ifcheck params 3 pname GL_SPOT_DIRECTION ifcheck params 4 pname GL_AMBIENT,GL_DIFFUSE,GL_SPECULAR,GL_EMISSION

+glGetMaterial ifcheck params 1 pname GL_SHININESS ifcheck params 4 pname GL_AMBIENT,GL_DIFFUSE,GL_SPECULAR,GL_EMISSION,GL_AMBIENT_AND_DIFFUSE

+glGetTexEnv ifcheck params 1 pname GL_TEXTURE_ENV_MODE,GL_COMBINE_RGB,GL_COMBINE_ALPHA ifcheck params 4 pname GL_TEXTURE_ENV_COLOR

+glGetTexParameter check params 1

+glLightModel ifcheck params 1 pname GL_LIGHT_MODEL_TWO_SIDE ifcheck params 4 pname GL_LIGHT_MODEL_AMBIENT

+glLight ifcheck params 1 pname GL_SPOT_EXPONENT,GL_SPOT_CUTOFF,GL_CONSTANT_ATTENUATION,GL_LINEAR_ATTENUATION,GL_QUADRATIC_ATTENUATION ifcheck params 3 pname GL_SPOT_DIRECTION ifcheck params 4 pname GL_AMBIENT,GL_DIFFUSE,GL_SPECULAR,GL_EMISSION

+glLoadMatrix check m 16

+glMaterial ifcheck params 1 pname GL_SHININESS ifcheck params 4 pname GL_AMBIENT,GL_DIFFUSE,GL_SPECULAR,GL_EMISSION,GL_AMBIENT_AND_DIFFUSE

+glMultMatrix check m 16

+glPointParameter check params 1

+glTexEnv ifcheck params 1 pname GL_TEXTURE_ENV_MODE,GL_COMBINE_RGB,GL_COMBINE_ALPHA ifcheck params 4 pname GL_TEXTURE_ENV_COLOR

+glTexImage2D nullAllowed

+glTexSubImage2D nullAllowed

+glBufferData nullAllowed

+glTexParameter check params 1

+glQueryMatrixxOES check mantissa 16 check exponent 16 return -1

+glDrawTexfvOES check coords 5

+glDrawTexivOES check coords 5

+glDrawTexsvOES check coords 5

+glDrawTexxvOES check coords 5

+glBindFramebufferOES unsupported

+glBindRenderbufferOES unsupported

+glBlendEquation unsupported

+glBlendEquationSeparate unsupported

+glBlendFuncSeparate unsupported

+glCheckFramebufferStatusOES unsupported return 0

+glCurrentPaletteMatrixOES unsupported

+glDeleteFramebuffersOES unsupported

+glDeleteRenderbuffersOES unsupported

+glFramebufferRenderbufferOES unsupported

+glFramebufferStorageOES unsupported

+glFramebufferTexture2DOES unsupported

+glGenFramebuffersOES unsupported

+glGenRenderbuffersOES unsupported

+glGenerateMipmapOES unsupported

+glGetBufferParameter unsupported

+glGetFramebufferAttachmentParameterivOES unsupported

+glGetRenderbufferParameterivOES unsupported

+glGetTexGen unsupported

+glIsFramebufferOES unsupported return JNI_FALSE

+glIsRenderbufferOES unsupported return JNI_FALSE

+glLoadPaletteFromModelViewMatrixOES unsupported

+glMatrixIndexPointerOES unsupported

+glRenderbufferStorageOES unsupported return false

+glTexGen unsupported

+glTexGenf unsupported

+glTexGeni unsupported

+glTexGenx unsupported

+glWeightPointerOES unsupported

diff --git a/opengl/tools/glgen/glspec-1.0 b/opengl/tools/glgen/specs/jsr239/glspec-1.0
similarity index 100%
rename from opengl/tools/glgen/glspec-1.0
rename to opengl/tools/glgen/specs/jsr239/glspec-1.0
diff --git a/opengl/tools/glgen/glspec-1.0ext b/opengl/tools/glgen/specs/jsr239/glspec-1.0ext
similarity index 100%
rename from opengl/tools/glgen/glspec-1.0ext
rename to opengl/tools/glgen/specs/jsr239/glspec-1.0ext
diff --git a/opengl/tools/glgen/glspec-1.1 b/opengl/tools/glgen/specs/jsr239/glspec-1.1
similarity index 100%
rename from opengl/tools/glgen/glspec-1.1
rename to opengl/tools/glgen/specs/jsr239/glspec-1.1
diff --git a/opengl/tools/glgen/glspec-1.1ext b/opengl/tools/glgen/specs/jsr239/glspec-1.1ext
similarity index 100%
rename from opengl/tools/glgen/glspec-1.1ext
rename to opengl/tools/glgen/specs/jsr239/glspec-1.1ext
diff --git a/opengl/tools/glgen/glspec-1.1extpack b/opengl/tools/glgen/specs/jsr239/glspec-1.1extpack
similarity index 100%
rename from opengl/tools/glgen/glspec-1.1extpack
rename to opengl/tools/glgen/specs/jsr239/glspec-1.1extpack
diff --git a/opengl/tools/glgen/glspec-checks b/opengl/tools/glgen/specs/jsr239/glspec-checks
similarity index 100%
rename from opengl/tools/glgen/glspec-checks
rename to opengl/tools/glgen/specs/jsr239/glspec-checks
diff --git a/opengl/tools/glgen/src/.gitignore b/opengl/tools/glgen/src/.gitignore
new file mode 100644
index 0000000..6b468b6
--- /dev/null
+++ b/opengl/tools/glgen/src/.gitignore
@@ -0,0 +1 @@
+*.class
diff --git a/opengl/tools/glgen/src/CFunc.java b/opengl/tools/glgen/src/CFunc.java
index 0794f41..a89e1c5 100644
--- a/opengl/tools/glgen/src/CFunc.java
+++ b/opengl/tools/glgen/src/CFunc.java
@@ -1,155 +1,156 @@
-

-import java.util.*;

-

-public class CFunc {

-

-    String original;

-

-    CType ftype;

-    String fname;

-

-    List<String> argNames = new ArrayList<String>();

-    List<CType> argTypes = new ArrayList<CType>();

-

-    boolean hasPointerArg = false;

-    boolean hasTypedPointerArg = false;

-

-    public CFunc(String original) {

-        this.original = original;

-    }

-

-    public String getOriginal() {

-        return original;

-    }

-

-    public void setName(String fname) {

-        this.fname = fname;

-    }

-

-    public String getName() {

-        return fname;

-    }

-

-    public void setType(CType ftype) {

-        this.ftype = ftype;

-    }

-

-    public CType getType() {

-        return ftype;

-    }

-

-    public void addArgument(String argName, CType argType) {

-        argNames.add(argName);

-        argTypes.add(argType);

-

-        if (argType.isPointer()) {

-            hasPointerArg = true;

-        }

-        if (argType.isTypedPointer()) {

-            hasTypedPointerArg = true;

-        }

-    }

-

-    public int getNumArgs() {

-        return argNames.size();

-    }

-

-    public int getArgIndex(String name) {

-        int len = argNames.size();

-        for (int i = 0; i < len; i++) {

-            if (name.equals(argNames.get(i))) {

-                return i;

-            }

-        }

-        return -1;

-    }

-

-    public String getArgName(int index) {

-        return argNames.get(index);

-    }

-

-    public CType getArgType(int index) {

-        return argTypes.get(index);

-    }

-

-    public boolean hasPointerArg() {

-        return hasPointerArg;

-    }

-

-    public boolean hasTypedPointerArg() {

-        return hasTypedPointerArg;

-    }

-

-    public String toString() {

-        String s =  "Function " + fname + " returns " + ftype + ": ";

-        for (int i = 0; i < argNames.size(); i++) {

-            if (i > 0) {

-                s += ", ";

-            }

-            s += argTypes.get(i) + " " + argNames.get(i);

-        }

-        return s;

-    }

-

-    public static CFunc parseCFunc(String s) {

-        CFunc cfunc = new CFunc(s);

-        String[] tokens = s.split("\\s");

-

-        int i = 0;

-        CType ftype = new CType();

-        String ftypeName = tokens[i++];

-        if (ftypeName.equals("const")) {

-            ftype.setIsConst(true);

-            ftypeName = tokens[i++];

-        }

-        ftype.setBaseType(ftypeName);

-

-        String fname = tokens[i++];

-        if (fname.equals("*")) {

-            ftype.setIsPointer(true);

-            fname = tokens[i++];

-        }

-	

-        cfunc.setName(fname);

-        cfunc.setType(ftype);

-	

-        while (i < tokens.length) {

-            String tok = tokens[i++];

-	    

-            if (tok.equals("(")) {

-                continue;

-            }

-            if (tok.equals(")")) {

-                break;

-            }

-

-            CType argType = new CType();

-	    

-            String argTypeName = tok;

-            String argName = "";

-	    

-            if (argTypeName.equals("const")) {

-                argType.setIsConst(true);

-                argTypeName = tokens[i++];

-            }

-            argType.setBaseType(argTypeName);

-

-            if (argTypeName.equals("void")) {

-                break;

-            }

-	    

-            argName = tokens[i++];

-            if (argName.startsWith("*")) {

-                argType.setIsPointer(true);

-                argName = argName.substring(1, argName.length());

-            }

-            if (argName.endsWith(",")) {

-                argName = argName.substring(0, argName.length() - 1);

-            }

-	    

-            cfunc.addArgument(argName, argType);

-        }

-

-        return cfunc;

-    }

-}

+
+import java.util.*;
+
+public class CFunc {
+
+    String original;
+
+    CType ftype;
+    String fname;
+
+    List<String> argNames = new ArrayList<String>();
+    List<CType> argTypes = new ArrayList<CType>();
+
+    boolean hasPointerArg = false;
+    boolean hasTypedPointerArg = false;
+
+    public CFunc(String original) {
+        this.original = original;
+    }
+
+    public String getOriginal() {
+        return original;
+    }
+
+    public void setName(String fname) {
+        this.fname = fname;
+    }
+
+    public String getName() {
+        return fname;
+    }
+
+    public void setType(CType ftype) {
+        this.ftype = ftype;
+    }
+
+    public CType getType() {
+        return ftype;
+    }
+
+    public void addArgument(String argName, CType argType) {
+        argNames.add(argName);
+        argTypes.add(argType);
+
+        if (argType.isPointer()) {
+            hasPointerArg = true;
+        }
+        if (argType.isTypedPointer()) {
+            hasTypedPointerArg = true;
+        }
+    }
+
+    public int getNumArgs() {
+        return argNames.size();
+    }
+
+    public int getArgIndex(String name) {
+        int len = argNames.size();
+        for (int i = 0; i < len; i++) {
+            if (name.equals(argNames.get(i))) {
+                return i;
+            }
+        }
+        return -1;
+    }
+
+    public String getArgName(int index) {
+        return argNames.get(index);
+    }
+
+    public CType getArgType(int index) {
+        return argTypes.get(index);
+    }
+
+    public boolean hasPointerArg() {
+        return hasPointerArg;
+    }
+
+    public boolean hasTypedPointerArg() {
+        return hasTypedPointerArg;
+    }
+
+    @Override
+    public String toString() {
+        String s =  "Function " + fname + " returns " + ftype + ": ";
+        for (int i = 0; i < argNames.size(); i++) {
+            if (i > 0) {
+                s += ", ";
+            }
+            s += argTypes.get(i) + " " + argNames.get(i);
+        }
+        return s;
+    }
+
+    public static CFunc parseCFunc(String s) {
+        CFunc cfunc = new CFunc(s);
+        String[] tokens = s.split("\\s");
+
+        int i = 0;
+        CType ftype = new CType();
+        String ftypeName = tokens[i++];
+        if (ftypeName.equals("const")) {
+            ftype.setIsConst(true);
+            ftypeName = tokens[i++];
+        }
+        ftype.setBaseType(ftypeName);
+
+        String fname = tokens[i++];
+        if (fname.equals("*")) {
+            ftype.setIsPointer(true);
+            fname = tokens[i++];
+        }
+
+        cfunc.setName(fname);
+        cfunc.setType(ftype);
+
+        while (i < tokens.length) {
+            String tok = tokens[i++];
+
+            if (tok.equals("(")) {
+                continue;
+            }
+            if (tok.equals(")")) {
+                break;
+            }
+
+            CType argType = new CType();
+
+            String argTypeName = tok;
+            String argName = "";
+
+            if (argTypeName.equals("const")) {
+                argType.setIsConst(true);
+                argTypeName = tokens[i++];
+            }
+            argType.setBaseType(argTypeName);
+
+            if (argTypeName.equals("void")) {
+                break;
+            }
+
+            argName = tokens[i++];
+            if (argName.startsWith("*")) {
+                argType.setIsPointer(true);
+                argName = argName.substring(1, argName.length());
+            }
+            if (argName.endsWith(",")) {
+                argName = argName.substring(0, argName.length() - 1);
+            }
+
+            cfunc.addArgument(argName, argType);
+        }
+
+        return cfunc;
+    }
+}
diff --git a/opengl/tools/glgen/src/CType.java b/opengl/tools/glgen/src/CType.java
index 331ec62..826c90d 100644
--- a/opengl/tools/glgen/src/CType.java
+++ b/opengl/tools/glgen/src/CType.java
@@ -1,85 +1,88 @@
-

-public class CType {

-

-    String baseType;

-    boolean isConst;

-    boolean isPointer;

-

-    public CType() {

-    }

-

-    public CType(String baseType) {

-	setBaseType(baseType);

-    }

-

-    public CType(String baseType, boolean isConst, boolean isPointer) {

-	setBaseType(baseType);

-	setIsConst(isConst);

-	setIsPointer(isPointer);

-    }

-

-    public String getDeclaration() {

-	return baseType + (isPointer ? " *" : "");

-    }

-    

-    public void setIsConst(boolean isConst) {

-	this.isConst = isConst;

-    }

-

-    public boolean isConst() {

-	return isConst;

-    }

-

-    public void setIsPointer(boolean isPointer) {

-	this.isPointer = isPointer;

-    }

-

-    public boolean isPointer() {

-	return isPointer;

-    }

-

-    boolean isVoid() {

-	String baseType = getBaseType();

-	return baseType.equals("GLvoid") ||

-	    baseType.equals("void");

-    }

-

-    public boolean isTypedPointer() {

-	return isPointer() && !isVoid();

-    }

-

-    public void setBaseType(String baseType) {

-	this.baseType = baseType;

-    }

-

-    public String getBaseType() {

-	return baseType;

-    }

-

-    public String toString() {

-	String s = "";

-	if (isConst()) {

-	    s += "const ";

-	}

-	s += baseType;

-	if (isPointer()) {

-	    s += "*";

-	}

-

-	return s;

-    }

-

-    public int hashCode() {

-	return baseType.hashCode() ^ (isPointer ? 2 : 0) ^ (isConst ? 1 : 0);

-    }

-

-    public boolean equals(Object o) {

-	if (o != null && o instanceof CType) {

-	    CType c = (CType)o;

-	    return baseType.equals(c.baseType) &&

-		isPointer() == c.isPointer() &&

-		isConst() == c.isConst();

-	}

-	return false;

-    }

-}

+
+public class CType {
+
+    String baseType;
+    boolean isConst;
+    boolean isPointer;
+
+    public CType() {
+    }
+
+    public CType(String baseType) {
+    setBaseType(baseType);
+    }
+
+    public CType(String baseType, boolean isConst, boolean isPointer) {
+    setBaseType(baseType);
+    setIsConst(isConst);
+    setIsPointer(isPointer);
+    }
+
+    public String getDeclaration() {
+    return baseType + (isPointer ? " *" : "");
+    }
+
+    public void setIsConst(boolean isConst) {
+    this.isConst = isConst;
+    }
+
+    public boolean isConst() {
+    return isConst;
+    }
+
+    public void setIsPointer(boolean isPointer) {
+    this.isPointer = isPointer;
+    }
+
+    public boolean isPointer() {
+    return isPointer;
+    }
+
+    boolean isVoid() {
+    String baseType = getBaseType();
+    return baseType.equals("GLvoid") ||
+        baseType.equals("void");
+    }
+
+    public boolean isTypedPointer() {
+    return isPointer() && !isVoid();
+    }
+
+    public void setBaseType(String baseType) {
+    this.baseType = baseType;
+    }
+
+    public String getBaseType() {
+    return baseType;
+    }
+
+    @Override
+    public String toString() {
+    String s = "";
+    if (isConst()) {
+        s += "const ";
+    }
+    s += baseType;
+    if (isPointer()) {
+        s += "*";
+    }
+
+    return s;
+    }
+
+    @Override
+    public int hashCode() {
+    return baseType.hashCode() ^ (isPointer ? 2 : 0) ^ (isConst ? 1 : 0);
+    }
+
+    @Override
+    public boolean equals(Object o) {
+    if (o != null && o instanceof CType) {
+        CType c = (CType)o;
+        return baseType.equals(c.baseType) &&
+        isPointer() == c.isPointer() &&
+        isConst() == c.isConst();
+    }
+    return false;
+    }
+}
diff --git a/opengl/tools/glgen/src/CodeEmitter.java b/opengl/tools/glgen/src/CodeEmitter.java
index 3e9b90a..ebb9727 100644
--- a/opengl/tools/glgen/src/CodeEmitter.java
+++ b/opengl/tools/glgen/src/CodeEmitter.java
@@ -1,8 +1,8 @@
-

-public interface CodeEmitter {

-

-    void setVersion(int version, boolean ext, boolean pack);

-    void emitCode(CFunc cfunc, String original);

-    void addNativeRegistration(String fname);

-    void emitNativeRegistration();

-}

+
+public interface CodeEmitter {
+
+    void setVersion(int version, boolean ext, boolean pack);
+    void emitCode(CFunc cfunc, String original);
+    void addNativeRegistration(String fname);
+    void emitNativeRegistration();
+}
diff --git a/opengl/tools/glgen/src/GLESCodeEmitter.java b/opengl/tools/glgen/src/GLESCodeEmitter.java
new file mode 100644
index 0000000..b303503
--- /dev/null
+++ b/opengl/tools/glgen/src/GLESCodeEmitter.java
@@ -0,0 +1,40 @@
+import java.io.PrintStream;
+
+/**
+ * Emits a Java interface and Java & C implementation for a C function.
+ *
+ * <p> The Java interface will have Buffer and array variants for functions that
+ * have a typed pointer argument.  The array variant will convert a single "<type> *data"
+ * argument to a pair of arguments "<type>[] data, int offset".
+ */
+public class GLESCodeEmitter extends JniCodeEmitter {
+
+    PrintStream mJavaImplStream;
+    PrintStream mCStream;
+
+    PrintStream mJavaInterfaceStream;
+
+    /**
+      */
+    public GLESCodeEmitter(String classPathName,
+                          ParameterChecker checker,
+                          PrintStream javaImplStream,
+                          PrintStream cStream) {
+        mClassPathName = classPathName;
+        mChecker = checker;
+
+        mJavaImplStream = javaImplStream;
+        mCStream = cStream;
+        mUseContextPointer = false;
+        mUseStaticMethods = true;
+    }
+
+    public void emitCode(CFunc cfunc, String original) {
+        emitCode(cfunc, original, null, mJavaImplStream,
+                mCStream);
+    }
+
+    public void emitNativeRegistration(String nativeRegistrationName) {
+        emitNativeRegistration(nativeRegistrationName, mCStream);
+    }
+}
diff --git a/opengl/tools/glgen/src/GenerateGL.java b/opengl/tools/glgen/src/GenerateGL.java
index 657ee6e..3715a96 100644
--- a/opengl/tools/glgen/src/GenerateGL.java
+++ b/opengl/tools/glgen/src/GenerateGL.java
@@ -1,164 +1,167 @@
-

-import java.io.*;

-import java.util.*;

-

-public class GenerateGL {

-

-    static void copy(String filename, PrintStream out) throws IOException {

-        BufferedReader br = new BufferedReader(new FileReader(filename));

-        String s;

-        while ((s = br.readLine()) != null) {

-            out.println(s);

-        }

-    }

-

-    private static void emit(int version, boolean ext, boolean pack,

-                             CodeEmitter emitter,

-                             BufferedReader specReader,

-                             PrintStream glStream,

-                             PrintStream glImplStream,

-                             PrintStream cStream) throws Exception {

-        String s = null;

-        int counter = 0;

-        while ((s = specReader.readLine()) != null) {

-            if (s.trim().startsWith("//")) {

-                continue;

-            }

-

-            CFunc cfunc = CFunc.parseCFunc(s);

-

-            String fname = cfunc.getName();

-            File f = new File("stubs/" + fname +

-                              ".java-1" + version + "-if");

-            if (f.exists()) {

-                System.out.println("Special-casing function " + fname);

-                copy("stubs/" + fname +

-                     ".java-1" + version + "-if", glStream);

-                copy("stubs/" + fname + ".java-impl", glImplStream);

-                copy("stubs/" + fname + ".cpp", cStream);

-

-                // Register native function names

-                // This should be improved to require fewer discrete files

-                String filename = "stubs/" + fname + ".nativeReg";

-                BufferedReader br =

-                    new BufferedReader(new FileReader(filename));

-                String nfunc;

-                while ((nfunc = br.readLine()) != null) {

-                    emitter.addNativeRegistration(nfunc);

-                }

-            } else {

-                emitter.setVersion(version, ext, pack);

-                emitter.emitCode(cfunc, s);

-            }

-        }

-    }

-

-    public static void main(String[] args) throws Exception {

-        String classPathName = "com/google/android/gles_jni/GLImpl";

-        boolean useContextPointer = true;

-

-        int aidx = 0;

-        while (args[aidx].charAt(0) == '-') {

-            switch (args[aidx].charAt(1)) {

-            case 'c':

-                useContextPointer = false;

-                break;

-

-            default:

-                System.err.println("Unknown flag: " + args[aidx]);

-                System.exit(1);

-            }

-

-            aidx++;

-        }

-

-        System.out.println("useContextPointer = " + useContextPointer);

-

-        BufferedReader spec10Reader =

-            new BufferedReader(new FileReader(args[aidx++]));

-        BufferedReader spec10ExtReader =

-            new BufferedReader(new FileReader(args[aidx++]));

-        BufferedReader spec11Reader =

-            new BufferedReader(new FileReader(args[aidx++]));

-        BufferedReader spec11ExtReader =

-            new BufferedReader(new FileReader(args[aidx++]));

-        BufferedReader spec11ExtPackReader =

-            new BufferedReader(new FileReader(args[aidx++]));

-        BufferedReader checksReader =

-            new BufferedReader(new FileReader(args[aidx++]));

-

-        String gl10Filename = "javax/microedition/khronos/opengles/GL10.java";

-        String gl10ExtFilename =

-            "javax/microedition/khronos/opengles/GL10Ext.java";

-        String gl11Filename = "javax/microedition/khronos/opengles/GL11.java";

-        String gl11ExtFilename =

-            "javax/microedition/khronos/opengles/GL11Ext.java";

-        String gl11ExtPackFilename =

-            "javax/microedition/khronos/opengles/GL11ExtensionPack.java";

-        String glImplFilename = "com/google/android/gles_jni/GLImpl.java";

-        String cFilename = "com_google_android_gles_jni_GLImpl.cpp";

-

-        PrintStream gl10Stream =

-            new PrintStream(new FileOutputStream("out/" + gl10Filename));

-        PrintStream gl10ExtStream =

-            new PrintStream(new FileOutputStream("out/" + gl10ExtFilename));

-        PrintStream gl11Stream =

-            new PrintStream(new FileOutputStream("out/" + gl11Filename));

-        PrintStream gl11ExtStream =

-            new PrintStream(new FileOutputStream("out/" + gl11ExtFilename));

-        PrintStream gl11ExtPackStream =

-            new PrintStream(new FileOutputStream("out/" + gl11ExtPackFilename));

-        PrintStream glImplStream =

-            new PrintStream(new FileOutputStream("out/" + glImplFilename));

-        PrintStream cStream =

-            new PrintStream(new FileOutputStream("out/" + cFilename));

-

-        ParameterChecker checker = new ParameterChecker(checksReader);

-

-        CodeEmitter emitter =

-            new JniCodeEmitter(classPathName,

-                               checker,

-                               gl10Stream, gl10ExtStream,

-                               gl11Stream, gl11ExtStream, gl11ExtPackStream,

-                               glImplStream, cStream,

-                               useContextPointer);

-

-        gl10Stream.println("/* //device/java/android/" + gl10Filename);

-        gl10ExtStream.println("/* //device/java/android/" + gl10ExtFilename);

-        gl11Stream.println("/* //device/java/android/" + gl11Filename);

-        gl11ExtStream.println("/* //device/java/android/" + gl11ExtFilename);

-        gl11ExtPackStream.println("/* //device/java/android/" +

-            gl11ExtPackFilename);

-        glImplStream.println("/* //device/java/android/" + glImplFilename);

-        cStream.println("/* //device/libs/android_runtime/" + cFilename);

-

-        copy("stubs/GL10Header.java-if", gl10Stream);

-        copy("stubs/GL10ExtHeader.java-if", gl10ExtStream);

-        copy("stubs/GL11Header.java-if", gl11Stream);

-        copy("stubs/GL11ExtHeader.java-if", gl11ExtStream);

-        copy("stubs/GL11ExtensionPackHeader.java-if", gl11ExtPackStream);

-        copy("stubs/GLImplHeader.java-impl", glImplStream);

-        copy("stubs/GLCHeader.cpp", cStream);

-

-        emit(0, false, false,

-             emitter, spec10Reader, gl10Stream, glImplStream, cStream);

-        emit(0, true, false,

-             emitter, spec10ExtReader, gl10ExtStream, glImplStream, cStream);

-        emit(1, false, false,

-             emitter, spec11Reader, gl11Stream, glImplStream, cStream);

-        emit(1, true, false,

-             emitter, spec11ExtReader, gl11ExtStream, glImplStream, cStream);

-        emit(1, true, true,

-             emitter, spec11ExtPackReader, gl11ExtPackStream, glImplStream,

-             cStream);

-

-        emitter.emitNativeRegistration();

-

-        gl10Stream.println("}");

-        gl10ExtStream.println("}");

-        gl11Stream.println("}");

-        gl11ExtStream.println("}");

-        gl11ExtPackStream.println("}");

-        glImplStream.println("}");

-    }

-}

+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.FileReader;
+import java.io.IOException;
+import java.io.PrintStream;
+
+public class GenerateGL {
+
+    static void copy(String filename, PrintStream out) throws IOException {
+        BufferedReader br = new BufferedReader(new FileReader(filename));
+        String s;
+        while ((s = br.readLine()) != null) {
+            out.println(s);
+        }
+    }
+
+    private static void emit(int version, boolean ext, boolean pack,
+                             CodeEmitter emitter,
+                             BufferedReader specReader,
+                             PrintStream glStream,
+                             PrintStream glImplStream,
+                             PrintStream cStream) throws Exception {
+        String s = null;
+        while ((s = specReader.readLine()) != null) {
+            if (s.trim().startsWith("//")) {
+                continue;
+            }
+
+            CFunc cfunc = CFunc.parseCFunc(s);
+
+            String fname = cfunc.getName();
+            File f = new File("stubs/jsr239/" + fname +
+                              ".java-1" + version + "-if");
+            if (f.exists()) {
+                System.out.println("Special-casing function " + fname);
+                copy("stubs/jsr239/" + fname +
+                     ".java-1" + version + "-if", glStream);
+                copy("stubs/jsr239/" + fname + ".java-impl", glImplStream);
+                copy("stubs/jsr239/" + fname + ".cpp", cStream);
+
+                // Register native function names
+                // This should be improved to require fewer discrete files
+                String filename = "stubs/jsr239/" + fname + ".nativeReg";
+                BufferedReader br =
+                    new BufferedReader(new FileReader(filename));
+                String nfunc;
+                while ((nfunc = br.readLine()) != null) {
+                    emitter.addNativeRegistration(nfunc);
+                }
+            } else {
+                emitter.setVersion(version, ext, pack);
+                emitter.emitCode(cfunc, s);
+            }
+        }
+    }
+
+    public static void main(String[] args) throws Exception {
+        String classPathName = "com/google/android/gles_jni/GLImpl";
+        boolean useContextPointer = true;
+
+        int aidx = 0;
+        while (args[aidx].charAt(0) == '-') {
+            switch (args[aidx].charAt(1)) {
+            case 'c':
+                useContextPointer = false;
+                break;
+
+            default:
+                System.err.println("Unknown flag: " + args[aidx]);
+                System.exit(1);
+            }
+
+            aidx++;
+        }
+
+        System.out.println("useContextPointer = " + useContextPointer);
+
+        BufferedReader spec10Reader =
+            new BufferedReader(new FileReader(args[aidx++]));
+        BufferedReader spec10ExtReader =
+            new BufferedReader(new FileReader(args[aidx++]));
+        BufferedReader spec11Reader =
+            new BufferedReader(new FileReader(args[aidx++]));
+        BufferedReader spec11ExtReader =
+            new BufferedReader(new FileReader(args[aidx++]));
+        BufferedReader spec11ExtPackReader =
+            new BufferedReader(new FileReader(args[aidx++]));
+        BufferedReader checksReader =
+            new BufferedReader(new FileReader(args[aidx++]));
+
+        String gl10Filename = "javax/microedition/khronos/opengles/GL10.java";
+        String gl10ExtFilename =
+            "javax/microedition/khronos/opengles/GL10Ext.java";
+        String gl11Filename = "javax/microedition/khronos/opengles/GL11.java";
+        String gl11ExtFilename =
+            "javax/microedition/khronos/opengles/GL11Ext.java";
+        String gl11ExtPackFilename =
+            "javax/microedition/khronos/opengles/GL11ExtensionPack.java";
+        String glImplFilename = "com/google/android/gles_jni/GLImpl.java";
+        String cFilename = "com_google_android_gles_jni_GLImpl.cpp";
+
+        PrintStream gl10Stream =
+            new PrintStream(new FileOutputStream("out/" + gl10Filename));
+        PrintStream gl10ExtStream =
+            new PrintStream(new FileOutputStream("out/" + gl10ExtFilename));
+        PrintStream gl11Stream =
+            new PrintStream(new FileOutputStream("out/" + gl11Filename));
+        PrintStream gl11ExtStream =
+            new PrintStream(new FileOutputStream("out/" + gl11ExtFilename));
+        PrintStream gl11ExtPackStream =
+            new PrintStream(new FileOutputStream("out/" + gl11ExtPackFilename));
+        PrintStream glImplStream =
+            new PrintStream(new FileOutputStream("out/" + glImplFilename));
+        PrintStream cStream =
+            new PrintStream(new FileOutputStream("out/" + cFilename));
+
+        ParameterChecker checker = new ParameterChecker(checksReader);
+
+        CodeEmitter emitter =
+            new Jsr239CodeEmitter(classPathName,
+                               checker,
+                               gl10Stream, gl10ExtStream,
+                               gl11Stream, gl11ExtStream, gl11ExtPackStream,
+                               glImplStream, cStream,
+                               useContextPointer);
+
+        gl10Stream.println("/* //device/java/android/" + gl10Filename);
+        gl10ExtStream.println("/* //device/java/android/" + gl10ExtFilename);
+        gl11Stream.println("/* //device/java/android/" + gl11Filename);
+        gl11ExtStream.println("/* //device/java/android/" + gl11ExtFilename);
+        gl11ExtPackStream.println("/* //device/java/android/" +
+            gl11ExtPackFilename);
+        glImplStream.println("/* //device/java/android/" + glImplFilename);
+        cStream.println("/* //device/libs/android_runtime/" + cFilename);
+
+        copy("stubs/jsr239/GL10Header.java-if", gl10Stream);
+        copy("stubs/jsr239/GL10ExtHeader.java-if", gl10ExtStream);
+        copy("stubs/jsr239/GL11Header.java-if", gl11Stream);
+        copy("stubs/jsr239/GL11ExtHeader.java-if", gl11ExtStream);
+        copy("stubs/jsr239/GL11ExtensionPackHeader.java-if", gl11ExtPackStream);
+        copy("stubs/jsr239/GLImplHeader.java-impl", glImplStream);
+        copy("stubs/jsr239/GLCHeader.cpp", cStream);
+
+        emit(0, false, false,
+             emitter, spec10Reader, gl10Stream, glImplStream, cStream);
+        emit(0, true, false,
+             emitter, spec10ExtReader, gl10ExtStream, glImplStream, cStream);
+        emit(1, false, false,
+             emitter, spec11Reader, gl11Stream, glImplStream, cStream);
+        emit(1, true, false,
+             emitter, spec11ExtReader, gl11ExtStream, glImplStream, cStream);
+        emit(1, true, true,
+             emitter, spec11ExtPackReader, gl11ExtPackStream, glImplStream,
+             cStream);
+
+        emitter.emitNativeRegistration();
+
+        gl10Stream.println("}");
+        gl10ExtStream.println("}");
+        gl11Stream.println("}");
+        gl11ExtStream.println("}");
+        gl11ExtPackStream.println("}");
+        glImplStream.println("}");
+    }
+}
diff --git a/opengl/tools/glgen/src/GenerateGLES.java b/opengl/tools/glgen/src/GenerateGLES.java
new file mode 100644
index 0000000..60775b7
--- /dev/null
+++ b/opengl/tools/glgen/src/GenerateGLES.java
@@ -0,0 +1,99 @@
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.FileReader;
+import java.io.IOException;
+import java.io.PrintStream;
+
+public class GenerateGLES {
+
+    static void copy(String filename, PrintStream out) throws IOException {
+        BufferedReader br = new BufferedReader(new FileReader(filename));
+        String s;
+        while ((s = br.readLine()) != null) {
+            out.println(s);
+        }
+    }
+
+    private static void emit(GLESCodeEmitter emitter,
+                             BufferedReader specReader,
+                             PrintStream glStream,
+                             PrintStream cStream) throws Exception {
+        String s = null;
+        while ((s = specReader.readLine()) != null) {
+            if (s.trim().startsWith("//")) {
+                continue;
+            }
+
+            CFunc cfunc = CFunc.parseCFunc(s);
+
+            String fname = cfunc.getName();
+            String stubRoot = "stubs/gles11/" + fname;
+            String javaPath = stubRoot + ".java";
+            File f = new File(javaPath);
+            if (f.exists()) {
+                System.out.println("Special-casing function " + fname);
+                copy(javaPath, glStream);
+                copy(stubRoot + ".cpp", cStream);
+
+                // Register native function names
+                // This should be improved to require fewer discrete files
+                String filename = stubRoot + ".nativeReg";
+                BufferedReader br =
+                    new BufferedReader(new FileReader(filename));
+                String nfunc;
+                while ((nfunc = br.readLine()) != null) {
+                    emitter.addNativeRegistration(nfunc);
+                }
+            } else {
+                emitter.emitCode(cfunc, s);
+            }
+        }
+    }
+
+    public static void main(String[] args) throws Exception {
+        int aidx = 0;
+        while ((aidx < args.length) && (args[aidx].charAt(0) == '-')) {
+            switch (args[aidx].charAt(1)) {
+            default:
+                System.err.println("Unknown flag: " + args[aidx]);
+                System.exit(1);
+            }
+
+            aidx++;
+        }
+
+        BufferedReader checksReader =
+            new BufferedReader(new FileReader("specs/gles11/checks.spec"));
+        ParameterChecker checker = new ParameterChecker(checksReader);
+
+        // Generate files
+        for(String suffix: new String[] {"GLES10", "GLES10Ext",
+                "GLES11", "GLES11Ext"})
+        {
+            BufferedReader spec11Reader =
+                new BufferedReader(new FileReader("specs/gles11/"
+                        + suffix + ".spec"));
+            String gl11Filename = "android/opengl/" + suffix + ".java";
+            String gl11cFilename = "android_opengl_" + suffix + ".cpp";
+            PrintStream gl11Stream =
+                new PrintStream(new FileOutputStream("out/" + gl11Filename));
+            PrintStream gl11cStream =
+                new PrintStream(new FileOutputStream("out/" + gl11cFilename));
+            gl11Stream.println("/*");
+            gl11cStream.println("/*");
+            copy("stubs/gles11/" + suffix + "Header.java-if", gl11Stream);
+            copy("stubs/gles11/" + suffix + "cHeader.cpp", gl11cStream);
+            GLESCodeEmitter emitter = new GLESCodeEmitter(
+                    "android/opengl/" + suffix,
+                    checker, gl11Stream, gl11cStream);
+            emit(emitter, spec11Reader, gl11Stream, gl11cStream);
+            emitter.emitNativeRegistration("register_android_opengl_jni_"
+                    + suffix);
+            gl11Stream.println("}");
+            gl11Stream.close();
+            gl11cStream.close();
+        }
+    }
+}
diff --git a/opengl/tools/glgen/src/JFunc.java b/opengl/tools/glgen/src/JFunc.java
index 42d466c..63c045b 100644
--- a/opengl/tools/glgen/src/JFunc.java
+++ b/opengl/tools/glgen/src/JFunc.java
@@ -1,148 +1,154 @@
-

-import java.util.ArrayList;

-import java.util.List;

-

-public class JFunc {

-

-    String className = "com.google.android.gles_jni.GL11Impl";

-

-    CFunc cfunc;

-    JType ftype;

-    String fname;

-

-    List<String> argNames = new ArrayList<String>();

-    List<JType> argTypes = new ArrayList<JType>();

-    List<Integer> argCIndices = new ArrayList<Integer>();

-

-    boolean hasBufferArg = false;

-    boolean hasTypedBufferArg = false;

-    ArrayList<String> bufferArgNames = new ArrayList<String>();

-

-    public JFunc(CFunc cfunc) {

-        this.cfunc = cfunc;

-    }

-

-    public CFunc getCFunc() {

-        return cfunc;

-    }

-

-    public void setName(String fname) {

-        this.fname = fname;

-    }

-

-    public String getName() {

-        return fname;

-    }

-

-    public void setType(JType ftype) {

-        this.ftype = ftype;

-    }

-

-    public JType getType() {

-        return ftype;

-    }

-

-    public void setClassName(String className) {

-        this.className = className;

-    }

-

-    public String getClassName() {

-        return className;

-    }

-    

-    public boolean hasBufferArg() {

-        return hasBufferArg;

-    }

-

-    public boolean hasTypedBufferArg() {

-        return hasTypedBufferArg;

-    }

-

-    public String getBufferArgName(int index) {

-        return bufferArgNames.get(index);

-    }

-

-    public void addArgument(String argName, JType argType, int cindex) {

-        argNames.add(argName);

-        argTypes.add(argType);

-        argCIndices.add(new Integer(cindex));

-

-        if (argType.isBuffer()) {

-            hasBufferArg = true;

-            bufferArgNames.add(argName);

-        }

-        if (argType.isTypedBuffer()) {

-            hasTypedBufferArg = true;

-            bufferArgNames.add(argName);

-        }

-    }

-

-    public int getNumArgs() {

-        return argNames.size();

-    }

-

-    public int getArgIndex(String name) {

-        int len = argNames.size();

-        for (int i = 0; i < len; i++) {

-            if (name.equals(argNames.get(i))) {

-                return i;

-            }

-        }

-        return -1;

-    }

-

-    public String getArgName(int index) {

-        return argNames.get(index);

-    }

-

-    public JType getArgType(int index) {

-        return argTypes.get(index);

-    }

-

-    public int getArgCIndex(int index) {

-        return argCIndices.get(index).intValue();

-    }

-

-    public static JFunc convert(CFunc cfunc, boolean useArray) {

-        JFunc jfunc = new JFunc(cfunc);

-        jfunc.setName(cfunc.getName());

-        jfunc.setType(JType.convert(cfunc.getType(), false));

-	

-        int numArgs = cfunc.getNumArgs();

-        int numOffsets = 0;

-        for (int i = 0; i < numArgs; i++) {

-            CType cArgType = cfunc.getArgType(i);

-            if (cArgType.isTypedPointer() && useArray) {

-                ++numOffsets;

-            }

-        }

-

-        for (int i = 0; i < numArgs; i++) {

-            String cArgName = cfunc.getArgName(i);

-            CType cArgType = cfunc.getArgType(i);

-

-            jfunc.addArgument(cArgName, JType.convert(cArgType, useArray), i);

-            if (cArgType.isTypedPointer() && useArray) {

-                if (numOffsets > 1) {

-                    jfunc.addArgument(cArgName + "Offset", new JType("int"), i);

-                } else {

-                    jfunc.addArgument("offset", new JType("int"), i);

-                }

-            }

-        }

-

-        return jfunc;

-    }

-

-    public String toString() {

-        String s =  "Function " + fname + " returns " + ftype + ": ";

-        for (int i = 0; i < argNames.size(); i++) {

-            if (i > 0) {

-                s += ", ";

-            }

-            s += argTypes.get(i) + " " + argNames.get(i);

-        }

-        return s;

-    }

-

-}

+
+import java.util.ArrayList;
+import java.util.List;
+
+public class JFunc {
+
+    String className = "com.google.android.gles_jni.GL11Impl";
+
+    CFunc cfunc;
+    JType ftype;
+    String fname;
+
+    List<String> argNames = new ArrayList<String>();
+    List<JType> argTypes = new ArrayList<JType>();
+    List<Integer> argCIndices = new ArrayList<Integer>();
+
+    boolean hasBufferArg = false;
+    boolean hasTypedBufferArg = false;
+    ArrayList<String> bufferArgNames = new ArrayList<String>();
+
+    public JFunc(CFunc cfunc) {
+        this.cfunc = cfunc;
+    }
+
+    public CFunc getCFunc() {
+        return cfunc;
+    }
+
+    public void setName(String fname) {
+        this.fname = fname;
+    }
+
+    public String getName() {
+        return fname;
+    }
+
+    public void setType(JType ftype) {
+        this.ftype = ftype;
+    }
+
+    public JType getType() {
+        return ftype;
+    }
+
+    public void setClassName(String className) {
+        this.className = className;
+    }
+
+    public String getClassName() {
+        return className;
+    }
+
+    public boolean hasBufferArg() {
+        return hasBufferArg;
+    }
+
+    public boolean hasTypedBufferArg() {
+        return hasTypedBufferArg;
+    }
+
+    public String getBufferArgName(int index) {
+        return bufferArgNames.get(index);
+    }
+
+    public void addArgument(String argName, JType argType, int cindex) {
+        argNames.add(argName);
+        argTypes.add(argType);
+        argCIndices.add(new Integer(cindex));
+
+        if (argType.isBuffer()) {
+            hasBufferArg = true;
+            bufferArgNames.add(argName);
+        }
+        if (argType.isTypedBuffer()) {
+            hasTypedBufferArg = true;
+            bufferArgNames.add(argName);
+        }
+    }
+
+    public int getNumArgs() {
+        return argNames.size();
+    }
+
+    public int getArgIndex(String name) {
+        int len = argNames.size();
+        for (int i = 0; i < len; i++) {
+            if (name.equals(argNames.get(i))) {
+                return i;
+            }
+        }
+        return -1;
+    }
+
+    public String getArgName(int index) {
+        return argNames.get(index);
+    }
+
+    public JType getArgType(int index) {
+        return argTypes.get(index);
+    }
+
+    public int getArgCIndex(int index) {
+        return argCIndices.get(index).intValue();
+    }
+
+    public static JFunc convert(CFunc cfunc, boolean useArray) {
+        try {
+            JFunc jfunc = new JFunc(cfunc);
+            jfunc.setName(cfunc.getName());
+            jfunc.setType(JType.convert(cfunc.getType(), false));
+
+            int numArgs = cfunc.getNumArgs();
+            int numOffsets = 0;
+            for (int i = 0; i < numArgs; i++) {
+                CType cArgType = cfunc.getArgType(i);
+                if (cArgType.isTypedPointer() && useArray) {
+                    ++numOffsets;
+                }
+            }
+
+            for (int i = 0; i < numArgs; i++) {
+                String cArgName = cfunc.getArgName(i);
+                CType cArgType = cfunc.getArgType(i);
+
+                jfunc.addArgument(cArgName, JType.convert(cArgType, useArray), i);
+                if (cArgType.isTypedPointer() && useArray) {
+                    if (numOffsets > 1) {
+                        jfunc.addArgument(cArgName + "Offset", new JType("int"), i);
+                    } else {
+                        jfunc.addArgument("offset", new JType("int"), i);
+                    }
+                }
+            }
+
+            return jfunc;
+        } catch (RuntimeException e) {
+            System.err.println("Failed to convert function " + cfunc);
+            throw e;
+        }
+    }
+
+    @Override
+    public String toString() {
+        String s =  "Function " + fname + " returns " + ftype + ": ";
+        for (int i = 0; i < argNames.size(); i++) {
+            if (i > 0) {
+                s += ", ";
+            }
+            s += argTypes.get(i) + " " + argNames.get(i);
+        }
+        return s;
+    }
+
+}
diff --git a/opengl/tools/glgen/src/JType.java b/opengl/tools/glgen/src/JType.java
index a16d440..df1177b 100644
--- a/opengl/tools/glgen/src/JType.java
+++ b/opengl/tools/glgen/src/JType.java
@@ -1,139 +1,142 @@
-

-import java.util.HashMap;

-

-public class JType {

-    

-    String baseType;

-    boolean isArray;

-    boolean isClass;

-

-    static HashMap<CType,JType> typeMapping = new HashMap<CType,JType>();

-    static HashMap<CType,JType> arrayTypeMapping = new HashMap<CType,JType>();

-

-    static {

-	// Primitive types

-	typeMapping.put(new CType("GLbitfield"), new JType("int"));

-	typeMapping.put(new CType("GLboolean"), new JType("boolean"));

-	typeMapping.put(new CType("GLclampf"), new JType("float"));

-	typeMapping.put(new CType("GLclampx"), new JType("int"));

-	typeMapping.put(new CType("GLenum"), new JType("int"));

-	typeMapping.put(new CType("GLfloat"), new JType("float"));

-	typeMapping.put(new CType("GLfixed"), new JType("int"));

-	typeMapping.put(new CType("GLint"), new JType("int"));

-	typeMapping.put(new CType("GLintptr"), new JType("int"));

-	typeMapping.put(new CType("GLshort"), new JType("short"));

-	typeMapping.put(new CType("GLsizei"), new JType("int"));

-	typeMapping.put(new CType("GLsizeiptr"), new JType("int"));

-	typeMapping.put(new CType("GLubyte"), new JType("byte"));

-	typeMapping.put(new CType("GLuint"), new JType("int"));

-	typeMapping.put(new CType("void"), new JType("void"));

-	typeMapping.put(new CType("GLubyte", true, true), new JType("String"));

-

-	// Untyped pointers map to untyped Buffers

-	typeMapping.put(new CType("GLvoid", true, true),

-			new JType("java.nio.Buffer", true, false));

-	typeMapping.put(new CType("GLvoid", false, true),

-			new JType("java.nio.Buffer", true, false));

-	typeMapping.put(new CType("void", false, true),

-			new JType("java.nio.Buffer", true, false));

-

-	// Typed pointers map to typed Buffers

-	typeMapping.put(new CType("GLboolean", false, true),

-			new JType("java.nio.IntBuffer", true, false));

-	typeMapping.put(new CType("GLfixed", false, true),

-			new JType("java.nio.IntBuffer", true, false));

-	typeMapping.put(new CType("GLfixed", true, true),

-			new JType("java.nio.IntBuffer", true, false));

-	typeMapping.put(new CType("GLfloat", false, true),

-			new JType("java.nio.FloatBuffer", true, false));

-	typeMapping.put(new CType("GLfloat", true, true),

-			new JType("java.nio.FloatBuffer", true, false));

-	typeMapping.put(new CType("GLint", false, true),

-			new JType("java.nio.IntBuffer", true, false));

-	typeMapping.put(new CType("GLint", true, true),

-			new JType("java.nio.IntBuffer", true, false));

-	typeMapping.put(new CType("GLuint", false, true),

-			new JType("java.nio.IntBuffer", true, false));

-	typeMapping.put(new CType("GLuint", true, true),

-			new JType("java.nio.IntBuffer", true, false));

-	typeMapping.put(new CType("GLshort", true, true),

-			new JType("java.nio.ShortBuffer", true, false));

-

-	// Typed pointers map to arrays + offsets

-	arrayTypeMapping.put(new CType("GLboolean", false, true),

-			     new JType("boolean", false, true));

-	arrayTypeMapping.put(new CType("GLfixed", true, true), new JType("int", false, true));

-	arrayTypeMapping.put(new CType("GLfixed", false, true), new JType("int", false, true));

-	arrayTypeMapping.put(new CType("GLfloat", false, true), new JType("float", false, true));

-	arrayTypeMapping.put(new CType("GLfloat", true, true), new JType("float", false, true));

-	arrayTypeMapping.put(new CType("GLint", false, true), new JType("int", false, true));

-	arrayTypeMapping.put(new CType("GLint", true, true), new JType("int", false, true));

-	arrayTypeMapping.put(new CType("GLshort", true, true), new JType("short", false, true));

-	arrayTypeMapping.put(new CType("GLuint", false, true), new JType("int", false, true));

-	arrayTypeMapping.put(new CType("GLuint", true, true), new JType("int", false, true));

-	arrayTypeMapping.put(new CType("GLintptr"), new JType("int", false, true));

-	arrayTypeMapping.put(new CType("GLsizeiptr"), new JType("int", false, true));

-    }

-

-    public JType() {

-    }

-

-    public JType(String primitiveTypeName) {

-	this.baseType = primitiveTypeName;

-	this.isClass = false;

-	this.isArray = false;

-    }

-

-    public JType(String primitiveTypeName, boolean isClass, boolean isArray) {

-	this.baseType = primitiveTypeName;

-	this.isClass = isClass;

-	this.isArray = isArray;

-    }

-

-    public String getBaseType() {

-	return baseType;

-    }

-

-    public String toString() {

-	return baseType + (isArray ? "[]" : "");

-    }

-

-    public boolean isArray() {

-	return isArray;

-    }

-

-    public boolean isClass() {

-	return isClass;

-    }

-

-    public boolean isPrimitive() {

-	return !isClass() && !isArray();

-    }

-

-    public boolean isVoid() {

-	return baseType.equals("void");

-    }

-

-    public boolean isBuffer() {

-	return baseType.indexOf("Buffer") != -1;

-    }

-

-    public boolean isTypedBuffer() {

-	return !baseType.equals("java.nio.Buffer") &&

-	    (baseType.indexOf("Buffer") != -1);

-    }

-

-    public static JType convert(CType ctype, boolean useArray) {

- 	JType javaType = null;

- 	if (useArray) {

- 	    javaType = arrayTypeMapping.get(ctype);

- 	}

- 	if (javaType == null) {

- 	    javaType = typeMapping.get(ctype);

- 	}

- 	if (javaType == null) {

- 	    throw new RuntimeException("Unsupported C type: " + ctype);

- 	}

- 	return javaType;

-    }

-}

+
+import java.util.HashMap;
+
+public class JType {
+
+    String baseType;
+    boolean isArray;
+    boolean isClass;
+
+    static HashMap<CType,JType> typeMapping = new HashMap<CType,JType>();
+    static HashMap<CType,JType> arrayTypeMapping = new HashMap<CType,JType>();
+
+    static {
+    // Primitive types
+    typeMapping.put(new CType("GLbitfield"), new JType("int"));
+    typeMapping.put(new CType("GLboolean"), new JType("boolean"));
+    typeMapping.put(new CType("GLclampf"), new JType("float"));
+    typeMapping.put(new CType("GLclampx"), new JType("int"));
+    typeMapping.put(new CType("GLenum"), new JType("int"));
+    typeMapping.put(new CType("GLfloat"), new JType("float"));
+    typeMapping.put(new CType("GLfixed"), new JType("int"));
+    typeMapping.put(new CType("GLint"), new JType("int"));
+    typeMapping.put(new CType("GLintptr"), new JType("int"));
+    typeMapping.put(new CType("GLshort"), new JType("short"));
+    typeMapping.put(new CType("GLsizei"), new JType("int"));
+    typeMapping.put(new CType("GLsizeiptr"), new JType("int"));
+    typeMapping.put(new CType("GLubyte"), new JType("byte"));
+    typeMapping.put(new CType("GLuint"), new JType("int"));
+    typeMapping.put(new CType("void"), new JType("void"));
+    typeMapping.put(new CType("GLubyte", true, true), new JType("String"));
+
+    // Untyped pointers map to untyped Buffers
+    typeMapping.put(new CType("GLvoid", true, true),
+            new JType("java.nio.Buffer", true, false));
+    typeMapping.put(new CType("GLvoid", false, true),
+            new JType("java.nio.Buffer", true, false));
+    typeMapping.put(new CType("void", false, true),
+            new JType("java.nio.Buffer", true, false));
+    typeMapping.put(new CType("GLeglImageOES", false, false),
+            new JType("java.nio.Buffer", true, false));
+
+    // Typed pointers map to typed Buffers
+    typeMapping.put(new CType("GLboolean", false, true),
+            new JType("java.nio.IntBuffer", true, false));
+    typeMapping.put(new CType("GLfixed", false, true),
+            new JType("java.nio.IntBuffer", true, false));
+    typeMapping.put(new CType("GLfixed", true, true),
+            new JType("java.nio.IntBuffer", true, false));
+    typeMapping.put(new CType("GLfloat", false, true),
+            new JType("java.nio.FloatBuffer", true, false));
+    typeMapping.put(new CType("GLfloat", true, true),
+            new JType("java.nio.FloatBuffer", true, false));
+    typeMapping.put(new CType("GLint", false, true),
+            new JType("java.nio.IntBuffer", true, false));
+    typeMapping.put(new CType("GLint", true, true),
+            new JType("java.nio.IntBuffer", true, false));
+    typeMapping.put(new CType("GLuint", false, true),
+            new JType("java.nio.IntBuffer", true, false));
+    typeMapping.put(new CType("GLuint", true, true),
+            new JType("java.nio.IntBuffer", true, false));
+    typeMapping.put(new CType("GLshort", true, true),
+            new JType("java.nio.ShortBuffer", true, false));
+
+    // Typed pointers map to arrays + offsets
+    arrayTypeMapping.put(new CType("GLboolean", false, true),
+                 new JType("boolean", false, true));
+    arrayTypeMapping.put(new CType("GLfixed", true, true), new JType("int", false, true));
+    arrayTypeMapping.put(new CType("GLfixed", false, true), new JType("int", false, true));
+    arrayTypeMapping.put(new CType("GLfloat", false, true), new JType("float", false, true));
+    arrayTypeMapping.put(new CType("GLfloat", true, true), new JType("float", false, true));
+    arrayTypeMapping.put(new CType("GLint", false, true), new JType("int", false, true));
+    arrayTypeMapping.put(new CType("GLint", true, true), new JType("int", false, true));
+    arrayTypeMapping.put(new CType("GLshort", true, true), new JType("short", false, true));
+    arrayTypeMapping.put(new CType("GLuint", false, true), new JType("int", false, true));
+    arrayTypeMapping.put(new CType("GLuint", true, true), new JType("int", false, true));
+    arrayTypeMapping.put(new CType("GLintptr"), new JType("int", false, true));
+    arrayTypeMapping.put(new CType("GLsizeiptr"), new JType("int", false, true));
+    }
+
+    public JType() {
+    }
+
+    public JType(String primitiveTypeName) {
+    this.baseType = primitiveTypeName;
+    this.isClass = false;
+    this.isArray = false;
+    }
+
+    public JType(String primitiveTypeName, boolean isClass, boolean isArray) {
+    this.baseType = primitiveTypeName;
+    this.isClass = isClass;
+    this.isArray = isArray;
+    }
+
+    public String getBaseType() {
+    return baseType;
+    }
+
+    @Override
+    public String toString() {
+    return baseType + (isArray ? "[]" : "");
+    }
+
+    public boolean isArray() {
+    return isArray;
+    }
+
+    public boolean isClass() {
+    return isClass;
+    }
+
+    public boolean isPrimitive() {
+    return !isClass() && !isArray();
+    }
+
+    public boolean isVoid() {
+    return baseType.equals("void");
+    }
+
+    public boolean isBuffer() {
+    return baseType.indexOf("Buffer") != -1;
+    }
+
+    public boolean isTypedBuffer() {
+    return !baseType.equals("java.nio.Buffer") &&
+        (baseType.indexOf("Buffer") != -1);
+    }
+
+    public static JType convert(CType ctype, boolean useArray) {
+     JType javaType = null;
+     if (useArray) {
+         javaType = arrayTypeMapping.get(ctype);
+     }
+     if (javaType == null) {
+         javaType = typeMapping.get(ctype);
+     }
+     if (javaType == null) {
+         throw new RuntimeException("Unsupported C type: " + ctype);
+     }
+     return javaType;
+    }
+}
diff --git a/opengl/tools/glgen/src/JniCodeEmitter.java b/opengl/tools/glgen/src/JniCodeEmitter.java
index 33b9a3e..ef0dbd0 100644
--- a/opengl/tools/glgen/src/JniCodeEmitter.java
+++ b/opengl/tools/glgen/src/JniCodeEmitter.java
@@ -1,99 +1,55 @@
 import java.io.PrintStream;
-import java.io.FileNotFoundException;
-import java.io.FileOutputStream;
 import java.util.ArrayList;
 import java.util.HashSet;
 import java.util.Iterator;
 import java.util.List;
 
-/**
- * Emits a Java interface and Java & C implementation for a C function.
- *
- * <p> The Java interface will have Buffer and array variants for functions that
- * have a typed pointer argument.  The array variant will convert a single "<type> *data"
- * argument to a pair of arguments "<type>[] data, int offset".
- */
-public class JniCodeEmitter implements CodeEmitter {
+public class JniCodeEmitter {
 
-    // If true, use C++ style for calling through a JNIEnv *:
-    // env->Func(...)
-    // If false, use C style:
-    // (*env)->Func(env, ...)
     static final boolean mUseCPlusPlus = true;
-
-    boolean mUseContextPointer = true;
-
-    String mClassPathName;
-    
-    ParameterChecker mChecker;
-    PrintStream mJava10InterfaceStream;
-    PrintStream mJava10ExtInterfaceStream;
-    PrintStream mJava11InterfaceStream;
-    PrintStream mJava11ExtInterfaceStream;
-    PrintStream mJava11ExtPackInterfaceStream;
-    PrintStream mJavaImplStream;
-    PrintStream mCStream;
-
-    PrintStream mJavaInterfaceStream;
-
-    List<String> nativeRegistrations = new ArrayList<String>();
-
+    protected boolean mUseContextPointer = true;
+    protected boolean mUseStaticMethods = false;
+    protected String mClassPathName;
+    protected ParameterChecker mChecker;
+    protected List<String> nativeRegistrations = new ArrayList<String>();
     boolean needsExit;
-
-    static String indent = "    ";
-
+    protected static String indent = "    ";
     HashSet<String> mFunctionsEmitted = new HashSet<String>();
 
-    /**
-     * @param java10InterfaceStream the PrintStream to which to emit the Java interface for GL 1.0 functions
-     * @param java10ExtInterfaceStream the PrintStream to which to emit the Java interface for GL 1.0 extension functions
-     * @param java11InterfaceStream the PrintStream to which to emit the Java interface for GL 1.1 functions 
-     * @param java11ExtInterfaceStream the PrintStream to which to emit the Java interface for GL 1.1 Extension functions
-     * @param java11ExtPackInterfaceStream the PrintStream to which to emit the Java interface for GL 1.1 Extension Pack functions
-     * @param javaImplStream the PrintStream to which to emit the Java implementation
-     * @param cStream the PrintStream to which to emit the C implementation
-     */
-    public JniCodeEmitter(String classPathName,
-                          ParameterChecker checker,
-                          PrintStream java10InterfaceStream,
-                          PrintStream java10ExtInterfaceStream,
-                          PrintStream java11InterfaceStream,
-                          PrintStream java11ExtInterfaceStream,
-                          PrintStream java11ExtPackInterfaceStream,
-                          PrintStream javaImplStream,
-                          PrintStream cStream,
-                          boolean useContextPointer) {
-        mClassPathName = classPathName;
-        mChecker = checker;
-        mJava10InterfaceStream = java10InterfaceStream;
-        mJava10ExtInterfaceStream = java10ExtInterfaceStream;
-        mJava11InterfaceStream = java11InterfaceStream;
-        mJava11ExtInterfaceStream = java11ExtInterfaceStream;
-        mJava11ExtPackInterfaceStream = java11ExtPackInterfaceStream;
-        mJavaImplStream = javaImplStream;
-        mCStream = cStream;
-        mUseContextPointer = useContextPointer;
-    }
-
-    public void setVersion(int version, boolean ext, boolean pack) {
-        if (version == 0) {
-            mJavaInterfaceStream = ext ? mJava10ExtInterfaceStream :
-                mJava10InterfaceStream;
-        } else if (version == 1) {
-            mJavaInterfaceStream = ext ?
-                (pack ? mJava11ExtPackInterfaceStream :
-                 mJava11ExtInterfaceStream) :
-                mJava11InterfaceStream;
-        } else {
-            throw new RuntimeException("Bad version: " + version);
+    public static String getJniName(JType jType) {
+        String jniName = "";
+        if (jType.isClass()) {
+            return "L" + jType.getBaseType() + ";";
+        } else if (jType.isArray()) {
+            jniName = "[";
         }
+
+        String baseType = jType.getBaseType();
+        if (baseType.equals("int")) {
+            jniName += "I";
+        } else if (baseType.equals("float")) {
+            jniName += "F";
+        } else if (baseType.equals("boolean")) {
+            jniName += "Z";
+        } else if (baseType.equals("short")) {
+            jniName += "S";
+        } else if (baseType.equals("long")) {
+            jniName += "L";
+        } else if (baseType.equals("byte")) {
+            jniName += "B";
+        }
+        return jniName;
     }
 
-    public void emitCode(CFunc cfunc, String original) {
+
+    public void emitCode(CFunc cfunc, String original,
+            PrintStream javaInterfaceStream,
+            PrintStream javaImplStream,
+            PrintStream cStream) {
         JFunc jfunc;
         String signature;
         boolean duplicate;
-        
+
         if (cfunc.hasTypedPointerArg()) {
             jfunc = JFunc.convert(cfunc, true);
 
@@ -109,12 +65,14 @@
             }
 
             if (!duplicate) {
-                emitNativeDeclaration(jfunc, mJavaImplStream);
-                emitJavaCode(jfunc, mJavaImplStream);
+                emitNativeDeclaration(jfunc, javaImplStream);
+                emitJavaCode(jfunc, javaImplStream);
             }
-            emitJavaInterfaceCode(jfunc, mJavaInterfaceStream);
+            if (javaInterfaceStream != null) {
+                emitJavaInterfaceCode(jfunc, javaInterfaceStream);
+            }
             if (!duplicate) {
-                emitJniCode(jfunc, mCStream);
+                emitJniCode(jfunc, cStream);
             }
         }
 
@@ -129,12 +87,14 @@
         }
 
         if (!duplicate) {
-            emitNativeDeclaration(jfunc, mJavaImplStream);
+            emitNativeDeclaration(jfunc, javaImplStream);
         }
-        emitJavaInterfaceCode(jfunc, mJavaInterfaceStream);
+        if (javaInterfaceStream != null) {
+            emitJavaInterfaceCode(jfunc, javaInterfaceStream);
+        }
         if (!duplicate) {
-            emitJavaCode(jfunc, mJavaImplStream);
-            emitJniCode(jfunc, mCStream);
+            emitJavaCode(jfunc, javaImplStream);
+            emitJniCode(jfunc, cStream);
         }
     }
 
@@ -152,8 +112,8 @@
     public void emitJavaCode(JFunc jfunc, PrintStream out) {
         emitFunction(jfunc, out, false, false);
     }
-    
-    void emitFunctionCall(JFunc jfunc, PrintStream out, String iii, boolean grabArray ) {
+
+    void emitFunctionCall(JFunc jfunc, PrintStream out, String iii, boolean grabArray) {
         boolean isVoid = jfunc.getType().isVoid();
         boolean isPointerFunc = jfunc.getName().endsWith("Pointer") &&
             jfunc.getCFunc().hasPointerArg();
@@ -167,7 +127,7 @@
                     jfunc.getName() +
                     (isPointerFunc ? "Bounds" : "" ) +
                     "(");
-	
+
         int numArgs = jfunc.getNumArgs();
         for (int i = 0; i < numArgs; i++) {
             String argName = jfunc.getArgName(i);
@@ -177,7 +137,7 @@
                 String typeName = argType.getBaseType();
                 typeName = typeName.substring(9, typeName.length() - 6);
                 out.println(iii + indent + "get" + typeName + "Array(" + argName + "),");
-                out.print(iii + indent + "getOffset(" + argName + ")"); 
+                out.print(iii + indent + "getOffset(" + argName + ")");
             } else {
                 out.print(iii + indent + argName);
             }
@@ -192,41 +152,40 @@
                 out.println(",");
             }
         }
-	
+
         out.println(iii + ");");
     }
 
-    void printIfcheckPostamble(PrintStream out, boolean isBuffer,
-                               boolean emitExceptionCheck, String iii) {
-        printIfcheckPostamble(out, isBuffer, emitExceptionCheck,
-                              "offset", "_remaining", iii);
-    }
+    void printIfcheckPostamble(PrintStream out, boolean isBuffer, boolean emitExceptionCheck,
+            String iii) {
+                printIfcheckPostamble(out, isBuffer, emitExceptionCheck,
+                                      "offset", "_remaining", iii);
+            }
 
-    void printIfcheckPostamble(PrintStream out, boolean isBuffer,
-                               boolean emitExceptionCheck,
-                               String offset, String remaining, String iii) {
-        out.println(iii + "    default:");
-        out.println(iii + "        _needed = 0;");
-        out.println(iii + "        break;");
-        out.println(iii + "}");
+    void printIfcheckPostamble(PrintStream out, boolean isBuffer, boolean emitExceptionCheck,
+            String offset, String remaining, String iii) {
+                out.println(iii + "    default:");
+                out.println(iii + "        _needed = 0;");
+                out.println(iii + "        break;");
+                out.println(iii + "}");
 
-        out.println(iii + "if (" + remaining + " < _needed) {");
-        if (emitExceptionCheck) {
-            out.println(iii + indent + "_exception = 1;");
-        }
-        out.println(iii + indent +
-                    (mUseCPlusPlus ? "_env" : "(*_env)") +
-                    "->ThrowNew(" +
-                    (mUseCPlusPlus ? "" : "_env, ") +
-                    "IAEClass, " +
-                    "\"" +
-                    (isBuffer ? 
-                     "remaining()" : "length - " + offset) +
-                    " < needed\");");
-        out.println(iii + indent + "goto exit;");
-        needsExit = true;
-        out.println(iii + "}");
-    }
+                out.println(iii + "if (" + remaining + " < _needed) {");
+                if (emitExceptionCheck) {
+                    out.println(iii + indent + "_exception = 1;");
+                }
+                out.println(iii + indent +
+                            (mUseCPlusPlus ? "_env" : "(*_env)") +
+                            "->ThrowNew(" +
+                            (mUseCPlusPlus ? "" : "_env, ") +
+                            "IAEClass, " +
+                            "\"" +
+                            (isBuffer ?
+                             "remaining()" : "length - " + offset) +
+                            " < needed\");");
+                out.println(iii + indent + "goto exit;");
+                needsExit = true;
+                out.println(iii + "}");
+            }
 
     boolean isNullAllowed(CFunc cfunc) {
         String[] checks = mChecker.getChecks(cfunc.getName());
@@ -312,115 +271,106 @@
     }
 
     void emitNativeBoundsChecks(CFunc cfunc, String cname, PrintStream out,
-                                boolean isBuffer, boolean emitExceptionCheck,
-                                String offset, String remaining, String iii) {
-        CType returnType = cfunc.getType();
-        boolean isVoid = returnType.isVoid();
+            boolean isBuffer, boolean emitExceptionCheck, String offset, String remaining, String iii) {
 
-        String[] checks = mChecker.getChecks(cfunc.getName());
-        String checkVar;
-        String retval = getErrorReturnValue(cfunc);
+                String[] checks = mChecker.getChecks(cfunc.getName());
 
-        boolean lastWasIfcheck = false;
+                boolean lastWasIfcheck = false;
 
-        int index = 1;
-        if (checks != null) {
-            boolean remainingDeclared = false;
-            boolean nullCheckDeclared = false;
-            boolean offsetChecked = false;
-            while (index < checks.length) {
-                if (checks[index].startsWith("check")) {
-                    if (lastWasIfcheck) {
-                        printIfcheckPostamble(out, isBuffer, emitExceptionCheck,
-                                              offset, remaining, iii);
+                int index = 1;
+                if (checks != null) {
+                    while (index < checks.length) {
+                        if (checks[index].startsWith("check")) {
+                            if (lastWasIfcheck) {
+                                printIfcheckPostamble(out, isBuffer, emitExceptionCheck,
+                                                      offset, remaining, iii);
+                            }
+                            lastWasIfcheck = false;
+                            if (cname != null && !cname.equals(checks[index + 1])) {
+                                index += 3;
+                                continue;
+                            }
+                            out.println(iii + "if (" + remaining + " < " +
+                                        checks[index + 2] +
+                                        ") {");
+                            if (emitExceptionCheck) {
+                                out.println(iii + indent + "_exception = 1;");
+                            }
+                    String exceptionClassName = "IAEClass";
+                    // If the "check" keyword was of the form
+                    // "check_<class name>", use the class name in the
+                    // exception to be thrown
+                    int underscore = checks[index].indexOf('_');
+                    if (underscore >= 0) {
+                    exceptionClassName = checks[index].substring(underscore + 1) + "Class";
                     }
-                    lastWasIfcheck = false;
-                    if (cname != null && !cname.equals(checks[index + 1])) {
-                        index += 3;
-                        continue;
-                    }
-                    out.println(iii + "if (" + remaining + " < " +
-                                checks[index + 2] +
-                                ") {");
-                    if (emitExceptionCheck) {
-                        out.println(iii + indent + "_exception = 1;");
-                    }
-		    String exceptionClassName = "IAEClass";
-		    // If the "check" keyword was of the form
-		    // "check_<class name>", use the class name in the
-		    // exception to be thrown
-		    int underscore = checks[index].indexOf('_');
-		    if (underscore >= 0) {
-			exceptionClassName = checks[index].substring(underscore + 1) + "Class";
-		    }
-                    out.println(iii + indent +
-                                (mUseCPlusPlus ? "_env" : "(*_env)") +
-                                "->ThrowNew(" +
-                                (mUseCPlusPlus ? "" : "_env, ") +
-				exceptionClassName + ", " +
-                                "\"" +
-                                (isBuffer ? 
-                                 "remaining()" : "length - " + offset) +
-                                " < " + checks[index + 2] +
-                                "\");");
+                            out.println(iii + indent +
+                                        (mUseCPlusPlus ? "_env" : "(*_env)") +
+                                        "->ThrowNew(" +
+                                        (mUseCPlusPlus ? "" : "_env, ") +
+                        exceptionClassName + ", " +
+                                        "\"" +
+                                        (isBuffer ?
+                                         "remaining()" : "length - " + offset) +
+                                        " < " + checks[index + 2] +
+                                        "\");");
 
-                    out.println(iii + indent + "goto exit;");
-                    needsExit = true;
-                    out.println(iii + "}");
-                
-                    index += 3;
-                } else if (checks[index].equals("ifcheck")) {
-                    String[] matches = checks[index + 4].split(",");
+                            out.println(iii + indent + "goto exit;");
+                            needsExit = true;
+                            out.println(iii + "}");
 
-                    if (!lastWasIfcheck) {
-                        out.println(iii + "int _needed;");
-                        out.println(iii +
-                                    "switch (" +
-                                    checks[index + 3] +
-                                    ") {");
+                            index += 3;
+                        } else if (checks[index].equals("ifcheck")) {
+                            String[] matches = checks[index + 4].split(",");
+
+                            if (!lastWasIfcheck) {
+                                out.println(iii + "int _needed;");
+                                out.println(iii +
+                                            "switch (" +
+                                            checks[index + 3] +
+                                            ") {");
+                            }
+
+                            for (int i = 0; i < matches.length; i++) {
+                                out.println("#if defined(" + matches[i] + ")");
+                                out.println(iii +
+                                            "    case " +
+                                            matches[i] +
+                                            ":");
+                                out.println("#endif // defined(" + matches[i] + ")");
+                            }
+                            out.println(iii +
+                                        "        _needed = " +
+                                        checks[index + 2] +
+                                        ";");
+                            out.println(iii +
+                                        "        break;");
+
+                            lastWasIfcheck = true;
+                            index += 5;
+                        } else if (checks[index].equals("return")) {
+                            // ignore
+                            index += 2;
+                        } else if (checks[index].equals("unsupported")) {
+                            // ignore
+                            index += 1;
+                        } else if (checks[index].equals("nullAllowed")) {
+                            // ignore
+                            index += 1;
+                        } else {
+                            System.out.println("Error: unknown keyword \"" +
+                                               checks[index] + "\"");
+                            System.exit(0);
+                        }
                     }
-                    
-                    for (int i = 0; i < matches.length; i++) {
-                        out.println("#if defined(" + matches[i] + ")");
-                        out.println(iii +
-                                    "    case " +
-                                    matches[i] +
-                                    ":");
-                        out.println("#endif // defined(" + matches[i] + ")");
-                    }
-                    out.println(iii +
-                                "        _needed = " +
-                                checks[index + 2] +
-                                ";");
-                    out.println(iii +
-                                "        break;");
-                
-                    lastWasIfcheck = true;
-                    index += 5;
-                } else if (checks[index].equals("return")) {
-                    // ignore
-                    index += 2;
-                } else if (checks[index].equals("unsupported")) {
-                    // ignore
-                    index += 1;
-                } else if (checks[index].equals("nullAllowed")) {
-                    // ignore
-                    index += 1;
-                } else {
-                    System.out.println("Error: unknown keyword \"" +
-                                       checks[index] + "\"");
-                    System.exit(0);
+                }
+
+                if (lastWasIfcheck) {
+                    printIfcheckPostamble(out, isBuffer, emitExceptionCheck, iii);
                 }
             }
-        }
 
-        if (lastWasIfcheck) {
-            printIfcheckPostamble(out, isBuffer, emitExceptionCheck, iii);
-        }
-    }
-
-    boolean hasNonConstArg(JFunc jfunc, CFunc cfunc,
-        List<Integer> nonPrimitiveArgs) {
+    boolean hasNonConstArg(JFunc jfunc, CFunc cfunc, List<Integer> nonPrimitiveArgs) {
         if (nonPrimitiveArgs.size() > 0) {
             for (int i = nonPrimitiveArgs.size() - 1; i >= 0; i--) {
                 int idx = nonPrimitiveArgs.get(i).intValue();
@@ -439,7 +389,7 @@
 
         return false;
     }
-    
+
     /**
      * Emit a function in several variants:
      *
@@ -449,9 +399,7 @@
      *   if interfaceDecl:  public <returntype> func(args);
      *   if !interfaceDecl: public <returntype> func(args) { body }
      */
-    void emitFunction(JFunc jfunc,
-                      PrintStream out,
-                      boolean nativeDecl, boolean interfaceDecl) {
+    void emitFunction(JFunc jfunc, PrintStream out, boolean nativeDecl, boolean interfaceDecl) {
         boolean isPointerFunc =
             jfunc.getName().endsWith("Pointer") &&
             jfunc.getCFunc().hasPointerArg();
@@ -462,28 +410,30 @@
             return;
         }
 
+        String maybeStatic = mUseStaticMethods ? "static " : "";
+
         if (isPointerFunc) {
             out.println(indent +
-                        (nativeDecl ? "private native " :
-                         (interfaceDecl ? "" : "public ")) +
+                        (nativeDecl ? "private " + maybeStatic +"native " :
+                         (interfaceDecl ? "" : "public ") + maybeStatic) +
                         jfunc.getType() + " " +
                         jfunc.getName() +
                         (nativeDecl ? "Bounds" : "") +
                         "(");
         } else {
             out.println(indent +
-                        (nativeDecl ? "public native " :
-                         (interfaceDecl ? "" : "public ")) +
+                        (nativeDecl ? "public " + maybeStatic +"native " :
+                         (interfaceDecl ? "" : "public ") + maybeStatic) +
                         jfunc.getType() + " " +
                         jfunc.getName() +
                         "(");
         }
-	
+
         int numArgs = jfunc.getNumArgs();
         for (int i = 0; i < numArgs; i++) {
             String argName = jfunc.getArgName(i);
             JType argType = jfunc.getArgType(i);
-	    
+
             out.print(indent + indent + argType + " " + argName);
             if (i == numArgs - 1) {
                 if (isPointerFunc && nativeDecl) {
@@ -561,29 +511,44 @@
         out.println();
     }
 
-    public static String getJniName(JType jType) {
-        String jniName = "";
-        if (jType.isClass()) {
-            return "L" + jType.getBaseType() + ";";
-        } else if (jType.isArray()) {
-            jniName = "[";
+    public void addNativeRegistration(String s) {
+        nativeRegistrations.add(s);
+    }
+
+    public void emitNativeRegistration(String registrationFunctionName,
+            PrintStream cStream) {
+        cStream.println("static const char *classPathName = \"" +
+                        mClassPathName +
+                        "\";");
+        cStream.println();
+
+        cStream.println("static JNINativeMethod methods[] = {");
+
+        cStream.println("{\"_nativeClassInit\", \"()V\", (void*)nativeClassInit },");
+
+        Iterator<String> i = nativeRegistrations.iterator();
+        while (i.hasNext()) {
+            cStream.println(i.next());
         }
-	
-        String baseType = jType.getBaseType();
-        if (baseType.equals("int")) {
-            jniName += "I";
-        } else if (baseType.equals("float")) {
-            jniName += "F";
-        } else if (baseType.equals("boolean")) {
-            jniName += "Z";
-        } else if (baseType.equals("short")) {
-            jniName += "S";
-        } else if (baseType.equals("long")) {
-            jniName += "L";
-        } else if (baseType.equals("byte")) {
-            jniName += "B";
-        }
-        return jniName;
+
+        cStream.println("};");
+        cStream.println();
+
+
+        cStream.println("int " + registrationFunctionName + "(JNIEnv *_env)");
+        cStream.println("{");
+        cStream.println(indent +
+                        "int err;");
+
+        cStream.println(indent +
+                        "err = android::AndroidRuntime::registerNativeMethods(_env, classPathName, methods, NELEM(methods));");
+
+        cStream.println(indent + "return err;");
+        cStream.println("}");
+    }
+
+    public JniCodeEmitter() {
+        super();
     }
 
     String getJniType(JType jType) {
@@ -604,7 +569,7 @@
             return "jobject";
         }
     }
-    
+
     String getJniMangledName(String name) {
         name = name.replaceAll("_", "_1");
         name = name.replaceAll(";", "_2");
@@ -614,7 +579,7 @@
 
     public void emitJniCode(JFunc jfunc, PrintStream out) {
         CFunc cfunc = jfunc.getCFunc();
-	
+
         // Emit comment identifying original C function
         //
         // Example:
@@ -658,13 +623,13 @@
         }
 
         // Append signature to function name
-        String sig = getJniMangledName(signature).replace('.', '_');        
+        String sig = getJniMangledName(signature).replace('.', '_');
         out.print("__" + sig);
         outName += "__" + sig;
-	
+
         signature = signature.replace('.', '/');
         rsignature = rsignature.replace('.', '/');
-	
+
         out.println();
         if (rsignature.length() == 0) {
             rsignature = "V";
@@ -718,13 +683,11 @@
             out.print(", jint remaining");
         }
         out.println(") {");
-	
+
         int numArrays = 0;
         int numBuffers = 0;
         for (int i = 0; i < nonPrimitiveArgs.size(); i++) {
             int idx = nonPrimitiveArgs.get(i).intValue();
-            int cIndex = jfunc.getArgCIndex(idx);
-            String cname = cfunc.getArgName(cIndex);
             if (jfunc.getArgType(idx).isArray()) {
                 ++numArrays;
             }
@@ -740,7 +703,7 @@
         // Example:
         //
         // android::gl::ogles_context_t *ctx;
-        // 
+        //
         // jint _exception;
         // GLenum _returnValue;
         //
@@ -827,15 +790,13 @@
                 out.println(indent +
                             decl +
                             (decl.endsWith("*") ? "" : " ") +
-                            jfunc.getArgName(idx) + 
+                            jfunc.getArgName(idx) +
                             " = (" + decl + ") 0;");
             }
 
             out.println();
         }
 
-        String retval = isVoid ? "" : " _returnValue";
-
         // Emit 'GetPrimitiveArrayCritical' for arrays
         // Emit 'GetPointer' calls for Buffer pointers
         int bufArgIdx = 0;
@@ -843,7 +804,7 @@
             for (int i = 0; i < nonPrimitiveArgs.size(); i++) {
                 int idx = nonPrimitiveArgs.get(i).intValue();
                 int cIndex = jfunc.getArgCIndex(idx);
-		
+
                 String cname = cfunc.getArgName(cIndex);
                 offset = numArrays <= 1 ? "offset" :
                     cname + "Offset";
@@ -852,7 +813,7 @@
 
                 if (jfunc.getArgType(idx).isArray()) {
                     out.println(indent +
-                                "if (!" + 
+                                "if (!" +
                                 cname +
                                 "_ref) {");
                     if (emitExceptionCheck) {
@@ -884,7 +845,7 @@
                     out.println(indent + "}");
 
                     out.println(indent + remaining + " = " +
-                                    (mUseCPlusPlus ? "_env" : "(*_env)") + 
+                                    (mUseCPlusPlus ? "_env" : "(*_env)") +
                                     "->GetArrayLength(" +
                                     (mUseCPlusPlus ? "" : "_env, ") +
                                     cname + "_ref) - " + offset + ";");
@@ -901,7 +862,7 @@
                     out.println(indent + "    " +
                                 (mUseCPlusPlus ? "_env" : "(*_env)") +
                                 "->GetPrimitiveArrayCritical(" +
-                                (mUseCPlusPlus ? "" : "_env, ") + 
+                                (mUseCPlusPlus ? "" : "_env, ") +
                                 jfunc.getArgName(idx) +
                                 "_ref, (jboolean *)0);");
                     out.println(indent +
@@ -917,7 +878,7 @@
                         out.println(indent + "if (" + cname + "_buf) {");
                         out.print(indent);
                     }
-                    
+
                     out.println(indent +
                                 cname +
                                 " = (" +
@@ -950,10 +911,10 @@
                 name.substring(1, name.length());
             out.print("ctx->procs.");
         }
-        
+
         out.print(name + (isPointerFunc ? "Bounds" : "") + "(");
 
-        numArgs = cfunc.getNumArgs();    
+        numArgs = cfunc.getNumArgs();
         if (numArgs == 0) {
             if (mUseContextPointer) {
                 out.println("ctx);");
@@ -1006,7 +967,7 @@
 
                 int cIndex = jfunc.getArgCIndex(idx);
                 if (jfunc.getArgType(idx).isArray()) {
-		    
+
                     // If the argument is 'const', GL will not write to it.
                     // In this case, we can use the 'JNI_ABORT' flag to avoid
                     // the need to write back to the Java array
@@ -1015,7 +976,7 @@
                     out.println(indent + indent +
                                 (mUseCPlusPlus ? "_env" : "(*_env)") +
                                 "->ReleasePrimitiveArrayCritical(" +
-                                (mUseCPlusPlus ? "" : "_env, ") + 
+                                (mUseCPlusPlus ? "" : "_env, ") +
                                 jfunc.getArgName(idx) + "_ref, " +
                                 cfunc.getArgName(cIndex) +
                                 "_base,");
@@ -1049,38 +1010,4 @@
         out.println();
     }
 
-    public void addNativeRegistration(String s) {
-        nativeRegistrations.add(s);
-    }
-
-    public void emitNativeRegistration() {
-        mCStream.println("static const char *classPathName = \"" +
-                        mClassPathName +
-                        "\";");
-        mCStream.println();
-
-        mCStream.println("static JNINativeMethod methods[] = {");
-
-        mCStream.println("{\"_nativeClassInit\", \"()V\", (void*)nativeClassInit },");
-
-        Iterator<String> i = nativeRegistrations.iterator();
-        while (i.hasNext()) {
-            mCStream.println(i.next());
-        }
-
-        mCStream.println("};");
-        mCStream.println();
-    
-
-        mCStream.println("int register_com_google_android_gles_jni_GLImpl(JNIEnv *_env)");
-        mCStream.println("{");
-        mCStream.println(indent +
-                        "int err;");
-
-        mCStream.println(indent +
-                        "err = android::AndroidRuntime::registerNativeMethods(_env, classPathName, methods, NELEM(methods));");
-
-        mCStream.println(indent + "return err;");
-        mCStream.println("}");
-    }
 }
diff --git a/opengl/tools/glgen/src/Jsr239CodeEmitter.java b/opengl/tools/glgen/src/Jsr239CodeEmitter.java
new file mode 100644
index 0000000..335d226
--- /dev/null
+++ b/opengl/tools/glgen/src/Jsr239CodeEmitter.java
@@ -0,0 +1,74 @@
+import java.io.PrintStream;
+
+/**
+ * Emits a Java interface and Java & C implementation for a C function.
+ *
+ * <p> The Java interface will have Buffer and array variants for functions that
+ * have a typed pointer argument.  The array variant will convert a single "<type> *data"
+ * argument to a pair of arguments "<type>[] data, int offset".
+ */
+public class Jsr239CodeEmitter extends JniCodeEmitter implements CodeEmitter {
+
+    PrintStream mJava10InterfaceStream;
+    PrintStream mJava10ExtInterfaceStream;
+    PrintStream mJava11InterfaceStream;
+    PrintStream mJava11ExtInterfaceStream;
+    PrintStream mJava11ExtPackInterfaceStream;
+    PrintStream mJavaImplStream;
+    PrintStream mCStream;
+
+    PrintStream mJavaInterfaceStream;
+
+    /**
+     * @param java10InterfaceStream the PrintStream to which to emit the Java interface for GL 1.0 functions
+     * @param java10ExtInterfaceStream the PrintStream to which to emit the Java interface for GL 1.0 extension functions
+     * @param java11InterfaceStream the PrintStream to which to emit the Java interface for GL 1.1 functions
+     * @param java11ExtInterfaceStream the PrintStream to which to emit the Java interface for GL 1.1 Extension functions
+     * @param java11ExtPackInterfaceStream the PrintStream to which to emit the Java interface for GL 1.1 Extension Pack functions
+     * @param javaImplStream the PrintStream to which to emit the Java implementation
+     * @param cStream the PrintStream to which to emit the C implementation
+     */
+    public Jsr239CodeEmitter(String classPathName,
+                          ParameterChecker checker,
+                          PrintStream java10InterfaceStream,
+                          PrintStream java10ExtInterfaceStream,
+                          PrintStream java11InterfaceStream,
+                          PrintStream java11ExtInterfaceStream,
+                          PrintStream java11ExtPackInterfaceStream,
+                          PrintStream javaImplStream,
+                          PrintStream cStream,
+                          boolean useContextPointer) {
+        mClassPathName = classPathName;
+        mChecker = checker;
+        mJava10InterfaceStream = java10InterfaceStream;
+        mJava10ExtInterfaceStream = java10ExtInterfaceStream;
+        mJava11InterfaceStream = java11InterfaceStream;
+        mJava11ExtInterfaceStream = java11ExtInterfaceStream;
+        mJava11ExtPackInterfaceStream = java11ExtPackInterfaceStream;
+        mJavaImplStream = javaImplStream;
+        mCStream = cStream;
+        mUseContextPointer = useContextPointer;
+    }
+
+    public void setVersion(int version, boolean ext, boolean pack) {
+        if (version == 0) {
+            mJavaInterfaceStream = ext ? mJava10ExtInterfaceStream :
+                mJava10InterfaceStream;
+        } else if (version == 1) {
+            mJavaInterfaceStream = ext ?
+                (pack ? mJava11ExtPackInterfaceStream :
+                 mJava11ExtInterfaceStream) :
+                mJava11InterfaceStream;
+        } else {
+            throw new RuntimeException("Bad version: " + version);
+        }
+    }
+
+    public void emitCode(CFunc cfunc, String original) {
+        emitCode(cfunc, original, mJavaInterfaceStream, mJavaImplStream, mCStream);
+    }
+
+    public void emitNativeRegistration() {
+        emitNativeRegistration("register_com_google_android_gles_jni_GLImpl", mCStream);
+    }
+}
diff --git a/opengl/tools/glgen/stubs/gles11/GLES10ExtHeader.java-if b/opengl/tools/glgen/stubs/gles11/GLES10ExtHeader.java-if
new file mode 100644
index 0000000..42891ea
--- /dev/null
+++ b/opengl/tools/glgen/stubs/gles11/GLES10ExtHeader.java-if
@@ -0,0 +1,26 @@
+**
+** Copyright 2009, The Android Open Source Project
+**
+** Licensed under the Apache License, Version 2.0 (the "License");
+** you may not use this file except in compliance with the License.
+** You may obtain a copy of the License at
+**
+**     http://www.apache.org/licenses/LICENSE-2.0
+**
+** Unless required by applicable law or agreed to in writing, software
+** distributed under the License is distributed on an "AS IS" BASIS,
+** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+** See the License for the specific language governing permissions and 
+** limitations under the License.
+*/
+
+// This source file is automatically generated
+
+package android.opengl;
+
+public class GLES10Ext {
+    native private static void _nativeClassInit();
+    static {
+	    _nativeClassInit();
+    }
+    
\ No newline at end of file
diff --git a/opengl/tools/glgen/stubs/GLCHeader.cpp b/opengl/tools/glgen/stubs/gles11/GLES10ExtcHeader.cpp
similarity index 97%
copy from opengl/tools/glgen/stubs/GLCHeader.cpp
copy to opengl/tools/glgen/stubs/gles11/GLES10ExtcHeader.cpp
index 6495686..3e5c19c 100644
--- a/opengl/tools/glgen/stubs/GLCHeader.cpp
+++ b/opengl/tools/glgen/stubs/gles11/GLES10ExtcHeader.cpp
@@ -1,5 +1,5 @@
 **
-** Copyright 2006, The Android Open Source Project
+** Copyright 2009, The Android Open Source Project
 **
 ** Licensed under the Apache License, Version 2.0 (the "License"); 
 ** you may not use this file except in compliance with the License. 
@@ -44,7 +44,7 @@
 
 /* Cache method IDs each time the class is loaded. */
 
-void
+static void
 nativeClassInitBuffer(JNIEnv *_env)
 {
     jclass nioAccessClassLocal = _env->FindClass("java/nio/NIOAccess");
diff --git a/opengl/tools/glgen/stubs/gles11/GLES10Header.java-if b/opengl/tools/glgen/stubs/gles11/GLES10Header.java-if
new file mode 100644
index 0000000..4b2a831
--- /dev/null
+++ b/opengl/tools/glgen/stubs/gles11/GLES10Header.java-if
@@ -0,0 +1,271 @@
+**
+** Copyright 2009, The Android Open Source Project
+**
+** Licensed under the Apache License, Version 2.0 (the "License");
+** you may not use this file except in compliance with the License.
+** You may obtain a copy of the License at
+**
+**     http://www.apache.org/licenses/LICENSE-2.0
+**
+** Unless required by applicable law or agreed to in writing, software
+** distributed under the License is distributed on an "AS IS" BASIS,
+** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+** See the License for the specific language governing permissions and
+** limitations under the License.
+*/
+
+// This source file is automatically generated
+
+package android.opengl;
+
+import java.nio.Buffer;
+
+public class GLES10 {
+    public static final int GL_ADD                                   = 0x0104;
+    public static final int GL_ALIASED_LINE_WIDTH_RANGE              = 0x846E;
+    public static final int GL_ALIASED_POINT_SIZE_RANGE              = 0x846D;
+    public static final int GL_ALPHA                                 = 0x1906;
+    public static final int GL_ALPHA_BITS                            = 0x0D55;
+    public static final int GL_ALPHA_TEST                            = 0x0BC0;
+    public static final int GL_ALWAYS                                = 0x0207;
+    public static final int GL_AMBIENT                               = 0x1200;
+    public static final int GL_AMBIENT_AND_DIFFUSE                   = 0x1602;
+    public static final int GL_AND                                   = 0x1501;
+    public static final int GL_AND_INVERTED                          = 0x1504;
+    public static final int GL_AND_REVERSE                           = 0x1502;
+    public static final int GL_BACK                                  = 0x0405;
+    public static final int GL_BLEND                                 = 0x0BE2;
+    public static final int GL_BLUE_BITS                             = 0x0D54;
+    public static final int GL_BYTE                                  = 0x1400;
+    public static final int GL_CCW                                   = 0x0901;
+    public static final int GL_CLAMP_TO_EDGE                         = 0x812F;
+    public static final int GL_CLEAR                                 = 0x1500;
+    public static final int GL_COLOR_ARRAY                           = 0x8076;
+    public static final int GL_COLOR_BUFFER_BIT                      = 0x4000;
+    public static final int GL_COLOR_LOGIC_OP                        = 0x0BF2;
+    public static final int GL_COLOR_MATERIAL                        = 0x0B57;
+    public static final int GL_COMPRESSED_TEXTURE_FORMATS            = 0x86A3;
+    public static final int GL_CONSTANT_ATTENUATION                  = 0x1207;
+    public static final int GL_COPY                                  = 0x1503;
+    public static final int GL_COPY_INVERTED                         = 0x150C;
+    public static final int GL_CULL_FACE                             = 0x0B44;
+    public static final int GL_CW                                    = 0x0900;
+    public static final int GL_DECAL                                 = 0x2101;
+    public static final int GL_DECR                                  = 0x1E03;
+    public static final int GL_DEPTH_BITS                            = 0x0D56;
+    public static final int GL_DEPTH_BUFFER_BIT                      = 0x0100;
+    public static final int GL_DEPTH_TEST                            = 0x0B71;
+    public static final int GL_DIFFUSE                               = 0x1201;
+    public static final int GL_DITHER                                = 0x0BD0;
+    public static final int GL_DONT_CARE                             = 0x1100;
+    public static final int GL_DST_ALPHA                             = 0x0304;
+    public static final int GL_DST_COLOR                             = 0x0306;
+    public static final int GL_EMISSION                              = 0x1600;
+    public static final int GL_EQUAL                                 = 0x0202;
+    public static final int GL_EQUIV                                 = 0x1509;
+    public static final int GL_EXP                                   = 0x0800;
+    public static final int GL_EXP2                                  = 0x0801;
+    public static final int GL_EXTENSIONS                            = 0x1F03;
+    public static final int GL_FALSE                                 = 0;
+    public static final int GL_FASTEST                               = 0x1101;
+    public static final int GL_FIXED                                 = 0x140C;
+    public static final int GL_FLAT                                  = 0x1D00;
+    public static final int GL_FLOAT                                 = 0x1406;
+    public static final int GL_FOG                                   = 0x0B60;
+    public static final int GL_FOG_COLOR                             = 0x0B66;
+    public static final int GL_FOG_DENSITY                           = 0x0B62;
+    public static final int GL_FOG_END                               = 0x0B64;
+    public static final int GL_FOG_HINT                              = 0x0C54;
+    public static final int GL_FOG_MODE                              = 0x0B65;
+    public static final int GL_FOG_START                             = 0x0B63;
+    public static final int GL_FRONT                                 = 0x0404;
+    public static final int GL_FRONT_AND_BACK                        = 0x0408;
+    public static final int GL_GEQUAL                                = 0x0206;
+    public static final int GL_GREATER                               = 0x0204;
+    public static final int GL_GREEN_BITS                            = 0x0D53;
+    public static final int GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES  = 0x8B9B;
+    public static final int GL_IMPLEMENTATION_COLOR_READ_TYPE_OES    = 0x8B9A;
+    public static final int GL_INCR                                  = 0x1E02;
+    public static final int GL_INVALID_ENUM                          = 0x0500;
+    public static final int GL_INVALID_OPERATION                     = 0x0502;
+    public static final int GL_INVALID_VALUE                         = 0x0501;
+    public static final int GL_INVERT                                = 0x150A;
+    public static final int GL_KEEP                                  = 0x1E00;
+    public static final int GL_LEQUAL                                = 0x0203;
+    public static final int GL_LESS                                  = 0x0201;
+    public static final int GL_LIGHT_MODEL_AMBIENT                   = 0x0B53;
+    public static final int GL_LIGHT_MODEL_TWO_SIDE                  = 0x0B52;
+    public static final int GL_LIGHT0                                = 0x4000;
+    public static final int GL_LIGHT1                                = 0x4001;
+    public static final int GL_LIGHT2                                = 0x4002;
+    public static final int GL_LIGHT3                                = 0x4003;
+    public static final int GL_LIGHT4                                = 0x4004;
+    public static final int GL_LIGHT5                                = 0x4005;
+    public static final int GL_LIGHT6                                = 0x4006;
+    public static final int GL_LIGHT7                                = 0x4007;
+    public static final int GL_LIGHTING                              = 0x0B50;
+    public static final int GL_LINE_LOOP                             = 0x0002;
+    public static final int GL_LINE_SMOOTH                           = 0x0B20;
+    public static final int GL_LINE_SMOOTH_HINT                      = 0x0C52;
+    public static final int GL_LINE_STRIP                            = 0x0003;
+    public static final int GL_LINEAR                                = 0x2601;
+    public static final int GL_LINEAR_ATTENUATION                    = 0x1208;
+    public static final int GL_LINEAR_MIPMAP_LINEAR                  = 0x2703;
+    public static final int GL_LINEAR_MIPMAP_NEAREST                 = 0x2701;
+    public static final int GL_LINES                                 = 0x0001;
+    public static final int GL_LUMINANCE                             = 0x1909;
+    public static final int GL_LUMINANCE_ALPHA                       = 0x190A;
+    public static final int GL_MAX_ELEMENTS_INDICES                  = 0x80E9;
+    public static final int GL_MAX_ELEMENTS_VERTICES                 = 0x80E8;
+    public static final int GL_MAX_LIGHTS                            = 0x0D31;
+    public static final int GL_MAX_MODELVIEW_STACK_DEPTH             = 0x0D36;
+    public static final int GL_MAX_PROJECTION_STACK_DEPTH            = 0x0D38;
+    public static final int GL_MAX_TEXTURE_SIZE                      = 0x0D33;
+    public static final int GL_MAX_TEXTURE_STACK_DEPTH               = 0x0D39;
+    public static final int GL_MAX_TEXTURE_UNITS                     = 0x84E2;
+    public static final int GL_MAX_VIEWPORT_DIMS                     = 0x0D3A;
+    public static final int GL_MODELVIEW                             = 0x1700;
+    public static final int GL_MODULATE                              = 0x2100;
+    public static final int GL_MULTISAMPLE                           = 0x809D;
+    public static final int GL_NAND                                  = 0x150E;
+    public static final int GL_NEAREST                               = 0x2600;
+    public static final int GL_NEAREST_MIPMAP_LINEAR                 = 0x2702;
+    public static final int GL_NEAREST_MIPMAP_NEAREST                = 0x2700;
+    public static final int GL_NEVER                                 = 0x0200;
+    public static final int GL_NICEST                                = 0x1102;
+    public static final int GL_NO_ERROR                              = 0;
+    public static final int GL_NOOP                                  = 0x1505;
+    public static final int GL_NOR                                   = 0x1508;
+    public static final int GL_NORMAL_ARRAY                          = 0x8075;
+    public static final int GL_NORMALIZE                             = 0x0BA1;
+    public static final int GL_NOTEQUAL                              = 0x0205;
+    public static final int GL_NUM_COMPRESSED_TEXTURE_FORMATS        = 0x86A2;
+    public static final int GL_ONE                                   = 1;
+    public static final int GL_ONE_MINUS_DST_ALPHA                   = 0x0305;
+    public static final int GL_ONE_MINUS_DST_COLOR                   = 0x0307;
+    public static final int GL_ONE_MINUS_SRC_ALPHA                   = 0x0303;
+    public static final int GL_ONE_MINUS_SRC_COLOR                   = 0x0301;
+    public static final int GL_OR                                    = 0x1507;
+    public static final int GL_OR_INVERTED                           = 0x150D;
+    public static final int GL_OR_REVERSE                            = 0x150B;
+    public static final int GL_OUT_OF_MEMORY                         = 0x0505;
+    public static final int GL_PACK_ALIGNMENT                        = 0x0D05;
+    public static final int GL_PALETTE4_R5_G6_B5_OES                 = 0x8B92;
+    public static final int GL_PALETTE4_RGB5_A1_OES                  = 0x8B94;
+    public static final int GL_PALETTE4_RGB8_OES                     = 0x8B90;
+    public static final int GL_PALETTE4_RGBA4_OES                    = 0x8B93;
+    public static final int GL_PALETTE4_RGBA8_OES                    = 0x8B91;
+    public static final int GL_PALETTE8_R5_G6_B5_OES                 = 0x8B97;
+    public static final int GL_PALETTE8_RGB5_A1_OES                  = 0x8B99;
+    public static final int GL_PALETTE8_RGB8_OES                     = 0x8B95;
+    public static final int GL_PALETTE8_RGBA4_OES                    = 0x8B98;
+    public static final int GL_PALETTE8_RGBA8_OES                    = 0x8B96;
+    public static final int GL_PERSPECTIVE_CORRECTION_HINT           = 0x0C50;
+    public static final int GL_POINT_SMOOTH                          = 0x0B10;
+    public static final int GL_POINT_SMOOTH_HINT                     = 0x0C51;
+    public static final int GL_POINTS                                = 0x0000;
+    public static final int GL_POINT_FADE_THRESHOLD_SIZE             = 0x8128;
+    public static final int GL_POINT_SIZE                            = 0x0B11;
+    public static final int GL_POLYGON_OFFSET_FILL                   = 0x8037;
+    public static final int GL_POLYGON_SMOOTH_HINT                   = 0x0C53;
+    public static final int GL_POSITION                              = 0x1203;
+    public static final int GL_PROJECTION                            = 0x1701;
+    public static final int GL_QUADRATIC_ATTENUATION                 = 0x1209;
+    public static final int GL_RED_BITS                              = 0x0D52;
+    public static final int GL_RENDERER                              = 0x1F01;
+    public static final int GL_REPEAT                                = 0x2901;
+    public static final int GL_REPLACE                               = 0x1E01;
+    public static final int GL_RESCALE_NORMAL                        = 0x803A;
+    public static final int GL_RGB                                   = 0x1907;
+    public static final int GL_RGBA                                  = 0x1908;
+    public static final int GL_SAMPLE_ALPHA_TO_COVERAGE              = 0x809E;
+    public static final int GL_SAMPLE_ALPHA_TO_ONE                   = 0x809F;
+    public static final int GL_SAMPLE_COVERAGE                       = 0x80A0;
+    public static final int GL_SCISSOR_TEST                          = 0x0C11;
+    public static final int GL_SET                                   = 0x150F;
+    public static final int GL_SHININESS                             = 0x1601;
+    public static final int GL_SHORT                                 = 0x1402;
+    public static final int GL_SMOOTH                                = 0x1D01;
+    public static final int GL_SMOOTH_LINE_WIDTH_RANGE               = 0x0B22;
+    public static final int GL_SMOOTH_POINT_SIZE_RANGE               = 0x0B12;
+    public static final int GL_SPECULAR                              = 0x1202;
+    public static final int GL_SPOT_CUTOFF                           = 0x1206;
+    public static final int GL_SPOT_DIRECTION                        = 0x1204;
+    public static final int GL_SPOT_EXPONENT                         = 0x1205;
+    public static final int GL_SRC_ALPHA                             = 0x0302;
+    public static final int GL_SRC_ALPHA_SATURATE                    = 0x0308;
+    public static final int GL_SRC_COLOR                             = 0x0300;
+    public static final int GL_STACK_OVERFLOW                        = 0x0503;
+    public static final int GL_STACK_UNDERFLOW                       = 0x0504;
+    public static final int GL_STENCIL_BITS                          = 0x0D57;
+    public static final int GL_STENCIL_BUFFER_BIT                    = 0x0400;
+    public static final int GL_STENCIL_TEST                          = 0x0B90;
+    public static final int GL_SUBPIXEL_BITS                         = 0x0D50;
+    public static final int GL_TEXTURE                               = 0x1702;
+    public static final int GL_TEXTURE_2D                            = 0x0DE1;
+    public static final int GL_TEXTURE_COORD_ARRAY                   = 0x8078;
+    public static final int GL_TEXTURE_ENV                           = 0x2300;
+    public static final int GL_TEXTURE_ENV_COLOR                     = 0x2201;
+    public static final int GL_TEXTURE_ENV_MODE                      = 0x2200;
+    public static final int GL_TEXTURE_MAG_FILTER                    = 0x2800;
+    public static final int GL_TEXTURE_MIN_FILTER                    = 0x2801;
+    public static final int GL_TEXTURE_WRAP_S                        = 0x2802;
+    public static final int GL_TEXTURE_WRAP_T                        = 0x2803;
+    public static final int GL_TEXTURE0                              = 0x84C0;
+    public static final int GL_TEXTURE1                              = 0x84C1;
+    public static final int GL_TEXTURE2                              = 0x84C2;
+    public static final int GL_TEXTURE3                              = 0x84C3;
+    public static final int GL_TEXTURE4                              = 0x84C4;
+    public static final int GL_TEXTURE5                              = 0x84C5;
+    public static final int GL_TEXTURE6                              = 0x84C6;
+    public static final int GL_TEXTURE7                              = 0x84C7;
+    public static final int GL_TEXTURE8                              = 0x84C8;
+    public static final int GL_TEXTURE9                              = 0x84C9;
+    public static final int GL_TEXTURE10                             = 0x84CA;
+    public static final int GL_TEXTURE11                             = 0x84CB;
+    public static final int GL_TEXTURE12                             = 0x84CC;
+    public static final int GL_TEXTURE13                             = 0x84CD;
+    public static final int GL_TEXTURE14                             = 0x84CE;
+    public static final int GL_TEXTURE15                             = 0x84CF;
+    public static final int GL_TEXTURE16                             = 0x84D0;
+    public static final int GL_TEXTURE17                             = 0x84D1;
+    public static final int GL_TEXTURE18                             = 0x84D2;
+    public static final int GL_TEXTURE19                             = 0x84D3;
+    public static final int GL_TEXTURE20                             = 0x84D4;
+    public static final int GL_TEXTURE21                             = 0x84D5;
+    public static final int GL_TEXTURE22                             = 0x84D6;
+    public static final int GL_TEXTURE23                             = 0x84D7;
+    public static final int GL_TEXTURE24                             = 0x84D8;
+    public static final int GL_TEXTURE25                             = 0x84D9;
+    public static final int GL_TEXTURE26                             = 0x84DA;
+    public static final int GL_TEXTURE27                             = 0x84DB;
+    public static final int GL_TEXTURE28                             = 0x84DC;
+    public static final int GL_TEXTURE29                             = 0x84DD;
+    public static final int GL_TEXTURE30                             = 0x84DE;
+    public static final int GL_TEXTURE31                             = 0x84DF;
+    public static final int GL_TRIANGLE_FAN                          = 0x0006;
+    public static final int GL_TRIANGLE_STRIP                        = 0x0005;
+    public static final int GL_TRIANGLES                             = 0x0004;
+    public static final int GL_TRUE                                  = 1;
+    public static final int GL_UNPACK_ALIGNMENT                      = 0x0CF5;
+    public static final int GL_UNSIGNED_BYTE                         = 0x1401;
+    public static final int GL_UNSIGNED_SHORT                        = 0x1403;
+    public static final int GL_UNSIGNED_SHORT_4_4_4_4                = 0x8033;
+    public static final int GL_UNSIGNED_SHORT_5_5_5_1                = 0x8034;
+    public static final int GL_UNSIGNED_SHORT_5_6_5                  = 0x8363;
+    public static final int GL_VENDOR                                = 0x1F00;
+    public static final int GL_VERSION                               = 0x1F02;
+    public static final int GL_VERTEX_ARRAY                          = 0x8074;
+    public static final int GL_XOR                                   = 0x1506;
+    public static final int GL_ZERO                                  = 0;
+
+    native private static void _nativeClassInit();
+    static {
+	    _nativeClassInit();
+    }
+
+    private static Buffer _colorPointer;
+    private static Buffer _normalPointer;
+    private static Buffer _texCoordPointer;
+    private static Buffer _vertexPointer;
+
diff --git a/opengl/tools/glgen/stubs/GLCHeader.cpp b/opengl/tools/glgen/stubs/gles11/GLES10cHeader.cpp
similarity index 98%
copy from opengl/tools/glgen/stubs/GLCHeader.cpp
copy to opengl/tools/glgen/stubs/gles11/GLES10cHeader.cpp
index 6495686..3e5c19c 100644
--- a/opengl/tools/glgen/stubs/GLCHeader.cpp
+++ b/opengl/tools/glgen/stubs/gles11/GLES10cHeader.cpp
@@ -1,5 +1,5 @@
 **
-** Copyright 2006, The Android Open Source Project
+** Copyright 2009, The Android Open Source Project
 **
 ** Licensed under the Apache License, Version 2.0 (the "License"); 
 ** you may not use this file except in compliance with the License. 
@@ -44,7 +44,7 @@
 
 /* Cache method IDs each time the class is loaded. */
 
-void
+static void
 nativeClassInitBuffer(JNIEnv *_env)
 {
     jclass nioAccessClassLocal = _env->FindClass("java/nio/NIOAccess");
diff --git a/opengl/tools/glgen/stubs/gles11/GLES11ExtHeader.java-if b/opengl/tools/glgen/stubs/gles11/GLES11ExtHeader.java-if
new file mode 100644
index 0000000..428ccee
--- /dev/null
+++ b/opengl/tools/glgen/stubs/gles11/GLES11ExtHeader.java-if
@@ -0,0 +1,130 @@
+**
+** Copyright 2009, The Android Open Source Project
+**
+** Licensed under the Apache License, Version 2.0 (the "License");
+** you may not use this file except in compliance with the License.
+** You may obtain a copy of the License at
+**
+**     http://www.apache.org/licenses/LICENSE-2.0
+**
+** Unless required by applicable law or agreed to in writing, software
+** distributed under the License is distributed on an "AS IS" BASIS,
+** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+** See the License for the specific language governing permissions and 
+** limitations under the License.
+*/
+
+// This source file is automatically generated
+
+package android.opengl;
+
+public class GLES11Ext {
+    public static final int GL_BLEND_EQUATION_RGB_OES                               = 0x8009;
+    public static final int GL_BLEND_EQUATION_ALPHA_OES                             = 0x883D;
+    public static final int GL_BLEND_DST_RGB_OES                                    = 0x80C8;
+    public static final int GL_BLEND_SRC_RGB_OES                                    = 0x80C9;
+    public static final int GL_BLEND_DST_ALPHA_OES                                  = 0x80CA;
+    public static final int GL_BLEND_SRC_ALPHA_OES                                  = 0x80CB;
+    public static final int GL_BLEND_EQUATION_OES                                   = 0x8009;
+    public static final int GL_FUNC_ADD_OES                                         = 0x8006;
+    public static final int GL_FUNC_SUBTRACT_OES                                    = 0x800A;
+    public static final int GL_FUNC_REVERSE_SUBTRACT_OES                            = 0x800B;
+    public static final int GL_ETC1_RGB8_OES                                        = 0x8D64;
+    public static final int GL_DEPTH_COMPONENT24_OES                                = 0x81A6;
+    public static final int GL_DEPTH_COMPONENT32_OES                                = 0x81A7;
+    public static final int GL_TEXTURE_CROP_RECT_OES                                = 0x8B9D;
+    public static final int GL_FIXED_OES                                            = 0x140C;
+    public static final int GL_NONE_OES                                             = 0;
+    public static final int GL_FRAMEBUFFER_OES                                      = 0x8D40;
+    public static final int GL_RENDERBUFFER_OES                                     = 0x8D41;
+    public static final int GL_RGBA4_OES                                            = 0x8056;
+    public static final int GL_RGB5_A1_OES                                          = 0x8057;
+    public static final int GL_RGB565_OES                                           = 0x8D62;
+    public static final int GL_DEPTH_COMPONENT16_OES                                = 0x81A5;
+    public static final int GL_RENDERBUFFER_WIDTH_OES                               = 0x8D42;
+    public static final int GL_RENDERBUFFER_HEIGHT_OES                              = 0x8D43;
+    public static final int GL_RENDERBUFFER_INTERNAL_FORMAT_OES                     = 0x8D44;
+    public static final int GL_RENDERBUFFER_RED_SIZE_OES                            = 0x8D50;
+    public static final int GL_RENDERBUFFER_GREEN_SIZE_OES                          = 0x8D51;
+    public static final int GL_RENDERBUFFER_BLUE_SIZE_OES                           = 0x8D52;
+    public static final int GL_RENDERBUFFER_ALPHA_SIZE_OES                          = 0x8D53;
+    public static final int GL_RENDERBUFFER_DEPTH_SIZE_OES                          = 0x8D54;
+    public static final int GL_RENDERBUFFER_STENCIL_SIZE_OES                        = 0x8D55;
+    public static final int GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE_OES               = 0x8CD0;
+    public static final int GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME_OES               = 0x8CD1;
+    public static final int GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL_OES             = 0x8CD2;
+    public static final int GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE_OES     = 0x8CD3;
+    public static final int GL_COLOR_ATTACHMENT0_OES                                = 0x8CE0;
+    public static final int GL_DEPTH_ATTACHMENT_OES                                 = 0x8D00;
+    public static final int GL_STENCIL_ATTACHMENT_OES                               = 0x8D20;
+    public static final int GL_FRAMEBUFFER_COMPLETE_OES                             = 0x8CD5;
+    public static final int GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_OES                = 0x8CD6;
+    public static final int GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_OES        = 0x8CD7;
+    public static final int GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_OES                = 0x8CD9;
+    public static final int GL_FRAMEBUFFER_INCOMPLETE_FORMATS_OES                   = 0x8CDA;
+    public static final int GL_FRAMEBUFFER_UNSUPPORTED_OES                          = 0x8CDD;
+    public static final int GL_FRAMEBUFFER_BINDING_OES                              = 0x8CA6;
+    public static final int GL_RENDERBUFFER_BINDING_OES                             = 0x8CA7;
+    public static final int GL_MAX_RENDERBUFFER_SIZE_OES                            = 0x84E8;
+    public static final int GL_INVALID_FRAMEBUFFER_OPERATION_OES                    = 0x0506;
+    public static final int GL_WRITE_ONLY_OES                                       = 0x88B9;
+    public static final int GL_BUFFER_ACCESS_OES                                    = 0x88BB;
+    public static final int GL_BUFFER_MAPPED_OES                                    = 0x88BC;
+    public static final int GL_BUFFER_MAP_POINTER_OES                               = 0x88BD;
+    public static final int GL_MODELVIEW_MATRIX_FLOAT_AS_INT_BITS_OES               = 0x898D;
+    public static final int GL_PROJECTION_MATRIX_FLOAT_AS_INT_BITS_OES              = 0x898E;
+    public static final int GL_TEXTURE_MATRIX_FLOAT_AS_INT_BITS_OES                 = 0x898F;
+    public static final int GL_MAX_VERTEX_UNITS_OES                                 = 0x86A4;
+    public static final int GL_MAX_PALETTE_MATRICES_OES                             = 0x8842;
+    public static final int GL_MATRIX_PALETTE_OES                                   = 0x8840;
+    public static final int GL_MATRIX_INDEX_ARRAY_OES                               = 0x8844;
+    public static final int GL_WEIGHT_ARRAY_OES                                     = 0x86AD;
+    public static final int GL_CURRENT_PALETTE_MATRIX_OES                           = 0x8843;
+    public static final int GL_MATRIX_INDEX_ARRAY_SIZE_OES                          = 0x8846;
+    public static final int GL_MATRIX_INDEX_ARRAY_TYPE_OES                          = 0x8847;
+    public static final int GL_MATRIX_INDEX_ARRAY_STRIDE_OES                        = 0x8848;
+    public static final int GL_MATRIX_INDEX_ARRAY_POINTER_OES                       = 0x8849;
+    public static final int GL_MATRIX_INDEX_ARRAY_BUFFER_BINDING_OES                = 0x8B9E;
+    public static final int GL_WEIGHT_ARRAY_SIZE_OES                                = 0x86AB;
+    public static final int GL_WEIGHT_ARRAY_TYPE_OES                                = 0x86A9;
+    public static final int GL_WEIGHT_ARRAY_STRIDE_OES                              = 0x86AA;
+    public static final int GL_WEIGHT_ARRAY_POINTER_OES                             = 0x86AC;
+    public static final int GL_WEIGHT_ARRAY_BUFFER_BINDING_OES                      = 0x889E;
+    public static final int GL_DEPTH_STENCIL_OES                                    = 0x84F9;
+    public static final int GL_UNSIGNED_INT_24_8_OES                                = 0x84FA;
+    public static final int GL_DEPTH24_STENCIL8_OES                                 = 0x88F0;
+    public static final int GL_RGB8_OES                                             = 0x8051;
+    public static final int GL_RGBA8_OES                                            = 0x8058;
+    public static final int GL_STENCIL_INDEX1_OES                                   = 0x8D46;
+    public static final int GL_STENCIL_INDEX4_OES                                   = 0x8D47;
+    public static final int GL_STENCIL_INDEX8_OES                                   = 0x8D48;
+    public static final int GL_INCR_WRAP_OES                                        = 0x8507;
+    public static final int GL_DECR_WRAP_OES                                        = 0x8508;
+    public static final int GL_NORMAL_MAP_OES                                       = 0x8511;
+    public static final int GL_REFLECTION_MAP_OES                                   = 0x8512;
+    public static final int GL_TEXTURE_CUBE_MAP_OES                                 = 0x8513;
+    public static final int GL_TEXTURE_BINDING_CUBE_MAP_OES                         = 0x8514;
+    public static final int GL_TEXTURE_CUBE_MAP_POSITIVE_X_OES                      = 0x8515;
+    public static final int GL_TEXTURE_CUBE_MAP_NEGATIVE_X_OES                      = 0x8516;
+    public static final int GL_TEXTURE_CUBE_MAP_POSITIVE_Y_OES                      = 0x8517;
+    public static final int GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_OES                      = 0x8518;
+    public static final int GL_TEXTURE_CUBE_MAP_POSITIVE_Z_OES                      = 0x8519;
+    public static final int GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_OES                      = 0x851A;
+    public static final int GL_MAX_CUBE_MAP_TEXTURE_SIZE_OES                        = 0x851C;
+    public static final int GL_TEXTURE_GEN_MODE_OES                                 = 0x2500;
+    public static final int GL_TEXTURE_GEN_STR_OES                                  = 0x8D60;
+    public static final int GL_MIRRORED_REPEAT_OES                                  = 0x8370;
+    public static final int GL_3DC_X_AMD                                            = 0x87F9;
+    public static final int GL_3DC_XY_AMD                                           = 0x87FA;
+    public static final int GL_ATC_RGB_AMD                                          = 0x8C92;
+    public static final int GL_ATC_RGBA_EXPLICIT_ALPHA_AMD                          = 0x8C93;
+    public static final int GL_ATC_RGBA_INTERPOLATED_ALPHA_AMD                      = 0x87EE;
+    public static final int GL_TEXTURE_MAX_ANISOTROPY_EXT                           = 0x84FE;
+    public static final int GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT                       = 0x84FF;
+    public static final int GL_BGRA                                                 = 0x80E1;
+
+    native private static void _nativeClassInit();
+    static {
+	    _nativeClassInit();
+    }
+    
\ No newline at end of file
diff --git a/opengl/tools/glgen/stubs/GLCHeader.cpp b/opengl/tools/glgen/stubs/gles11/GLES11ExtcHeader.cpp
similarity index 97%
copy from opengl/tools/glgen/stubs/GLCHeader.cpp
copy to opengl/tools/glgen/stubs/gles11/GLES11ExtcHeader.cpp
index 6495686..3e5c19c 100644
--- a/opengl/tools/glgen/stubs/GLCHeader.cpp
+++ b/opengl/tools/glgen/stubs/gles11/GLES11ExtcHeader.cpp
@@ -1,5 +1,5 @@
 **
-** Copyright 2006, The Android Open Source Project
+** Copyright 2009, The Android Open Source Project
 **
 ** Licensed under the Apache License, Version 2.0 (the "License"); 
 ** you may not use this file except in compliance with the License. 
@@ -44,7 +44,7 @@
 
 /* Cache method IDs each time the class is loaded. */
 
-void
+static void
 nativeClassInitBuffer(JNIEnv *_env)
 {
     jclass nioAccessClassLocal = _env->FindClass("java/nio/NIOAccess");
diff --git a/opengl/tools/glgen/stubs/gles11/GLES11Header.java-if b/opengl/tools/glgen/stubs/gles11/GLES11Header.java-if
new file mode 100644
index 0000000..26f466f
--- /dev/null
+++ b/opengl/tools/glgen/stubs/gles11/GLES11Header.java-if
@@ -0,0 +1,151 @@
+**
+** Copyright 2009, The Android Open Source Project
+**
+** Licensed under the Apache License, Version 2.0 (the "License");
+** you may not use this file except in compliance with the License.
+** You may obtain a copy of the License at
+**
+**     http://www.apache.org/licenses/LICENSE-2.0
+**
+** Unless required by applicable law or agreed to in writing, software
+** distributed under the License is distributed on an "AS IS" BASIS,
+** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+** See the License for the specific language governing permissions and
+** limitations under the License.
+*/
+
+// This source file is automatically generated
+
+package android.opengl;
+
+import java.nio.Buffer;
+
+public class GLES11 extends GLES10 {
+    public static final int GL_ACTIVE_TEXTURE                          = 0x84E0;
+    public static final int GL_ADD_SIGNED                              = 0x8574;
+    public static final int GL_ALPHA_SCALE                             = 0x0D1C;
+    public static final int GL_ALPHA_TEST_FUNC                         = 0x0BC1;
+    public static final int GL_ALPHA_TEST_REF                          = 0x0BC2;
+    public static final int GL_ARRAY_BUFFER                            = 0x8892;
+    public static final int GL_ARRAY_BUFFER_BINDING                    = 0x8894;
+    public static final int GL_BLEND_DST                               = 0x0BE0;
+    public static final int GL_BLEND_SRC                               = 0x0BE1;
+    public static final int GL_BUFFER_ACCESS                           = 0x88BB;
+    public static final int GL_BUFFER_SIZE                             = 0x8764;
+    public static final int GL_BUFFER_USAGE                            = 0x8765;
+    public static final int GL_CLIENT_ACTIVE_TEXTURE                   = 0x84E1;
+    public static final int GL_CLIP_PLANE0                             = 0x3000;
+    public static final int GL_CLIP_PLANE1                             = 0x3001;
+    public static final int GL_CLIP_PLANE2                             = 0x3002;
+    public static final int GL_CLIP_PLANE3                             = 0x3003;
+    public static final int GL_CLIP_PLANE4                             = 0x3004;
+    public static final int GL_CLIP_PLANE5                             = 0x3005;
+    public static final int GL_COLOR_ARRAY_BUFFER_BINDING              = 0x8898;
+    public static final int GL_COLOR_ARRAY_POINTER                     = 0x8090;
+    public static final int GL_COLOR_ARRAY_SIZE                        = 0x8081;
+    public static final int GL_COLOR_ARRAY_STRIDE                      = 0x8083;
+    public static final int GL_COLOR_ARRAY_TYPE                        = 0x8082;
+    public static final int GL_COLOR_CLEAR_VALUE                       = 0x0C22;
+    public static final int GL_COLOR_WRITEMASK                         = 0x0C23;
+    public static final int GL_COMBINE                                 = 0x8570;
+    public static final int GL_COMBINE_ALPHA                           = 0x8572;
+    public static final int GL_COMBINE_RGB                             = 0x8571;
+    public static final int GL_CONSTANT                                = 0x8576;
+    public static final int GL_COORD_REPLACE_OES                       = 0x8862;
+    public static final int GL_CULL_FACE_MODE                          = 0x0B45;
+    public static final int GL_CURRENT_COLOR                           = 0x0B00;
+    public static final int GL_CURRENT_NORMAL                          = 0x0B02;
+    public static final int GL_CURRENT_TEXTURE_COORDS                  = 0x0B03;
+    public static final int GL_DEPTH_CLEAR_VALUE                       = 0x0B73;
+    public static final int GL_DEPTH_FUNC                              = 0x0B74;
+    public static final int GL_DEPTH_RANGE                             = 0x0B70;
+    public static final int GL_DEPTH_WRITEMASK                         = 0x0B72;
+    public static final int GL_DOT3_RGB                                = 0x86AE;
+    public static final int GL_DOT3_RGBA                               = 0x86AF;
+    public static final int GL_DYNAMIC_DRAW                            = 0x88E8;
+    public static final int GL_ELEMENT_ARRAY_BUFFER                    = 0x8893;
+    public static final int GL_ELEMENT_ARRAY_BUFFER_BINDING            = 0x8895;
+    public static final int GL_FRONT_FACE                              = 0x0B46;
+    public static final int GL_GENERATE_MIPMAP                         = 0x8191;
+    public static final int GL_GENERATE_MIPMAP_HINT                    = 0x8192;
+    public static final int GL_INTERPOLATE                             = 0x8575;
+    public static final int GL_LINE_WIDTH                              = 0x0B21;
+    public static final int GL_LOGIC_OP_MODE                           = 0x0BF0;
+    public static final int GL_MATRIX_MODE                             = 0x0BA0;
+    public static final int GL_MAX_CLIP_PLANES                         = 0x0D32;
+    public static final int GL_MODELVIEW_MATRIX                        = 0x0BA6;
+    public static final int GL_MODELVIEW_MATRIX_FLOAT_AS_INT_BITS_OES  = 0x898D;
+    public static final int GL_MODELVIEW_STACK_DEPTH                   = 0x0BA3;
+    public static final int GL_NORMAL_ARRAY_BUFFER_BINDING             = 0x8897;
+    public static final int GL_NORMAL_ARRAY_POINTER                    = 0x808F;
+    public static final int GL_NORMAL_ARRAY_STRIDE                     = 0x807F;
+    public static final int GL_NORMAL_ARRAY_TYPE                       = 0x807E;
+    public static final int GL_OPERAND0_ALPHA                          = 0x8598;
+    public static final int GL_OPERAND0_RGB                            = 0x8590;
+    public static final int GL_OPERAND1_ALPHA                          = 0x8599;
+    public static final int GL_OPERAND1_RGB                            = 0x8591;
+    public static final int GL_OPERAND2_ALPHA                          = 0x859A;
+    public static final int GL_OPERAND2_RGB                            = 0x8592;
+    public static final int GL_POINT_DISTANCE_ATTENUATION              = 0x8129;
+    public static final int GL_POINT_FADE_THRESHOLD_SIZE               = 0x8128;
+    public static final int GL_POINT_SIZE                              = 0x0B11;
+    public static final int GL_POINT_SIZE_ARRAY_BUFFER_BINDING_OES     = 0x8B9F;
+    public static final int GL_POINT_SIZE_ARRAY_OES                    = 0x8B9C;
+    public static final int GL_POINT_SIZE_ARRAY_POINTER_OES            = 0x898C;
+    public static final int GL_POINT_SIZE_ARRAY_STRIDE_OES             = 0x898B;
+    public static final int GL_POINT_SIZE_ARRAY_TYPE_OES               = 0x898A;
+    public static final int GL_POINT_SIZE_MAX                          = 0x8127;
+    public static final int GL_POINT_SIZE_MIN                          = 0x8126;
+    public static final int GL_POINT_SPRITE_OES                        = 0x8861;
+    public static final int GL_POLYGON_OFFSET_FACTOR                   = 0x8038;
+    public static final int GL_POLYGON_OFFSET_UNITS                    = 0x2A00;
+    public static final int GL_PREVIOUS                                = 0x8578;
+    public static final int GL_PRIMARY_COLOR                           = 0x8577;
+    public static final int GL_PROJECTION_MATRIX                       = 0x0BA7;
+    public static final int GL_PROJECTION_MATRIX_FLOAT_AS_INT_BITS_OES = 0x898E;
+    public static final int GL_PROJECTION_STACK_DEPTH                  = 0x0BA4;
+    public static final int GL_RGB_SCALE                               = 0x8573;
+    public static final int GL_SAMPLE_BUFFERS                          = 0x80A8;
+    public static final int GL_SAMPLE_COVERAGE_INVERT                  = 0x80AB;
+    public static final int GL_SAMPLE_COVERAGE_VALUE                   = 0x80AA;
+    public static final int GL_SAMPLES                                 = 0x80A9;
+    public static final int GL_SCISSOR_BOX                             = 0x0C10;
+    public static final int GL_SHADE_MODEL                             = 0x0B54;
+    public static final int GL_SRC0_ALPHA                              = 0x8588;
+    public static final int GL_SRC0_RGB                                = 0x8580;
+    public static final int GL_SRC1_ALPHA                              = 0x8589;
+    public static final int GL_SRC1_RGB                                = 0x8581;
+    public static final int GL_SRC2_ALPHA                              = 0x858A;
+    public static final int GL_SRC2_RGB                                = 0x8582;
+    public static final int GL_STATIC_DRAW                             = 0x88E4;
+    public static final int GL_STENCIL_CLEAR_VALUE                     = 0x0B91;
+    public static final int GL_STENCIL_FAIL                            = 0x0B94;
+    public static final int GL_STENCIL_FUNC                            = 0x0B92;
+    public static final int GL_STENCIL_PASS_DEPTH_FAIL                 = 0x0B95;
+    public static final int GL_STENCIL_PASS_DEPTH_PASS                 = 0x0B96;
+    public static final int GL_STENCIL_REF                             = 0x0B97;
+    public static final int GL_STENCIL_VALUE_MASK                      = 0x0B93;
+    public static final int GL_STENCIL_WRITEMASK                       = 0x0B98;
+    public static final int GL_SUBTRACT                                = 0x84E7;
+    public static final int GL_TEXTURE_BINDING_2D                      = 0x8069;
+    public static final int GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING      = 0x889A;
+    public static final int GL_TEXTURE_COORD_ARRAY_POINTER             = 0x8092;
+    public static final int GL_TEXTURE_COORD_ARRAY_SIZE                = 0x8088;
+    public static final int GL_TEXTURE_COORD_ARRAY_STRIDE              = 0x808A;
+    public static final int GL_TEXTURE_COORD_ARRAY_TYPE                = 0x8089;
+    public static final int GL_TEXTURE_MATRIX                          = 0x0BA8;
+    public static final int GL_TEXTURE_MATRIX_FLOAT_AS_INT_BITS_OES    = 0x898F;
+    public static final int GL_TEXTURE_STACK_DEPTH                     = 0x0BA5;
+    public static final int GL_VERTEX_ARRAY_BUFFER_BINDING             = 0x8896;
+    public static final int GL_VERTEX_ARRAY_POINTER                    = 0x808E;
+    public static final int GL_VERTEX_ARRAY_SIZE                       = 0x807A;
+    public static final int GL_VERTEX_ARRAY_STRIDE                     = 0x807C;
+    public static final int GL_VERTEX_ARRAY_TYPE                       = 0x807B;
+    public static final int GL_VIEWPORT                                = 0x0BA2;
+    public static final int GL_WRITE_ONLY                              = 0x88B9;
+
+    native private static void _nativeClassInit();
+    static {
+	    _nativeClassInit();
+    }
+
diff --git a/opengl/tools/glgen/stubs/GLCHeader.cpp b/opengl/tools/glgen/stubs/gles11/GLES11cHeader.cpp
similarity index 98%
copy from opengl/tools/glgen/stubs/GLCHeader.cpp
copy to opengl/tools/glgen/stubs/gles11/GLES11cHeader.cpp
index 6495686..3e5c19c 100644
--- a/opengl/tools/glgen/stubs/GLCHeader.cpp
+++ b/opengl/tools/glgen/stubs/gles11/GLES11cHeader.cpp
@@ -1,5 +1,5 @@
 **
-** Copyright 2006, The Android Open Source Project
+** Copyright 2009, The Android Open Source Project
 **
 ** Licensed under the Apache License, Version 2.0 (the "License"); 
 ** you may not use this file except in compliance with the License. 
@@ -44,7 +44,7 @@
 
 /* Cache method IDs each time the class is loaded. */
 
-void
+static void
 nativeClassInitBuffer(JNIEnv *_env)
 {
     jclass nioAccessClassLocal = _env->FindClass("java/nio/NIOAccess");
diff --git a/opengl/tools/glgen/stubs/glGetString.cpp b/opengl/tools/glgen/stubs/gles11/glGetString.cpp
similarity index 97%
rename from opengl/tools/glgen/stubs/glGetString.cpp
rename to opengl/tools/glgen/stubs/gles11/glGetString.cpp
index 22e1297..a400859 100644
--- a/opengl/tools/glgen/stubs/glGetString.cpp
+++ b/opengl/tools/glgen/stubs/gles11/glGetString.cpp
@@ -1,6 +1,7 @@
 #include <string.h>

 

 /* const GLubyte * glGetString ( GLenum name ) */

+static

 jstring

 android_glGetString

   (JNIEnv *_env, jobject _this, jint name) {

diff --git a/opengl/tools/glgen/stubs/gles11/glGetString.java b/opengl/tools/glgen/stubs/gles11/glGetString.java
new file mode 100644
index 0000000..fba249b
--- /dev/null
+++ b/opengl/tools/glgen/stubs/gles11/glGetString.java
@@ -0,0 +1,5 @@
+    // C function const GLubyte * glGetString ( GLenum name )

+

+    public static native String glGetString(

+        int name

+    );

diff --git a/opengl/tools/glgen/stubs/gles11/glGetString.nativeReg b/opengl/tools/glgen/stubs/gles11/glGetString.nativeReg
new file mode 100644
index 0000000..a4af31f
--- /dev/null
+++ b/opengl/tools/glgen/stubs/gles11/glGetString.nativeReg
@@ -0,0 +1 @@
+{"glGetString", "(I)Ljava/lang/String;", (void *) android_glGetString },

diff --git a/opengl/tools/glgen/stubs/GL10ExtHeader.java-if b/opengl/tools/glgen/stubs/jsr239/GL10ExtHeader.java-if
similarity index 100%
rename from opengl/tools/glgen/stubs/GL10ExtHeader.java-if
rename to opengl/tools/glgen/stubs/jsr239/GL10ExtHeader.java-if
diff --git a/opengl/tools/glgen/stubs/GL10Header.java-if b/opengl/tools/glgen/stubs/jsr239/GL10Header.java-if
similarity index 100%
rename from opengl/tools/glgen/stubs/GL10Header.java-if
rename to opengl/tools/glgen/stubs/jsr239/GL10Header.java-if
diff --git a/opengl/tools/glgen/stubs/GL11ExtHeader.java-if b/opengl/tools/glgen/stubs/jsr239/GL11ExtHeader.java-if
similarity index 100%
rename from opengl/tools/glgen/stubs/GL11ExtHeader.java-if
rename to opengl/tools/glgen/stubs/jsr239/GL11ExtHeader.java-if
diff --git a/opengl/tools/glgen/stubs/GL11ExtensionPackHeader.java-if b/opengl/tools/glgen/stubs/jsr239/GL11ExtensionPackHeader.java-if
similarity index 100%
rename from opengl/tools/glgen/stubs/GL11ExtensionPackHeader.java-if
rename to opengl/tools/glgen/stubs/jsr239/GL11ExtensionPackHeader.java-if
diff --git a/opengl/tools/glgen/stubs/GL11Header.java-if b/opengl/tools/glgen/stubs/jsr239/GL11Header.java-if
similarity index 100%
rename from opengl/tools/glgen/stubs/GL11Header.java-if
rename to opengl/tools/glgen/stubs/jsr239/GL11Header.java-if
diff --git a/opengl/tools/glgen/stubs/GL11ImplHeader.java-impl b/opengl/tools/glgen/stubs/jsr239/GL11ImplHeader.java-impl
similarity index 100%
rename from opengl/tools/glgen/stubs/GL11ImplHeader.java-impl
rename to opengl/tools/glgen/stubs/jsr239/GL11ImplHeader.java-impl
diff --git a/opengl/tools/glgen/stubs/GLCHeader.cpp b/opengl/tools/glgen/stubs/jsr239/GLCHeader.cpp
similarity index 99%
rename from opengl/tools/glgen/stubs/GLCHeader.cpp
rename to opengl/tools/glgen/stubs/jsr239/GLCHeader.cpp
index 6495686..4636081 100644
--- a/opengl/tools/glgen/stubs/GLCHeader.cpp
+++ b/opengl/tools/glgen/stubs/jsr239/GLCHeader.cpp
@@ -44,7 +44,7 @@
 
 /* Cache method IDs each time the class is loaded. */
 
-void
+static void
 nativeClassInitBuffer(JNIEnv *_env)
 {
     jclass nioAccessClassLocal = _env->FindClass("java/nio/NIOAccess");
diff --git a/opengl/tools/glgen/stubs/GLHeader.java-if b/opengl/tools/glgen/stubs/jsr239/GLHeader.java-if
similarity index 100%
rename from opengl/tools/glgen/stubs/GLHeader.java-if
rename to opengl/tools/glgen/stubs/jsr239/GLHeader.java-if
diff --git a/opengl/tools/glgen/stubs/GLImplHeader.java-impl b/opengl/tools/glgen/stubs/jsr239/GLImplHeader.java-impl
similarity index 100%
rename from opengl/tools/glgen/stubs/GLImplHeader.java-impl
rename to opengl/tools/glgen/stubs/jsr239/GLImplHeader.java-impl
diff --git a/opengl/tools/glgen/stubs/glGetString.cpp b/opengl/tools/glgen/stubs/jsr239/glGetString.cpp
similarity index 97%
copy from opengl/tools/glgen/stubs/glGetString.cpp
copy to opengl/tools/glgen/stubs/jsr239/glGetString.cpp
index 22e1297..a400859 100644
--- a/opengl/tools/glgen/stubs/glGetString.cpp
+++ b/opengl/tools/glgen/stubs/jsr239/glGetString.cpp
@@ -1,6 +1,7 @@
 #include <string.h>

 

 /* const GLubyte * glGetString ( GLenum name ) */

+static

 jstring

 android_glGetString

   (JNIEnv *_env, jobject _this, jint name) {

diff --git a/opengl/tools/glgen/stubs/glGetString.java-10-if b/opengl/tools/glgen/stubs/jsr239/glGetString.java-10-if
similarity index 100%
rename from opengl/tools/glgen/stubs/glGetString.java-10-if
rename to opengl/tools/glgen/stubs/jsr239/glGetString.java-10-if
diff --git a/opengl/tools/glgen/stubs/glGetString.java-if b/opengl/tools/glgen/stubs/jsr239/glGetString.java-if
similarity index 100%
rename from opengl/tools/glgen/stubs/glGetString.java-if
rename to opengl/tools/glgen/stubs/jsr239/glGetString.java-if
diff --git a/opengl/tools/glgen/stubs/glGetString.java-impl b/opengl/tools/glgen/stubs/jsr239/glGetString.java-impl
similarity index 100%
rename from opengl/tools/glgen/stubs/glGetString.java-impl
rename to opengl/tools/glgen/stubs/jsr239/glGetString.java-impl
diff --git a/opengl/tools/glgen/stubs/glGetString.nativeReg b/opengl/tools/glgen/stubs/jsr239/glGetString.nativeReg
similarity index 100%
rename from opengl/tools/glgen/stubs/glGetString.nativeReg
rename to opengl/tools/glgen/stubs/jsr239/glGetString.nativeReg
diff --git a/services/java/com/android/server/AlarmManagerService.java b/services/java/com/android/server/AlarmManagerService.java
index d66c6e5..9c4ace1 100644
--- a/services/java/com/android/server/AlarmManagerService.java
+++ b/services/java/com/android/server/AlarmManagerService.java
@@ -413,41 +413,45 @@
         
         synchronized (mLock) {
             pw.println("Current Alarm Manager state:");
-            if (mRtcWakeupAlarms.size() > 0) {
+            if (mRtcWakeupAlarms.size() > 0 || mRtcAlarms.size() > 0) {
                 pw.println(" ");
-                pw.println("  Realtime wakeup alarms that are scheduled:");
-                dumpAlarmList(pw, mRtcWakeupAlarms, "  ", "RTC_WAKEUP");
+                pw.print("  Realtime wakeup (now=");
+                        pw.print(System.currentTimeMillis()); pw.println("):");
+                if (mRtcWakeupAlarms.size() > 0) {
+                    dumpAlarmList(pw, mRtcWakeupAlarms, "  ", "RTC_WAKEUP");
+                }
+                if (mRtcAlarms.size() > 0) {
+                    dumpAlarmList(pw, mRtcAlarms, "  ", "RTC");
+                }
             }
-            if (mRtcAlarms.size() > 0) {
+            if (mElapsedRealtimeWakeupAlarms.size() > 0 || mElapsedRealtimeAlarms.size() > 0) {
                 pw.println(" ");
-                pw.println("  Realtime alarms that are scheduled:");
-                dumpAlarmList(pw, mRtcAlarms, "  ", "RTC");
-            }
-            if (mElapsedRealtimeWakeupAlarms.size() > 0) {
-                pw.println(" ");
-                pw.println("  Elapsed realtime wakeup alarms that are scheduled:");
-                dumpAlarmList(pw, mElapsedRealtimeWakeupAlarms, "  ", "ELAPSED_REALTIME_WAKEUP");
-            }
-            if (mElapsedRealtimeAlarms.size() > 0) {
-                pw.println(" ");
-                pw.println("  Elapsed realtime alarms that are scheduled:");
-                dumpAlarmList(pw, mElapsedRealtimeAlarms, "  ", "ELAPSED_REALTIME");
+                pw.print("  Elapsed realtime wakeup (now=");
+                        pw.print(SystemClock.elapsedRealtime()); pw.println("):");
+                if (mElapsedRealtimeWakeupAlarms.size() > 0) {
+                    dumpAlarmList(pw, mElapsedRealtimeWakeupAlarms, "  ", "ELAPSED_WAKEUP");
+                }
+                if (mElapsedRealtimeAlarms.size() > 0) {
+                    dumpAlarmList(pw, mElapsedRealtimeAlarms, "  ", "ELAPSED");
+                }
             }
             
             pw.println(" ");
-            pw.println("  Broadcast ref count: " + mBroadcastRefCount);
+            pw.print("  Broadcast ref count: "); pw.println(mBroadcastRefCount);
             
             pw.println(" ");
             pw.println("  Alarm Stats:");
             for (Map.Entry<String, BroadcastStats> be : mBroadcastStats.entrySet()) {
                 BroadcastStats bs = be.getValue();
-                pw.println("  " + be.getKey());
-                pw.println("    " + bs.aggregateTime + "ms running, "
-                        + bs.numWakeup + " wakeups");
+                pw.print("  "); pw.println(be.getKey());
+                pw.print("    "); pw.print(bs.aggregateTime);
+                        pw.print("ms running, "); pw.print(bs.numWakeup);
+                        pw.println(" wakeups");
                 for (Map.Entry<Intent.FilterComparison, FilterStats> fe
                         : bs.filterStats.entrySet()) {
-                    pw.println("    " + fe.getValue().count + " alarms: "
-                            + fe.getKey().getIntent());
+                    pw.print("    "); pw.print(fe.getValue().count);
+                            pw.print(" alarms: ");
+                            pw.println(fe.getKey().getIntent().toShortString(true, false));
                 }
             }
         }
@@ -456,7 +460,8 @@
     private static final void dumpAlarmList(PrintWriter pw, ArrayList<Alarm> list, String prefix, String label) {
         for (int i=list.size()-1; i>=0; i--) {
             Alarm a = list.get(i);
-            pw.println(prefix + label + " #" + i + ":");
+            pw.print(prefix); pw.print(label); pw.print(" #"); pw.print(i);
+                    pw.print(": "); pw.println(a);
             a.dump(pw, prefix + "  ");
         }
     }
@@ -561,18 +566,24 @@
         @Override
         public String toString()
         {
-            return "Alarm{"
-                + Integer.toHexString(System.identityHashCode(this))
-                + " type " + type + " " + operation.getTargetPackage() + "}";
+            StringBuilder sb = new StringBuilder(128);
+            sb.append("Alarm{");
+            sb.append(Integer.toHexString(System.identityHashCode(this)));
+            sb.append(" type ");
+            sb.append(type);
+            sb.append(" ");
+            sb.append(operation.getTargetPackage());
+            sb.append('}');
+            return sb.toString();
         }
 
         public void dump(PrintWriter pw, String prefix)
         {
-            pw.println(prefix + this);
-            pw.println(prefix + "type=" + type + " when=" + when
-                  + " repeatInterval=" + repeatInterval
-                  + " count=" + count);
-            pw.println(prefix + "operation=" + operation);
+            pw.print(prefix); pw.print("type="); pw.print(type);
+                    pw.print(" when="); pw.print(when);
+                    pw.print(" repeatInterval="); pw.print(repeatInterval);
+                    pw.print(" count="); pw.println(count);
+            pw.print(prefix); pw.print("operation="); pw.println(operation);
         }
     }
     
diff --git a/services/java/com/android/server/AppWidgetService.java b/services/java/com/android/server/AppWidgetService.java
index de5d0ac..bb420a6e 100644
--- a/services/java/com/android/server/AppWidgetService.java
+++ b/services/java/com/android/server/AppWidgetService.java
@@ -151,34 +151,57 @@
 
         synchronized (mAppWidgetIds) {
             int N = mInstalledProviders.size();
-            pw.println("Providers: (size=" + N + ")");
+            pw.println("Providers:");
             for (int i=0; i<N; i++) {
                 Provider p = mInstalledProviders.get(i);
                 AppWidgetProviderInfo info = p.info;
-                pw.println("  [" + i + "] provder=" + info.provider
-                        + " min=(" + info.minWidth + "x" + info.minHeight + ")"
-                        + " updatePeriodMillis=" + info.updatePeriodMillis
-                        + " initialLayout=" + info.initialLayout + " zombie=" + p.zombie);
+                pw.print("  ["); pw.print(i); pw.print("] provider ");
+                        pw.print(info.provider.flattenToShortString());
+                        pw.println(':');
+                pw.print("    min=("); pw.print(info.minWidth);
+                        pw.print("x"); pw.print(info.minHeight);
+                        pw.print(") updatePeriodMillis=");
+                        pw.print(info.updatePeriodMillis);
+                        pw.print(" initialLayout=#");
+                        pw.print(Integer.toHexString(info.initialLayout));
+                        pw.print(" zombie="); pw.println(p.zombie);
             }
 
             N = mAppWidgetIds.size();
-            pw.println("AppWidgetIds: (size=" + N + ")");
+            pw.println(" ");
+            pw.println("AppWidgetIds:");
             for (int i=0; i<N; i++) {
                 AppWidgetId id = mAppWidgetIds.get(i);
-                pw.println("  [" + i + "] appWidgetId=" + id.appWidgetId
-                        + " host=" + id.host.hostId + "/" + id.host.packageName + " provider="
-                        + (id.provider == null ? "null" : id.provider.info.provider)
-                        + " host.callbacks=" + (id.host != null ? id.host.callbacks : "(no host)")
-                        + " views=" + id.views);
+                pw.print("  ["); pw.print(i); pw.print("] id=");
+                        pw.println(id.appWidgetId);;
+                pw.print("    hostId=");
+                        pw.print(id.host.hostId); pw.print(' ');
+                        pw.print(id.host.packageName); pw.print('/');
+                        pw.println(id.host.uid);
+                if (id.provider != null) {
+                    pw.print("    provider=");
+                            pw.println(id.provider.info.provider.flattenToShortString());
+                }
+                if (id.host != null) {
+                    pw.print("    host.callbacks="); pw.println(id.host.callbacks);
+                }
+                if (id.views != null) {
+                    pw.print("    views="); pw.println(id.views);
+                }
             }
 
             N = mHosts.size();
-            pw.println("Hosts: (size=" + N + ")");
+            pw.println(" ");
+            pw.println("Hosts:");
             for (int i=0; i<N; i++) {
                 Host host = mHosts.get(i);
-                pw.println("  [" + i + "] packageName=" + host.packageName + " uid=" + host.uid
-                        + " hostId=" + host.hostId + " callbacks=" + host.callbacks
-                        + " instances.size=" + host.instances.size() + " zombie=" + host.zombie);
+                pw.print("  ["); pw.print(i); pw.print("] hostId=");
+                        pw.print(host.hostId); pw.print(' ');
+                        pw.print(host.packageName); pw.print('/');
+                        pw.print(host.uid); pw.println(':');
+                pw.print("    callbacks="); pw.println(host.callbacks);
+                pw.print("    instances.size="); pw.print(host.instances.size());
+                        pw.print(" zombie="); pw.println(host.zombie);
             }
         }
     }
diff --git a/services/java/com/android/server/BatteryService.java b/services/java/com/android/server/BatteryService.java
index 7cd6b17..90d8c9d 100644
--- a/services/java/com/android/server/BatteryService.java
+++ b/services/java/com/android/server/BatteryService.java
@@ -84,7 +84,7 @@
     private static final int CRITICAL_BATTERY_LEVEL = 4; 
 
     private static final int DUMP_MAX_LENGTH = 24 * 1024;
-    private static final String[] DUMPSYS_ARGS = new String[] { "-c", "-u" };
+    private static final String[] DUMPSYS_ARGS = new String[] { "--checkin", "-u" };
     private static final String BATTERY_STATS_SERVICE_NAME = "batteryinfo";
     
     private static final String DUMPSYS_DATA_PATH = "/data/system/";
@@ -247,6 +247,20 @@
                 logOutlier = true;
             }
             
+            // Separate broadcast is sent for power connected / not connected
+            // since the standard intent will not wake any applications and some
+            // applications may want to have smart behavior based on this.
+            if (mPlugType != 0 && mLastPlugType == 0) {
+                Intent intent = new Intent(Intent.ACTION_POWER_CONNECTED);
+                intent.addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY_BEFORE_BOOT);
+                mContext.sendBroadcast(intent);
+            }
+            else if (mPlugType == 0 && mLastPlugType != 0) {
+                Intent intent = new Intent(Intent.ACTION_POWER_DISCONNECTED);
+                intent.addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY_BEFORE_BOOT);
+                mContext.sendBroadcast(intent);
+            }
+            
             mLastBatteryStatus = mBatteryStatus;
             mLastBatteryHealth = mBatteryHealth;
             mLastBatteryPresent = mBatteryPresent;
diff --git a/services/java/com/android/server/IntentResolver.java b/services/java/com/android/server/IntentResolver.java
index b534ef1..72efca5 100644
--- a/services/java/com/android/server/IntentResolver.java
+++ b/services/java/com/android/server/IntentResolver.java
@@ -16,6 +16,7 @@
 
 package com.android.server;
 
+import java.io.PrintWriter;
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.Comparator;
@@ -89,11 +90,11 @@
         }
     }
 
-    void dumpMap(Printer out, String prefix, Map<String, ArrayList<F>> map) {
+    void dumpMap(PrintWriter out, String prefix, Map<String, ArrayList<F>> map) {
         String eprefix = prefix + "  ";
         String fprefix = prefix + "    ";
         for (Map.Entry<String, ArrayList<F>> e : map.entrySet()) {
-            out.println(eprefix + e.getKey() + ":");
+            out.print(eprefix); out.print(e.getKey()); out.println(":");
             ArrayList<F> a = e.getValue();
             final int N = a.size();
             for (int i=0; i<N; i++) {
@@ -102,24 +103,25 @@
         }
     }
 
-    public void dump(Printer out, String prefix) {
-        out.println(prefix + "Full MIME Types:");
-        dumpMap(out, prefix+"  ", mTypeToFilter);
-        out.println(prefix);
-        out.println(prefix + "Base MIME Types:");
-        dumpMap(out, prefix+"  ", mBaseTypeToFilter);
-        out.println(prefix);
-        out.println(prefix + "Wild MIME Types:");
-        dumpMap(out, prefix+"  ", mWildTypeToFilter);
-        out.println(prefix);
-        out.println(prefix + "Schemes:");
-        dumpMap(out, prefix+"  ", mSchemeToFilter);
-        out.println(prefix);
-        out.println(prefix + "Non-Data Actions:");
-        dumpMap(out, prefix+"  ", mActionToFilter);
-        out.println(prefix);
-        out.println(prefix + "MIME Typed Actions:");
-        dumpMap(out, prefix+"  ", mTypedActionToFilter);
+    public void dump(PrintWriter out, String prefix) {
+        String innerPrefix = prefix + "  ";
+        out.print(prefix); out.println("Full MIME Types:");
+        dumpMap(out, innerPrefix, mTypeToFilter);
+        out.println(" ");
+        out.print(prefix); out.println("Base MIME Types:");
+        dumpMap(out, innerPrefix, mBaseTypeToFilter);
+        out.println(" ");
+        out.print(prefix); out.println("Wild MIME Types:");
+        dumpMap(out, innerPrefix, mWildTypeToFilter);
+        out.println(" ");
+        out.print(prefix); out.println("Schemes:");
+        dumpMap(out, innerPrefix, mSchemeToFilter);
+        out.println(" ");
+        out.print(prefix); out.println("Non-Data Actions:");
+        dumpMap(out, innerPrefix, mActionToFilter);
+        out.println(" ");
+        out.print(prefix); out.println("MIME Typed Actions:");
+        dumpMap(out, innerPrefix, mTypedActionToFilter);
     }
 
     private class IteratorWrapper implements Iterator<F> {
@@ -275,8 +277,8 @@
         Collections.sort(results, mResolvePrioritySorter);
     }
 
-    protected void dumpFilter(Printer out, String prefix, F filter) {
-        out.println(prefix + filter);
+    protected void dumpFilter(PrintWriter out, String prefix, F filter) {
+        out.print(prefix); out.println(filter);
     }
 
     private final int register_mime_types(F filter, String prefix) {
diff --git a/services/java/com/android/server/LocationManagerService.java b/services/java/com/android/server/LocationManagerService.java
index 938a43d..2e7f2c1 100644
--- a/services/java/com/android/server/LocationManagerService.java
+++ b/services/java/com/android/server/LocationManagerService.java
@@ -44,6 +44,7 @@
 import android.content.pm.PackageManager;
 import android.database.Cursor;
 import android.location.Address;
+import android.location.IGeocodeProvider;
 import android.location.IGpsStatusListener;
 import android.location.ILocationCollector;
 import android.location.ILocationListener;
@@ -52,31 +53,28 @@
 import android.location.Location;
 import android.location.LocationManager;
 import android.location.LocationProvider;
-import android.location.LocationProviderImpl;
 import android.net.ConnectivityManager;
 import android.net.Uri;
-import android.net.wifi.WifiManager;
 import android.os.Binder;
 import android.os.Bundle;
 import android.os.Handler;
 import android.os.IBinder;
+import android.os.Looper;
 import android.os.Message;
 import android.os.PowerManager;
 import android.os.Process;
 import android.os.RemoteException;
 import android.os.SystemClock;
 import android.provider.Settings;
-import android.telephony.TelephonyManager;
 import android.util.Config;
 import android.util.Log;
 import android.util.PrintWriterPrinter;
 import android.util.SparseIntArray;
 
-import com.android.internal.app.IBatteryStats;
 import com.android.internal.location.GpsLocationProvider;
+import com.android.internal.location.LocationProviderImpl;
 import com.android.internal.location.LocationProviderProxy;
 import com.android.internal.location.MockProvider;
-import com.android.internal.location.TrackProvider;
 import com.android.server.am.BatteryStatsService;
 
 /**
@@ -85,7 +83,7 @@
  *
  * {@hide}
  */
-public class LocationManagerService extends ILocationManager.Stub {
+public class LocationManagerService extends ILocationManager.Stub implements Runnable {
     private static final String TAG = "LocationManagerService";
     private static final boolean LOCAL_LOGV = false;
 
@@ -95,10 +93,6 @@
     // Max time to hold wake lock for, in milliseconds.
     private static final long MAX_TIME_FOR_WAKE_LOCK = 60 * 1000L;
 
-    // Time to wait after releasing a wake lock for clients to process location update,
-    // in milliseconds.
-    private static final long TIME_AFTER_WAKE_LOCK = 2 * 1000L;
-
     // The last time a location was written, by provider name.
     private HashMap<String,Long> mLastWriteTime = new HashMap<String,Long>();
 
@@ -126,58 +120,33 @@
 
     private final Context mContext;
     private GpsLocationProvider mGpsLocationProvider;
-    private boolean mGpsNavigating;
     private LocationProviderProxy mNetworkLocationProvider;
+    private IGeocodeProvider mGeocodeProvider;
     private LocationWorkerHandler mLocationHandler;
 
     // Handler messages
     private static final int MESSAGE_LOCATION_CHANGED = 1;
-    private static final int MESSAGE_ACQUIRE_WAKE_LOCK = 2;
-    private static final int MESSAGE_RELEASE_WAKE_LOCK = 3;
 
     // Alarm manager and wakelock variables
     private final static String ALARM_INTENT = "com.android.location.ALARM_INTENT";
     private final static String WAKELOCK_KEY = "LocationManagerService";
-    private final static String WIFILOCK_KEY = "LocationManagerService";
     private AlarmManager mAlarmManager;
     private long mAlarmInterval = 0;
-    private boolean mScreenOn = true;
     private PowerManager.WakeLock mWakeLock = null;
-    private WifiManager.WifiLock mWifiLock = null;
+    private int mPendingBroadcasts;
     private long mWakeLockAcquireTime = 0;
     private boolean mWakeLockGpsReceived = true;
     private boolean mWakeLockNetworkReceived = true;
-    private boolean mWifiWakeLockAcquired = false;
-    private boolean mCellWakeLockAcquired = false;
-    
-    private final IBatteryStats mBatteryStats;
     
     /**
-     * Mapping from listener IBinder/PendingIntent to local Listener wrappers.
+     * List of all receivers.
      */
-    private final ArrayList<Receiver> mListeners = new ArrayList<Receiver>();
+    private final HashMap<Object, Receiver> mReceivers = new HashMap<Object, Receiver>();
 
     /**
-     * Used for reporting which UIDs are causing the GPS to run.
+     * Object used internally for synchronization
      */
-    private final SparseIntArray mReportedGpsUids = new SparseIntArray();
-    private int mReportedGpsSeq = 0;
-    
-    /**
-     * Mapping from listener IBinder/PendingIntent to a map from provider name to UpdateRecord.
-     * This also serves as the lock for our state.
-     */
-    private final HashMap<Receiver,HashMap<String,UpdateRecord>> mLocationListeners =
-        new HashMap<Receiver,HashMap<String,UpdateRecord>>();
-
-    /**
-     * Mapping from listener IBinder/PendingIntent to a map from provider name to last broadcast
-     * location.
-     */
-    private final HashMap<Receiver,HashMap<String,Location>> mLastFixBroadcast =
-        new HashMap<Receiver,HashMap<String,Location>>();
-    private final HashMap<Receiver,HashMap<String,Long>> mLastStatusBroadcast =
-        new HashMap<Receiver,HashMap<String,Long>>();
+    private final Object mLock = new Object();
 
     /**
      * Mapping from provider name to all its UpdateRecords
@@ -186,7 +155,8 @@
         new HashMap<String,ArrayList<UpdateRecord>>();
 
     // Proximity listeners
-    private Receiver mProximityListener = null;
+    private Receiver mProximityReceiver = null;
+    private ILocationListener mProximityListener = null;
     private HashMap<PendingIntent,ProximityAlert> mProximityAlerts =
         new HashMap<PendingIntent,ProximityAlert>();
     private HashSet<ProximityAlert> mProximitiesEntered =
@@ -196,15 +166,9 @@
     private HashMap<String,Location> mLastKnownLocation =
         new HashMap<String,Location>();
 
-    // Last known cell service state
-    private TelephonyManager mTelephonyManager;
-
     // Location collector
     private ILocationCollector mCollector;
 
-    // Wifi Manager
-    private WifiManager mWifiManager;
-
     private int mNetworkState = LocationProvider.TEMPORARILY_UNAVAILABLE;
 
     // for Settings change notification
@@ -214,23 +178,22 @@
      * A wrapper class holding either an ILocationListener or a PendingIntent to receive
      * location updates.
      */
-    private final class Receiver implements IBinder.DeathRecipient {
+    private final class Receiver implements IBinder.DeathRecipient, PendingIntent.OnFinished {
         final ILocationListener mListener;
         final PendingIntent mPendingIntent;
-        final int mUid;
         final Object mKey;
+        final HashMap<String,UpdateRecord> mUpdateRecords = new HashMap<String,UpdateRecord>();
+        int mPendingBroadcasts;
 
-        Receiver(ILocationListener listener, int uid) {
+        Receiver(ILocationListener listener) {
             mListener = listener;
             mPendingIntent = null;
-            mUid = uid;
             mKey = listener.asBinder();
         }
 
-        Receiver(PendingIntent intent, int uid) {
+        Receiver(PendingIntent intent) {
             mPendingIntent = intent;
             mListener = null;
-            mUid = uid;
             mKey = intent;
         }
 
@@ -254,11 +217,11 @@
             if (mListener != null) {
                 return "Receiver{"
                         + Integer.toHexString(System.identityHashCode(this))
-                        + " uid " + mUid + " Listener " + mKey + "}";
+                        + " Listener " + mKey + "}";
             } else {
                 return "Receiver{"
                         + Integer.toHexString(System.identityHashCode(this))
-                        + " uid " + mUid + " Intent " + mKey + "}";
+                        + " Intent " + mKey + "}";
             }
         }
 
@@ -287,7 +250,16 @@
         public boolean callStatusChangedLocked(String provider, int status, Bundle extras) {
             if (mListener != null) {
                 try {
-                    mListener.onStatusChanged(provider, status, extras);
+                    synchronized (this) {
+                        // synchronize to ensure incrementPendingBroadcastsLocked()
+                        // is called before decrementPendingBroadcasts()
+                        mListener.onStatusChanged(provider, status, extras);
+                        if (mListener != mProximityListener) {
+                            // call this after broadcasting so we do not increment
+                            // if we throw an exeption.
+                            incrementPendingBroadcastsLocked();
+                        }
+                    }
                 } catch (RemoteException e) {
                     return false;
                 }
@@ -296,7 +268,14 @@
                 statusChanged.putExtras(extras);
                 statusChanged.putExtra(LocationManager.KEY_STATUS_CHANGED, status);
                 try {
-                    mPendingIntent.send(mContext, 0, statusChanged, null, null);
+                    synchronized (this) {
+                        // synchronize to ensure incrementPendingBroadcastsLocked()
+                        // is called before decrementPendingBroadcasts()
+                        mPendingIntent.send(mContext, 0, statusChanged, this, mLocationHandler);
+                        // call this after broadcasting so we do not increment
+                        // if we throw an exeption.
+                        incrementPendingBroadcastsLocked();
+                    }
                 } catch (PendingIntent.CanceledException e) {
                     return false;
                 }
@@ -307,7 +286,16 @@
         public boolean callLocationChangedLocked(Location location) {
             if (mListener != null) {
                 try {
-                    mListener.onLocationChanged(location);
+                    synchronized (this) {
+                        // synchronize to ensure incrementPendingBroadcastsLocked()
+                        // is called before decrementPendingBroadcasts()
+                        mListener.onLocationChanged(location);
+                        if (mListener != mProximityListener) {
+                            // call this after broadcasting so we do not increment
+                            // if we throw an exeption.
+                            incrementPendingBroadcastsLocked();
+                        }
+                    }
                 } catch (RemoteException e) {
                     return false;
                 }
@@ -315,7 +303,53 @@
                 Intent locationChanged = new Intent();
                 locationChanged.putExtra(LocationManager.KEY_LOCATION_CHANGED, location);
                 try {
-                    mPendingIntent.send(mContext, 0, locationChanged, null, null);
+                    synchronized (this) {
+                        // synchronize to ensure incrementPendingBroadcastsLocked()
+                        // is called before decrementPendingBroadcasts()
+                        mPendingIntent.send(mContext, 0, locationChanged, this, mLocationHandler);
+                        // call this after broadcasting so we do not increment
+                        // if we throw an exeption.
+                        incrementPendingBroadcastsLocked();
+                    }
+                } catch (PendingIntent.CanceledException e) {
+                    return false;
+                }
+            }
+            return true;
+        }
+
+        public boolean callProviderEnabledLocked(String provider, boolean enabled) {
+            if (mListener != null) {
+                try {
+                    synchronized (this) {
+                        // synchronize to ensure incrementPendingBroadcastsLocked()
+                        // is called before decrementPendingBroadcasts()
+                        if (enabled) {
+                            mListener.onProviderEnabled(provider);
+                        } else {
+                            mListener.onProviderDisabled(provider);
+                        }
+                        if (mListener != mProximityListener) {
+                            // call this after broadcasting so we do not increment
+                            // if we throw an exeption.
+                            incrementPendingBroadcastsLocked();
+                        }
+                    }
+                } catch (RemoteException e) {
+                    return false;
+                }
+            } else {
+                Intent providerIntent = new Intent();
+                providerIntent.putExtra(LocationManager.KEY_PROVIDER_ENABLED, enabled);
+                try {
+                    synchronized (this) {
+                        // synchronize to ensure incrementPendingBroadcastsLocked()
+                        // is called before decrementPendingBroadcasts()
+                        mPendingIntent.send(mContext, 0, providerIntent, this, mLocationHandler);
+                        // call this after broadcasting so we do not increment
+                        // if we throw an exeption.
+                        incrementPendingBroadcastsLocked();
+                    }
                 } catch (PendingIntent.CanceledException e) {
                     return false;
                 }
@@ -327,15 +361,51 @@
             if (LOCAL_LOGV) {
                 Log.v(TAG, "Location listener died");
             }
-            synchronized (mLocationListeners) {
+            synchronized (mLock) {
                 removeUpdatesLocked(this);
             }
+            synchronized (this) {
+                if (mPendingBroadcasts > 0) {
+                    LocationManagerService.this.decrementPendingBroadcasts();
+                    mPendingBroadcasts = 0;
+                }
+            }
+        }
+
+        public void onSendFinished(PendingIntent pendingIntent, Intent intent,
+                int resultCode, String resultData, Bundle resultExtras) {
+            decrementPendingBroadcasts();
+        }
+
+        // this must be called while synchronized by callerin a synchronized block
+        // containing the sending of the broadcaset
+        private void incrementPendingBroadcastsLocked() {
+            if (mPendingBroadcasts++ == 0) {
+                synchronized (mLock) {
+                    LocationManagerService.this.incrementPendingBroadcastsLocked();
+                }
+            }
+        }
+
+        private void decrementPendingBroadcasts() {
+            synchronized (this) {
+                if (--mPendingBroadcasts == 0) {
+                    LocationManagerService.this.decrementPendingBroadcasts();
+                }
+            }
+        }
+    }
+
+    public void locationCallbackFinished(ILocationListener listener) {
+        Receiver receiver = getReceiver(listener);
+        if (receiver != null) {
+            receiver.decrementPendingBroadcasts();
         }
     }
 
     private final class SettingsObserver implements Observer {
         public void update(Observable o, Object arg) {
-            synchronized (mLocationListeners) {
+            synchronized (mLock) {
                 updateProvidersLocked();
             }
         }
@@ -442,7 +512,7 @@
      *                                                          properties
      */
     private void loadProviders() {
-        synchronized (mLocationListeners) {
+        synchronized (mLock) {
             if (sProvidersLoaded) {
                 return;
             }
@@ -469,71 +539,6 @@
             LocationProviderImpl.addProvider(mGpsLocationProvider);
         }
 
-        // Load fake providers if real providers are not available
-        File f = new File(LocationManager.PROVIDER_DIR);
-        if (f.isDirectory()) {
-            File[] subdirs = f.listFiles();
-            for (int i = 0; i < subdirs.length; i++) {
-                if (!subdirs[i].isDirectory()) {
-                    continue;
-                }
-
-                String name = subdirs[i].getName();
-
-                if (LOCAL_LOGV) {
-                    Log.v(TAG, "Found dir " + subdirs[i].getAbsolutePath());
-                    Log.v(TAG, "name = " + name);
-                }
-
-                // Don't create a fake provider if a real provider exists
-                if (LocationProviderImpl.getProvider(name) == null) {
-                    LocationProviderImpl provider = null;
-                    try {
-                        File classFile = new File(subdirs[i], "class");
-                        // Look for a 'class' file
-                        provider = LocationProviderImpl.loadFromClass(classFile);
-
-                        // Look for an 'kml', 'nmea', or 'track' file
-                        if (provider == null) {
-                            // Load properties from 'properties' file, if present
-                            File propertiesFile = new File(subdirs[i], "properties");
-
-                            if (propertiesFile.exists()) {
-                                provider = new TrackProvider(name, this);
-                                ((TrackProvider)provider).readProperties(propertiesFile);
-
-                                File kmlFile = new File(subdirs[i], "kml");
-                                if (kmlFile.exists()) {
-                                    ((TrackProvider) provider).readKml(kmlFile);
-                                } else {
-                                    File nmeaFile = new File(subdirs[i], "nmea");
-                                    if (nmeaFile.exists()) {
-                                        ((TrackProvider) provider).readNmea(name, nmeaFile);
-                                    } else {
-                                        File trackFile = new File(subdirs[i], "track");
-                                        if (trackFile.exists()) {
-                                            ((TrackProvider) provider).readTrack(trackFile);
-                                        }
-                                    }
-                                }
-                            }
-                        }
-                        if (provider != null) {
-                            LocationProviderImpl.addProvider(provider);
-                        }
-                        // Grab the initial location of a TrackProvider and
-                        // store it as the last known location for that provider
-                        if (provider instanceof TrackProvider) {
-                            TrackProvider tp = (TrackProvider) provider;
-                            mLastKnownLocation.put(tp.getName(), tp.getInitialLocation());
-                        }
-                    } catch (Exception e) {
-                        Log.e(TAG, "Exception loading provder " + name, e);
-                    }
-                }
-            }
-        }
-
         updateProvidersLocked();
     }
 
@@ -543,44 +548,40 @@
     public LocationManagerService(Context context) {
         super();
         mContext = context;
-        mLocationHandler = new LocationWorkerHandler();
+
+        Thread thread = new Thread(null, this, "LocationManagerService");
+        thread.start();
 
         if (LOCAL_LOGV) {
             Log.v(TAG, "Constructed LocationManager Service");
         }
+    }
 
+    private void initialize() {
         // Alarm manager, needs to be done before calling loadProviders() below
-        mAlarmManager = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE);
+        mAlarmManager = (AlarmManager) mContext.getSystemService(Context.ALARM_SERVICE);
 
         // Create a wake lock, needs to be done before calling loadProviders() below
         PowerManager powerManager = (PowerManager) mContext.getSystemService(Context.POWER_SERVICE);
         mWakeLock = powerManager.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, WAKELOCK_KEY);
         
-        // Battery statistics service to be notified when GPS turns on or off
-        mBatteryStats = BatteryStatsService.getService();
-
         // Load providers
         loadProviders();
 
-        // Listen for Radio changes
-        mTelephonyManager = (TelephonyManager)context.getSystemService(Context.TELEPHONY_SERVICE);
-
         // Register for Network (Wifi or Mobile) updates
         NetworkStateBroadcastReceiver networkReceiver = new NetworkStateBroadcastReceiver();
         IntentFilter networkIntentFilter = new IntentFilter();
         networkIntentFilter.addAction(ConnectivityManager.CONNECTIVITY_ACTION);
         networkIntentFilter.addAction(GpsLocationProvider.GPS_ENABLED_CHANGE_ACTION);
-        context.registerReceiver(networkReceiver, networkIntentFilter);
+        mContext.registerReceiver(networkReceiver, networkIntentFilter);
 
         // Register for power updates
         PowerStateBroadcastReceiver powerStateReceiver = new PowerStateBroadcastReceiver();
         IntentFilter intentFilter = new IntentFilter();
         intentFilter.addAction(ALARM_INTENT);
-        intentFilter.addAction(Intent.ACTION_SCREEN_OFF);
-        intentFilter.addAction(Intent.ACTION_SCREEN_ON);
         intentFilter.addAction(Intent.ACTION_PACKAGE_REMOVED);
         intentFilter.addAction(Intent.ACTION_PACKAGE_RESTARTED);
-        context.registerReceiver(powerStateReceiver, intentFilter);
+        mContext.registerReceiver(powerStateReceiver, intentFilter);
 
         // listen for settings changes
         ContentResolver resolver = mContext.getContentResolver();
@@ -591,12 +592,15 @@
         mSettings = new ContentQueryMap(settingsCursor, Settings.System.NAME, true, mLocationHandler);
         SettingsObserver settingsObserver = new SettingsObserver();
         mSettings.addObserver(settingsObserver);
+    }
 
-        // Get the wifi manager
-        mWifiManager = (WifiManager) context.getSystemService(Context.WIFI_SERVICE);
-
-        // Create a wifi lock for future use
-        mWifiLock = getWifiWakelockLocked();
+    public void run()
+    {
+        Process.setThreadPriority(Process.THREAD_PRIORITY_BACKGROUND);
+        Looper.prepare();
+        mLocationHandler = new LocationWorkerHandler();
+        initialize();
+        Looper.loop();
     }
 
     public void setNetworkLocationProvider(ILocationProvider provider) {
@@ -605,16 +609,14 @@
                 "Installing location providers outside of the system is not supported");
         }
 
-        synchronized (mLocationListeners) {
+        synchronized (mLock) {
             mNetworkLocationProvider =
                     new LocationProviderProxy(LocationManager.NETWORK_PROVIDER, this, provider);
-            mNetworkLocationProvider.addListener(getPackageNames());
             LocationProviderImpl.addProvider(mNetworkLocationProvider);
             updateProvidersLocked();
             
             // notify NetworkLocationProvider of any events it might have missed
             mNetworkLocationProvider.updateNetworkState(mNetworkState);
-            mNetworkLocationProvider.updateCellLockStatus(mCellWakeLockAcquired);
         }
     }
 
@@ -624,20 +626,16 @@
                 "Installing location collectors outside of the system is not supported");
         }
 
-        synchronized (mLocationListeners) {
-            mCollector = collector;
-            if (mGpsLocationProvider != null) {
-                mGpsLocationProvider.setLocationCollector(mCollector);
-            }
-        }
+        mCollector = collector;
     }
 
-    private WifiManager.WifiLock getWifiWakelockLocked() {
-        if (mWifiLock == null && mWifiManager != null) {
-            mWifiLock = mWifiManager.createWifiLock(WifiManager.WIFI_MODE_SCAN_ONLY, WIFILOCK_KEY);
-            mWifiLock.setReferenceCounted(false);
+    public void setGeocodeProvider(IGeocodeProvider provider) {
+        if (Binder.getCallingUid() != Process.SYSTEM_UID) {
+            throw new SecurityException(
+                "Installing location providers outside of the system is not supported");
         }
-        return mWifiLock;
+
+        mGeocodeProvider = provider;
     }
 
     private boolean isAllowedBySettingsLocked(String provider) {
@@ -688,15 +686,9 @@
         return true;
     }
 
-    private String[] getPackageNames() {
-        // Since a single UID may correspond to multiple packages, this can only be used as an
-        // approximation for tracking
-        return mContext.getPackageManager().getPackagesForUid(Binder.getCallingUid());
-    }
-
     public List<String> getAllProviders() {
         try {
-            synchronized (mLocationListeners) {
+            synchronized (mLock) {
                 return _getAllProvidersLocked();
             }
         } catch (SecurityException se) {
@@ -722,7 +714,7 @@
 
     public List<String> getProviders(boolean enabledOnly) {
         try {
-            synchronized (mLocationListeners) {
+            synchronized (mLock) {
                 return _getProvidersLocked(enabledOnly);
             }
         } catch (SecurityException se) {
@@ -783,29 +775,11 @@
             for (int i=0; i<N; i++) {
                 UpdateRecord record = records.get(i);
                 // Sends a notification message to the receiver
-                try {
-                    Receiver receiver = record.mReceiver;
-                    if (receiver.isListener()) {
-                        if (enabled) {
-                            receiver.getListener().onProviderEnabled(provider);
-                        } else {
-                            receiver.getListener().onProviderDisabled(provider);
-                        }
-                    } else {
-                        Intent providerIntent = new Intent();
-                        providerIntent.putExtra(LocationManager.KEY_PROVIDER_ENABLED, enabled);
-                        try {
-                            receiver.getPendingIntent().send(mContext, 0,
-                                 providerIntent, null, null);
-                        } catch (PendingIntent.CanceledException e) {
-                            if (deadReceivers == null) {
-                                deadReceivers = new ArrayList<Receiver>();
-                                deadReceivers.add(receiver);
-                            }
-                        }
+                if (!record.mReceiver.callProviderEnabledLocked(provider, enabled)) {
+                    if (deadReceivers == null) {
+                        deadReceivers = new ArrayList<Receiver>();
+                        deadReceivers.add(record.mReceiver);
                     }
-                } catch (RemoteException e) {
-                    // The death link will clean this up.
                 }
                 listeners++;
             }
@@ -822,16 +796,12 @@
             if (listeners > 0) {
                 p.setMinTime(getMinTimeLocked(provider));
                 p.enableLocationTracking(true);
-                updateWakelockStatusLocked(mScreenOn);
+                updateWakelockStatusLocked();
             }
         } else {
             p.enableLocationTracking(false);
-            if (p == mGpsLocationProvider) {
-                mGpsNavigating = false;
-                reportStopGpsLocked();
-            }
             p.disable();
-            updateWakelockStatusLocked(mScreenOn);
+            updateWakelockStatusLocked();
         }
     }
 
@@ -852,19 +822,19 @@
         final long mMinTime;
         final float mMinDistance;
         final int mUid;
-        final String[] mPackages;
+        Location mLastFixBroadcast;
+        long mLastStatusBroadcast;
 
         /**
          * Note: must be constructed with lock held.
          */
         UpdateRecord(String provider, long minTime, float minDistance,
-            Receiver receiver, int uid, String[] packages) {
+            Receiver receiver, int uid) {
             mProvider = provider;
             mReceiver = receiver;
             mMinTime = minTime;
             mMinDistance = minDistance;
             mUid = uid;
-            mPackages = packages;
 
             ArrayList<UpdateRecord> records = mRecordsByProvider.get(provider);
             if (records == null) {
@@ -896,33 +866,77 @@
             pw.println(prefix + this);
             pw.println(prefix + "mProvider=" + mProvider + " mReceiver=" + mReceiver);
             pw.println(prefix + "mMinTime=" + mMinTime + " mMinDistance=" + mMinDistance);
-            StringBuilder sb = new StringBuilder();
-            if (mPackages != null) {
-                for (int i=0; i<mPackages.length; i++) {
-                    if (i > 0) sb.append(", ");
-                    sb.append(mPackages[i]);
-                }
-            }
-            pw.println(prefix + "mUid=" + mUid + " mPackages=" + sb);
+            pw.println(prefix + "mUid=" + mUid);
+            pw.println(prefix + "mLastFixBroadcast:");
+            mLastFixBroadcast.dump(new PrintWriterPrinter(pw), prefix + "  ");
+            pw.println(prefix + "mLastStatusBroadcast=" + mLastStatusBroadcast);
         }
         
         /**
          * Calls dispose().
          */
         @Override protected void finalize() {
-            synchronized (mLocationListeners) {
+            synchronized (mLock) {
                 disposeLocked();
             }
         }
     }
 
+    private Receiver getReceiver(ILocationListener listener) {
+        IBinder binder = listener.asBinder();
+        Receiver receiver = mReceivers.get(binder);
+        if (receiver == null) {
+            receiver = new Receiver(listener);
+            mReceivers.put(binder, receiver);
+
+            try {
+                if (receiver.isListener()) {
+                    receiver.getListener().asBinder().linkToDeath(receiver, 0);
+                }
+            } catch (RemoteException e) {
+                Log.e(TAG, "linkToDeath failed:", e);
+                return null;
+            }
+        }
+        return receiver;
+    }
+
+    private Receiver getReceiver(PendingIntent intent) {
+        Receiver receiver = mReceivers.get(intent);
+        if (receiver == null) {
+            receiver = new Receiver(intent);
+            mReceivers.put(intent, receiver);
+        }
+        return receiver;
+    }
+
+    private boolean providerHasListener(String provider, int uid, Receiver excludedReceiver) {
+        ArrayList<UpdateRecord> records = mRecordsByProvider.get(provider);
+        if (records != null) {
+            for (int i = records.size() - 1; i >= 0; i--) {
+                UpdateRecord record = records.get(i);
+                if (record.mUid == uid && record.mReceiver != excludedReceiver) {
+                    return true;
+                }
+           }
+        }
+        if (LocationManager.GPS_PROVIDER.equals(provider) ||
+                LocationManager.NETWORK_PROVIDER.equals(provider)) {
+            for (ProximityAlert alert : mProximityAlerts.values()) {
+                if (alert.mUid == uid) {
+                    return true;
+                }
+            }
+        }
+        return false;
+    }
+
     public void requestLocationUpdates(String provider,
         long minTime, float minDistance, ILocationListener listener) {
 
         try {
-            synchronized (mLocationListeners) {
-                requestLocationUpdatesLocked(provider, minTime, minDistance,
-                    new Receiver(listener, Binder.getCallingUid()));
+            synchronized (mLock) {
+                requestLocationUpdatesLocked(provider, minTime, minDistance, getReceiver(listener));
             }
         } catch (SecurityException se) {
             throw se;
@@ -934,9 +948,8 @@
     public void requestLocationUpdatesPI(String provider,
             long minTime, float minDistance, PendingIntent intent) {
         try {
-            synchronized (mLocationListeners) {
-                requestLocationUpdatesLocked(provider, minTime, minDistance,
-                        new Receiver(intent, Binder.getCallingUid()));
+            synchronized (mLock) {
+                requestLocationUpdatesLocked(provider, minTime, minDistance, getReceiver(intent));
             }
         } catch (SecurityException se) {
             throw se;
@@ -958,57 +971,30 @@
 
         checkPermissionsSafe(provider);
 
-        String[] packages = getPackageNames();
-
         // so wakelock calls will succeed
         final int callingUid = Binder.getCallingUid();
+        boolean newUid = !providerHasListener(provider, callingUid, null);
         long identity = Binder.clearCallingIdentity();
         try {
-            UpdateRecord r = new UpdateRecord(provider, minTime, minDistance,
-                    receiver, callingUid, packages);
-            if (!mListeners.contains(receiver)) {
-                try {
-                    if (receiver.isListener()) {
-                        receiver.getListener().asBinder().linkToDeath(receiver, 0);
-                    }
-                    mListeners.add(receiver);
-                } catch (RemoteException e) {
-                    return;
-                }
-            }
-
-            HashMap<String,UpdateRecord> records = mLocationListeners.get(receiver);
-            if (records == null) {
-                records = new HashMap<String,UpdateRecord>();
-                mLocationListeners.put(receiver, records);
-            }
-            UpdateRecord oldRecord = records.put(provider, r);
+            UpdateRecord r = new UpdateRecord(provider, minTime, minDistance, receiver, callingUid);
+            UpdateRecord oldRecord = receiver.mUpdateRecords.put(provider, r);
             if (oldRecord != null) {
                 oldRecord.disposeLocked();
             }
 
+            if (newUid) {
+                impl.addListener(callingUid);
+            }
+
             boolean isProviderEnabled = isAllowedBySettingsLocked(provider);
             if (isProviderEnabled) {
                 long minTimeForProvider = getMinTimeLocked(provider);
                 impl.setMinTime(minTimeForProvider);
                 impl.enableLocationTracking(true);
-                updateWakelockStatusLocked(mScreenOn);
-
-                if (provider.equals(LocationManager.GPS_PROVIDER)) {
-                    if (mGpsNavigating) {
-                        updateReportedGpsLocked();
-                    }
-                }
+                updateWakelockStatusLocked();
             } else {
-                try {
-                    // Notify the listener that updates are currently disabled
-                    if (receiver.isListener()) {
-                        receiver.getListener().onProviderDisabled(provider);
-                    }
-                } catch(RemoteException e) {
-                    Log.w(TAG, "RemoteException calling onProviderDisabled on " +
-                            receiver.getListener());
-                }
+                // Notify the listener that updates are currently disabled
+                receiver.callProviderEnabledLocked(provider, false);
             }
         } finally {
             Binder.restoreCallingIdentity(identity);
@@ -1017,8 +1003,8 @@
 
     public void removeUpdates(ILocationListener listener) {
         try {
-            synchronized (mLocationListeners) {
-                removeUpdatesLocked(new Receiver(listener, Binder.getCallingUid()));
+            synchronized (mLock) {
+                removeUpdatesLocked(getReceiver(listener));
             }
         } catch (SecurityException se) {
             throw se;
@@ -1029,8 +1015,8 @@
 
     public void removeUpdatesPI(PendingIntent intent) {
         try {
-            synchronized (mLocationListeners) {
-                removeUpdatesLocked(new Receiver(intent, Binder.getCallingUid()));
+            synchronized (mLock) {
+                removeUpdatesLocked(getReceiver(intent));
             }
         } catch (SecurityException se) {
             throw se;
@@ -1048,23 +1034,21 @@
         final int callingUid = Binder.getCallingUid();
         long identity = Binder.clearCallingIdentity();
         try {
-            int idx = mListeners.indexOf(receiver);
-            if (idx >= 0) {
-                Receiver myReceiver = mListeners.remove(idx);
-                if (myReceiver.isListener()) {
-                    myReceiver.getListener().asBinder().unlinkToDeath(myReceiver, 0);
-                }
+            if (mReceivers.remove(receiver.mKey) != null && receiver.isListener()) {
+                receiver.getListener().asBinder().unlinkToDeath(receiver, 0);
             }
 
             // Record which providers were associated with this listener
             HashSet<String> providers = new HashSet<String>();
-            HashMap<String,UpdateRecord> oldRecords = mLocationListeners.get(receiver);
+            HashMap<String,UpdateRecord> oldRecords = receiver.mUpdateRecords;
             if (oldRecords != null) {
                 // Call dispose() on the obsolete update records.
                 for (UpdateRecord record : oldRecords.values()) {
-                    if (record.mProvider.equals(LocationManager.NETWORK_PROVIDER)) {
-                        if (mNetworkLocationProvider != null) {
-                            mNetworkLocationProvider.removeListener(record.mPackages);
+                    if (!providerHasListener(record.mProvider, callingUid, receiver)) {
+                        LocationProviderImpl impl =
+                                LocationProviderImpl.getProvider(record.mProvider);
+                        if (impl != null) {
+                            impl.removeListener(callingUid);
                         }
                     }
                     record.disposeLocked();
@@ -1072,10 +1056,6 @@
                 // Accumulate providers
                 providers.addAll(oldRecords.keySet());
             }
-            
-            mLocationListeners.remove(receiver);
-            mLastFixBroadcast.remove(receiver);
-            mLastStatusBroadcast.remove(receiver);
 
             // See if the providers associated with this listener have any
             // other listeners; if one does, inform it of the new smallest minTime
@@ -1099,14 +1079,10 @@
                     } else {
                         p.enableLocationTracking(false);
                     }
-                    
-                    if (p == mGpsLocationProvider && mGpsNavigating) {
-                        updateReportedGpsLocked();
-                    }
                 }
             }
 
-            updateWakelockStatusLocked(mScreenOn);
+            updateWakelockStatusLocked();
         } finally {
             Binder.restoreCallingIdentity(identity);
         }
@@ -1131,7 +1107,7 @@
     }
 
     public void removeGpsStatusListener(IGpsStatusListener listener) {
-        synchronized (mLocationListeners) {
+        synchronized (mLock) {
             mGpsLocationProvider.removeGpsStatusListener(listener);
         }
     }
@@ -1145,7 +1121,7 @@
             throw new SecurityException("Requires ACCESS_LOCATION_EXTRA_COMMANDS permission");
         }
 
-        synchronized (mLocationListeners) {
+        synchronized (mLock) {
             LocationProviderImpl impl = LocationProviderImpl.getProvider(provider);
             if (provider == null) {
                 return false;
@@ -1213,7 +1189,7 @@
     }
 
     // Listener for receiving locations to trigger proximity alerts
-    class ProximityListener extends ILocationListener.Stub {
+    class ProximityListener extends ILocationListener.Stub implements PendingIntent.OnFinished {
 
         boolean isGpsAvailable = false;
 
@@ -1250,7 +1226,14 @@
                         Intent enteredIntent = new Intent();
                         enteredIntent.putExtra(LocationManager.KEY_PROXIMITY_ENTERING, true);
                         try {
-                            intent.send(mContext, 0, enteredIntent, null, null);
+                            synchronized (mLock) {
+                                // synchronize to ensure incrementPendingBroadcastsLocked()
+                                // is called before decrementPendingBroadcasts()
+                                intent.send(mContext, 0, enteredIntent, this, mLocationHandler);
+                                // call this after broadcasting so we do not increment
+                                // if we throw an exeption.
+                                incrementPendingBroadcastsLocked();
+                            }
                         } catch (PendingIntent.CanceledException e) {
                             if (LOCAL_LOGV) {
                                 Log.v(TAG, "Canceled proximity alert: " + alert, e);
@@ -1268,7 +1251,14 @@
                         Intent exitedIntent = new Intent();
                         exitedIntent.putExtra(LocationManager.KEY_PROXIMITY_ENTERING, false);
                         try {
-                            intent.send(mContext, 0, exitedIntent, null, null);
+                            synchronized (mLock) {
+                                // synchronize to ensure incrementPendingBroadcastsLocked()
+                                // is called before decrementPendingBroadcasts()
+                                intent.send(mContext, 0, exitedIntent, this, mLocationHandler);
+                                // call this after broadcasting so we do not increment
+                                // if we throw an exeption.
+                                incrementPendingBroadcastsLocked();
+                            }
                         } catch (PendingIntent.CanceledException e) {
                             if (LOCAL_LOGV) {
                                 Log.v(TAG, "Canceled proximity alert: " + alert, e);
@@ -1321,12 +1311,17 @@
                 isGpsAvailable = false;
             }
         }
+
+        public void onSendFinished(PendingIntent pendingIntent, Intent intent,
+                int resultCode, String resultData, Bundle resultExtras) {
+            decrementPendingBroadcasts();
+        }
     }
 
     public void addProximityAlert(double latitude, double longitude,
         float radius, long expiration, PendingIntent intent) {
         try {
-            synchronized (mLocationListeners) {
+            synchronized (mLock) {
                 addProximityAlertLocked(latitude, longitude, radius, expiration, intent);
             }
         } catch (SecurityException se) {
@@ -1358,28 +1353,27 @@
                 latitude, longitude, radius, expiration, intent);
         mProximityAlerts.put(intent, alert);
 
-        if (mProximityListener == null) {
-            mProximityListener = new Receiver(new ProximityListener(), -1);
+        if (mProximityReceiver == null) {
+            mProximityListener = new ProximityListener();
+            mProximityReceiver = new Receiver(mProximityListener);
 
             LocationProvider provider = LocationProviderImpl.getProvider(
                 LocationManager.GPS_PROVIDER);
             if (provider != null) {
-                requestLocationUpdatesLocked(provider.getName(), 1000L, 1.0f, mProximityListener);
+                requestLocationUpdatesLocked(provider.getName(), 1000L, 1.0f, mProximityReceiver);
             }
 
             provider =
                 LocationProviderImpl.getProvider(LocationManager.NETWORK_PROVIDER);
             if (provider != null) {
-                requestLocationUpdatesLocked(provider.getName(), 1000L, 1.0f, mProximityListener);
+                requestLocationUpdatesLocked(provider.getName(), 1000L, 1.0f, mProximityReceiver);
             }
-        } else if (mGpsNavigating) {
-            updateReportedGpsLocked();
         }
     }
 
     public void removeProximityAlert(PendingIntent intent) {
         try {
-            synchronized (mLocationListeners) {
+            synchronized (mLock) {
                removeProximityAlertLocked(intent);
             }
         } catch (SecurityException se) {
@@ -1396,10 +1390,9 @@
 
         mProximityAlerts.remove(intent);
         if (mProximityAlerts.size() == 0) {
-            removeUpdatesLocked(mProximityListener);
+            removeUpdatesLocked(mProximityReceiver);
+            mProximityReceiver = null;
             mProximityListener = null;
-        } else if (mGpsNavigating) {
-            updateReportedGpsLocked();
         }
      }
 
@@ -1410,7 +1403,7 @@
      */
     public Bundle getProviderInfo(String provider) {
         try {
-            synchronized (mLocationListeners) {
+            synchronized (mLock) {
                 return _getProviderInfoLocked(provider);
             }
         } catch (SecurityException se) {
@@ -1445,7 +1438,7 @@
 
     public boolean isProviderEnabled(String provider) {
         try {
-            synchronized (mLocationListeners) {
+            synchronized (mLock) {
                 return _isProviderEnabledLocked(provider);
             }
         } catch (SecurityException se) {
@@ -1474,7 +1467,7 @@
 
     public Location getLastKnownLocation(String provider) {
         try {
-            synchronized (mLocationListeners) {
+            synchronized (mLock) {
                 return _getLastKnownLocationLocked(provider);
             }
         } catch (SecurityException se) {
@@ -1574,16 +1567,11 @@
             UpdateRecord r = records.get(i);
             Receiver receiver = r.mReceiver;
 
-            HashMap<String,Location> map = mLastFixBroadcast.get(receiver);
-            if (map == null) {
-                map = new HashMap<String,Location>();
-                mLastFixBroadcast.put(receiver, map);
-            }
-            Location lastLoc = map.get(provider);
+            Location lastLoc = r.mLastFixBroadcast;
             if ((lastLoc == null) || shouldBroadcastSafe(location, lastLoc, r)) {
                 if (lastLoc == null) {
                     lastLoc = new Location(location);
-                    map.put(provider, lastLoc);
+                    r.mLastFixBroadcast = lastLoc;
                 } else {
                     lastLoc.set(location);
                 }
@@ -1596,19 +1584,11 @@
                 }
             }
 
-            // Broadcast status message
-            HashMap<String,Long> statusMap = mLastStatusBroadcast.get(receiver);
-            if (statusMap == null) {
-                statusMap = new HashMap<String,Long>();
-                mLastStatusBroadcast.put(receiver, statusMap);
-            }
-            long prevStatusUpdateTime =
-                (statusMap.get(provider) != null) ? statusMap.get(provider) : 0;
-
+            long prevStatusUpdateTime = r.mLastStatusBroadcast;
             if ((newStatusUpdateTime > prevStatusUpdateTime) &&
                 (prevStatusUpdateTime != 0 || status != LocationProvider.AVAILABLE)) {
 
-                statusMap.put(provider, newStatusUpdateTime);
+                r.mLastStatusBroadcast = newStatusUpdateTime;
                 if (!receiver.callStatusChangedLocked(provider, status, extras)) {
                     Log.w(TAG, "RemoteException calling onStatusChanged on " + receiver);
                     if (deadReceivers == null) {
@@ -1636,54 +1616,25 @@
                 if (msg.what == MESSAGE_LOCATION_CHANGED) {
                     // log("LocationWorkerHandler: MESSAGE_LOCATION_CHANGED!");
 
-                    synchronized (mLocationListeners) {
+                    synchronized (mLock) {
                         Location location = (Location) msg.obj;
+
+                        if (mCollector != null && 
+                                LocationManager.GPS_PROVIDER.equals(location.getProvider())) {
+                            try {
+                                mCollector.updateLocation(location);
+                            } catch (RemoteException e) {
+                                Log.w(TAG, "mCollector.updateLocation failed");
+                            }
+                        }
+
                         String provider = location.getProvider();
                         if (!isAllowedBySettingsLocked(provider)) {
                             return;
                         }
 
-                        // Process the location fix if the screen is on or we're holding a wakelock
-                        if (mScreenOn || (mWakeLockAcquireTime != 0)) {
-                            handleLocationChangedLocked(location);
-                        }
-
-                        if ((mWakeLockAcquireTime != 0) &&
-                            (SystemClock.elapsedRealtime() - mWakeLockAcquireTime
-                                > MAX_TIME_FOR_WAKE_LOCK)) {
-    
-                            removeMessages(MESSAGE_ACQUIRE_WAKE_LOCK);
-                            removeMessages(MESSAGE_RELEASE_WAKE_LOCK);
-    
-                            log("LocationWorkerHandler: Exceeded max time for wake lock");
-                            Message m = Message.obtain(this, MESSAGE_RELEASE_WAKE_LOCK);
-                            sendMessageAtFrontOfQueue(m);
-    
-                        } else if (mWakeLockAcquireTime != 0 &&
-                            mWakeLockGpsReceived && mWakeLockNetworkReceived) {
-    
-                            removeMessages(MESSAGE_ACQUIRE_WAKE_LOCK);
-                            removeMessages(MESSAGE_RELEASE_WAKE_LOCK);
-    
-                            log("LocationWorkerHandler: Locations received.");
-                            mWakeLockAcquireTime = 0;
-                            Message m = Message.obtain(this, MESSAGE_RELEASE_WAKE_LOCK);
-                            sendMessageDelayed(m, TIME_AFTER_WAKE_LOCK);
-                        }
-                    }
-
-                } else if (msg.what == MESSAGE_ACQUIRE_WAKE_LOCK) {
-                    log("LocationWorkerHandler: Acquire");
-                    synchronized (mLocationListeners) {
-                        acquireWakeLockLocked();
-                    }
-                } else if (msg.what == MESSAGE_RELEASE_WAKE_LOCK) {
-                    log("LocationWorkerHandler: Release");
-
-                    // Update wakelock status so the next alarm is set before releasing wakelock
-                    synchronized (mLocationListeners) {
-                        updateWakelockStatusLocked(mScreenOn);
-                        releaseWakeLockLocked();
+                        handleLocationChangedLocked(location);
+                        updateWakelockStatusLocked();
                     }
                 }
             } catch (Exception e) {
@@ -1698,30 +1649,17 @@
             String action = intent.getAction();
 
             if (action.equals(ALARM_INTENT)) {
-                synchronized (mLocationListeners) {
+                synchronized (mLock) {
                     log("PowerStateBroadcastReceiver: Alarm received");
-                    mLocationHandler.removeMessages(MESSAGE_ACQUIRE_WAKE_LOCK);
                     // Have to do this immediately, rather than posting a
                     // message, so we execute our code while the system
                     // is holding a wake lock until the alarm broadcast
                     // is finished.
                     acquireWakeLockLocked();
                 }
-
-            } else if (action.equals(Intent.ACTION_SCREEN_OFF)) {
-                log("PowerStateBroadcastReceiver: Screen off");
-                synchronized (mLocationListeners) {
-                    updateWakelockStatusLocked(false);
-                }
-
-            } else if (action.equals(Intent.ACTION_SCREEN_ON)) {
-                log("PowerStateBroadcastReceiver: Screen on");
-                synchronized (mLocationListeners) {
-                    updateWakelockStatusLocked(true);
-                }
             } else if (action.equals(Intent.ACTION_PACKAGE_REMOVED)
                     || action.equals(Intent.ACTION_PACKAGE_RESTARTED)) {
-                synchronized (mLocationListeners) {
+                synchronized (mLock) {
                     int uid = intent.getIntExtra(Intent.EXTRA_UID, -1);
                     if (uid >= 0) {
                         ArrayList<Receiver> removedRecs = null;
@@ -1779,7 +1717,7 @@
                 }
 
                 // Notify location providers of current network state
-                synchronized (mLocationListeners) {
+                synchronized (mLock) {
                     List<LocationProviderImpl> providers = LocationProviderImpl.getProviders();
                     for (LocationProviderImpl provider : providers) {
                         if (provider.requiresNetwork()) {
@@ -1792,13 +1730,8 @@
                 final boolean enabled = intent.getBooleanExtra(GpsLocationProvider.EXTRA_ENABLED,
                     false);
 
-                synchronized (mLocationListeners) {
-                    if (enabled) {
-                        updateReportedGpsLocked();
-                        mGpsNavigating = true;
-                    } else {
-                        reportStopGpsLocked();
-                        mGpsNavigating = false;
+                synchronized (mLock) {
+                    if (!enabled) {
                         // When GPS is disabled, we are OK to release wake-lock
                         mWakeLockGpsReceived = true;
                     }
@@ -1810,12 +1743,12 @@
 
     // Wake locks
 
-    private void updateWakelockStatusLocked(boolean screenOn) {
-        log("updateWakelockStatus(): " + screenOn);
+    private void updateWakelockStatusLocked() {
+        log("updateWakelockStatus()");
 
         long callerId = Binder.clearCallingIdentity();
         
-        boolean needsLock = false;
+        boolean needsLock = (mPendingBroadcasts > 0);
         long minTime = Integer.MAX_VALUE;
 
         if (mNetworkLocationProvider != null && mNetworkLocationProvider.isLocationTracking()) {
@@ -1826,16 +1759,8 @@
         if (mGpsLocationProvider != null && mGpsLocationProvider.isLocationTracking()) {
             needsLock = true;
             minTime = Math.min(mGpsLocationProvider.getMinTime(), minTime);
-            if (screenOn) {
-                startGpsLocked();
-            } else if (mScreenOn && !screenOn) {
-                // We just turned the screen off so stop navigating
-                stopGpsLocked();
-            }
         }
 
-        mScreenOn = screenOn;
-
         PendingIntent sender =
             PendingIntent.getBroadcast(mContext, 0, new Intent(ALARM_INTENT), 0);
 
@@ -1843,7 +1768,7 @@
         log("Cancelling existing alarm");
         mAlarmManager.cancel(sender);
 
-        if (needsLock && !mScreenOn) {
+        if (needsLock) {
             long now = SystemClock.elapsedRealtime();
             mAlarmManager.set(
                 AlarmManager.ELAPSED_REALTIME_WAKEUP, now + minTime, sender);
@@ -1853,9 +1778,6 @@
             log("No need for alarm");
             mAlarmInterval = -1;
 
-            // Clear out existing wakelocks
-            mLocationHandler.removeMessages(MESSAGE_ACQUIRE_WAKE_LOCK);
-            mLocationHandler.removeMessages(MESSAGE_RELEASE_WAKE_LOCK);
             releaseWakeLockLocked();
         }
         Binder.restoreCallingIdentity(callerId);
@@ -1897,131 +1819,11 @@
         mWakeLockAcquireTime = SystemClock.elapsedRealtime();
         log("Acquired wakelock");
 
-        // Start the gps provider
-        startGpsLocked();
-
-        // Acquire cell lock
-        if (mCellWakeLockAcquired) {
-            // Lock is already acquired
-        } else if (!mWakeLockNetworkReceived) {
-            mTelephonyManager.enableLocationUpdates();
-            mCellWakeLockAcquired = true;
-        } else {
-            mCellWakeLockAcquired = false;
-        }
-
-        // Notify NetworkLocationProvider
         if (mNetworkLocationProvider != null) {
-            mNetworkLocationProvider.updateCellLockStatus(mCellWakeLockAcquired);
+            mNetworkLocationProvider.wakeLockAcquired();
         }
-
-        // Acquire wifi lock
-        WifiManager.WifiLock wifiLock = getWifiWakelockLocked();
-        if (wifiLock != null) {
-            if (mWifiWakeLockAcquired) {
-                // Lock is already acquired
-            } else if (mWifiManager.isWifiEnabled() && !mWakeLockNetworkReceived) {
-                wifiLock.acquire();
-                mWifiWakeLockAcquired = true;
-            } else {
-                mWifiWakeLockAcquired = false;
-                Log.w(TAG, "acquireWakeLock(): Unable to get WiFi lock");
-            }
-        }
-    }
-
-    private boolean reportGpsUidLocked(int curSeq, int nextSeq, int uid) {
-        int seq = mReportedGpsUids.get(uid, -1);
-        if (seq == curSeq) {
-            // Already reported; propagate to next sequence.
-            mReportedGpsUids.put(uid, nextSeq);
-            return true;
-        } else if (seq != nextSeq) {
-            try {
-                // New UID; report it.
-                mBatteryStats.noteStartGps(uid);
-                mReportedGpsUids.put(uid, nextSeq);
-                return true;
-            } catch (RemoteException e) {
-            }
-        }
-        return false;
-    }
-    
-    private void updateReportedGpsLocked() {
-        if (mGpsLocationProvider == null) {
-            return;
-        }
-        
-        final String name = mGpsLocationProvider.getName();
-        final int curSeq = mReportedGpsSeq;
-        final int nextSeq = (curSeq+1) >= 0 ? (curSeq+1) : 0;
-        mReportedGpsSeq = nextSeq;
-        
-        ArrayList<UpdateRecord> urs = mRecordsByProvider.get(name);
-        int num = 0;
-        final int N = urs.size();
-        for (int i=0; i<N; i++) {
-            UpdateRecord ur = urs.get(i);
-            if (ur.mReceiver == mProximityListener) {
-                // We don't want the system to take the blame for this one.
-                continue;
-            }
-            if (reportGpsUidLocked(curSeq, nextSeq, ur.mUid)) {
-                num++;
-            }
-        }
-        
-        for (ProximityAlert pe : mProximityAlerts.values()) {
-            if (reportGpsUidLocked(curSeq, nextSeq, pe.mUid)) {
-                num++;
-            }
-        }
-        
-        if (num != mReportedGpsUids.size()) {
-            // The number of uids is processed is different than the
-            // array; report any that are no longer active.
-            for (int i=mReportedGpsUids.size()-1; i>=0; i--) {
-                if (mReportedGpsUids.valueAt(i) != nextSeq) {
-                    try {
-                        mBatteryStats.noteStopGps(mReportedGpsUids.keyAt(i));
-                    } catch (RemoteException e) {
-                    }
-                    mReportedGpsUids.removeAt(i);
-                }
-            }
-        }
-    }
-    
-    private void reportStopGpsLocked() {
-        int curSeq = mReportedGpsSeq;
-        for (int i=mReportedGpsUids.size()-1; i>=0; i--) {
-            if (mReportedGpsUids.valueAt(i) == curSeq) {
-                try {
-                    mBatteryStats.noteStopGps(mReportedGpsUids.keyAt(i));
-                } catch (RemoteException e) {
-                }
-            }
-        }
-        curSeq++;
-        if (curSeq < 0) curSeq = 0;
-        mReportedGpsSeq = curSeq;
-        mReportedGpsUids.clear();
-    }
-    
-    private void startGpsLocked() {
-        boolean gpsActive = (mGpsLocationProvider != null)
-                    && mGpsLocationProvider.isLocationTracking();
-        if (gpsActive) {
-            mGpsLocationProvider.startNavigating();
-        }
-    }
-
-    private void stopGpsLocked() {
-        boolean gpsActive = mGpsLocationProvider != null
-                    && mGpsLocationProvider.isLocationTracking();
-        if (gpsActive) {
-            mGpsLocationProvider.stopNavigating();
+        if (mGpsLocationProvider != null) {
+            mGpsLocationProvider.wakeLockAcquired();
         }
     }
 
@@ -2036,29 +1838,11 @@
     }
 
     private void releaseWakeLockXLocked() {
-        // Release wifi lock
-        WifiManager.WifiLock wifiLock = getWifiWakelockLocked();
-        if (wifiLock != null) {
-            if (mWifiWakeLockAcquired) {
-                wifiLock.release();
-                mWifiWakeLockAcquired = false;
-            }
-        }
-
-        if (!mScreenOn) {
-            // Stop the gps
-            stopGpsLocked();
-        }
-
-        // Release cell lock
-        if (mCellWakeLockAcquired) {
-            mTelephonyManager.disableLocationUpdates();
-            mCellWakeLockAcquired = false;
-        }
-
-        // Notify NetworkLocationProvider
         if (mNetworkLocationProvider != null) {
-            mNetworkLocationProvider.updateCellLockStatus(mCellWakeLockAcquired);
+            mNetworkLocationProvider.wakeLockReleased();
+        }
+        if (mGpsLocationProvider != null) {
+            mGpsLocationProvider.wakeLockReleased();
         }
 
         // Release wake lock
@@ -2071,33 +1855,51 @@
         }
     }
 
-    // Geocoder
+    private void incrementPendingBroadcastsLocked() {
+        if (mPendingBroadcasts++ == 0) {
+            updateWakelockStatusLocked();
+        }
+    }
 
-    public String getFromLocation(double latitude, double longitude, int maxResults,
-        String language, String country, String variant, String appName, List<Address> addrs) {
-        synchronized (mLocationListeners) {
-            if (mNetworkLocationProvider != null) {
-                return mNetworkLocationProvider.getFromLocation(latitude, longitude, maxResults,
-                        language, country, variant, appName, addrs);
-            } else {
-                return null;
+    private void decrementPendingBroadcasts() {
+        synchronized (mLock) {
+            if (--mPendingBroadcasts == 0) {
+                updateWakelockStatusLocked();
             }
         }
     }
 
-    public String getFromLocationName(String locationName,
-        double lowerLeftLatitude, double lowerLeftLongitude,
-        double upperRightLatitude, double upperRightLongitude, int maxResults,
-        String language, String country, String variant, String appName, List<Address> addrs) {
-        synchronized (mLocationListeners) {
-            if (mNetworkLocationProvider != null) {
-                return mNetworkLocationProvider.getFromLocationName(locationName, lowerLeftLatitude, 
-                        lowerLeftLongitude, upperRightLatitude, upperRightLongitude, maxResults,
-                        language, country, variant, appName, addrs);
-            } else {
-                return null;
+    // Geocoder
+
+    public String getFromLocation(double latitude, double longitude, int maxResults,
+            String language, String country, String variant, String appName, List<Address> addrs) {
+        if (mGeocodeProvider != null) {
+            try {
+                return mGeocodeProvider.getFromLocation(latitude, longitude, maxResults, language, country,
+                        variant, appName,  addrs);
+            } catch (RemoteException e) {
+                Log.e(TAG, "getFromLocation failed", e);
             }
         }
+        return null;
+    }
+
+
+    public String getFromLocationName(String locationName,
+            double lowerLeftLatitude, double lowerLeftLongitude,
+            double upperRightLatitude, double upperRightLongitude, int maxResults,
+            String language, String country, String variant, String appName, List<Address> addrs) {
+
+        if (mGeocodeProvider != null) {
+            try {
+                return mGeocodeProvider.getFromLocationName(locationName, lowerLeftLatitude,
+                        lowerLeftLongitude, upperRightLatitude, upperRightLongitude,
+                        maxResults, language, country, variant, appName, addrs);
+            } catch (RemoteException e) {
+                Log.e(TAG, "getFromLocationName failed", e);
+            }
+        }
+        return null;
     }
 
     // Mock Providers
@@ -2120,7 +1922,7 @@
         boolean supportsSpeed, boolean supportsBearing, int powerRequirement, int accuracy) {
         checkMockPermissionsSafe();
 
-        synchronized (mLocationListeners) {
+        synchronized (mLock) {
             MockProvider provider = new MockProvider(name, this,
                 requiresNetwork, requiresSatellite,
                 requiresCell, hasMonetaryCost, supportsAltitude,
@@ -2136,7 +1938,7 @@
 
     public void removeTestProvider(String provider) {
         checkMockPermissionsSafe();
-        synchronized (mLocationListeners) {
+        synchronized (mLock) {
             MockProvider mockProvider = mMockProviders.get(provider);
             if (mockProvider == null) {
                 throw new IllegalArgumentException("Provider \"" + provider + "\" unknown");
@@ -2149,7 +1951,7 @@
 
     public void setTestProviderLocation(String provider, Location loc) {
         checkMockPermissionsSafe();
-        synchronized (mLocationListeners) {
+        synchronized (mLock) {
             MockProvider mockProvider = mMockProviders.get(provider);
             if (mockProvider == null) {
                 throw new IllegalArgumentException("Provider \"" + provider + "\" unknown");
@@ -2160,7 +1962,7 @@
 
     public void clearTestProviderLocation(String provider) {
         checkMockPermissionsSafe();
-        synchronized (mLocationListeners) {
+        synchronized (mLock) {
             MockProvider mockProvider = mMockProviders.get(provider);
             if (mockProvider == null) {
                 throw new IllegalArgumentException("Provider \"" + provider + "\" unknown");
@@ -2171,7 +1973,7 @@
 
     public void setTestProviderEnabled(String provider, boolean enabled) {
         checkMockPermissionsSafe();
-        synchronized (mLocationListeners) {
+        synchronized (mLock) {
             MockProvider mockProvider = mMockProviders.get(provider);
             if (mockProvider == null) {
                 throw new IllegalArgumentException("Provider \"" + provider + "\" unknown");
@@ -2191,7 +1993,7 @@
 
     public void clearTestProviderEnabled(String provider) {
         checkMockPermissionsSafe();
-        synchronized (mLocationListeners) {
+        synchronized (mLock) {
             MockProvider mockProvider = mMockProviders.get(provider);
             if (mockProvider == null) {
                 throw new IllegalArgumentException("Provider \"" + provider + "\" unknown");
@@ -2204,7 +2006,7 @@
 
     public void setTestProviderStatus(String provider, int status, Bundle extras, long updateTime) {
         checkMockPermissionsSafe();
-        synchronized (mLocationListeners) {
+        synchronized (mLock) {
             MockProvider mockProvider = mMockProviders.get(provider);
             if (mockProvider == null) {
                 throw new IllegalArgumentException("Provider \"" + provider + "\" unknown");
@@ -2215,7 +2017,7 @@
 
     public void clearTestProviderStatus(String provider) {
         checkMockPermissionsSafe();
-        synchronized (mLocationListeners) {
+        synchronized (mLock) {
             MockProvider mockProvider = mMockProviders.get(provider);
             if (mockProvider == null) {
                 throw new IllegalArgumentException("Provider \"" + provider + "\" unknown");
@@ -2239,52 +2041,29 @@
             return;
         }
         
-        synchronized (mLocationListeners) {
+        synchronized (mLock) {
             pw.println("Current Location Manager state:");
             pw.println("  sProvidersLoaded=" + sProvidersLoaded);
             pw.println("  mGpsLocationProvider=" + mGpsLocationProvider);
-            pw.println("  mGpsNavigating=" + mGpsNavigating);
             pw.println("  mNetworkLocationProvider=" + mNetworkLocationProvider);
             pw.println("  mCollector=" + mCollector);
             pw.println("  mAlarmInterval=" + mAlarmInterval
-                    + " mScreenOn=" + mScreenOn
                     + " mWakeLockAcquireTime=" + mWakeLockAcquireTime);
             pw.println("  mWakeLockGpsReceived=" + mWakeLockGpsReceived
                     + " mWakeLockNetworkReceived=" + mWakeLockNetworkReceived);
-            pw.println("  mWifiWakeLockAcquired=" + mWifiWakeLockAcquired
-                    + " mCellWakeLockAcquired=" + mCellWakeLockAcquired);
             pw.println("  Listeners:");
-            int N = mListeners.size();
+            int N = mReceivers.size();
             for (int i=0; i<N; i++) {
-                pw.println("    " + mListeners.get(i));
+                pw.println("    " + mReceivers.get(i));
             }
             pw.println("  Location Listeners:");
-            for (Map.Entry<Receiver, HashMap<String,UpdateRecord>> i
-                    : mLocationListeners.entrySet()) {
-                pw.println("    " + i.getKey() + ":");
-                for (Map.Entry<String,UpdateRecord> j : i.getValue().entrySet()) {
+            for (Receiver i : mReceivers.values()) {
+                pw.println("    " + i + ":");
+                for (Map.Entry<String,UpdateRecord> j : i.mUpdateRecords.entrySet()) {
                     pw.println("      " + j.getKey() + ":");
                     j.getValue().dump(pw, "        ");
                 }
             }
-            pw.println("  Last Fix Broadcasts:");
-            for (Map.Entry<Receiver, HashMap<String,Location>> i
-                    : mLastFixBroadcast.entrySet()) {
-                pw.println("    " + i.getKey() + ":");
-                for (Map.Entry<String,Location> j : i.getValue().entrySet()) {
-                    pw.println("      " + j.getKey() + ":");
-                    j.getValue().dump(new PrintWriterPrinter(pw), "        ");
-                }
-            }
-            pw.println("  Last Status Broadcasts:");
-            for (Map.Entry<Receiver, HashMap<String,Long>> i
-                    : mLastStatusBroadcast.entrySet()) {
-                pw.println("    " + i.getKey() + ":");
-                for (Map.Entry<String,Long> j : i.getValue().entrySet()) {
-                    pw.println("      " + j.getKey() + " -> 0x"
-                            + Long.toHexString(j.getValue()));
-                }
-            }
             pw.println("  Records by Provider:");
             for (Map.Entry<String, ArrayList<UpdateRecord>> i
                     : mRecordsByProvider.entrySet()) {
@@ -2315,6 +2094,7 @@
                     i.dump(pw, "      ");
                 }
             }
+            pw.println("  mProximityReceiver=" + mProximityReceiver);
             pw.println("  mProximityListener=" + mProximityListener);
             if (mEnabledProviders.size() > 0) {
                 pw.println("  Enabled Providers:");
@@ -2336,12 +2116,6 @@
                     i.getValue().dump(pw, "      ");
                 }
             }
-            pw.println("  Reported GPS UIDs @ seq " + mReportedGpsSeq + ":");
-            N = mReportedGpsUids.size();
-            for (int i=0; i<N; i++)  {
-                pw.println("    UID " + mReportedGpsUids.keyAt(i)
-                        + " seq=" + mReportedGpsUids.valueAt(i));
-            }
         }
     }
 }
diff --git a/services/java/com/android/server/PackageManagerService.java b/services/java/com/android/server/PackageManagerService.java
index 9e062f4..159bc76 100644
--- a/services/java/com/android/server/PackageManagerService.java
+++ b/services/java/com/android/server/PackageManagerService.java
@@ -2932,11 +2932,12 @@
         }
 
         @Override
-        protected void dumpFilter(Printer out, String prefix,
+        protected void dumpFilter(PrintWriter out, String prefix,
                 PackageParser.ActivityIntentInfo filter) {
-            out.println(prefix
-                    + Integer.toHexString(System.identityHashCode(filter.activity))
-                    + " " + filter.activity.component.flattenToShortString());
+            out.print(prefix); out.print(
+                    Integer.toHexString(System.identityHashCode(filter.activity)));
+                    out.print(' ');
+                    out.println(filter.activity.componentShortName);
         }
 
 //        List<ResolveInfo> filterEnabled(List<ResolveInfo> resolveInfoList) {
@@ -3064,11 +3065,12 @@
         }
 
         @Override
-        protected void dumpFilter(Printer out, String prefix,
+        protected void dumpFilter(PrintWriter out, String prefix,
                 PackageParser.ServiceIntentInfo filter) {
-            out.println(prefix
-                    + Integer.toHexString(System.identityHashCode(filter.service))
-                    + " " + filter.service.component.flattenToShortString());
+            out.print(prefix); out.print(
+                    Integer.toHexString(System.identityHashCode(filter.service)));
+                    out.print(' ');
+                    out.println(filter.service.componentShortName);
         }
 
 //        List<ResolveInfo> filterEnabled(List<ResolveInfo> resolveInfoList) {
@@ -4578,80 +4580,83 @@
             return;
         }
 
-        Printer printer = new PrintWriterPrinter(pw);
         synchronized (mPackages) {
             pw.println("Activity Resolver Table:");
-            mActivities.dump(printer, "  ");
+            mActivities.dump(pw, "  ");
             pw.println(" ");
             pw.println("Receiver Resolver Table:");
-            mReceivers.dump(printer, "  ");
+            mReceivers.dump(pw, "  ");
             pw.println(" ");
             pw.println("Service Resolver Table:");
-            mServices.dump(printer, "  ");
+            mServices.dump(pw, "  ");
             pw.println(" ");
             pw.println("Preferred Activities:");
-            mSettings.mPreferredActivities.dump(printer, "  ");
+            mSettings.mPreferredActivities.dump(pw, "  ");
             pw.println(" ");
             pw.println("Preferred Packages:");
             {
                 for (PackageSetting ps : mSettings.mPreferredPackages) {
-                    pw.println("  " + ps.name);
+                    pw.print("  "); pw.println(ps.name);
                 }
             }
             pw.println(" ");
             pw.println("Permissions:");
             {
                 for (BasePermission p : mSettings.mPermissions.values()) {
-                    pw.println("  Permission [" + p.name + "] ("
-                            + Integer.toHexString(System.identityHashCode(p))
-                            + "):");
-                    pw.println("    sourcePackage=" + p.sourcePackage);
-                    pw.println("    uid=" + p.uid
-                            + " gids=" + arrayToString(p.gids)
-                            + " type=" + p.type);
+                    pw.print("  Permission ["); pw.print(p.name); pw.print("] (");
+                            pw.print(Integer.toHexString(System.identityHashCode(p)));
+                            pw.println("):");
+                    pw.print("    sourcePackage="); pw.println(p.sourcePackage);
+                    pw.print("    uid="); pw.print(p.uid);
+                            pw.print(" gids="); pw.print(arrayToString(p.gids));
+                            pw.print(" type="); pw.println(p.type);
                 }
             }
             pw.println(" ");
             pw.println("Packages:");
             {
                 for (PackageSetting ps : mSettings.mPackages.values()) {
-                    pw.println("  Package [" + ps.name + "] ("
-                            + Integer.toHexString(System.identityHashCode(ps))
-                            + "):");
-                    pw.println("    userId=" + ps.userId
-                            + " gids=" + arrayToString(ps.gids));
-                    pw.println("    sharedUser=" + ps.sharedUser);
-                    pw.println("    pkg=" + ps.pkg);
-                    pw.println("    codePath=" + ps.codePathString);
-                    pw.println("    resourcePath=" + ps.resourcePathString);
+                    pw.print("  Package ["); pw.print(ps.name); pw.print("] (");
+                            pw.print(Integer.toHexString(System.identityHashCode(ps)));
+                            pw.println("):");
+                    pw.print("    userId="); pw.print(ps.userId);
+                            pw.print(" gids="); pw.println(arrayToString(ps.gids));
+                    pw.print("    sharedUser="); pw.println(ps.sharedUser);
+                    pw.print("    pkg="); pw.println(ps.pkg);
+                    pw.print("    codePath="); pw.println(ps.codePathString);
+                    pw.print("    resourcePath="); pw.println(ps.resourcePathString);
                     if (ps.pkg != null) {
-                        pw.println("    dataDir=" + ps.pkg.applicationInfo.dataDir);
+                        pw.print("    dataDir="); pw.println(ps.pkg.applicationInfo.dataDir);
                     }
-                    pw.println("    timeStamp=" + ps.getTimeStampStr());
-                    pw.println("    signatures=" + ps.signatures);
-                    pw.println("    permissionsFixed=" + ps.permissionsFixed
-                            + " pkgFlags=0x" + Integer.toHexString(ps.pkgFlags)
-                            + " installStatus=" + ps.installStatus
-                            + " enabled=" + ps.enabled);
+                    pw.print("    timeStamp="); pw.println(ps.getTimeStampStr());
+                    pw.print("    signatures="); pw.println(ps.signatures);
+                    pw.print("    permissionsFixed="); pw.print(ps.permissionsFixed);
+                            pw.print(" pkgFlags=0x"); pw.print(Integer.toHexString(ps.pkgFlags));
+                            pw.print(" installStatus="); pw.print(ps.installStatus);
+                            pw.print(" enabled="); pw.println(ps.enabled);
                     if (ps.disabledComponents.size() > 0) {
                         pw.println("    disabledComponents:");
                         for (String s : ps.disabledComponents) {
-                            pw.println("      " + s);
+                            pw.print("      "); pw.println(s);
                         }
                     }
                     if (ps.enabledComponents.size() > 0) {
                         pw.println("    enabledComponents:");
                         for (String s : ps.enabledComponents) {
-                            pw.println("      " + s);
+                            pw.print("      "); pw.println(s);
                         }
                     }
-                    pw.println("    grantedPermissions:");
-                    for (String s : ps.grantedPermissions) {
-                        pw.println("      " + s);
+                    if (ps.grantedPermissions.size() > 0) {
+                        pw.println("    grantedPermissions:");
+                        for (String s : ps.grantedPermissions) {
+                            pw.print("      "); pw.println(s);
+                        }
                     }
-                    pw.println("    loadedPermissions:");
-                    for (String s : ps.loadedPermissions) {
-                        pw.println("      " + s);
+                    if (ps.loadedPermissions.size() > 0) {
+                        pw.println("    loadedPermissions:");
+                        for (String s : ps.loadedPermissions) {
+                            pw.print("      "); pw.println(s);
+                        }
                     }
                 }
             }
@@ -4659,18 +4664,18 @@
             pw.println("Shared Users:");
             {
                 for (SharedUserSetting su : mSettings.mSharedUsers.values()) {
-                    pw.println("  SharedUser [" + su.name + "] ("
-                            + Integer.toHexString(System.identityHashCode(su))
-                            + "):");
-                    pw.println("    userId=" + su.userId
-                            + " gids=" + arrayToString(su.gids));
+                    pw.print("  SharedUser ["); pw.print(su.name); pw.print("] (");
+                            pw.print(Integer.toHexString(System.identityHashCode(su)));
+                            pw.println("):");
+                    pw.print("    userId="); pw.print(su.userId);
+                            pw.print(" gids="); pw.println(arrayToString(su.gids));
                     pw.println("    grantedPermissions:");
                     for (String s : su.grantedPermissions) {
-                        pw.println("      " + s);
+                        pw.print("      "); pw.println(s);
                     }
                     pw.println("    loadedPermissions:");
                     for (String s : su.loadedPermissions) {
-                        pw.println("      " + s);
+                        pw.print("      "); pw.println(s);
                     }
                 }
             }
@@ -5302,16 +5307,19 @@
         private final IntentResolver<PreferredActivity, PreferredActivity> mPreferredActivities =
                     new IntentResolver<PreferredActivity, PreferredActivity>() {
             @Override
-            protected void dumpFilter(Printer out, String prefix,
+            protected void dumpFilter(PrintWriter out, String prefix,
                     PreferredActivity filter) {
-                out.println(prefix
-                        + Integer.toHexString(System.identityHashCode(filter))
-                        + " " + filter.mActivity.flattenToShortString()
-                        + " match=0x" + Integer.toHexString(filter.mMatch));
+                out.print(prefix); out.print(
+                        Integer.toHexString(System.identityHashCode(filter)));
+                        out.print(' ');
+                        out.print(filter.mActivity.flattenToShortString());
+                        out.print(" match=0x");
+                        out.println( Integer.toHexString(filter.mMatch));
                 if (filter.mSetComponents != null) {
-                    out.println(prefix + "  Selected from:");
+                    out.print(prefix); out.println("  Selected from:");
                     for (int i=0; i<filter.mSetComponents.length; i++) {
-                        out.println(prefix + "    " + filter.mSetComponents[i]);
+                        out.print(prefix); out.print("    ");
+                                out.println(filter.mSetComponents[i]);
                     }
                 }
             }
diff --git a/services/java/com/android/server/WifiService.java b/services/java/com/android/server/WifiService.java
index 54e77f0..8850c31 100644
--- a/services/java/com/android/server/WifiService.java
+++ b/services/java/com/android/server/WifiService.java
@@ -165,7 +165,6 @@
      * Character buffer used to parse scan results (optimization)
      */
     private static final int SCAN_RESULT_BUFFER_SIZE = 512;
-    private char[] mScanResultBuffer;
     private boolean mNeedReconfig;
 
     /*
@@ -204,8 +203,6 @@
                 }
             };
 
-        mScanResultBuffer = new char [SCAN_RESULT_BUFFER_SIZE];
-
         HandlerThread wifiThread = new HandlerThread("WifiService");
         wifiThread.start();
         mWifiHandler = new WifiHandler(wifiThread.getLooper());
@@ -1217,61 +1214,13 @@
                     lineBeg = lineEnd + 1;
                     continue;
                 }
-                int lineLen = lineEnd - lineBeg;
-                if (0 < lineLen && lineLen <= SCAN_RESULT_BUFFER_SIZE) {
-                    int scanResultLevel = 0;
-                    /*
-                     * At most one thread should have access to the buffer at a time!
-                     */
-                    synchronized(mScanResultBuffer) {
-                        boolean parsingScanResultLevel = false;
-                        for (int i = lineBeg; i < lineEnd; ++i) {
-                            char ch = reply.charAt(i);
-                            /*
-                             * Assume that the signal level starts with a '-'
-                             */
-                            if (ch == '-') {
-                                /*
-                                 * Skip whatever instances of '-' we may have
-                                 * after we parse the signal level
-                                 */
-                                parsingScanResultLevel = (scanResultLevel == 0);
-                            } else if (parsingScanResultLevel) {
-                                int digit = Character.digit(ch, 10);
-                                if (0 <= digit) {
-                                    scanResultLevel =
-                                        10 * scanResultLevel + digit;
-                                    /*
-                                     * Replace the signal level number in
-                                     * the string with 0's for caching
-                                     */
-                                    ch = '0';
-                                } else {
-                                    /*
-                                     * Reset the flag if we meet a non-digit
-                                     * character
-                                     */
-                                    parsingScanResultLevel = false;
-                                }
-                            }
-                            mScanResultBuffer[i - lineBeg] = ch;
-                        }
-                        if (scanResultLevel != 0) {
-                            ScanResult scanResult = parseScanResult(
-                                new String(mScanResultBuffer, 0, lineLen));
-                            if (scanResult != null) {
-                              scanResult.level = -scanResultLevel;
-                              scanList.add(scanResult);
-                            }
-                        } else if (DBG) {
-                            Log.w(TAG,
-                                  "ScanResult.level=0: misformatted scan result?");
-                        }
-                    }
-                } else if (0 < lineLen) {
-                    if (DBG) {
-                        Log.w(TAG, "Scan result line is too long: " +
-                              (lineEnd - lineBeg) + ", skipping the line!");
+                if (lineEnd > lineBeg) {
+                    String line = reply.substring(lineBeg, lineEnd);
+                    ScanResult scanResult = parseScanResult(line);
+                    if (scanResult != null) {
+                        scanList.add(scanResult);
+                    } else if (DBG) {
+                        Log.w(TAG, "misformatted scan result for: " + line);
                     }
                 }
                 lineBeg = lineEnd + 1;
@@ -1294,21 +1243,29 @@
              * must synchronized here!
              */
             synchronized (mScanResultCache) {
-                scanResult = mScanResultCache.get(line);
-                if (scanResult == null) {
-                    String[] result = scanResultPattern.split(line);
-                    if (3 <= result.length && result.length <= 5) {
-                        // bssid | frequency | level | flags | ssid
-                        int frequency;
-                        int level;
-                        try {
-                            frequency = Integer.parseInt(result[1]);
-                            level = Integer.parseInt(result[2]);
-                        } catch (NumberFormatException e) {
-                            frequency = 0;
-                            level = 0;
-                        }
+                String[] result = scanResultPattern.split(line);
+                if (3 <= result.length && result.length <= 5) {
+                    String bssid = result[0];
+                    // bssid | frequency | level | flags | ssid
+                    int frequency;
+                    int level;
+                    try {
+                        frequency = Integer.parseInt(result[1]);
+                        level = Integer.parseInt(result[2]);
+                        /* some implementations avoid negative values by adding 256
+                         * so we need to adjust for that here.
+                         */
+                        if (level > 0) level -= 256;
+                    } catch (NumberFormatException e) {
+                        frequency = 0;
+                        level = 0;
+                    }
 
+                    // bssid is the hash key
+                    scanResult = mScanResultCache.get(bssid);
+                    if (scanResult != null) {
+                        scanResult.level = level;
+                    } else {
                         /*
                          * The formatting of the results returned by
                          * wpa_supplicant is intended to make the fields
@@ -1341,13 +1298,13 @@
                         if (0 < ssid.trim().length()) {
                             scanResult =
                                 new ScanResult(
-                                    ssid, result[0], flags, level, frequency);
-                            mScanResultCache.put(line, scanResult);
+                                    ssid, bssid, flags, level, frequency);
+                            mScanResultCache.put(bssid, scanResult);
                         }
-                    } else {
-                        Log.w(TAG, "Misformatted scan result text with " +
-                              result.length + " fields: " + line);
                     }
+                } else {
+                    Log.w(TAG, "Misformatted scan result text with " +
+                          result.length + " fields: " + line);
                 }
             }
         }
diff --git a/services/java/com/android/server/WindowManagerService.java b/services/java/com/android/server/WindowManagerService.java
index 0b1ddc8..321b17e 100644
--- a/services/java/com/android/server/WindowManagerService.java
+++ b/services/java/com/android/server/WindowManagerService.java
@@ -77,7 +77,6 @@
 import android.os.SystemProperties;
 import android.os.TokenWatcher;
 import android.provider.Settings;
-import android.util.Config;
 import android.util.EventLog;
 import android.util.Log;
 import android.util.SparseIntArray;
@@ -137,7 +136,7 @@
     
     static final boolean PROFILE_ORIENTATION = false;
     static final boolean BLUR = true;
-    static final boolean localLOGV = DEBUG ? Config.LOGD : Config.LOGV;
+    static final boolean localLOGV = DEBUG;
     
     static final int LOG_WM_NO_SURFACE_MEMORY = 31000;
     
@@ -2023,7 +2022,7 @@
             wtoken.appFullscreen = fullscreen;
             wtoken.requestedOrientation = requestedOrientation;
             mAppTokens.add(addPos, wtoken);
-            if (Config.LOGV) Log.v(TAG, "Adding new app token: " + wtoken);
+            if (localLOGV) Log.v(TAG, "Adding new app token: " + wtoken);
             mTokenMap.put(token.asBinder(), wtoken);
             mTokenList.add(wtoken);
             
@@ -4801,14 +4800,11 @@
                     mPaused = true;
                 } else {
                     if (mLastWin == null) {
-                        if (Config.LOGI) Log.i(
-                            TAG, "Key dispatching not paused: no last window.");
+                        Log.i(TAG, "Key dispatching not paused: no last window.");
                     } else if (mFinished) {
-                        if (Config.LOGI) Log.i(
-                            TAG, "Key dispatching not paused: finished last key.");
+                        Log.i(TAG, "Key dispatching not paused: finished last key.");
                     } else {
-                        if (Config.LOGI) Log.i(
-                            TAG, "Key dispatching not paused: window in higher layer.");
+                        Log.i(TAG, "Key dispatching not paused: window in higher layer.");
                     }
                 }
                 */
@@ -5179,6 +5175,7 @@
         final IInputContext mInputContext;
         final int mUid;
         final int mPid;
+        final String mStringName;
         SurfaceSession mSurfaceSession;
         int mNumWindow = 0;
         boolean mClientDead = false;
@@ -5202,6 +5199,14 @@
             mInputContext = inputContext;
             mUid = Binder.getCallingUid();
             mPid = Binder.getCallingPid();
+            StringBuilder sb = new StringBuilder();
+            sb.append("Session{");
+            sb.append(Integer.toHexString(System.identityHashCode(this)));
+            sb.append(" uid ");
+            sb.append(mUid);
+            sb.append("}");
+            mStringName = sb.toString();
+            
             synchronized (mWindowMap) {
                 if (mInputMethodManager == null && mHaveInputMethods) {
                     IBinder b = ServiceManager.getService(
@@ -5381,20 +5386,24 @@
         }
         
         void dump(PrintWriter pw, String prefix) {
-            pw.println(prefix + this);
-            pw.println(prefix + "mNumWindow=" + mNumWindow
-                    + " mClientDead=" + mClientDead
-                    + " mSurfaceSession=" + mSurfaceSession);
-            pw.println(prefix + "mPendingPointerWindow=" + mPendingPointerWindow
-                    + " mPendingPointerMove=" + mPendingPointerMove);
-            pw.println(prefix + "mPendingTrackballWindow=" + mPendingTrackballWindow
-                    + " mPendingTrackballMove=" + mPendingTrackballMove);
+            pw.print(prefix); pw.print("mNumWindow="); pw.print(mNumWindow);
+                    pw.print(" mClientDead="); pw.print(mClientDead);
+                    pw.print(" mSurfaceSession="); pw.println(mSurfaceSession);
+            if (mPendingPointerWindow != null || mPendingPointerMove != null) {
+                pw.print(prefix);
+                        pw.print("mPendingPointerWindow="); pw.print(mPendingPointerWindow);
+                        pw.print(" mPendingPointerMove="); pw.println(mPendingPointerMove);
+            }
+            if (mPendingTrackballWindow != null || mPendingTrackballMove != null) {
+                pw.print(prefix);
+                        pw.print("mPendingTrackballWindow="); pw.print(mPendingTrackballWindow);
+                        pw.print(" mPendingTrackballMove="); pw.println(mPendingTrackballMove);
+            }
         }
 
         @Override
         public String toString() {
-            return "Session{"
-                + Integer.toHexString(System.identityHashCode(this)) + "}";
+            return mStringName;
         }
     }
 
@@ -6462,67 +6471,114 @@
         }
 
         void dump(PrintWriter pw, String prefix) {
-            pw.println(prefix + this);
-            pw.println(prefix + "mSession=" + mSession
-                  + " mClient=" + mClient.asBinder());
-            pw.println(prefix + "mAttrs=" + mAttrs);
-            pw.println(prefix + "mAttachedWindow=" + mAttachedWindow
-                    + " mLayoutAttached=" + mLayoutAttached
-                    + " mIsImWindow=" + mIsImWindow);
-            pw.println(prefix + "mBaseLayer=" + mBaseLayer
-                  + " mSubLayer=" + mSubLayer
-                  + " mAnimLayer=" + mLayer + "+"
-                  + (mTargetAppToken != null ? mTargetAppToken.animLayerAdjustment
-                          : (mAppToken != null ? mAppToken.animLayerAdjustment : 0))
-                  + "=" + mAnimLayer
-                  + " mLastLayer=" + mLastLayer);
-            pw.println(prefix + "mSurface=" + mSurface);
-            pw.println(prefix + "mToken=" + mToken);
-            pw.println(prefix + "mRootToken=" + mRootToken);
-            pw.println(prefix + "mAppToken=" + mAppToken);
-            pw.println(prefix + "mTargetAppToken=" + mTargetAppToken);
-            pw.println(prefix + "mViewVisibility=0x" + Integer.toHexString(mViewVisibility)
-                  + " mPolicyVisibility=" + mPolicyVisibility
-                  + " (after=" + mPolicyVisibilityAfterAnim
-                  + ") mAttachedHidden=" + mAttachedHidden
-                  + " mLastHidden=" + mLastHidden
-                  + " mHaveFrame=" + mHaveFrame);
-            pw.println(prefix + "Requested w=" + mRequestedWidth + " h=" + mRequestedHeight
-                  + " x=" + mReqXPos + " y=" + mReqYPos);
-            pw.println(prefix + "mGivenContentInsets=" + mGivenContentInsets.toShortString()
-                    + " mGivenVisibleInsets=" + mGivenVisibleInsets.toShortString()
-                    + " mTouchableInsets=" + mTouchableInsets
-                    + " pending=" + mGivenInsetsPending);
-            pw.println(prefix + "mShownFrame=" + mShownFrame.toShortString()
-                  + " last=" + mLastShownFrame.toShortString());
-            pw.println(prefix + "mFrame=" + mFrame.toShortString()
-                    + " last=" + mLastFrame.toShortString());
-            pw.println(prefix + "mContainingFrame=" + mContainingFrame.toShortString()
-                    + " mDisplayFrame=" + mDisplayFrame.toShortString());
-            pw.println(prefix + "mContentFrame=" + mContentFrame.toShortString()
-                    + " mVisibleFrame=" + mVisibleFrame.toShortString());
-            pw.println(prefix + "mContentInsets=" + mContentInsets.toShortString()
-                    + " last=" + mLastContentInsets.toShortString()
-                    + " mVisibleInsets=" + mVisibleInsets.toShortString()
-                    + " last=" + mLastVisibleInsets.toShortString());
-            pw.println(prefix + "mShownAlpha=" + mShownAlpha
-                  + " mAlpha=" + mAlpha + " mLastAlpha=" + mLastAlpha);
-            pw.println(prefix + "mAnimating=" + mAnimating
-                    + " mLocalAnimating=" + mLocalAnimating
-                    + " mAnimationIsEntrance=" + mAnimationIsEntrance
-                    + " mAnimation=" + mAnimation);
-            pw.println(prefix + "XForm: has=" + mHasTransformation
-                    + " " + mTransformation.toShortString());
-            pw.println(prefix + "mDrawPending=" + mDrawPending
-                  + " mCommitDrawPending=" + mCommitDrawPending
-                  + " mReadyToShow=" + mReadyToShow
-                  + " mHasDrawn=" + mHasDrawn);
-            pw.println(prefix + "mExiting=" + mExiting
-                    + " mRemoveOnExit=" + mRemoveOnExit
-                    + " mDestroying=" + mDestroying
-                    + " mRemoved=" + mRemoved);
-            pw.println(prefix + "mOrientationChanging=" + mOrientationChanging
-                    + " mAppFreezing=" + mAppFreezing);
+            StringBuilder sb = new StringBuilder(64);
+            
+            pw.print(prefix); pw.print("mSession="); pw.print(mSession);
+                    pw.print(" mClient="); pw.println(mClient.asBinder());
+            pw.print(prefix); pw.print("mAttrs="); pw.println(mAttrs);
+            if (mAttachedWindow != null || mLayoutAttached) {
+                pw.print(prefix); pw.print("mAttachedWindow="); pw.print(mAttachedWindow);
+                        pw.print(" mLayoutAttached="); pw.println(mLayoutAttached);
+            }
+            if (mIsImWindow) {
+                pw.print(prefix); pw.print("mIsImWindow="); pw.println(mIsImWindow);
+            }
+            pw.print(prefix); pw.print("mBaseLayer="); pw.print(mBaseLayer);
+                    pw.print(" mSubLayer="); pw.print(mSubLayer);
+                    pw.print(" mAnimLayer="); pw.print(mLayer); pw.print("+");
+                    pw.print((mTargetAppToken != null ? mTargetAppToken.animLayerAdjustment
+                          : (mAppToken != null ? mAppToken.animLayerAdjustment : 0)));
+                    pw.print("="); pw.print(mAnimLayer);
+                    pw.print(" mLastLayer="); pw.println(mLastLayer);
+            if (mSurface != null) {
+                pw.print(prefix); pw.print("mSurface="); pw.println(mSurface);
+            }
+            pw.print(prefix); pw.print("mToken="); pw.println(mToken);
+            pw.print(prefix); pw.print("mRootToken="); pw.println(mRootToken);
+            if (mAppToken != null) {
+                pw.print(prefix); pw.print("mAppToken="); pw.println(mAppToken);
+            }
+            if (mTargetAppToken != null) {
+                pw.print(prefix); pw.print("mTargetAppToken="); pw.println(mTargetAppToken);
+            }
+            pw.print(prefix); pw.print("mViewVisibility=0x");
+                    pw.print(Integer.toHexString(mViewVisibility));
+                    pw.print(" mLastHidden="); pw.print(mLastHidden);
+                    pw.print(" mHaveFrame="); pw.println(mHaveFrame);
+            if (!mPolicyVisibility || !mPolicyVisibilityAfterAnim || mAttachedHidden) {
+                pw.print(prefix); pw.print("mPolicyVisibility=");
+                        pw.print(mPolicyVisibility);
+                        pw.print(" mPolicyVisibilityAfterAnim=");
+                        pw.print(mPolicyVisibilityAfterAnim);
+                        pw.print(" mAttachedHidden="); pw.println(mAttachedHidden);
+            }
+            pw.print(prefix); pw.print("Requested w="); pw.print(mRequestedWidth);
+                    pw.print(" h="); pw.print(mRequestedHeight);
+                    pw.print(" x="); pw.print(mReqXPos);
+                    pw.print(" y="); pw.println(mReqYPos);
+            pw.print(prefix); pw.print("mGivenContentInsets=");
+                    mGivenContentInsets.printShortString(pw);
+                    pw.print(" mGivenVisibleInsets=");
+                    mGivenVisibleInsets.printShortString(pw);
+                    pw.println();
+            if (mTouchableInsets != 0 || mGivenInsetsPending) {
+                pw.print(prefix); pw.print("mTouchableInsets="); pw.print(mTouchableInsets);
+                        pw.print(" mGivenInsetsPending="); pw.println(mGivenInsetsPending);
+            }
+            pw.print(prefix); pw.print("mShownFrame=");
+                    mShownFrame.printShortString(pw);
+                    pw.print(" last="); mLastShownFrame.printShortString(pw);
+                    pw.println();
+            pw.print(prefix); pw.print("mFrame="); mFrame.printShortString(pw);
+                    pw.print(" last="); mLastFrame.printShortString(pw);
+                    pw.println();
+            pw.print(prefix); pw.print("mContainingFrame=");
+                    mContainingFrame.printShortString(pw);
+                    pw.print(" mDisplayFrame=");
+                    mDisplayFrame.printShortString(pw);
+                    pw.println();
+            pw.print(prefix); pw.print("mContentFrame="); mContentFrame.printShortString(pw);
+                    pw.print(" mVisibleFrame="); mVisibleFrame.printShortString(pw);
+                    pw.println();
+            pw.print(prefix); pw.print("mContentInsets="); mContentInsets.printShortString(pw);
+                    pw.print(" last="); mLastContentInsets.printShortString(pw);
+                    pw.print(" mVisibleInsets="); mVisibleInsets.printShortString(pw);
+                    pw.print(" last="); mLastVisibleInsets.printShortString(pw);
+                    pw.println();
+            if (mShownAlpha != 1 || mAlpha != 1 || mLastAlpha != 1) {
+                pw.print(prefix); pw.print("mShownAlpha="); pw.print(mShownAlpha);
+                        pw.print(" mAlpha="); pw.print(mAlpha);
+                        pw.print(" mLastAlpha="); pw.println(mLastAlpha);
+            }
+            if (mAnimating || mLocalAnimating || mAnimationIsEntrance
+                    || mAnimation != null) {
+                pw.print(prefix); pw.print("mAnimating="); pw.print(mAnimating);
+                        pw.print(" mLocalAnimating="); pw.print(mLocalAnimating);
+                        pw.print(" mAnimationIsEntrance="); pw.print(mAnimationIsEntrance);
+                        pw.print(" mAnimation="); pw.println(mAnimation);
+            }
+            if (mHasTransformation || mHasLocalTransformation) {
+                pw.print(prefix); pw.print("XForm: has=");
+                        pw.print(mHasTransformation);
+                        pw.print(" hasLocal="); pw.print(mHasLocalTransformation);
+                        pw.print(" "); mTransformation.printShortString(pw);
+                        pw.println();
+            }
+            pw.print(prefix); pw.print("mDrawPending="); pw.print(mDrawPending);
+                    pw.print(" mCommitDrawPending="); pw.print(mCommitDrawPending);
+                    pw.print(" mReadyToShow="); pw.print(mReadyToShow);
+                    pw.print(" mHasDrawn="); pw.println(mHasDrawn);
+            if (mExiting || mRemoveOnExit || mDestroying || mRemoved) {
+                pw.print(prefix); pw.print("mExiting="); pw.print(mExiting);
+                        pw.print(" mRemoveOnExit="); pw.print(mRemoveOnExit);
+                        pw.print(" mDestroying="); pw.print(mDestroying);
+                        pw.print(" mRemoved="); pw.println(mRemoved);
+            }
+            if (mOrientationChanging || mAppFreezing) {
+                pw.print(prefix); pw.print("mOrientationChanging=");
+                        pw.print(mOrientationChanging);
+                        pw.print(" mAppFreezing="); pw.println(mAppFreezing);
+            }
         }
 
         @Override
@@ -6548,6 +6604,9 @@
         // not be removed when all windows are removed.
         final boolean explicit;
         
+        // For printing.
+        String stringName;
+        
         // If this is an AppWindowToken, this is non-null.
         AppWindowToken appWindowToken;
         
@@ -6570,18 +6629,23 @@
         }
 
         void dump(PrintWriter pw, String prefix) {
-            pw.println(prefix + this);
-            pw.println(prefix + "token=" + token);
-            pw.println(prefix + "windows=" + windows);
-            pw.println(prefix + "windowType=" + windowType + " hidden=" + hidden
-                    + " hasVisible=" + hasVisible);
+            pw.print(prefix); pw.print("token="); pw.println(token);
+            pw.print(prefix); pw.print("windows="); pw.println(windows);
+            pw.print(prefix); pw.print("windowType="); pw.print(windowType);
+                    pw.print(" hidden="); pw.print(hidden);
+                    pw.print(" hasVisible="); pw.println(hasVisible);
         }
 
         @Override
         public String toString() {
-            return "WindowToken{"
-                + Integer.toHexString(System.identityHashCode(this))
-                + " token=" + token + "}";
+            if (stringName == null) {
+                StringBuilder sb = new StringBuilder();
+                sb.append("WindowToken{");
+                sb.append(Integer.toHexString(System.identityHashCode(this)));
+                sb.append(" token="); sb.append(token); sb.append('}');
+                stringName = sb.toString();
+            }
+            return stringName;
         }
     };
 
@@ -6869,38 +6933,66 @@
         
         void dump(PrintWriter pw, String prefix) {
             super.dump(pw, prefix);
-            pw.println(prefix + "app=" + (appToken != null));
-            pw.println(prefix + "allAppWindows=" + allAppWindows);
-            pw.println(prefix + "groupId=" + groupId
-                    + " requestedOrientation=" + requestedOrientation);
-            pw.println(prefix + "hiddenRequested=" + hiddenRequested
-                    + " clientHidden=" + clientHidden
-                    + " willBeHidden=" + willBeHidden
-                    + " reportedVisible=" + reportedVisible);
-            pw.println(prefix + "paused=" + paused
-                    + " freezingScreen=" + freezingScreen);
-            pw.println(prefix + "numInterestingWindows=" + numInterestingWindows
-                    + " numDrawnWindows=" + numDrawnWindows
-                    + " inPendingTransaction=" + inPendingTransaction
-                    + " allDrawn=" + allDrawn);
-            pw.println(prefix + "animating=" + animating
-                    + " animation=" + animation);
-            pw.println(prefix + "animLayerAdjustment=" + animLayerAdjustment
-                    + " transformation=" + transformation.toShortString());
-            pw.println(prefix + "startingData=" + startingData
-                    + " removed=" + removed
-                    + " firstWindowDrawn=" + firstWindowDrawn);
-            pw.println(prefix + "startingWindow=" + startingWindow
-                    + " startingView=" + startingView
-                    + " startingDisplayed=" + startingDisplayed
-                    + " startingMoved" + startingMoved);
+            if (appToken != null) {
+                pw.print(prefix); pw.println("app=true");
+            }
+            if (allAppWindows.size() > 0) {
+                pw.print(prefix); pw.print("allAppWindows="); pw.println(allAppWindows);
+            }
+            pw.print(prefix); pw.print("groupId="); pw.print(groupId);
+                    pw.print(" requestedOrientation="); pw.println(requestedOrientation);
+            pw.print(prefix); pw.print("hiddenRequested="); pw.print(hiddenRequested);
+                    pw.print(" clientHidden="); pw.print(clientHidden);
+                    pw.print(" willBeHidden="); pw.print(willBeHidden);
+                    pw.print(" reportedVisible="); pw.println(reportedVisible);
+            if (paused || freezingScreen) {
+                pw.print(prefix); pw.print("paused="); pw.print(paused);
+                        pw.print(" freezingScreen="); pw.println(freezingScreen);
+            }
+            if (numInterestingWindows != 0 || numDrawnWindows != 0
+                    || inPendingTransaction || allDrawn) {
+                pw.print(prefix); pw.print("numInterestingWindows=");
+                        pw.print(numInterestingWindows);
+                        pw.print(" numDrawnWindows="); pw.print(numDrawnWindows);
+                        pw.print(" inPendingTransaction="); pw.print(inPendingTransaction);
+                        pw.print(" allDrawn="); pw.println(allDrawn);
+            }
+            if (animating || animation != null) {
+                pw.print(prefix); pw.print("animating="); pw.print(animating);
+                        pw.print(" animation="); pw.println(animation);
+            }
+            if (animLayerAdjustment != 0) {
+                pw.print(prefix); pw.print("animLayerAdjustment="); pw.println(animLayerAdjustment);
+            }
+            if (hasTransformation) {
+                pw.print(prefix); pw.print("hasTransformation="); pw.print(hasTransformation);
+                        pw.print(" transformation="); transformation.printShortString(pw);
+                        pw.println();
+            }
+            if (startingData != null || removed || firstWindowDrawn) {
+                pw.print(prefix); pw.print("startingData="); pw.print(startingData);
+                        pw.print(" removed="); pw.print(removed);
+                        pw.print(" firstWindowDrawn="); pw.println(firstWindowDrawn);
+            }
+            if (startingWindow != null || startingView != null
+                    || startingDisplayed || startingMoved) {
+                pw.print(prefix); pw.print("startingWindow="); pw.print(startingWindow);
+                        pw.print(" startingView="); pw.print(startingView);
+                        pw.print(" startingDisplayed="); pw.print(startingDisplayed);
+                        pw.print(" startingMoved"); pw.println(startingMoved);
+            }
         }
 
         @Override
         public String toString() {
-            return "AppWindowToken{"
-                + Integer.toHexString(System.identityHashCode(this))
-                + " token=" + token + "}";
+            if (stringName == null) {
+                StringBuilder sb = new StringBuilder();
+                sb.append("AppWindowToken{");
+                sb.append(Integer.toHexString(System.identityHashCode(this)));
+                sb.append(" token="); sb.append(token); sb.append('}');
+                stringName = sb.toString();
+            }
+            return stringName;
         }
     }
     
@@ -7423,7 +7515,7 @@
     private boolean mInLayout = false;
     private final void performLayoutAndPlaceSurfacesLocked() {
         if (mInLayout) {
-            if (Config.DEBUG) {
+            if (DEBUG) {
                 throw new RuntimeException("Recursive call!");
             }
             Log.w(TAG, "performLayoutAndPlaceSurfacesLocked called while in layout");
@@ -8656,7 +8748,8 @@
             pw.println("Current Window Manager state:");
             for (int i=mWindows.size()-1; i>=0; i--) {
                 WindowState w = (WindowState)mWindows.get(i);
-                pw.println("  Window #" + i + ":");
+                pw.print("  Window #"); pw.print(i); pw.print(' ');
+                        pw.print(w); pw.println(":");
                 w.dump(pw, "    ");
             }
             if (mInputMethodDialogs.size() > 0) {
@@ -8664,7 +8757,7 @@
                 pw.println("  Input method dialogs:");
                 for (int i=mInputMethodDialogs.size()-1; i>=0; i--) {
                     WindowState w = mInputMethodDialogs.get(i);
-                    pw.println("  IM Dialog #" + i + ": " + w);
+                    pw.print("  IM Dialog #"); pw.print(i); pw.print(": "); pw.println(w);
                 }
             }
             if (mPendingRemove.size() > 0) {
@@ -8672,7 +8765,8 @@
                 pw.println("  Remove pending for:");
                 for (int i=mPendingRemove.size()-1; i>=0; i--) {
                     WindowState w = mPendingRemove.get(i);
-                    pw.println("  Remove #" + i + ":");
+                    pw.print("  Remove #"); pw.print(i); pw.print(' ');
+                            pw.print(w); pw.println(":");
                     w.dump(pw, "    ");
                 }
             }
@@ -8681,7 +8775,8 @@
                 pw.println("  Windows force removing:");
                 for (int i=mForceRemoves.size()-1; i>=0; i--) {
                     WindowState w = mForceRemoves.get(i);
-                    pw.println("  Removing #" + i + ":");
+                    pw.print("  Removing #"); pw.print(i); pw.print(' ');
+                            pw.print(w); pw.println(":");
                     w.dump(pw, "    ");
                 }
             }
@@ -8690,7 +8785,8 @@
                 pw.println("  Windows waiting to destroy their surface:");
                 for (int i=mDestroySurface.size()-1; i>=0; i--) {
                     WindowState w = mDestroySurface.get(i);
-                    pw.println("  Destroy #" + i + ":");
+                    pw.print("  Destroy #"); pw.print(i); pw.print(' ');
+                            pw.print(w); pw.println(":");
                     w.dump(pw, "    ");
                 }
             }
@@ -8699,7 +8795,8 @@
                 pw.println("  Windows losing focus:");
                 for (int i=mLosingFocus.size()-1; i>=0; i--) {
                     WindowState w = mLosingFocus.get(i);
-                    pw.println("  Losing #" + i + ":");
+                    pw.print("  Losing #"); pw.print(i); pw.print(' ');
+                            pw.print(w); pw.println(":");
                     w.dump(pw, "    ");
                 }
             }
@@ -8709,7 +8806,7 @@
                 Iterator<Session> it = mSessions.iterator();
                 while (it.hasNext()) {
                     Session s = it.next();
-                    pw.println("  Session " + s);
+                    pw.print("  Session "); pw.print(s); pw.println(':');
                     s.dump(pw, "    ");
                 }
             }
@@ -8719,7 +8816,7 @@
                 Iterator<WindowToken> it = mTokenMap.values().iterator();
                 while (it.hasNext()) {
                     WindowToken token = it.next();
-                    pw.println("  Token " + token.token);
+                    pw.print("  Token "); pw.print(token.token); pw.println(':');
                     token.dump(pw, "    ");
                 }
             }
@@ -8727,14 +8824,16 @@
                 pw.println(" ");
                 pw.println("  Window token list:");
                 for (int i=0; i<mTokenList.size(); i++) {
-                    pw.println("  WindowToken #" + i + ": " + mTokenList.get(i));
+                    pw.print("  #"); pw.print(i); pw.print(": ");
+                            pw.println(mTokenList.get(i));
                 }
             }
             if (mAppTokens.size() > 0) {
                 pw.println(" ");
                 pw.println("  Application tokens in Z order:");
                 for (int i=mAppTokens.size()-1; i>=0; i--) {
-                    pw.println("  AppWindowToken #" + i + ": " + mAppTokens.get(i));
+                    pw.print("  App #"); pw.print(i); pw.print(": ");
+                            pw.println(mAppTokens.get(i));
                 }
             }
             if (mFinishedStarting.size() > 0) {
@@ -8742,7 +8841,8 @@
                 pw.println("  Finishing start of application tokens:");
                 for (int i=mFinishedStarting.size()-1; i>=0; i--) {
                     WindowToken token = mFinishedStarting.get(i);
-                    pw.println("  Finish Starting App Token #" + i + ":");
+                    pw.print("  Finished Starting #"); pw.print(i);
+                            pw.print(' '); pw.print(token); pw.println(':');
                     token.dump(pw, "    ");
                 }
             }
@@ -8751,7 +8851,8 @@
                 pw.println("  Exiting tokens:");
                 for (int i=mExitingTokens.size()-1; i>=0; i--) {
                     WindowToken token = mExitingTokens.get(i);
-                    pw.println("  Exiting Token #" + i + ":");
+                    pw.print("  Exiting #"); pw.print(i);
+                            pw.print(' '); pw.print(token); pw.println(':');
                     token.dump(pw, "    ");
                 }
             }
@@ -8760,54 +8861,59 @@
                 pw.println("  Exiting application tokens:");
                 for (int i=mExitingAppTokens.size()-1; i>=0; i--) {
                     WindowToken token = mExitingAppTokens.get(i);
-                    pw.println("  Exiting App Token #" + i + ":");
+                    pw.print("  Exiting App #"); pw.print(i);
+                            pw.print(' '); pw.print(token); pw.println(':');
                     token.dump(pw, "    ");
                 }
             }
             pw.println(" ");
-            pw.println("  mCurrentFocus=" + mCurrentFocus);
-            pw.println("  mLastFocus=" + mLastFocus);
-            pw.println("  mFocusedApp=" + mFocusedApp);
-            pw.println("  mInputMethodTarget=" + mInputMethodTarget);
-            pw.println("  mInputMethodWindow=" + mInputMethodWindow);
-            pw.println("  mInTouchMode=" + mInTouchMode);
-            pw.println("  mSystemBooted=" + mSystemBooted
-                    + " mDisplayEnabled=" + mDisplayEnabled);
-            pw.println("  mLayoutNeeded=" + mLayoutNeeded
-                    + " mBlurShown=" + mBlurShown);
-            pw.println("  mDimShown=" + mDimShown
-                    + " current=" + mDimCurrentAlpha
-                    + " target=" + mDimTargetAlpha
-                    + " delta=" + mDimDeltaPerMs
-                    + " lastAnimTime=" + mLastDimAnimTime);
-            pw.println("  mInputMethodAnimLayerAdjustment="
-                    + mInputMethodAnimLayerAdjustment);
-            pw.println("  mDisplayFrozen=" + mDisplayFrozen
-                    + " mWindowsFreezingScreen=" + mWindowsFreezingScreen
-                    + " mAppsFreezingScreen=" + mAppsFreezingScreen);
-            pw.println("  mRotation=" + mRotation
-                    + ", mForcedAppOrientation=" + mForcedAppOrientation
-                    + ", mRequestedRotation=" + mRequestedRotation);
-            pw.println("  mAnimationPending=" + mAnimationPending
-                    + " mWindowAnimationScale=" + mWindowAnimationScale
-                    + " mTransitionWindowAnimationScale=" + mTransitionAnimationScale);
-            pw.println("  mNextAppTransition=0x"
-                    + Integer.toHexString(mNextAppTransition)
-                    + ", mAppTransitionReady=" + mAppTransitionReady
-                    + ", mAppTransitionTimeout=" + mAppTransitionTimeout);
-            pw.println("  mStartingIconInTransition=" + mStartingIconInTransition
-                    + ", mSkipAppTransitionAnimation=" + mSkipAppTransitionAnimation);
-            pw.println("  mOpeningApps=" + mOpeningApps);
-                    pw.println("  mClosingApps=" + mClosingApps);
-            pw.println("  DisplayWidth=" + mDisplay.getWidth()
-                    + " DisplayHeight=" + mDisplay.getHeight());
+            pw.print("  mCurrentFocus="); pw.println(mCurrentFocus);
+            pw.print("  mLastFocus="); pw.println(mLastFocus);
+            pw.print("  mFocusedApp="); pw.println(mFocusedApp);
+            pw.print("  mInputMethodTarget="); pw.println(mInputMethodTarget);
+            pw.print("  mInputMethodWindow="); pw.println(mInputMethodWindow);
+            pw.print("  mInTouchMode="); pw.println(mInTouchMode);
+            pw.print("  mSystemBooted="); pw.print(mSystemBooted);
+                    pw.print(" mDisplayEnabled="); pw.println(mDisplayEnabled);
+            pw.print("  mLayoutNeeded="); pw.print(mLayoutNeeded);
+                    pw.print(" mBlurShown="); pw.println(mBlurShown);
+            pw.print("  mDimShown="); pw.print(mDimShown);
+                    pw.print(" current="); pw.print(mDimCurrentAlpha);
+                    pw.print(" target="); pw.print(mDimTargetAlpha);
+                    pw.print(" delta="); pw.print(mDimDeltaPerMs);
+                    pw.print(" lastAnimTime="); pw.println(mLastDimAnimTime);
+            pw.print("  mInputMethodAnimLayerAdjustment=");
+                    pw.println(mInputMethodAnimLayerAdjustment);
+            pw.print("  mDisplayFrozen="); pw.print(mDisplayFrozen);
+                    pw.print(" mWindowsFreezingScreen="); pw.print(mWindowsFreezingScreen);
+                    pw.print(" mAppsFreezingScreen="); pw.println(mAppsFreezingScreen);
+            pw.print("  mRotation="); pw.print(mRotation);
+                    pw.print(", mForcedAppOrientation="); pw.print(mForcedAppOrientation);
+                    pw.print(", mRequestedRotation="); pw.println(mRequestedRotation);
+            pw.print("  mAnimationPending="); pw.print(mAnimationPending);
+                    pw.print(" mWindowAnimationScale="); pw.print(mWindowAnimationScale);
+                    pw.print(" mTransitionWindowAnimationScale="); pw.println(mTransitionAnimationScale);
+            pw.print("  mNextAppTransition=0x");
+                    pw.print(Integer.toHexString(mNextAppTransition));
+                    pw.print(", mAppTransitionReady="); pw.print(mAppTransitionReady);
+                    pw.print(", mAppTransitionTimeout="); pw.println( mAppTransitionTimeout);
+            pw.print("  mStartingIconInTransition="); pw.print(mStartingIconInTransition);
+                    pw.print(", mSkipAppTransitionAnimation="); pw.println(mSkipAppTransitionAnimation);
+            if (mOpeningApps.size() > 0) {
+                pw.print("  mOpeningApps="); pw.println(mOpeningApps);
+            }
+            if (mClosingApps.size() > 0) {
+                pw.print("  mClosingApps="); pw.println(mClosingApps);
+            }
+            pw.print("  DisplayWidth="); pw.print(mDisplay.getWidth());
+                    pw.print(" DisplayHeight="); pw.println(mDisplay.getHeight());
             pw.println("  KeyWaiter state:");
-            pw.println("    mLastWin=" + mKeyWaiter.mLastWin
-                    + " mLastBinder=" + mKeyWaiter.mLastBinder);
-            pw.println("    mFinished=" + mKeyWaiter.mFinished
-                    + " mGotFirstWindow=" + mKeyWaiter.mGotFirstWindow
-                    + " mEventDispatching=" + mKeyWaiter.mEventDispatching
-                    + " mTimeToSwitch=" + mKeyWaiter.mTimeToSwitch);
+            pw.print("    mLastWin="); pw.print(mKeyWaiter.mLastWin);
+                    pw.print(" mLastBinder="); pw.println(mKeyWaiter.mLastBinder);
+            pw.print("    mFinished="); pw.print(mKeyWaiter.mFinished);
+                    pw.print(" mGotFirstWindow="); pw.print(mKeyWaiter.mGotFirstWindow);
+                    pw.print(" mEventDispatching="); pw.print(mKeyWaiter.mEventDispatching);
+                    pw.print(" mTimeToSwitch="); pw.println(mKeyWaiter.mTimeToSwitch);
         }
     }
 
diff --git a/services/java/com/android/server/am/ActivityManagerService.java b/services/java/com/android/server/am/ActivityManagerService.java
index d676c00..b04f5a8 100644
--- a/services/java/com/android/server/am/ActivityManagerService.java
+++ b/services/java/com/android/server/am/ActivityManagerService.java
@@ -682,6 +682,11 @@
     HashMap<String, IBinder> mAppBindArgs;
 
     /**
+     * Temporary to avoid allocations.  Protected by main lock.
+     */
+    final StringBuilder mStringBuilder = new StringBuilder(256);
+    
+    /**
      * Used to control how we initialize the service.
      */
     boolean mStartRunning = false;
@@ -778,6 +783,8 @@
     long mLastCpuTime = 0;
     long mLastWriteTime = 0;
 
+    long mInitialStartTime = 0;
+    
     /**
      * Set to true after the system has finished booting.
      */
@@ -1270,7 +1277,7 @@
         mBatteryStatsService.getActiveStatistics().writeLocked();
         
         mUsageStatsService = new UsageStatsService( new File(
-                systemDir, "usagestats.bin").toString());
+                systemDir, "usagestats").toString());
 
         mConfiguration.makeDefault();
         mProcessStats.init();
@@ -1635,6 +1642,11 @@
         
         if (r.startTime == 0) {
             r.startTime = SystemClock.uptimeMillis();
+            if (mInitialStartTime == 0) {
+                mInitialStartTime = r.startTime;
+            }
+        } else if (mInitialStartTime == 0) {
+            mInitialStartTime = SystemClock.uptimeMillis();
         }
         
         if (app != null && app.thread != null) {
@@ -1785,7 +1797,8 @@
                 Watchdog.getInstance().processStarted(app, app.processName, pid);
             }
             
-            StringBuilder buf = new StringBuilder(128);
+            StringBuilder buf = mStringBuilder;
+            buf.setLength(0);
             buf.append("Start proc ");
             buf.append(app.processName);
             buf.append(" for ");
@@ -2813,7 +2826,6 @@
         HistoryRecord r = new HistoryRecord(this, callerApp, callingUid,
                 intent, resolvedType, aInfo, mConfiguration,
                 resultRecord, resultWho, requestCode, componentSpecified);
-        r.startTime = SystemClock.uptimeMillis();
 
         HistoryRecord notTop = (launchFlags&Intent.FLAG_ACTIVITY_PREVIOUS_IS_TOP)
                 != 0 ? r : null;
@@ -4095,7 +4107,8 @@
             }
         }
 
-        StringBuilder info = new StringBuilder();
+        StringBuilder info = mStringBuilder;
+        info.setLength(0);
         info.append("ANR (application not responding) in process: ");
         info.append(app.processName);
         if (annotation != null) {
@@ -4517,7 +4530,7 @@
             }
         } else if (mStartingProcesses.size() > 0) {
             app = mStartingProcesses.remove(0);
-            app.pid = pid;
+            app.setPid(pid);
         } else {
             app = null;
         }
@@ -7877,24 +7890,24 @@
                 return;
             }
             pw.println("Activities in Current Activity Manager State:");
-            dumpHistoryList(pw, mHistory, "  ", "History");
+            dumpHistoryList(pw, mHistory, "  ", "Hist", true);
             pw.println(" ");
             pw.println("  Running activities (most recent first):");
-            dumpHistoryList(pw, mLRUActivities, "  ", "Running");
+            dumpHistoryList(pw, mLRUActivities, "  ", "Run", false);
             if (mWaitingVisibleActivities.size() > 0) {
                 pw.println(" ");
                 pw.println("  Activities waiting for another to become visible:");
-                dumpHistoryList(pw, mWaitingVisibleActivities, "  ", "Waiting");
+                dumpHistoryList(pw, mWaitingVisibleActivities, "  ", "Wait", false);
             }
             if (mStoppingActivities.size() > 0) {
                 pw.println(" ");
                 pw.println("  Activities waiting to stop:");
-                dumpHistoryList(pw, mStoppingActivities, "  ", "Stopping");
+                dumpHistoryList(pw, mStoppingActivities, "  ", "Stop", false);
             }
             if (mFinishingActivities.size() > 0) {
                 pw.println(" ");
                 pw.println("  Activities waiting to finish:");
-                dumpHistoryList(pw, mFinishingActivities, "  ", "Finishing");
+                dumpHistoryList(pw, mFinishingActivities, "  ", "Fin", false);
             }
 
             pw.println(" ");
@@ -7909,7 +7922,9 @@
 
                 final int N = mRecentTasks.size();
                 for (int i=0; i<N; i++) {
-                    pw.println("  Recent Task #" + i);
+                    TaskRecord tr = mRecentTasks.get(i);
+                    pw.print("  * Recent #"); pw.print(i); pw.print(": ");
+                            pw.println(tr);
                     mRecentTasks.get(i).dump(pw, "    ");
                 }
             }
@@ -7931,8 +7946,9 @@
                         needSep = true;
                     }
                     ProcessRecord r = procs.valueAt(ia);
-                    pw.println((r.persistent ? "  *PERSISTENT* Process [" : "  Process [")
-                            + r.processName + "] UID " + procs.keyAt(ia));
+                    pw.print(r.persistent ? "  *PERS*" : "  *APP*");
+                        pw.print(" UID "); pw.print(procs.keyAt(ia));
+                        pw.print(" "); pw.println(r);
                     r.dump(pw, "    ");
                     if (r.persistent) {
                         numPers++;
@@ -7945,7 +7961,7 @@
                 needSep = true;
                 pw.println("  Running processes (most recent first):");
                 dumpProcessList(pw, mLRUProcesses, "    ",
-                        "Running Norm Proc", "Running PERS Proc", true);
+                        "App ", "PERS", true);
                 needSep = true;
             }
 
@@ -7955,8 +7971,8 @@
                     needSep = true;
                     pw.println("  PID mappings:");
                     for (int i=0; i<mPidsSelfLocked.size(); i++) {
-                        pw.println("    PID #" + mPidsSelfLocked.keyAt(i)
-                                + ": " + mPidsSelfLocked.valueAt(i));
+                        pw.print("    PID #"); pw.print(mPidsSelfLocked.keyAt(i));
+                            pw.print(": "); pw.println(mPidsSelfLocked.valueAt(i));
                     }
                 }
             }
@@ -7966,8 +7982,8 @@
                 needSep = true;
                 pw.println("  Foreground Processes:");
                 for (int i=0; i<mForegroundProcesses.size(); i++) {
-                    pw.println("    PID #" + mForegroundProcesses.keyAt(i)
-                            + ": " + mForegroundProcesses.valueAt(i));
+                    pw.print("    PID #"); pw.print(mForegroundProcesses.keyAt(i));
+                            pw.print(": "); pw.println(mForegroundProcesses.valueAt(i));
                 }
             }
             
@@ -7976,7 +7992,7 @@
                 needSep = true;
                 pw.println("  Persisent processes that are starting:");
                 dumpProcessList(pw, mPersistentStartingProcesses, "    ",
-                        "Starting Initial Proc", "Restarting PERS Proc", false);
+                        "Starting Norm", "Restarting PERS", false);
             }
 
             if (mStartingProcesses.size() > 0) {
@@ -7984,7 +8000,7 @@
                 needSep = true;
                 pw.println("  Processes that are starting:");
                 dumpProcessList(pw, mStartingProcesses, "    ",
-                        "Starting Norm Proc", "Starting PERS Proc", false);
+                        "Starting Norm", "Starting PERS", false);
             }
 
             if (mRemovedProcesses.size() > 0) {
@@ -7992,7 +8008,7 @@
                 needSep = true;
                 pw.println("  Processes that are being removed:");
                 dumpProcessList(pw, mRemovedProcesses, "    ",
-                        "Removed Norm Proc", "Removed PERS Proc", false);
+                        "Removed Norm", "Removed PERS", false);
             }
             
             if (mProcessesOnHold.size() > 0) {
@@ -8000,7 +8016,7 @@
                 needSep = true;
                 pw.println("  Processes that are on old until the system is ready:");
                 dumpProcessList(pw, mProcessesOnHold, "    ",
-                        "OnHold Norm Proc", "OnHold PERS Proc", false);
+                        "OnHold Norm", "OnHold PERS", false);
             }
 
             if (mProcessCrashTimes.getMap().size() > 0) {
@@ -8013,10 +8029,11 @@
                     SparseArray<Long> uids = procs.getValue();
                     final int N = uids.size();
                     for (int i=0; i<N; i++) {
-                        pw.println("    Process " + procs.getKey()
-                                + " uid " + uids.keyAt(i)
-                                + ": last crashed "
-                                + (now-uids.valueAt(i)) + " ms ago");
+                        pw.print("    Process "); pw.print(procs.getKey());
+                                pw.print(" uid "); pw.print(uids.keyAt(i));
+                                pw.print(": last crashed ");
+                                pw.print((now-uids.valueAt(i)));
+                                pw.println(" ms ago");
                     }
                 }
             }
@@ -8030,9 +8047,10 @@
                     SparseArray<Long> uids = procs.getValue();
                     final int N = uids.size();
                     for (int i=0; i<N; i++) {
-                        pw.println("    Bad process " + procs.getKey()
-                                + " uid " + uids.keyAt(i)
-                                + ": crashed at time " + uids.valueAt(i));
+                        pw.print("    Bad process "); pw.print(procs.getKey());
+                                pw.print(" uid "); pw.print(uids.keyAt(i));
+                                pw.print(": crashed at time ");
+                                pw.println(uids.valueAt(i));
                     }
                 }
             }
@@ -8131,14 +8149,14 @@
                 Iterator it = mRegisteredReceivers.values().iterator();
                 while (it.hasNext()) {
                     ReceiverList r = (ReceiverList)it.next();
-                    pw.println("  Receiver " + r.receiver);
+                    pw.print("  * "); pw.println(r);
                     r.dump(pw, "    ");
                 }
             }
 
             pw.println(" ");
             pw.println("Receiver Resolver Table:");
-            mReceiverResolver.dump(new PrintWriterPrinter(pw), "  ");
+            mReceiverResolver.dump(pw, "  ");
             
             if (mParallelBroadcasts.size() > 0 || mOrderedBroadcasts.size() > 0
                     || mPendingBroadcast != null) {
@@ -8172,13 +8190,23 @@
             if (mStickyBroadcasts != null) {
                 pw.println(" ");
                 pw.println("  Sticky broadcasts:");
+                StringBuilder sb = new StringBuilder(128);
                 for (Map.Entry<String, ArrayList<Intent>> ent
                         : mStickyBroadcasts.entrySet()) {
-                    pw.println("  Sticky action " + ent.getKey() + ":");
+                    pw.print("  * Sticky action "); pw.print(ent.getKey());
+                            pw.println(":");
                     ArrayList<Intent> intents = ent.getValue();
                     final int N = intents.size();
                     for (int i=0; i<N; i++) {
-                        pw.println("    " + intents.get(i));
+                        sb.setLength(0);
+                        sb.append("    Intent: ");
+                        intents.get(i).toShortString(sb, true, false);
+                        pw.println(sb.toString());
+                        Bundle bundle = intents.get(i).getExtras();
+                        if (bundle != null) {
+                            pw.print("      ");
+                            pw.println(bundle.toString());
+                        }
                     }
                 }
             }
@@ -8209,7 +8237,7 @@
                 Iterator<ServiceRecord> it = mServices.values().iterator();
                 while (it.hasNext()) {
                     ServiceRecord r = it.next();
-                    pw.println("  Service " + r.shortName);
+                    pw.print("  * "); pw.println(r);
                     r.dump(pw, "    ");
                 }
                 needSep = true;
@@ -8220,7 +8248,7 @@
                 pw.println("  Pending services:");
                 for (int i=0; i<mPendingServices.size(); i++) {
                     ServiceRecord r = mPendingServices.get(i);
-                    pw.println("  Pending Service " + r.shortName);
+                    pw.print("  * Pending "); pw.println(r);
                     r.dump(pw, "    ");
                 }
                 needSep = true;
@@ -8231,7 +8259,7 @@
                 pw.println("  Restarting services:");
                 for (int i=0; i<mRestartingServices.size(); i++) {
                     ServiceRecord r = mRestartingServices.get(i);
-                    pw.println("  Restarting Service " + r.shortName);
+                    pw.print("  * Restarting "); pw.println(r);
                     r.dump(pw, "    ");
                 }
                 needSep = true;
@@ -8242,7 +8270,7 @@
                 pw.println("  Stopping services:");
                 for (int i=0; i<mStoppingServices.size(); i++) {
                     ServiceRecord r = mStoppingServices.get(i);
-                    pw.println("  Stopping Service " + r.shortName);
+                    pw.print("  * Stopping "); pw.println(r);
                     r.dump(pw, "    ");
                 }
                 needSep = true;
@@ -8255,8 +8283,7 @@
                         = mServiceConnections.values().iterator();
                 while (it.hasNext()) {
                     ConnectionRecord r = it.next();
-                    pw.println("  " + r.binding.service.shortName
-                          + " -> " + r.conn.asBinder());
+                    pw.print("  * "); pw.println(r);
                     r.dump(pw, "    ");
                 }
             }
@@ -8279,18 +8306,6 @@
 
             boolean needSep = false;
 
-            if (mProvidersByName.size() > 0) {
-                pw.println("  Published content providers (by name):");
-                Iterator it = mProvidersByName.entrySet().iterator();
-                while (it.hasNext()) {
-                    Map.Entry e = (Map.Entry)it.next();
-                    ContentProviderRecord r = (ContentProviderRecord)e.getValue();
-                    pw.println("  Provider " + (String)e.getKey());
-                    r.dump(pw, "    ");
-                }
-                needSep = true;
-            }
-
             if (mProvidersByClass.size() > 0) {
                 if (needSep) pw.println(" ");
                 pw.println("  Published content providers (by class):");
@@ -8298,31 +8313,48 @@
                 while (it.hasNext()) {
                     Map.Entry e = (Map.Entry)it.next();
                     ContentProviderRecord r = (ContentProviderRecord)e.getValue();
-                    pw.println("  Provider " + (String)e.getKey());
+                    pw.print("  * "); pw.println(r);
                     r.dump(pw, "    ");
                 }
                 needSep = true;
             }
 
+            if (mProvidersByName.size() > 0) {
+                pw.println(" ");
+                pw.println("  Authority to provider mappings:");
+                Iterator it = mProvidersByName.entrySet().iterator();
+                while (it.hasNext()) {
+                    Map.Entry e = (Map.Entry)it.next();
+                    ContentProviderRecord r = (ContentProviderRecord)e.getValue();
+                    pw.print("  "); pw.print(e.getKey()); pw.print(": ");
+                            pw.println(r);
+                }
+                needSep = true;
+            }
+
             if (mLaunchingProviders.size() > 0) {
                 if (needSep) pw.println(" ");
                 pw.println("  Launching content providers:");
                 for (int i=mLaunchingProviders.size()-1; i>=0; i--) {
-                    pw.println("  Provider #" + i + ":");
-                    ((ContentProviderRecord)mLaunchingProviders.get(i)).dump(pw, "    ");
+                    pw.print("  Launching #"); pw.print(i); pw.print(": ");
+                            pw.println(mLaunchingProviders.get(i));
                 }
                 needSep = true;
             }
 
-            pw.println();
-            pw.println("Granted Uri Permissions:");
-            for (int i=0; i<mGrantedUriPermissions.size(); i++) {
-                int uid = mGrantedUriPermissions.keyAt(i);
-                HashMap<Uri, UriPermission> perms
-                        = mGrantedUriPermissions.valueAt(i);
-                pw.println("  Uris granted to uid " + uid + ":");
-                for (UriPermission perm : perms.values()) {
-                    perm.dump(pw, "    ");
+            if (mGrantedUriPermissions.size() > 0) {
+                pw.println();
+                pw.println("Granted Uri Permissions:");
+                for (int i=0; i<mGrantedUriPermissions.size(); i++) {
+                    int uid = mGrantedUriPermissions.keyAt(i);
+                    HashMap<Uri, UriPermission> perms
+                            = mGrantedUriPermissions.valueAt(i);
+                    pw.print("  * UID "); pw.print(uid);
+                            pw.println(" holds:");
+                    for (UriPermission perm : perms.values()) {
+                        pw.print("    "); pw.println(perm);
+                        perm.dump(pw, "      ");
+                    }
                 }
             }
         }
@@ -8340,7 +8372,7 @@
                 return;
             }
 
-            pw.println("Intent Senders in Current Activity Manager State:");
+            pw.println("Pending Intents in Current Activity Manager State:");
 
             if (this.mIntentSenderRecords.size() > 0) {
                 Iterator<WeakReference<PendingIntentRecord>> it
@@ -8349,10 +8381,10 @@
                     WeakReference<PendingIntentRecord> ref = it.next();
                     PendingIntentRecord rec = ref != null ? ref.get(): null;
                     if (rec != null) {
-                        pw.println("  IntentSender " + rec);
+                        pw.print("  * "); pw.println(rec);
                         rec.dump(pw, "    ");
                     } else {
-                        pw.println("  IntentSender " + ref);
+                        pw.print("  * "); pw.print(ref);
                     }
                 }
             }
@@ -8360,16 +8392,26 @@
     }
 
     private static final void dumpHistoryList(PrintWriter pw, List list,
-            String prefix, String label) {
+            String prefix, String label, boolean complete) {
         TaskRecord lastTask = null;
         for (int i=list.size()-1; i>=0; i--) {
             HistoryRecord r = (HistoryRecord)list.get(i);
+            final boolean full = complete || !r.inHistory;
             if (lastTask != r.task) {
                 lastTask = r.task;
-                lastTask.dump(pw, prefix + "  ");
+                pw.print(prefix);
+                pw.print(full ? "* " : "  ");
+                pw.println(lastTask);
+                if (full) {
+                    lastTask.dump(pw, prefix + "  ");
+                }
             }
-            pw.println(prefix + "    " + label + " #" + i + ":");
-            r.dump(pw, prefix + "      ");
+            pw.print(prefix); pw.print(full ? "  * " : "    "); pw.print(label);
+            pw.print(" #"); pw.print(i); pw.print(": ");
+            pw.println(r);
+            if (full) {
+                r.dump(pw, prefix + "      ");
+            }
         }
     }
 
@@ -8401,7 +8443,7 @@
 
     private static final void dumpApplicationMemoryUsage(FileDescriptor fd,
             PrintWriter pw, List list, String prefix, String[] args) {
-        final boolean isCheckinRequest = scanArgs(args, "-c");
+        final boolean isCheckinRequest = scanArgs(args, "--checkin");
         long uptime = SystemClock.uptimeMillis();
         long realtime = SystemClock.elapsedRealtime();
         
@@ -8738,7 +8780,7 @@
                 mPidsSelfLocked.remove(app.pid);
                 mHandler.removeMessages(PROC_START_TIMEOUT_MSG, app);
             }
-            app.pid = 0;
+            app.setPid(0);
         }
     }
 
diff --git a/services/java/com/android/server/am/AppBindRecord.java b/services/java/com/android/server/am/AppBindRecord.java
index ce6f6dc..9c57360 100644
--- a/services/java/com/android/server/am/AppBindRecord.java
+++ b/services/java/com/android/server/am/AppBindRecord.java
@@ -32,9 +32,12 @@
                                     // All ConnectionRecord for this client.
 
     void dump(PrintWriter pw, String prefix) {
-        pw.println(prefix + this);
         pw.println(prefix + "service=" + service);
         pw.println(prefix + "client=" + client);
+        dumpInIntentBind(pw, prefix);
+    }
+
+    void dumpInIntentBind(PrintWriter pw, String prefix) {
         if (connections.size() > 0) {
             pw.println(prefix + "Per-process Connections:");
             Iterator<ConnectionRecord> it = connections.iterator();
diff --git a/services/java/com/android/server/am/BatteryStatsService.java b/services/java/com/android/server/am/BatteryStatsService.java
index c5907af..ddc3e68 100644
--- a/services/java/com/android/server/am/BatteryStatsService.java
+++ b/services/java/com/android/server/am/BatteryStatsService.java
@@ -295,14 +295,14 @@
             boolean isCheckin = false;
             if (args != null) {
                 for (String arg : args) {
-                    if ("-c".equals(arg)) {
+                    if ("--checkin".equals(arg)) {
                         isCheckin = true;
                         break;
                     }
                 }
             }
             if (isCheckin) mStats.dumpCheckinLocked(pw, args);
-            else mStats.dumpLocked(new PrintWriterPrinter(pw));
+            else mStats.dumpLocked(pw);
         }
     }
 }
diff --git a/services/java/com/android/server/am/BroadcastFilter.java b/services/java/com/android/server/am/BroadcastFilter.java
index cd7f720..0eeb393 100644
--- a/services/java/com/android/server/am/BroadcastFilter.java
+++ b/services/java/com/android/server/am/BroadcastFilter.java
@@ -18,6 +18,7 @@
 
 import android.content.IntentFilter;
 import android.util.PrintWriterPrinter;
+import android.util.Printer;
 
 import java.io.PrintWriter;
 
@@ -33,19 +34,25 @@
         requiredPermission = _requiredPermission;
     }
     
-    public void dumpLocal(PrintWriter pw, String prefix) {
-        super.dump(new PrintWriterPrinter(pw), prefix);
-    }
-    
     public void dump(PrintWriter pw, String prefix) {
-        dumpLocal(pw, prefix);
-        pw.println(prefix + "requiredPermission=" + requiredPermission);
+        dumpInReceiverList(pw, new PrintWriterPrinter(pw), prefix);
         receiverList.dumpLocal(pw, prefix);
     }
     
+    public void dumpInReceiverList(PrintWriter pw, Printer pr, String prefix) {
+        super.dump(pr, prefix);
+        if (requiredPermission != null) {
+            pw.print(prefix); pw.print("requiredPermission="); pw.println(requiredPermission);
+        }
+    }
+    
     public String toString() {
-        return "BroadcastFilter{"
-            + Integer.toHexString(System.identityHashCode(this))
-            + " " + receiverList + "}";
+        StringBuilder sb = new StringBuilder();
+        sb.append("BroadcastFilter{");
+        sb.append(Integer.toHexString(System.identityHashCode(this)));
+        sb.append(' ');
+        sb.append(receiverList);
+        sb.append('}');
+        return sb.toString();
     }
 }
diff --git a/services/java/com/android/server/am/ConnectionRecord.java b/services/java/com/android/server/am/ConnectionRecord.java
index 41a783f..b3343dd 100644
--- a/services/java/com/android/server/am/ConnectionRecord.java
+++ b/services/java/com/android/server/am/ConnectionRecord.java
@@ -28,11 +28,13 @@
     final HistoryRecord activity;   // If non-null, the owning activity.
     final IServiceConnection conn;  // The client connection.
     final int flags;                // Binding options.
-
+    String stringName;              // Caching of toString.
+    
     void dump(PrintWriter pw, String prefix) {
-        pw.println(prefix + this);
         pw.println(prefix + "binding=" + binding);
-        pw.println(prefix + "activity=" + activity);
+        if (activity != null) {
+            pw.println(prefix + "activity=" + activity);
+        }
         pw.println(prefix + "conn=" + conn.asBinder()
                 + " flags=0x" + Integer.toHexString(flags));
     }
@@ -46,9 +48,17 @@
     }
 
     public String toString() {
-        return "ConnectionRecord{"
-            + Integer.toHexString(System.identityHashCode(this))
-            + " " + binding.service.shortName
-            + ":@" + Integer.toHexString(System.identityHashCode(conn.asBinder())) + "}";
+        if (stringName != null) {
+            return stringName;
+        }
+        StringBuilder sb = new StringBuilder(128);
+        sb.append("ConnectionRecord{");
+        sb.append(Integer.toHexString(System.identityHashCode(this)));
+        sb.append(' ');
+        sb.append(binding.service.shortName);
+        sb.append(":@");
+        sb.append(Integer.toHexString(System.identityHashCode(conn.asBinder())));
+        sb.append('}');
+        return stringName = sb.toString();
     }
 }
diff --git a/services/java/com/android/server/am/ContentProviderRecord.java b/services/java/com/android/server/am/ContentProviderRecord.java
index 9f37c14..c764635 100644
--- a/services/java/com/android/server/am/ContentProviderRecord.java
+++ b/services/java/com/android/server/am/ContentProviderRecord.java
@@ -32,7 +32,8 @@
     int externals;     // number of non-framework processes supported by this provider
     ProcessRecord app; // if non-null, hosting application
     ProcessRecord launchingApp; // if non-null, waiting for this app to be launched.
-
+    String stringName;
+    
     public ContentProviderRecord(ProviderInfo _info, ApplicationInfo ai) {
         super(_info);
         uid = ai.uid;
@@ -53,24 +54,39 @@
     }
 
     void dump(PrintWriter pw, String prefix) {
-        pw.println(prefix + this);
-        pw.println(prefix + "package=" + info.applicationInfo.packageName
-              + " process=" + info.processName);
-        pw.println(prefix + "app=" + app);
-        pw.println(prefix + "launchingApp=" + launchingApp);
-        pw.println(prefix + "provider=" + provider);
-        pw.println(prefix + "name=" + info.authority);
-        pw.println(prefix + "isSyncable=" + info.isSyncable);
-        pw.println(prefix + "multiprocess=" + info.multiprocess
-              + " initOrder=" + info.initOrder
-              + " uid=" + uid);
-        pw.println(prefix + "clients=" + clients);
-        pw.println(prefix + "externals=" + externals);
+        pw.print(prefix); pw.print("package=");
+                pw.print(info.applicationInfo.packageName);
+                pw.print("process="); pw.println(info.processName);
+        pw.print(prefix); pw.print("app="); pw.println(app);
+        if (launchingApp != null) {
+            pw.print(prefix); pw.print("launchingApp="); pw.println(launchingApp);
+        }
+        pw.print(prefix); pw.print("uid="); pw.print(uid);
+                pw.print(" provider="); pw.println(provider);
+        pw.print(prefix); pw.print("name="); pw.println(info.authority);
+        if (info.isSyncable || info.multiprocess || info.initOrder != 0) {
+            pw.print(prefix); pw.print("isSyncable="); pw.print(info.isSyncable);
+                    pw.print("multiprocess="); pw.print(info.multiprocess);
+                    pw.print(" initOrder="); pw.println(info.initOrder);
+        }
+        if (clients.size() > 0) {
+            pw.print(prefix); pw.print("clients="); pw.println(clients);
+        }
+        if (externals != 0) {
+            pw.print(prefix); pw.print("externals="); pw.println(externals);
+        }
     }
 
     public String toString() {
-        return "ContentProviderRecord{"
-            + Integer.toHexString(System.identityHashCode(this))
-            + " " + info.name + "}";
+        if (stringName != null) {
+            return stringName;
+        }
+        StringBuilder sb = new StringBuilder(128);
+        sb.append("ContentProviderRecord{");
+        sb.append(Integer.toHexString(System.identityHashCode(this)));
+        sb.append(' ');
+        sb.append(info.name);
+        sb.append('}');
+        return stringName = sb.toString();
     }
 }
diff --git a/services/java/com/android/server/am/HistoryRecord.java b/services/java/com/android/server/am/HistoryRecord.java
index 0f62471..1488791 100644
--- a/services/java/com/android/server/am/HistoryRecord.java
+++ b/services/java/com/android/server/am/HistoryRecord.java
@@ -100,46 +100,74 @@
     boolean hasBeenLaunched;// has this activity ever been launched?
     boolean frozenBeforeDestroy;// has been frozen but not yet destroyed.
 
+    String stringName;      // for caching of toString().
+    
     void dump(PrintWriter pw, String prefix) {
-        pw.println(prefix + this);
-        pw.println(prefix + "packageName=" + packageName
-              + " processName=" + processName);
-        pw.println(prefix + "launchedFromUid=" + launchedFromUid
-                + " app=" + app);
-        pw.println(prefix + intent);
-        pw.println(prefix + "frontOfTask=" + frontOfTask + " task=" + task);
-        pw.println(prefix + "taskAffinity=" + taskAffinity);
-        pw.println(prefix + "realActivity=" + realActivity);
-        pw.println(prefix + "dir=" + baseDir + " res=" + resDir + " data=" + dataDir);
-        pw.println(prefix + "labelRes=0x" + Integer.toHexString(labelRes)
-                + " icon=0x" + Integer.toHexString(icon)
-                + " theme=0x" + Integer.toHexString(theme));
-        pw.println(prefix + "stateNotNeeded=" + stateNotNeeded
-                + " componentSpecified=" + componentSpecified
-                + " isHomeActivity=" + isHomeActivity);
-        pw.println(prefix + "configuration=" + configuration);
-        pw.println(prefix + "resultTo=" + resultTo
-              + " resultWho=" + resultWho + " resultCode=" + requestCode);
-        pw.println(prefix + "results=" + results);
-        pw.println(prefix + "pendingResults=" + pendingResults);
-        pw.println(prefix + "readUriPermissions=" + readUriPermissions);
-        pw.println(prefix + "writeUriPermissions=" + writeUriPermissions);
-        pw.println(prefix + "launchFailed=" + launchFailed
-              + " haveState=" + haveState + " icicle=" + icicle);
-        pw.println(prefix + "state=" + state
-              + " stopped=" + stopped + " finishing=" + finishing);
-        pw.println(prefix + "keysPaused=" + keysPaused
-              + " inHistory=" + inHistory + " persistent=" + persistent
-              + " launchMode=" + launchMode);
-        pw.println(prefix + "fullscreen=" + fullscreen
-              + " visible=" + visible
-              + " frozenBeforeDestroy=" + frozenBeforeDestroy
-              + " thumbnailNeeded=" + thumbnailNeeded + " idle=" + idle);
-        pw.println(prefix + "waitingVisible=" + waitingVisible
-              + " nowVisible=" + nowVisible);
-        pw.println(prefix + "configDestroy=" + configDestroy
-                + " configChangeFlags=" + Integer.toHexString(configChangeFlags));
-        pw.println(prefix + "connections=" + connections);
+        pw.print(prefix); pw.print("packageName="); pw.print(packageName);
+                pw.print(" processName="); pw.println(processName);
+        pw.print(prefix); pw.print("launchedFromUid="); pw.print(launchedFromUid);
+                pw.print(" app="); pw.println(app);
+        pw.print(prefix); pw.println(intent);
+        pw.print(prefix); pw.print("frontOfTask="); pw.print(frontOfTask);
+                pw.print(" task="); pw.println(task);
+        pw.print(prefix); pw.print("taskAffinity="); pw.println(taskAffinity);
+        pw.print(prefix); pw.print("realActivity=");
+                pw.println(realActivity.flattenToShortString());
+        pw.print(prefix); pw.print("base="); pw.print(baseDir);
+                if (!resDir.equals(baseDir)) pw.print(" res="); pw.print(resDir);
+                pw.print(" data="); pw.println(dataDir);
+        pw.print(prefix); pw.print("labelRes=0x");
+                pw.print(Integer.toHexString(labelRes));
+                pw.print(" icon=0x"); pw.print(Integer.toHexString(icon));
+                pw.print(" theme=0x"); pw.println(Integer.toHexString(theme));
+        pw.print(prefix); pw.print("stateNotNeeded="); pw.print(stateNotNeeded);
+                pw.print(" componentSpecified="); pw.print(componentSpecified);
+                pw.print(" isHomeActivity="); pw.println(isHomeActivity);
+        pw.print(prefix); pw.print("configuration="); pw.println(configuration);
+        if (resultTo != null || resultWho != null) {
+            pw.print(prefix); pw.print("resultTo="); pw.print(resultTo);
+                    pw.print(" resultWho="); pw.print(resultWho);
+                    pw.print(" resultCode="); pw.println(requestCode);
+        }
+        if (results != null) {
+            pw.print(prefix); pw.print("results="); pw.println(results);
+        }
+        if (pendingResults != null) {
+            pw.print(prefix); pw.print("pendingResults="); pw.println(pendingResults);
+        }
+        if (readUriPermissions != null) {
+            pw.print(prefix); pw.print("readUriPermissions="); pw.println(readUriPermissions);
+        }
+        if (writeUriPermissions != null) {
+            pw.print(prefix); pw.print("writeUriPermissions="); pw.println(writeUriPermissions);
+        }
+        pw.print(prefix); pw.print("launchFailed="); pw.print(launchFailed);
+                pw.print(" haveState="); pw.print(haveState);
+                pw.print(" icicle="); pw.println(icicle);
+        pw.print(prefix); pw.print("state="); pw.print(state);
+                pw.print(" stopped="); pw.print(stopped);
+                pw.print(" finishing="); pw.println(finishing);
+        pw.print(prefix); pw.print("keysPaused="); pw.print(keysPaused);
+                pw.print(" inHistory="); pw.print(inHistory);
+                pw.print(" persistent="); pw.print(persistent);
+                pw.print(" launchMode="); pw.println(launchMode);
+        pw.print(prefix); pw.print("fullscreen="); pw.print(fullscreen);
+                pw.print(" visible="); pw.print(visible);
+                pw.print(" frozenBeforeDestroy="); pw.print(frozenBeforeDestroy);
+                pw.print(" thumbnailNeeded="); pw.print(thumbnailNeeded);
+                pw.print(" idle="); pw.println(idle);
+        if (waitingVisible || nowVisible) {
+            pw.print(prefix); pw.print("waitingVisible="); pw.print(waitingVisible);
+                    pw.print(" nowVisible="); pw.println(nowVisible);
+        }
+        if (configDestroy || configChangeFlags != 0) {
+            pw.print(prefix); pw.print("configDestroy="); pw.print(configDestroy);
+                    pw.print(" configChangeFlags=");
+                    pw.println(Integer.toHexString(configChangeFlags));
+        }
+        if (connections != null) {
+            pw.print(prefix); pw.print("connections="); pw.println(connections);
+        }
     }
 
     HistoryRecord(ActivityManagerService _service, ProcessRecord _caller,
@@ -335,15 +363,31 @@
     
     public void windowsVisible() {
         synchronized(service) {
-            if (ActivityManagerService.SHOW_ACTIVITY_START_TIME
-                    && startTime != 0) {
-                long time = SystemClock.uptimeMillis() - startTime;
-                EventLog.writeEvent(ActivityManagerService.LOG_ACTIVITY_LAUNCH_TIME,
-                        System.identityHashCode(this), shortComponentName, time);
-                Log.i(ActivityManagerService.TAG, "Displayed activity "
-                        + shortComponentName
-                        + ": " + time + " ms");
+            if (startTime != 0) {
+                final long curTime = SystemClock.uptimeMillis();
+                final long thisTime = curTime - startTime;
+                final long totalTime = service.mInitialStartTime != 0
+                        ? (curTime - service.mInitialStartTime) : thisTime;
+                if (ActivityManagerService.SHOW_ACTIVITY_START_TIME) {
+                    EventLog.writeEvent(ActivityManagerService.LOG_ACTIVITY_LAUNCH_TIME,
+                            System.identityHashCode(this), shortComponentName,
+                            thisTime, totalTime);
+                    StringBuilder sb = service.mStringBuilder;
+                    sb.setLength(0);
+                    sb.append("Displayed activity ");
+                    sb.append(shortComponentName);
+                    sb.append(": ");
+                    sb.append(thisTime);
+                    sb.append(" ms (total ");
+                    sb.append(totalTime);
+                    sb.append(" ms)");
+                    Log.i(ActivityManagerService.TAG, sb.toString());
+                }
+                if (totalTime > 0) {
+                    service.mUsageStatsService.noteLaunchTime(realActivity, (int)totalTime);
+                }
                 startTime = 0;
+                service.mInitialStartTime = 0;
             }
             if (ActivityManagerService.DEBUG_SWITCH) Log.v(
                     ActivityManagerService.TAG, "windowsVisible(): " + this);
@@ -453,8 +497,15 @@
     
     
     public String toString() {
-        return "HistoryRecord{"
-            + Integer.toHexString(System.identityHashCode(this))
-            + " " + intent.getComponent().toShortString() + "}";
+        if (stringName != null) {
+            return stringName;
+        }
+        StringBuilder sb = new StringBuilder(128);
+        sb.append("HistoryRecord{");
+        sb.append(Integer.toHexString(System.identityHashCode(this)));
+        sb.append(' ');
+        sb.append(intent.getComponent().flattenToShortString());
+        sb.append('}');
+        return stringName = sb.toString();
     }
 }
diff --git a/services/java/com/android/server/am/IntentBindRecord.java b/services/java/com/android/server/am/IntentBindRecord.java
index 24c3943..3a5ca66 100644
--- a/services/java/com/android/server/am/IntentBindRecord.java
+++ b/services/java/com/android/server/am/IntentBindRecord.java
@@ -45,22 +45,30 @@
     /** Set when the service's onUnbind() has asked to be told about new clients. */
     boolean doRebind;
     
+    String stringName;      // caching of toString
+    
     void dump(PrintWriter pw, String prefix) {
-        pw.println(prefix + this);
-        pw.println(prefix + "service=" + service);
-        pw.println(prefix + "intent=" + intent.getIntent());
-        pw.println(prefix + "binder=" + binder
-                + " requested=" + requested
-                + " received=" + received
-                + " hasBound=" + hasBound
-                + " doRebind=" + doRebind);
+        pw.print(prefix); pw.print("service="); pw.println(service);
+        dumpInService(pw, prefix);
+    }
+
+    void dumpInService(PrintWriter pw, String prefix) {
+        pw.print(prefix); pw.print("intent={");
+                pw.print(intent.getIntent().toShortString(true, false));
+                pw.println('}');
+        pw.print(prefix); pw.print("binder="); pw.println(binder);
+        pw.print(prefix); pw.print("requested="); pw.print(requested);
+                pw.print(" received="); pw.print(received);
+                pw.print(" hasBound="); pw.print(hasBound);
+                pw.print(" doRebind="); pw.println(doRebind);
         if (apps.size() > 0) {
-            pw.println(prefix + "Application Bindings:");
             Iterator<AppBindRecord> it = apps.values().iterator();
             while (it.hasNext()) {
                 AppBindRecord a = it.next();
-                pw.println(prefix + "Client " + a.client);
-                a.dump(pw, prefix + "  ");
+                pw.print(prefix); pw.print("* Client AppBindRecord{");
+                        pw.print(Integer.toHexString(System.identityHashCode(a)));
+                        pw.print(' '); pw.print(a.client); pw.println('}');
+                a.dumpInIntentBind(pw, prefix + "  ");
             }
         }
     }
@@ -71,9 +79,19 @@
     }
 
     public String toString() {
-        return "IntentBindRecord{"
-            + Integer.toHexString(System.identityHashCode(this))
-            + " " + service.name.toShortString()
-            + ":" + intent + "}";
+        if (stringName != null) {
+            return stringName;
+        }
+        StringBuilder sb = new StringBuilder(128);
+        sb.append("IntentBindRecord{");
+        sb.append(Integer.toHexString(System.identityHashCode(this)));
+        sb.append(' ');
+        sb.append(service.shortName);
+        sb.append(':');
+        if (intent != null) {
+            intent.getIntent().toShortString(sb, false, false);
+        }
+        sb.append('}');
+        return stringName = sb.toString();
     }
 }
diff --git a/services/java/com/android/server/am/PendingIntentRecord.java b/services/java/com/android/server/am/PendingIntentRecord.java
index b18aaf7..4381392 100644
--- a/services/java/com/android/server/am/PendingIntentRecord.java
+++ b/services/java/com/android/server/am/PendingIntentRecord.java
@@ -36,6 +36,8 @@
     boolean sent = false;
     boolean canceled = false;
 
+    String stringName;
+    
     final static class Key {
         final int type;
         final String packageName;
@@ -142,7 +144,7 @@
         
         public String toString() {
             return "Key{" + typeName() + " pkg=" + packageName
-                + " intent=" + requestIntent + " flags=0x"
+                + " intent=" + requestIntent.toShortString(true, false) + " flags=0x"
                 + Integer.toHexString(flags) + "}";
         }
         
@@ -260,19 +262,38 @@
     }
 
     void dump(PrintWriter pw, String prefix) {
-        pw.println(prefix + "packageName=" + key.packageName
-                + " type=" + key.typeName()
-                + " flags=0x" + Integer.toHexString(key.flags));
-        pw.println(prefix + "activity=" + key.activity + " who=" + key.who);
-        pw.println(prefix + "requestCode=" + key.requestCode
-                + " requestResolvedType=" + key.requestResolvedType);
-        pw.println(prefix + "requestIntent=" + key.requestIntent);
-        pw.println(prefix + "sent=" + sent + " canceled=" + canceled);
+        pw.print(prefix); pw.print("uid="); pw.print(uid);
+                pw.print(" packageName="); pw.print(key.packageName);
+                pw.print(" type="); pw.print(key.typeName());
+                pw.print(" flags=0x"); pw.println(Integer.toHexString(key.flags));
+        if (key.activity != null || key.who != null) {
+            pw.print(prefix); pw.print("activity="); pw.print(key.activity);
+                    pw.print(" who="); pw.println(key.who);
+        }
+        if (key.requestCode != 0 || key.requestResolvedType != null) {
+            pw.print(prefix); pw.print("requestCode="); pw.print(key.requestCode);
+                    pw.print(" requestResolvedType="); pw.println(key.requestResolvedType);
+        }
+        pw.print(prefix); pw.print("requestIntent=");
+                pw.println(key.requestIntent.toShortString(true, true));
+        if (sent || canceled) {
+            pw.print(prefix); pw.print("sent="); pw.print(sent);
+                    pw.print(" canceled="); pw.println(canceled);
+        }
     }
 
     public String toString() {
-        return "IntentSenderRecord{"
-            + Integer.toHexString(System.identityHashCode(this))
-            + " " + key.packageName + " " + key.typeName() + "}";
+        if (stringName != null) {
+            return stringName;
+        }
+        StringBuilder sb = new StringBuilder(128);
+        sb.append("PendingIntentRecord{");
+        sb.append(Integer.toHexString(System.identityHashCode(this)));
+        sb.append(' ');
+        sb.append(key.packageName);
+        sb.append(' ');
+        sb.append(key.typeName());
+        sb.append('}');
+        return stringName = sb.toString();
     }
 }
diff --git a/services/java/com/android/server/am/ProcessRecord.java b/services/java/com/android/server/am/ProcessRecord.java
index a1320df..b76547a 100644
--- a/services/java/com/android/server/am/ProcessRecord.java
+++ b/services/java/com/android/server/am/ProcessRecord.java
@@ -98,44 +98,81 @@
     boolean waitedForDebugger;  // has process show wait for debugger dialog?
     Dialog waitDialog;          // current wait for debugger dialog
     
+    String stringName;          // caching of toString() result.
+    
     // These reports are generated & stored when an app gets into an error condition.
     // They will be "null" when all is OK.
     ActivityManager.ProcessErrorStateInfo crashingReport;
     ActivityManager.ProcessErrorStateInfo notRespondingReport;
 
     void dump(PrintWriter pw, String prefix) {
-        pw.println(prefix + this);
-        pw.println(prefix + "class=" + info.className);
-        pw.println(prefix+"manageSpaceActivityName="+info.manageSpaceActivityName);
-        pw.println(prefix + "dir=" + info.sourceDir + " publicDir=" + info.publicSourceDir 
-              + " data=" + info.dataDir);
-        pw.println(prefix + "packageList=" + pkgList);
-        pw.println(prefix + "instrumentationClass=" + instrumentationClass
-              + " instrumentationProfileFile=" + instrumentationProfileFile);
-        pw.println(prefix + "instrumentationArguments=" + instrumentationArguments);
-        pw.println(prefix + "thread=" + thread + " curReceiver=" + curReceiver);
-        pw.println(prefix + "pid=" + pid + " starting=" + starting
-                + " lastPss=" + lastPss);
-        pw.println(prefix + "maxAdj=" + maxAdj + " hiddenAdj=" + hiddenAdj
-                + " curRawAdj=" + curRawAdj + " setRawAdj=" + setRawAdj
-                + " curAdj=" + curAdj + " setAdj=" + setAdj);
-        pw.println(prefix + "isForeground=" + isForeground
-                + " setIsForeground=" + setIsForeground
-                + " foregroundServices=" + foregroundServices
-                + " forcingToForeground=" + forcingToForeground);
-        pw.println(prefix + "persistent=" + persistent + " removed=" + removed
-                + " persistentActivities=" + persistentActivities);
-        pw.println(prefix + "debugging=" + debugging
-                + " crashing=" + crashing + " " + crashDialog
-                + " notResponding=" + notResponding + " " + anrDialog
-                + " bad=" + bad);
-        pw.println(prefix + "activities=" + activities);
-        pw.println(prefix + "services=" + services);
-        pw.println(prefix + "executingServices=" + executingServices);
-        pw.println(prefix + "connections=" + connections);
-        pw.println(prefix + "pubProviders=" + pubProviders);
-        pw.println(prefix + "conProviders=" + conProviders);
-        pw.println(prefix + "receivers=" + receivers);
+        if (info.className != null) {
+            pw.print(prefix); pw.print("class="); pw.println(info.className);
+        }
+        if (info.manageSpaceActivityName != null) {
+            pw.print(prefix); pw.print("manageSpaceActivityName=");
+            pw.println(info.manageSpaceActivityName);
+        }
+        pw.print(prefix); pw.print("dir="); pw.print(info.sourceDir);
+                pw.print(" publicDir="); pw.print(info.publicSourceDir);
+                pw.print(" data="); pw.println(info.dataDir);
+        pw.print(prefix); pw.print("packageList="); pw.println(pkgList);
+        if (instrumentationClass != null || instrumentationProfileFile != null
+                || instrumentationArguments != null) {
+            pw.print(prefix); pw.print("instrumentationClass=");
+                    pw.print(instrumentationClass);
+                    pw.print(" instrumentationProfileFile=");
+                    pw.println(instrumentationProfileFile);
+            pw.print(prefix); pw.print("instrumentationArguments=");
+                    pw.println(instrumentationArguments);
+        }
+        pw.print(prefix); pw.print("thread="); pw.print(thread);
+                pw.print(" curReceiver="); pw.println(curReceiver);
+        pw.print(prefix); pw.print("pid="); pw.print(pid); pw.print(" starting=");
+                pw.print(starting); pw.print(" lastPss="); pw.println(lastPss);
+        pw.print(prefix); pw.print("oom: max="); pw.print(maxAdj);
+                pw.print(" hidden="); pw.print(hiddenAdj);
+                pw.print(" curRaw="); pw.print(curRawAdj);
+                pw.print(" setRaw="); pw.print(setRawAdj);
+                pw.print(" cur="); pw.print(curAdj);
+                pw.print(" set="); pw.println(setAdj);
+        pw.print(prefix); pw.print("isForeground="); pw.print(isForeground);
+                pw.print(" setIsForeground="); pw.print(setIsForeground);
+                pw.print(" foregroundServices="); pw.print(foregroundServices);
+                pw.print(" forcingToForeground="); pw.println(forcingToForeground);
+        pw.print(prefix); pw.print("persistent="); pw.print(persistent);
+                pw.print(" removed="); pw.print(removed);
+                pw.print(" persistentActivities="); pw.println(persistentActivities);
+        if (debugging || crashing || crashDialog != null || notResponding
+                || anrDialog != null || bad) {
+            pw.print(prefix); pw.print("debugging="); pw.print(debugging);
+                    pw.print(" crashing="); pw.print(crashing);
+                    pw.print(" "); pw.print(crashDialog);
+                    pw.print(" notResponding="); pw.print(notResponding);
+                    pw.print(" " ); pw.print(anrDialog);
+                    pw.print(" bad="); pw.println(bad);
+        }
+        if (activities.size() > 0) {
+            pw.print(prefix); pw.print("activities="); pw.println(activities);
+        }
+        if (services.size() > 0) {
+            pw.print(prefix); pw.print("services="); pw.println(services);
+        }
+        if (executingServices.size() > 0) {
+            pw.print(prefix); pw.print("executingServices="); pw.println(executingServices);
+        }
+        if (connections.size() > 0) {
+            pw.print(prefix); pw.print("connections="); pw.println(connections);
+        }
+        if (pubProviders.size() > 0) {
+            pw.print(prefix); pw.print("pubProviders="); pw.println(pubProviders);
+        }
+        if (conProviders.size() > 0) {
+            pw.print(prefix); pw.print("conProviders="); pw.println(conProviders);
+        }
+        if (receivers.size() > 0) {
+            pw.print(prefix); pw.print("receivers="); pw.println(receivers);
+        }
     }
     
     ProcessRecord(BatteryStatsImpl.Uid.Proc _batteryStats, IApplicationThread _thread,
@@ -154,6 +191,11 @@
         persistentActivities = 0;
     }
 
+    public void setPid(int _pid) {
+        pid = _pid;
+        stringName = null;
+    }
+    
     /**
      * This method returns true if any of the activities within the process record are interesting
      * to the user. See HistoryRecord.isInterestingToUserLocked()
@@ -188,9 +230,20 @@
     }
     
     public String toString() {
-        return "ProcessRecord{"
-            + Integer.toHexString(System.identityHashCode(this))
-            + " " + pid + ":" + processName + "/" + info.uid + "}";
+        if (stringName != null) {
+            return stringName;
+        }
+        StringBuilder sb = new StringBuilder(128);
+        sb.append("ProcessRecord{");
+        sb.append(Integer.toHexString(System.identityHashCode(this)));
+        sb.append(' ');
+        sb.append(pid);
+        sb.append(':');
+        sb.append(processName);
+        sb.append('/');
+        sb.append(info.uid);
+        sb.append('}');
+        return stringName = sb.toString();
     }
     
     /*
diff --git a/services/java/com/android/server/am/ReceiverList.java b/services/java/com/android/server/am/ReceiverList.java
index 6ac527b..0facefc 100644
--- a/services/java/com/android/server/am/ReceiverList.java
+++ b/services/java/com/android/server/am/ReceiverList.java
@@ -18,9 +18,12 @@
 
 import android.app.IIntentReceiver;
 import android.content.Intent;
+import android.os.Binder;
 import android.os.Bundle;
 import android.os.IBinder;
 import android.os.RemoteException;
+import android.util.PrintWriterPrinter;
+import android.util.Printer;
 
 import java.io.PrintWriter;
 import java.util.ArrayList;
@@ -39,6 +42,8 @@
     BroadcastRecord curBroadcast = null;
     boolean linkedToDeath = false;
 
+    String stringName;
+    
     ReceiverList(ActivityManagerService _owner, ProcessRecord _app,
             int _pid, int _uid, IIntentReceiver _receiver) {
         owner = _owner;
@@ -62,31 +67,45 @@
     }
     
     void dumpLocal(PrintWriter pw, String prefix) {
-        pw.println(prefix + "receiver=IBinder "
-                + Integer.toHexString(System.identityHashCode(receiver.asBinder())));
-        pw.println(prefix + "app=" + app + " pid=" + pid + " uid=" + uid);
-        pw.println(prefix + "curBroadcast=" + curBroadcast
-                + " linkedToDeath=" + linkedToDeath);
+        pw.print(prefix); pw.print("app="); pw.print(app);
+            pw.print(" pid="); pw.print(pid); pw.print(" uid="); pw.println(uid);
+        if (curBroadcast != null || linkedToDeath) {
+            pw.print(prefix); pw.print("curBroadcast="); pw.print(curBroadcast);
+                pw.print(" linkedToDeath="); pw.println(linkedToDeath);
+        }
     }
     
     void dump(PrintWriter pw, String prefix) {
-        pw.println(prefix + this);
+        Printer pr = new PrintWriterPrinter(pw);
         dumpLocal(pw, prefix);
         String p2 = prefix + "  ";
         final int N = size();
         for (int i=0; i<N; i++) {
             BroadcastFilter bf = get(i);
-            pw.println(prefix + "Filter #" + i + ": " + bf);
-            bf.dump(pw, p2);
+            pw.print(prefix); pw.print("Filter #"); pw.print(i);
+                    pw.print(": BroadcastFilter{");
+                    pw.print(Integer.toHexString(System.identityHashCode(bf)));
+                    pw.println('}');
+            bf.dumpInReceiverList(pw, pr, p2);
         }
     }
     
     public String toString() {
-        return "ReceiverList{"
-            + Integer.toHexString(System.identityHashCode(this))
-            + " " + pid + " " + (app != null ? app.processName : "(unknown name)")
-            + "/" + uid + " client "
-            + Integer.toHexString(System.identityHashCode(receiver.asBinder()))
-            + "}";
+        if (stringName != null) {
+            return stringName;
+        }
+        StringBuilder sb = new StringBuilder(128);
+        sb.append("ReceiverList{");
+        sb.append(Integer.toHexString(System.identityHashCode(this)));
+        sb.append(' ');
+        sb.append(pid);
+        sb.append(' ');
+        sb.append((app != null ? app.processName : "(unknown name)"));
+        sb.append('/');
+        sb.append(uid);
+        sb.append((receiver.asBinder() instanceof Binder) ? " local:" : " remote:");
+        sb.append(Integer.toHexString(System.identityHashCode(receiver.asBinder())));
+        sb.append('}');
+        return stringName = sb.toString();
     }
 }
diff --git a/services/java/com/android/server/am/ServiceRecord.java b/services/java/com/android/server/am/ServiceRecord.java
index 4b90600..fc93b69 100644
--- a/services/java/com/android/server/am/ServiceRecord.java
+++ b/services/java/com/android/server/am/ServiceRecord.java
@@ -77,41 +77,49 @@
     long restartTime;       // time of last restart.
     long nextRestartTime;   // time when restartDelay will expire.
 
+    String stringName;      // caching of toString
+    
     void dump(PrintWriter pw, String prefix) {
-        pw.println(prefix + this);
-        pw.println(prefix + "intent=" + intent.getIntent());
-        pw.println(prefix + "packageName=" + packageName);
-        pw.println(prefix + "processName=" + processName);
-        pw.println(prefix + "permission=" + permission);
-        pw.println(prefix + "baseDir=" + baseDir+ " resDir=" + resDir + " dataDir=" + dataDir);
-        pw.println(prefix + "app=" + app);
-        pw.println(prefix + "isForeground=" + isForeground
-                + " lastActivity=" + lastActivity);
-        pw.println(prefix + "startRequested=" + startRequested
-              + " startId=" + lastStartId
-              + " executeNesting=" + executeNesting
-              + " executingStart=" + executingStart
-              + " crashCount=" + crashCount);
-        pw.println(prefix + "totalRestartCount=" + totalRestartCount
-                + " restartCount=" + restartCount
-                + " restartDelay=" + restartDelay
-                + " restartTime=" + restartTime
-                + " nextRestartTime=" + nextRestartTime);
+        pw.print(prefix); pw.print("intent={");
+                pw.print(intent.getIntent().toShortString(true, false));
+                pw.println('}');
+        pw.print(prefix); pw.print("packageName="); pw.println(packageName);
+        pw.print(prefix); pw.print("processName="); pw.println(processName);
+        if (permission != null) {
+            pw.print(prefix); pw.print("permission="); pw.println(permission);
+        }
+        pw.print(prefix); pw.print("baseDir="); pw.print(baseDir);
+                if (!resDir.equals(baseDir)) pw.print(" resDir="); pw.print(resDir);
+                pw.print(" dataDir="); pw.println(dataDir);
+        pw.print(prefix); pw.print("app="); pw.println(app);
+        pw.print(prefix); pw.print("isForeground="); pw.print(isForeground);
+                pw.print(" lastActivity="); pw.println(lastActivity);
+        pw.print(prefix); pw.print("startRequested="); pw.print(startRequested);
+                pw.print(" startId="); pw.print(lastStartId);
+                pw.print(" executeNesting="); pw.print(executeNesting);
+                pw.print(" executingStart="); pw.print(executingStart);
+                pw.print(" crashCount="); pw.println(crashCount);
+        pw.print(prefix); pw.print("totalRestartCount="); pw.print(totalRestartCount);
+                pw.print(" restartCount="); pw.print(restartCount);
+                pw.print(" restartDelay="); pw.print(restartDelay);
+                pw.print(" restartTime="); pw.print(restartTime);
+                pw.print(" nextRestartTime="); pw.println(nextRestartTime);
         if (bindings.size() > 0) {
-            pw.println(prefix + "Bindings:");
             Iterator<IntentBindRecord> it = bindings.values().iterator();
             while (it.hasNext()) {
                 IntentBindRecord b = it.next();
-                pw.println(prefix + "Binding " + b);
-                b.dump(pw, prefix + "  ");
+                pw.print(prefix); pw.print("* IntentBindRecord{");
+                        pw.print(Integer.toHexString(System.identityHashCode(b)));
+                        pw.println("}:");
+                b.dumpInService(pw, prefix + "  ");
             }
         }
         if (connections.size() > 0) {
-            pw.println(prefix + "All Connections:");
+            pw.print(prefix); pw.println("All Connections:");
             Iterator<ConnectionRecord> it = connections.values().iterator();
             while (it.hasNext()) {
                 ConnectionRecord c = it.next();
-                pw.println(prefix + "  " + c);
+                pw.print(prefix); pw.print("  "); pw.println(c);
             }
         }
     }
@@ -159,8 +167,13 @@
     }
     
     public String toString() {
-        return "ServiceRecord{"
-            + Integer.toHexString(System.identityHashCode(this))
-            + " " + shortName + "}";
+        if (stringName != null) {
+            return stringName;
+        }
+        StringBuilder sb = new StringBuilder(128);
+        sb.append("ServiceRecord{")
+            .append(Integer.toHexString(System.identityHashCode(this)))
+            .append(' ').append(shortName).append('}');
+        return stringName = sb.toString();
     }
 }
diff --git a/services/java/com/android/server/am/TaskRecord.java b/services/java/com/android/server/am/TaskRecord.java
index aab3736..bcb8f54 100644
--- a/services/java/com/android/server/am/TaskRecord.java
+++ b/services/java/com/android/server/am/TaskRecord.java
@@ -36,6 +36,8 @@
     boolean rootWasReset;   // True if the intent at the root of the task had
                             // the FLAG_ACTIVITY_RESET_TASK_IF_NEEDED flag.
 
+    String stringName;      // caching of toString() result.
+    
     TaskRecord(int _taskId, ActivityInfo info, Intent _intent,
             boolean _clearOnBackground) {
         taskId = _taskId;
@@ -53,6 +55,8 @@
     }
     
     void setIntent(Intent _intent, ActivityInfo info) {
+        stringName = null;
+        
         if (info.targetActivity == null) {
             intent = _intent;
             realActivity = _intent != null ? _intent.getComponent() : null;
@@ -82,23 +86,63 @@
     }
     
     void dump(PrintWriter pw, String prefix) {
-        pw.println(prefix + this);
-        pw.println(prefix + "clearOnBackground=" + clearOnBackground
-              + " numActivities=" + numActivities
-              + " rootWasReset=" + rootWasReset);
-        pw.println(prefix + "affinity=" + affinity);
-        pw.println(prefix + "intent=" + intent);
-        pw.println(prefix + "affinityIntent=" + affinityIntent);
-        pw.println(prefix + "origActivity=" + origActivity);
-        pw.println(prefix + "lastActiveTime=" + lastActiveTime
-                +" (inactive for " + (getInactiveDuration()/1000) + "s)");
+        if (clearOnBackground || numActivities != 0 || rootWasReset) {
+            pw.print(prefix); pw.print("clearOnBackground="); pw.print(clearOnBackground);
+                    pw.print(" numActivities="); pw.print(numActivities);
+                    pw.print(" rootWasReset="); pw.println(rootWasReset);
+        }
+        if (affinity != null) {
+            pw.print(prefix); pw.print("affinity="); pw.println(affinity);
+        }
+        if (intent != null) {
+            StringBuilder sb = new StringBuilder(128);
+            sb.append(prefix); sb.append("intent={");
+            intent.toShortString(sb, true, false);
+            sb.append('}');
+            pw.println(sb.toString());
+        }
+        if (affinityIntent != null) {
+            StringBuilder sb = new StringBuilder(128);
+            sb.append(prefix); sb.append("affinityIntent={");
+            affinityIntent.toShortString(sb, true, false);
+            sb.append('}');
+            pw.println(sb.toString());
+        }
+        if (origActivity != null) {
+            pw.print(prefix); pw.print("origActivity=");
+            pw.println(origActivity.flattenToShortString());
+        }
+        if (realActivity != null) {
+            pw.print(prefix); pw.print("realActivity=");
+            pw.println(realActivity.flattenToShortString());
+        }
+        pw.print(prefix); pw.print("lastActiveTime="); pw.print(lastActiveTime);
+                pw.print(" (inactive for ");
+                pw.print((getInactiveDuration()/1000)); pw.println("s)");
     }
 
     public String toString() {
-        return "Task{" + taskId + " "
-                + (affinity != null ? affinity
-                        : (intent != null ? intent.getComponent().flattenToShortString()
-                                : affinityIntent != null ? affinityIntent.getComponent().flattenToShortString() : "??"))
-                + "}";
+        if (stringName != null) {
+            return stringName;
+        }
+        StringBuilder sb = new StringBuilder(128);
+        sb.append("TaskRecord{");
+        sb.append(Integer.toHexString(System.identityHashCode(this)));
+        sb.append(" #");
+        sb.append(taskId);
+        if (affinity != null) {
+            sb.append(" A ");
+            sb.append(affinity);
+        } else if (intent != null) {
+            sb.append(" I ");
+            sb.append(intent.getComponent().flattenToShortString());
+        } else if (affinityIntent != null) {
+            sb.append(" aI ");
+            sb.append(affinityIntent.getComponent().flattenToShortString());
+        } else {
+            sb.append(" ??");
+        }
+        sb.append('}');
+        return stringName = sb.toString();
     }
 }
diff --git a/services/java/com/android/server/am/UriPermission.java b/services/java/com/android/server/am/UriPermission.java
index fb7a745..ffa8a2a 100644
--- a/services/java/com/android/server/am/UriPermission.java
+++ b/services/java/com/android/server/am/UriPermission.java
@@ -30,6 +30,8 @@
     final HashSet<HistoryRecord> readActivities = new HashSet<HistoryRecord>();
     final HashSet<HistoryRecord> writeActivities = new HashSet<HistoryRecord>();
     
+    String stringName;
+    
     UriPermission(int _uid, Uri _uri) {
         uid = _uid;
         uri = _uri;
@@ -65,18 +67,29 @@
     }
     
     public String toString() {
-        return "UriPermission{"
-                + Integer.toHexString(System.identityHashCode(this))
-                + " " + uri + "}";
+        if (stringName != null) {
+            return stringName;
+        }
+        StringBuilder sb = new StringBuilder(128);
+        sb.append("UriPermission{");
+        sb.append(Integer.toHexString(System.identityHashCode(this)));
+        sb.append(' ');
+        sb.append(uri);
+        sb.append('}');
+        return stringName = sb.toString();
     }
 
     void dump(PrintWriter pw, String prefix) {
-        pw.println(prefix + this);
-        pw.println(prefix + "  modeFlags=0x" + Integer.toHexString(modeFlags)
-                + " uid=" + uid 
-                + " globalModeFlags=0x"
-                + Integer.toHexString(globalModeFlags));
-        pw.println(prefix + "  readActivities=" + readActivities);
-        pw.println(prefix + "  writeActivities=" + writeActivities);
+        pw.print(prefix); pw.print("modeFlags=0x");
+                pw.print(Integer.toHexString(modeFlags));
+                pw.print(" uid="); pw.print(uid); 
+                pw.print(" globalModeFlags=0x");
+                pw.println(Integer.toHexString(globalModeFlags));
+        if (readActivities.size() != 0) {
+            pw.print(prefix); pw.print("readActivities="); pw.println(readActivities);
+        }
+        if (writeActivities.size() != 0) {
+            pw.print(prefix); pw.print("writeActivities="); pw.println(writeActivities);
+        }
     }
 }
diff --git a/services/java/com/android/server/am/UsageStatsService.java b/services/java/com/android/server/am/UsageStatsService.java
index 3922f39..b6f9158 100755
--- a/services/java/com/android/server/am/UsageStatsService.java
+++ b/services/java/com/android/server/am/UsageStatsService.java
@@ -37,11 +37,11 @@
 import java.util.ArrayList;
 import java.util.Calendar;
 import java.util.Collections;
-import java.util.Date;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
+import java.util.TimeZone;
 
 /**
  * This service collects the statistics associated with usage
@@ -53,6 +53,23 @@
     public static final String SERVICE_NAME = "usagestats";
     private static final boolean localLOGV = false;
     private static final String TAG = "UsageStats";
+    
+    // Current on-disk Parcel version
+    private static final int VERSION = 1004;
+
+    private static final int CHECKIN_VERSION = 3;
+    
+    private static final String FILE_PREFIX = "usage-";
+    
+    private static final int FILE_WRITE_INTERVAL = 30*60*1000; //ms
+    
+    private static final int MAX_NUM_FILES = 5;
+    
+    private static final int NUM_LAUNCH_TIME_BINS = 10;
+    private static final int[] LAUNCH_TIME_BINS = {
+        250, 500, 750, 1000, 1500, 2000, 3000, 4000, 5000
+    };
+    
     static IUsageStats sService;
     private Context mContext;
     // structure used to maintain statistics since the last checkin.
@@ -66,16 +83,48 @@
     // Order of locks is mFileLock followed by mStatsLock to avoid deadlocks
     private String mResumedPkg;
     private File mFile;
+    private String mFileLeaf;
     //private File mBackupFile;
-    private long mLastWriteRealTime;
-    private int _FILE_WRITE_INTERVAL = 30*60*1000; //ms
-    private static final String _PREFIX_DELIMIT=".";
-    private String mFilePrefix;
+    private long mLastWriteElapsedTime;
+    private File mDir;
     private Calendar mCal;
-    private static final int  _MAX_NUM_FILES = 10;
-    private long mLastTime;
+    private int mLastWriteDay;
+    
+    static class TimeStats {
+        int[] times = new int[NUM_LAUNCH_TIME_BINS];
+        
+        TimeStats() {
+        }
+        
+        void add(int val) {
+            final int[] bins = LAUNCH_TIME_BINS;
+            for (int i=0; i<NUM_LAUNCH_TIME_BINS-1; i++) {
+                if (val < bins[i]) {
+                    times[i]++;
+                    return;
+                }
+            }
+            times[NUM_LAUNCH_TIME_BINS-1]++;
+        }
+        
+        TimeStats(Parcel in) {
+            final int[] localTimes = times;
+            for (int i=0; i<NUM_LAUNCH_TIME_BINS; i++) {
+                localTimes[i] = in.readInt();
+            }
+        }
+        
+        void writeToParcel(Parcel out) {
+            final int[] localTimes = times;
+            for (int i=0; i<NUM_LAUNCH_TIME_BINS; i++) {
+                out.writeInt(localTimes[i]);
+            }
+        }
+    }
     
     private class PkgUsageStatsExtended {
+        final HashMap<String, TimeStats> mLaunchTimes
+                = new HashMap<String, TimeStats>();
         int mLaunchCount;
         long mUsageTime;
         long mPausedTime;
@@ -85,44 +134,106 @@
             mLaunchCount = 0;
             mUsageTime = 0;
         }
+        
+        PkgUsageStatsExtended(Parcel in) {
+            mLaunchCount = in.readInt();
+            mUsageTime = in.readLong();
+            if (localLOGV) Log.v(TAG, "Launch count: " + mLaunchCount
+                    + ", Usage time:" + mUsageTime);
+            
+            final int N = in.readInt();
+            if (localLOGV) Log.v(TAG, "Reading comps: " + N);
+            for (int i=0; i<N; i++) {
+                String comp = in.readString();
+                if (localLOGV) Log.v(TAG, "Component: " + comp);
+                TimeStats times = new TimeStats(in);
+                mLaunchTimes.put(comp, times);
+            }
+        }
+        
         void updateResume() {
             mLaunchCount ++;
             mResumedTime = SystemClock.elapsedRealtime();
         }
+        
         void updatePause() {
             mPausedTime =  SystemClock.elapsedRealtime();
             mUsageTime += (mPausedTime - mResumedTime);
         }
+        
+        void addLaunchTime(String comp, int millis) {
+            TimeStats times = mLaunchTimes.get(comp);
+            if (times == null) {
+                times = new TimeStats();
+                mLaunchTimes.put(comp, times);
+            }
+            times.add(millis);
+        }
+        
+        void writeToParcel(Parcel out) {
+            out.writeInt(mLaunchCount);
+            out.writeLong(mUsageTime);
+            final int N = mLaunchTimes.size();
+            out.writeInt(N);
+            if (N > 0) {
+                for (Map.Entry<String, TimeStats> ent : mLaunchTimes.entrySet()) {
+                    out.writeString(ent.getKey());
+                    TimeStats times = ent.getValue();
+                    times.writeToParcel(out);
+                }
+            }
+        }
+        
         void clear() {
+            mLaunchTimes.clear();
             mLaunchCount = 0;
             mUsageTime = 0;
         }
     }
     
-    UsageStatsService(String fileName) {
+    UsageStatsService(String dir) {
         mStats = new HashMap<String, PkgUsageStatsExtended>();
         mStatsLock = new Object();
         mFileLock = new Object();
-        mFilePrefix = fileName;
-        mCal = Calendar.getInstance();
+        mDir = new File(dir);
+        mCal = Calendar.getInstance(TimeZone.getTimeZone("GMT+0"));
+        
+        mDir.mkdir();
+        
+        // Remove any old usage files from previous versions.
+        File parentDir = mDir.getParentFile();
+        String fList[] = parentDir.list();
+        if (fList != null) {
+            String prefix = mDir.getName() + ".";
+            int i = fList.length;
+            while (i > 0) {
+                i--;
+                if (fList[i].startsWith(prefix)) {
+                    Log.i(TAG, "Deleting old usage file: " + fList[i]);
+                    (new File(parentDir, fList[i])).delete();
+                }
+            }
+        }
+        
         // Update current stats which are binned by date
-        String uFileName = getCurrentDateStr(mFilePrefix);
-        mFile = new File(uFileName);
+        mFileLeaf = getCurrentDateStr(FILE_PREFIX);
+        mFile = new File(mDir, mFileLeaf);
         readStatsFromFile();
-        mLastWriteRealTime = SystemClock.elapsedRealtime();
-        mLastTime = new Date().getTime();
+        mLastWriteElapsedTime = SystemClock.elapsedRealtime();
+        // mCal was set by getCurrentDateStr(), want to use that same time.
+        mLastWriteDay = mCal.get(Calendar.DAY_OF_YEAR);
     }
 
     /*
      * Utility method to convert date into string.
      */
     private String getCurrentDateStr(String prefix) {
-        mCal.setTime(new Date());
+        mCal.setTimeInMillis(System.currentTimeMillis());
         StringBuilder sb = new StringBuilder();
         if (prefix != null) {
             sb.append(prefix);
-            sb.append(".");
         }
+        sb.append(mCal.get(Calendar.YEAR));
         int mm = mCal.get(Calendar.MONTH) - Calendar.JANUARY +1;
         if (mm < 10) {
             sb.append("0");
@@ -133,7 +244,6 @@
             sb.append("0");
         }
         sb.append(dd);
-        sb.append(mCal.get(Calendar.YEAR));
         return sb.toString();
     }
     
@@ -166,11 +276,20 @@
     
     private void readStatsFLOCK(File file) throws IOException {
         Parcel in = getParcelForFile(file);
-        while (in.dataAvail() > 0) {
+        int vers = in.readInt();
+        if (vers != VERSION) {
+            Log.w(TAG, "Usage stats version changed; dropping");
+            return;
+        }
+        int N = in.readInt();
+        while (N > 0) {
+            N--;
             String pkgName = in.readString();
-            PkgUsageStatsExtended pus = new PkgUsageStatsExtended();
-            pus.mLaunchCount = in.readInt();
-            pus.mUsageTime = in.readLong();
+            if (pkgName == null) {
+                break;
+            }
+            if (localLOGV) Log.v(TAG, "Reading package #" + N + ": " + pkgName);
+            PkgUsageStatsExtended pus = new PkgUsageStatsExtended(in);
             synchronized (mStatsLock) {
                 mStats.put(pkgName, pus);
             }
@@ -178,27 +297,18 @@
     }
 
     private ArrayList<String> getUsageStatsFileListFLOCK() {
-        File dir = getUsageFilesDir();
-        if (dir == null) {
-            Log.w(TAG, "Couldnt find writable directory for usage stats file");
-            return null;
-        }
         // Check if there are too many files in the system and delete older files
-        String fList[] = dir.list();
+        String fList[] = mDir.list();
         if (fList == null) {
             return null;
         }
-        File pre = new File(mFilePrefix);
-        String filePrefix = pre.getName();
-        // file name followed by dot
-        int prefixLen = filePrefix.length()+1;
         ArrayList<String> fileList = new ArrayList<String>();
         for (String file : fList) {
-            int index = file.indexOf(filePrefix);
-            if (index == -1) {
+            if (!file.startsWith(FILE_PREFIX)) {
                 continue;
             }
             if (file.endsWith(".bak")) {
+                (new File(mDir, file)).delete();
                 continue;
             }
             fileList.add(file);
@@ -206,20 +316,7 @@
         return fileList;
     }
     
-    private File getUsageFilesDir() {
-        if (mFilePrefix == null) {
-            return null;
-        }
-        File pre = new File(mFilePrefix);
-        return new File(pre.getParent());
-    }
-    
     private void checkFileLimitFLOCK() {
-        File dir = getUsageFilesDir();
-        if (dir == null) {
-            Log.w(TAG, "Couldnt find writable directory for usage stats file");
-            return;
-        }
         // Get all usage stats output files
         ArrayList<String> fileList = getUsageStatsFileListFLOCK();
         if (fileList == null) {
@@ -227,49 +324,54 @@
             return;
         }
         int count = fileList.size();
-        if (count <= _MAX_NUM_FILES) {
+        if (count <= MAX_NUM_FILES) {
             return;
         }
         // Sort files
         Collections.sort(fileList);
-        count -= _MAX_NUM_FILES;
+        count -= MAX_NUM_FILES;
         // Delete older files
         for (int i = 0; i < count; i++) {
             String fileName = fileList.get(i);
-            File file = new File(dir, fileName);
-            Log.i(TAG, "Deleting file : "+fileName);
+            File file = new File(mDir, fileName);
+            Log.i(TAG, "Deleting usage file : " + fileName);
             file.delete();
         }
     }
     
-    private void writeStatsToFile() {
+    private void writeStatsToFile(boolean force) {
         synchronized (mFileLock) {
-            long currTime = new Date().getTime();
-            boolean dayChanged =  ((currTime - mLastTime) >= (24*60*60*1000));
-            long currRealTime = SystemClock.elapsedRealtime();
-            if (((currRealTime-mLastWriteRealTime) < _FILE_WRITE_INTERVAL) &&
-                    (!dayChanged)) {
-                // wait till the next update
-                return;
+            mCal.setTimeInMillis(System.currentTimeMillis());
+            final int curDay = mCal.get(Calendar.DAY_OF_YEAR);
+            // Determine if the day changed...  note that this will be wrong
+            // if the year has changed but we are in the same day of year...
+            // we can probably live with this.
+            final boolean dayChanged =  curDay != mLastWriteDay;
+            long currElapsedTime = SystemClock.elapsedRealtime();
+            if (!force) {
+                if (((currElapsedTime-mLastWriteElapsedTime) < FILE_WRITE_INTERVAL) &&
+                        (!dayChanged)) {
+                    // wait till the next update
+                    return;
+                }
             }
             // Get the most recent file
-            String todayStr = getCurrentDateStr(mFilePrefix);
+            mFileLeaf = getCurrentDateStr(FILE_PREFIX);
             // Copy current file to back up
             File backupFile =  new File(mFile.getPath() + ".bak");
             mFile.renameTo(backupFile);
             try {
-                checkFileLimitFLOCK();
-                mFile.createNewFile();
                 // Write mStats to file
                 writeStatsFLOCK();
-                mLastWriteRealTime = currRealTime;
-                mLastTime = currTime;
+                mLastWriteElapsedTime = currElapsedTime;
                 if (dayChanged) {
+                    mLastWriteDay = curDay;
                     // clear stats
                     synchronized (mStats) {
                         mStats.clear();
                     }
-                    mFile = new File(todayStr);
+                    mFile = new File(mDir, mFileLeaf);
+                    checkFileLimitFLOCK();
                 }
                 // Delete the backup file
                 if (backupFile != null) {
@@ -278,6 +380,7 @@
             } catch (IOException e) {
                 Log.w(TAG, "Failed writing stats to file:" + mFile);
                 if (backupFile != null) {
+                    mFile.delete();
                     backupFile.renameTo(mFile);
                 }
             }
@@ -286,22 +389,26 @@
 
     private void writeStatsFLOCK() throws IOException {
         FileOutputStream stream = new FileOutputStream(mFile);
-        Parcel out = Parcel.obtain();
-        writeStatsToParcelFLOCK(out);
-        stream.write(out.marshall());
-        out.recycle();
-        stream.flush();
-        stream.close();
+        try {
+            Parcel out = Parcel.obtain();
+            writeStatsToParcelFLOCK(out);
+            stream.write(out.marshall());
+            out.recycle();
+            stream.flush();
+        } finally {
+            stream.close();
+        }
     }
 
     private void writeStatsToParcelFLOCK(Parcel out) {
         synchronized (mStatsLock) {
+            out.writeInt(VERSION);
             Set<String> keys = mStats.keySet();
+            out.writeInt(keys.size());
             for (String key : keys) {
                 PkgUsageStatsExtended pus = mStats.get(key);
                 out.writeString(key);
-                out.writeInt(pus.mLaunchCount);
-                out.writeLong(pus.mUsageTime);
+                pus.writeToParcel(out);
             }
         }
     }
@@ -355,6 +462,10 @@
             return;
         }
         if (localLOGV) Log.i(TAG, "paused component:"+pkgName);
+        
+        // Persist current data to file if needed.
+        writeStatsToFile(false);
+        
         synchronized (mStatsLock) {
             PkgUsageStatsExtended pus = mStats.get(pkgName);
             if (pus == null) {
@@ -364,8 +475,25 @@
             }
             pus.updatePause();
         }
-        // Persist data to file
-        writeStatsToFile();
+    }
+    
+    public void noteLaunchTime(ComponentName componentName, int millis) {
+        enforceCallingPermission();
+        String pkgName;
+        if ((componentName == null) ||
+                ((pkgName = componentName.getPackageName()) == null)) {
+            return;
+        }
+        
+        // Persist current data to file if needed.
+        writeStatsToFile(false);
+        
+        synchronized (mStatsLock) {
+            PkgUsageStatsExtended pus = mStats.get(pkgName);
+            if (pus != null) {
+                pus.addLaunchTime(componentName.getClassName(), millis);
+            }
+        }
     }
     
     public void enforceCallingPermission() {
@@ -432,27 +560,25 @@
         }
     }
     
-    private void collectDumpInfoFLOCK(PrintWriter pw, String[] args) {
+    private void collectDumpInfoFLOCK(PrintWriter pw, boolean isCompactOutput,
+            boolean deleteAfterPrint) {
         List<String> fileList = getUsageStatsFileListFLOCK();
         if (fileList == null) {
             return;
         }
-        final boolean isCheckinRequest = scanArgs(args, "-c");
         Collections.sort(fileList);
-        File usageFile = new File(mFilePrefix);
-        String dirName = usageFile.getParent();
-        File dir = new File(dirName);
-        String filePrefix = usageFile.getName();
-        // file name followed by dot
-        int prefixLen = filePrefix.length()+1;
-        String todayStr = getCurrentDateStr(null);
         for (String file : fileList) {
-            File dFile = new File(dir, file);
-            String dateStr = file.substring(prefixLen);
+            if (deleteAfterPrint && file.equalsIgnoreCase(mFileLeaf)) {
+                // In this mode we don't print the current day's stats, since
+                // they are incomplete.
+                continue;
+            }
+            File dFile = new File(mDir, file);
+            String dateStr = file.substring(FILE_PREFIX.length());
             try {
                 Parcel in = getParcelForFile(dFile);
-                collectDumpInfoFromParcelFLOCK(in, pw, dateStr, isCheckinRequest);
-                if (isCheckinRequest && !todayStr.equalsIgnoreCase(dateStr)) {
+                collectDumpInfoFromParcelFLOCK(in, pw, dateStr, isCompactOutput);
+                if (deleteAfterPrint) {
                     // Delete old file after collecting info only for checkin requests
                     dFile.delete();
                 }
@@ -466,40 +592,101 @@
     }
     
     private void collectDumpInfoFromParcelFLOCK(Parcel in, PrintWriter pw,
-            String date, boolean isCheckinRequest) {
-        StringBuilder sb = new StringBuilder();
-        sb.append("Date:");
-        sb.append(date);
-        boolean first = true;
-        while (in.dataAvail() > 0) {
-            String pkgName = in.readString();
-            int launchCount = in.readInt();
-            long usageTime = in.readLong();
-            if (isCheckinRequest) {
-                if (!first) {
-                    sb.append(",");
-                }
-                sb.append(pkgName);
-                sb.append(",");
-                sb.append(launchCount);
-                sb.append(",");
-                sb.append(usageTime);
-                sb.append("ms");
-            } else {
-                if (first) {
-                    sb.append("\n");
-                }
-                sb.append("pkg=");
-                sb.append(pkgName);
-                sb.append(", launchCount=");
-                sb.append(launchCount);
-                sb.append(", usageTime=");
-                sb.append(usageTime);
-                sb.append(" ms\n");
-            }
-            first = false;
+            String date, boolean isCompactOutput) {
+        StringBuilder sb = new StringBuilder(512);
+        if (isCompactOutput) {
+            sb.append("D:");
+            sb.append(CHECKIN_VERSION);
+            sb.append(',');
+        } else {
+            sb.append("Date: ");
         }
-        pw.write(sb.toString());
+        
+        sb.append(date);
+        
+        int vers = in.readInt();
+        if (vers != VERSION) {
+            sb.append(" (old data version)");
+            pw.println(sb.toString());
+            return;
+        }
+        
+        pw.println(sb.toString());
+        int N = in.readInt();
+        
+        while (N > 0) {
+            N--;
+            String pkgName = in.readString();
+            if (pkgName == null) {
+                break;
+            }
+            sb.setLength(0);
+            PkgUsageStatsExtended pus = new PkgUsageStatsExtended(in);
+            if (isCompactOutput) {
+                sb.append("P:");
+                sb.append(pkgName);
+                sb.append(",");
+                sb.append(pus.mLaunchCount);
+                sb.append(",");
+                sb.append(pus.mUsageTime);
+                sb.append('\n');
+                final int NC = pus.mLaunchTimes.size();
+                if (NC > 0) {
+                    for (Map.Entry<String, TimeStats> ent : pus.mLaunchTimes.entrySet()) {
+                        sb.append("A:");
+                        sb.append(ent.getKey());
+                        TimeStats times = ent.getValue();
+                        for (int i=0; i<NUM_LAUNCH_TIME_BINS; i++) {
+                            sb.append(",");
+                            sb.append(times.times[i]);
+                        }
+                        sb.append('\n');
+                    }
+                }
+                
+            } else {
+                sb.append("  ");
+                sb.append(pkgName);
+                sb.append(": ");
+                sb.append(pus.mLaunchCount);
+                sb.append(" times, ");
+                sb.append(pus.mUsageTime);
+                sb.append(" ms");
+                sb.append('\n');
+                final int NC = pus.mLaunchTimes.size();
+                if (NC > 0) {
+                    for (Map.Entry<String, TimeStats> ent : pus.mLaunchTimes.entrySet()) {
+                        sb.append("    ");
+                        sb.append(ent.getKey());
+                        TimeStats times = ent.getValue();
+                        int lastBin = 0;
+                        boolean first = true;
+                        for (int i=0; i<NUM_LAUNCH_TIME_BINS-1; i++) {
+                            if (times.times[i] != 0) {
+                                sb.append(first ? ": " : ", ");
+                                sb.append(lastBin);
+                                sb.append('-');
+                                sb.append(LAUNCH_TIME_BINS[i]);
+                                sb.append('=');
+                                sb.append(times.times[i]);
+                                first = false;
+                            }
+                            lastBin = LAUNCH_TIME_BINS[i];
+                        }
+                        if (times.times[NUM_LAUNCH_TIME_BINS-1] != 0) {
+                            sb.append(first ? ": " : ", ");
+                            sb.append(">=");
+                            sb.append(lastBin);
+                            sb.append('=');
+                            sb.append(times.times[NUM_LAUNCH_TIME_BINS-1]);
+                        }
+                        sb.append('\n');
+                    }
+                }
+            }
+            
+            pw.write(sb.toString());
+        }
     }
     
     /**
@@ -524,8 +711,19 @@
      * The data persisted to file is parsed and the stats are computed. 
      */
     protected void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
+        final boolean isCheckinRequest = scanArgs(args, "--checkin");
+        final boolean isCompactOutput = isCheckinRequest || scanArgs(args, "-c");
+        final boolean deleteAfterPrint = isCheckinRequest || scanArgs(args, "-d");
+        
+        // Make sure the current stats are written to the file.  This
+        // doesn't need to be done if we are deleting files after printing,
+        // since it that case we won't print the current stats.
+        if (!deleteAfterPrint) {
+            writeStatsToFile(true);
+        }
+        
         synchronized (mFileLock) {
-            collectDumpInfoFLOCK(pw, args);
+            collectDumpInfoFLOCK(pw, isCompactOutput, deleteAfterPrint);
         }
     }
 
diff --git a/telephony/java/com/android/internal/telephony/DriverCall.java b/telephony/java/com/android/internal/telephony/DriverCall.java
index 6c4e71f..0d9a60f 100644
--- a/telephony/java/com/android/internal/telephony/DriverCall.java
+++ b/telephony/java/com/android/internal/telephony/DriverCall.java
@@ -44,8 +44,11 @@
     public String number;
     public int TOA;
     public boolean isVoice;
+    public boolean isVoicePrivacy;
     public int als;
     public int numberPresentation;
+    public String name;
+    public int namePresentation;
 
     /** returns null on error */
     static DriverCall
@@ -101,11 +104,15 @@
     public String
     toString() {
         return "id=" + index + ","
-                + (isMT ? "mt" : "mo") + ","
                 + state + ","
-                + (isVoice ? "voice" : "no_voc") + ","
+                + "toa=" + TOA + ","
                 + (isMpty ? "conf" : "norm") + ","
-                + TOA + "," + als + ",cli " + numberPresentation;
+                + (isMT ? "mt" : "mo") + ","
+                + als + ","
+                + (isVoice ? "voc" : "nonvoc") + ","
+                + (isVoicePrivacy ? "evp" : "noevp") + ","
+                /*+ "number=" + number */ + ",cli=" + numberPresentation + ","
+                /*+ "name="+ name */ + "," + namePresentation;
     }
 
     public static State
diff --git a/telephony/java/com/android/internal/telephony/IccConstants.java b/telephony/java/com/android/internal/telephony/IccConstants.java
index 59ce5bb..014fbb6 100644
--- a/telephony/java/com/android/internal/telephony/IccConstants.java
+++ b/telephony/java/com/android/internal/telephony/IccConstants.java
@@ -21,39 +21,44 @@
  */
 public interface IccConstants {
     // GSM SIM file ids from TS 51.011
-    public static final int EF_ADN = 0x6F3A;
-    public static final int EF_FDN = 0x6F3B;
-    public static final int EF_SDN = 0x6F49;
-    public static final int EF_EXT1 = 0x6F4A;
-    public static final int EF_EXT2 = 0x6F4B;
-    public static final int EF_EXT3 = 0x6F4C;
-    public static final int EF_EXT6 = 0x6fc8;   // Ext record for EF[MBDN]
-    public static final int EF_MWIS = 0x6FCA;
-    public static final int EF_MBDN = 0x6fc7;
-    public static final int EF_PNN = 0x6fc5;
-    public static final int EF_SPN = 0x6F46;
-    public static final int EF_SMS = 0x6F3C;
-    public static final int EF_ICCID = 0x2fe2;
-    public static final int EF_AD = 0x6FAD;
-    public static final int EF_MBI = 0x6fc9;
-    public static final int EF_MSISDN = 0x6f40;
-    public static final int EF_SPDI = 0x6fcd;
-    public static final int EF_SST = 0x6f38;
-    public static final int EF_CFIS = 0x6FCB;
-    public static final int EF_IMG = 0x4f20;
+    static final int EF_ADN = 0x6F3A;
+    static final int EF_FDN = 0x6F3B;
+    static final int EF_SDN = 0x6F49;
+    static final int EF_EXT1 = 0x6F4A;
+    static final int EF_EXT2 = 0x6F4B;
+    static final int EF_EXT3 = 0x6F4C;
+    static final int EF_EXT6 = 0x6fc8;   // Ext record for EF[MBDN]
+    static final int EF_MWIS = 0x6FCA;
+    static final int EF_MBDN = 0x6fc7;
+    static final int EF_PNN = 0x6fc5;
+    static final int EF_SPN = 0x6F46;
+    static final int EF_SMS = 0x6F3C;
+    static final int EF_ICCID = 0x2fe2;
+    static final int EF_AD = 0x6FAD;
+    static final int EF_MBI = 0x6fc9;
+    static final int EF_MSISDN = 0x6f40;
+    static final int EF_SPDI = 0x6fcd;
+    static final int EF_SST = 0x6f38;
+    static final int EF_CFIS = 0x6FCB;
+    static final int EF_IMG = 0x4f20;
 
     // GSM SIM file ids from CPHS (phase 2, version 4.2) CPHS4_2.WW6
-    public static final int EF_MAILBOX_CPHS = 0x6F17;
-    public static final int EF_VOICE_MAIL_INDICATOR_CPHS = 0x6F11;
-    public static final int EF_CFF_CPHS = 0x6F13;
-    public static final int EF_SPN_CPHS = 0x6f14;
-    public static final int EF_SPN_SHORT_CPHS = 0x6f18;
-    public static final int EF_INFO_CPHS = 0x6f16;
+    static final int EF_MAILBOX_CPHS = 0x6F17;
+    static final int EF_VOICE_MAIL_INDICATOR_CPHS = 0x6F11;
+    static final int EF_CFF_CPHS = 0x6F13;
+    static final int EF_SPN_CPHS = 0x6f14;
+    static final int EF_SPN_SHORT_CPHS = 0x6f18;
+    static final int EF_INFO_CPHS = 0x6f16;
 
     // CDMA RUIM file ids from 3GPP2 C.S0023-0
-    public static final int EF_CST = 0x6f32;
-    public static final int EF_RUIM_SPN =0x6F41;
+    static final int EF_CST = 0x6f32;
+    static final int EF_RUIM_SPN =0x6F41;
 
     // SMS record length from TS 51.011 10.5.3
     static public final int SMS_RECORD_LENGTH = 176;
+
+    static final String MF_SIM = "3F00";
+    static final String DF_TELECOM = "7F10";
+    static final String DF_GRAPHICS = "5F50";
+    static final String DF_GSM = "7F20";
 }
diff --git a/telephony/java/com/android/internal/telephony/IccFileHandler.java b/telephony/java/com/android/internal/telephony/IccFileHandler.java
index e751c5e..92ddd2c 100644
--- a/telephony/java/com/android/internal/telephony/IccFileHandler.java
+++ b/telephony/java/com/android/internal/telephony/IccFileHandler.java
@@ -23,7 +23,7 @@
 /**
  * {@hide}
  */
-public abstract class IccFileHandler extends Handler {
+public abstract class IccFileHandler extends Handler implements IccConstants {
 
     //from TS 11.11 9.1 or elsewhere
     static protected final int COMMAND_READ_BINARY = 0xb0;
@@ -145,7 +145,7 @@
             = obtainMessage(EVENT_GET_RECORD_SIZE_DONE,
                         new LoadLinearFixedContext(fileid, recordNum, onLoaded));
 
-        phone.mCM.iccIO(COMMAND_GET_RESPONSE, fileid, null,
+        phone.mCM.iccIO(COMMAND_GET_RESPONSE, fileid, getEFPath(fileid),
                         0, 0, GET_RESPONSE_EF_SIZE_BYTES, null, null, response);
     }
 
@@ -163,6 +163,7 @@
                 new LoadLinearFixedContext(IccConstants.EF_IMG, recordNum,
                         onLoaded));
 
+        // TODO(): Verify when path changes are done.
         phone.mCM.iccIO(COMMAND_GET_RESPONSE, IccConstants.EF_IMG, "img",
                 recordNum, READ_RECORD_MODE_ABSOLUTE,
                 GET_RESPONSE_EF_IMG_SIZE_BYTES, null, null, response);
@@ -181,7 +182,7 @@
         Message response
                 = obtainMessage(EVENT_GET_EF_LINEAR_RECORD_SIZE_DONE,
                         new LoadLinearFixedContext(fileid, onLoaded));
-        phone.mCM.iccIO(COMMAND_GET_RESPONSE, fileid, null,
+        phone.mCM.iccIO(COMMAND_GET_RESPONSE, fileid, getEFPath(fileid),
                     0, 0, GET_RESPONSE_EF_SIZE_BYTES, null, null, response);
     }
 
@@ -198,7 +199,7 @@
         Message response = obtainMessage(EVENT_GET_RECORD_SIZE_DONE,
                         new LoadLinearFixedContext(fileid,onLoaded));
 
-        phone.mCM.iccIO(COMMAND_GET_RESPONSE, fileid, null,
+        phone.mCM.iccIO(COMMAND_GET_RESPONSE, fileid, getEFPath(fileid),
                         0, 0, GET_RESPONSE_EF_SIZE_BYTES, null, null, response);
     }
 
@@ -216,7 +217,7 @@
         Message response = obtainMessage(EVENT_GET_BINARY_SIZE_DONE,
                         fileid, 0, onLoaded);
 
-        phone.mCM.iccIO(COMMAND_GET_RESPONSE, fileid, null,
+        phone.mCM.iccIO(COMMAND_GET_RESPONSE, fileid, getEFPath(fileid),
                         0, 0, GET_RESPONSE_EF_SIZE_BYTES, null, null, response);
     }
 
@@ -250,7 +251,7 @@
      */
     public void updateEFLinearFixed(int fileid, int recordNum, byte[] data,
             String pin2, Message onComplete) {
-        phone.mCM.iccIO(COMMAND_UPDATE_RECORD, fileid, null,
+        phone.mCM.iccIO(COMMAND_UPDATE_RECORD, fileid, getEFPath(fileid),
                         recordNum, READ_RECORD_MODE_ABSOLUTE, data.length,
                         IccUtils.bytesToHexString(data), pin2, onComplete);
     }
@@ -261,7 +262,7 @@
      * @param data must be exactly as long as the EF
      */
     public void updateEFTransparent(int fileid, byte[] data, Message onComplete) {
-        phone.mCM.iccIO(COMMAND_UPDATE_BINARY, fileid, null,
+        phone.mCM.iccIO(COMMAND_UPDATE_BINARY, fileid, getEFPath(fileid),
                         0, 0, data.length,
                         IccUtils.bytesToHexString(data), null, onComplete);
     }
@@ -394,7 +395,7 @@
                      lc.results = new ArrayList<byte[]>(lc.countRecords);
                  }
 
-                 phone.mCM.iccIO(COMMAND_READ_RECORD, lc.efid, null,
+                 phone.mCM.iccIO(COMMAND_READ_RECORD, lc.efid, getEFPath(lc.efid),
                          lc.recordNum,
                          READ_RECORD_MODE_ABSOLUTE,
                          lc.recordSize, null, null,
@@ -432,7 +433,7 @@
                 size = ((data[RESPONSE_DATA_FILE_SIZE_1] & 0xff) << 8)
                        + (data[RESPONSE_DATA_FILE_SIZE_2] & 0xff);
 
-                phone.mCM.iccIO(COMMAND_READ_BINARY, fileid, null,
+                phone.mCM.iccIO(COMMAND_READ_BINARY, fileid, getEFPath(fileid),
                                 0, 0, size, null, null,
                                 obtainMessage(EVENT_READ_BINARY_DONE,
                                               fileid, 0, response));
@@ -467,7 +468,7 @@
                     if (lc.recordNum > lc.countRecords) {
                         sendResult(response, lc.results, null);
                     } else {
-                        phone.mCM.iccIO(COMMAND_READ_RECORD, lc.efid, null,
+                        phone.mCM.iccIO(COMMAND_READ_RECORD, lc.efid, getEFPath(lc.efid),
                                     lc.recordNum,
                                     READ_RECORD_MODE_ABSOLUTE,
                                     lc.recordSize, null, null,
@@ -506,6 +507,36 @@
         }
     }
 
+    /**
+     * Returns the root path of the EF file.
+     * i.e returns MasterFile + DFfile as a string.
+     * Ex: For EF_ADN on a SIM, it will return "3F007F10"
+     * This function handles only EFids that are common to
+     * RUIM, SIM, USIM and other types of Icc cards.
+     *
+     * @param efId
+     * @return root path of the file.
+     */
+    protected String getCommonIccEFPath(int efid) {
+        switch(efid) {
+        case EF_ADN:
+        case EF_FDN:
+        case EF_MSISDN:
+        case EF_SDN:
+        case EF_EXT1:
+        case EF_EXT2:
+        case EF_EXT3:
+            return MF_SIM + DF_TELECOM;
+
+        case EF_ICCID:
+            return MF_SIM;
+        case EF_IMG:
+            return MF_SIM + DF_TELECOM + DF_GRAPHICS;
+        }
+        return null;
+    }
+
+    protected abstract String getEFPath(int efid);
     protected abstract void logd(String s);
 
     protected abstract void loge(String s);
diff --git a/telephony/java/com/android/internal/telephony/Phone.java b/telephony/java/com/android/internal/telephony/Phone.java
index ed90d32..3f210ca 100644
--- a/telephony/java/com/android/internal/telephony/Phone.java
+++ b/telephony/java/com/android/internal/telephony/Phone.java
@@ -113,9 +113,12 @@
     static final String APN_TYPE_DEFAULT = "default";
     /** APN type for MMS traffic */
     static final String APN_TYPE_MMS = "mms";
+    /** APN type for SUPL assisted GPS */
+    static final String APN_TYPE_SUPL = "supl";
 
     // "Features" accessible through the connectivity manager
     static final String FEATURE_ENABLE_MMS = "enableMMS";
+    static final String FEATURE_ENABLE_SUPL = "enableSUPL";
 
     /**
      * Return codes for <code>enableApnType()</code>
@@ -170,7 +173,7 @@
     int NT_MODE_EVDO_NO_CDMA = 6; /* EvDo only */
     int NT_MODE_GLOBAL       = 7; /* GSM/WCDMA, CDMA, and EvDo (auto mode, according to PRL)
                                      AVAILABLE Application Settings menu*/
-    int PREFERRED_NT_MODE    = NT_MODE_GLOBAL;
+    int PREFERRED_NT_MODE    = NT_MODE_GSM_ONLY;
 
 
     // Used for CDMA roaming mode
diff --git a/telephony/java/com/android/internal/telephony/PhoneFactory.java b/telephony/java/com/android/internal/telephony/PhoneFactory.java
index 3db0499..86e2f04 100644
--- a/telephony/java/com/android/internal/telephony/PhoneFactory.java
+++ b/telephony/java/com/android/internal/telephony/PhoneFactory.java
@@ -108,26 +108,23 @@
                 sCommandsInterface = new RIL(context, networkMode, cdmaSubscription);
 
                 switch(networkMode) {
+                    case RILConstants.NETWORK_MODE_CDMA:
+                    case RILConstants.NETWORK_MODE_CDMA_NO_EVDO:
+                    case RILConstants.NETWORK_MODE_EVDO_NO_CDMA:
+                    case RILConstants.NETWORK_MODE_GLOBAL:
+                        sProxyPhone = new PhoneProxy(new CDMAPhone(context,
+                                sCommandsInterface, sPhoneNotifier));
+                        Log.i(LOG_TAG, "Creating CDMAPhone");
+                        break;
                     case RILConstants.NETWORK_MODE_WCDMA_PREF:
                     case RILConstants.NETWORK_MODE_GSM_ONLY:
                     case RILConstants.NETWORK_MODE_WCDMA_ONLY:
                     case RILConstants.NETWORK_MODE_GSM_UMTS:
+                    default:
                         sProxyPhone = new PhoneProxy(new GSMPhone(context,
                                 sCommandsInterface, sPhoneNotifier));
                         Log.i(LOG_TAG, "Creating GSMPhone");
                         break;
-                    case RILConstants.NETWORK_MODE_CDMA:
-                    case RILConstants.NETWORK_MODE_CDMA_NO_EVDO:
-                    case RILConstants.NETWORK_MODE_EVDO_NO_CDMA:
-                        sProxyPhone = new PhoneProxy(new CDMAPhone(context,
-                                sCommandsInterface, sPhoneNotifier));
-                        Log.i(LOG_TAG, "Creating CDMAPhone");
-                        break;
-                    case RILConstants.NETWORK_MODE_GLOBAL:
-                    default:
-                        sProxyPhone = new PhoneProxy(new CDMAPhone(context,
-                                sCommandsInterface, sPhoneNotifier));
-                        Log.i(LOG_TAG, "Creating CDMAPhone");
                 }
                 sMadeDefaults = true;
             }
@@ -160,5 +157,3 @@
         }
     }
 }
-
-
diff --git a/telephony/java/com/android/internal/telephony/RIL.java b/telephony/java/com/android/internal/telephony/RIL.java
index f5d3b32..cebbe5c 100644
--- a/telephony/java/com/android/internal/telephony/RIL.java
+++ b/telephony/java/com/android/internal/telephony/RIL.java
@@ -234,6 +234,11 @@
 
     static final int SOCKET_OPEN_RETRY_MILLIS = 4 * 1000;
 
+    // The number of the required config values for broadcast SMS stored in the C struct
+    // RIL_CDMA_BroadcastServiceInfo
+    private static final int CDMA_BSI_NO_OF_INTS_STRUCT = 3;
+
+    private static final int CDMA_BROADCAST_SMS_NO_OF_SERVICE_CATEGORIES = 31;
 
     BroadcastReceiver mIntentReceiver = new BroadcastReceiver() {
         public void onReceive(Context context, Intent intent) {
@@ -565,22 +570,18 @@
         mNetworkMode = networkMode;
         //At startup mPhoneType is first set from networkMode
         switch(networkMode) {
+            case RILConstants.NETWORK_MODE_CDMA:
+            case RILConstants.NETWORK_MODE_CDMA_NO_EVDO:
+            case RILConstants.NETWORK_MODE_EVDO_NO_CDMA:
+            case RILConstants.NETWORK_MODE_GLOBAL:
+                mPhoneType = RILConstants.CDMA_PHONE;
+                break;
             case RILConstants.NETWORK_MODE_WCDMA_PREF:
             case RILConstants.NETWORK_MODE_GSM_ONLY:
             case RILConstants.NETWORK_MODE_WCDMA_ONLY:
             case RILConstants.NETWORK_MODE_GSM_UMTS:
-                mPhoneType = RILConstants.GSM_PHONE;
-                break;
-            case RILConstants.NETWORK_MODE_CDMA:
-            case RILConstants.NETWORK_MODE_CDMA_NO_EVDO:
-            case RILConstants.NETWORK_MODE_EVDO_NO_CDMA:
-                mPhoneType = RILConstants.CDMA_PHONE;
-                break;
-            case RILConstants.NETWORK_MODE_GLOBAL:
-                mPhoneType = RILConstants.CDMA_PHONE;
-                break;
             default:
-                mPhoneType = RILConstants.CDMA_PHONE;
+                mPhoneType = RILConstants.GSM_PHONE;
         }
 
         PowerManager pm = (PowerManager)context.getSystemService(Context.POWER_SERVICE);
@@ -2021,7 +2022,7 @@
             case RIL_REQUEST_CDMA_QUERY_PREFERRED_VOICE_PRIVACY_MODE: ret =  responseInts(p); break;
             case RIL_REQUEST_CDMA_FLASH: ret =  responseVoid(p); break;
             case RIL_REQUEST_CDMA_BURST_DTMF: ret =  responseVoid(p); break;
-            case RIL_REQUEST_CDMA_SEND_SMS: ret =  responseVoid(p); break;
+            case RIL_REQUEST_CDMA_SEND_SMS: ret =  responseSMS(p); break;
             case RIL_REQUEST_CDMA_SMS_ACKNOWLEDGE: ret =  responseVoid(p); break;
             case RIL_REQUEST_GET_BROADCAST_CONFIG: ret =  responseBR_SMS_CNF(p); break;
             case RIL_REQUEST_SET_BROADCAST_CONFIG: ret =  responseVoid(p); break;
@@ -2629,8 +2630,16 @@
             dc.als = p.readInt();
             voiceSettings = p.readInt();
             dc.isVoice = (0 == voiceSettings) ? false : true;
+
+            //dc.isVoicePrivacy = (0 != p.readInt());
+            int voicePrivacy = p.readInt();
+            dc.isVoicePrivacy = (0 != voicePrivacy);
+
             dc.number = p.readString();
-            dc.numberPresentation = DriverCall.presentationFromCLIP(p.readInt());
+            int np = p.readInt();
+            dc.numberPresentation = DriverCall.presentationFromCLIP(np);
+            dc.name = p.readString();
+            dc.namePresentation = p.readInt();
 
             // Make sure there's a leading + on addresses with a TOA
             // of 145
@@ -2668,7 +2677,7 @@
             PDPContextState pdp = new PDPContextState();
 
             pdp.cid = p.readInt();
-            pdp.active = p.readInt() == 0 ? false : true;
+            pdp.active = p.readInt();
             pdp.type = p.readString();
             pdp.apn = p.readString();
             pdp.address = p.readString();
@@ -2734,16 +2743,37 @@
 
     private Object
     responseCDMA_BR_CNF(Parcel p) {
-        int numInts;
+        int numServiceCategories;
         int response[];
 
-        numInts = p.readInt();
+        numServiceCategories = p.readInt();
 
-        response = new int[numInts];
+        if (numServiceCategories == 0) {
+            int numInts;
+            numInts = CDMA_BROADCAST_SMS_NO_OF_SERVICE_CATEGORIES * CDMA_BSI_NO_OF_INTS_STRUCT + 1;
+            response = new int[numInts];
 
-        response[0] = numInts;
-        for (int i = 1 ; i < numInts; i++) {
-            response[i] = p.readInt();
+            // indicate that a zero length table was received
+            response[0] = 0;
+            //for all supported service categories set 'english' as default language
+            //and selection status to false
+            for (int i = 1, j = 1
+                    ; i <= (CDMA_BROADCAST_SMS_NO_OF_SERVICE_CATEGORIES
+                                * CDMA_BSI_NO_OF_INTS_STRUCT)
+                                        ; i += CDMA_BSI_NO_OF_INTS_STRUCT, j++ ) {
+                response[i] = j;
+                response[i+1] = 1;
+                response[i+2] = 0;
+            }
+        } else {
+            int numInts;
+            numInts = numServiceCategories * CDMA_BSI_NO_OF_INTS_STRUCT + 1;
+            response = new int[numInts];
+
+            response[0] = numServiceCategories;
+            for (int i = 1 ; i < numInts; i++) {
+                 response[i] = p.readInt();
+             }
         }
 
         return response;
@@ -3032,10 +3062,13 @@
     public void setCdmaBroadcastConfig(int[] configValuesArray, Message response) {
         RILRequest rr = RILRequest.obtain(RIL_REQUEST_CDMA_SET_BROADCAST_CONFIG, response);
 
-        for(int i = 0; i < configValuesArray.length; i++) {
+        rr.mp.writeInt(configValuesArray[0]);
+        for(int i = 1; i <= (configValuesArray[0] * 3); i++) {
             rr.mp.writeInt(configValuesArray[i]);
         }
 
+        if (RILJ_LOGD) riljLog(rr.serialString() + "> " + requestToString(rr.mRequest));
+
         send(rr);
     }
 
@@ -3045,6 +3078,8 @@
         rr.mp.writeInt(1);
         rr.mp.writeInt(activate);
 
+        if (RILJ_LOGD) riljLog(rr.serialString() + "> " + requestToString(rr.mRequest));
+
         send(rr);
     }
 }
diff --git a/telephony/java/com/android/internal/telephony/RILConstants.java b/telephony/java/com/android/internal/telephony/RILConstants.java
index 028aad7..9c63627 100644
--- a/telephony/java/com/android/internal/telephony/RILConstants.java
+++ b/telephony/java/com/android/internal/telephony/RILConstants.java
@@ -51,7 +51,7 @@
     int NETWORK_MODE_EVDO_NO_CDMA   = 6; /* EvDo only */
     int NETWORK_MODE_GLOBAL         = 7; /* GSM/WCDMA, CDMA, and EvDo (auto mode, according to PRL)
                                             AVAILABLE Application Settings menu*/
-    int PREFERRED_NETWORK_MODE      = NETWORK_MODE_GLOBAL;
+    int PREFERRED_NETWORK_MODE      = NETWORK_MODE_GSM_ONLY;
 
     /* CDMA subscription source. See ril.h RIL_REQUEST_CDMA_SET_SUBSCRIPTION */
     int SUBSCRIPTION_FROM_RUIM      = 0; /* CDMA subscription from RUIM when available */
diff --git a/telephony/java/com/android/internal/telephony/ServiceStateTracker.java b/telephony/java/com/android/internal/telephony/ServiceStateTracker.java
index a4bf0dd..7274e99 100644
--- a/telephony/java/com/android/internal/telephony/ServiceStateTracker.java
+++ b/telephony/java/com/android/internal/telephony/ServiceStateTracker.java
@@ -98,7 +98,7 @@
     protected static final int EVENT_RESET_PREFERRED_NETWORK_TYPE      = 21;
     protected static final int EVENT_CHECK_REPORT_GPRS                 = 22;
     protected static final int EVENT_RESTRICTED_STATE_CHANGED          = 23;
-    
+
     //*****CDMA events:
     protected static final int EVENT_POLL_STATE_REGISTRATION_CDMA      = 24;
     protected static final int EVENT_POLL_STATE_OPERATOR_CDMA          = 25;
@@ -112,10 +112,6 @@
     protected static final int EVENT_SIGNAL_STRENGTH_UPDATE_CDMA       = 33;
     protected static final int EVENT_NV_LOADED                         = 34;
 
-    // Event Log Tags
-    protected static final int EVENT_LOG_CGREG_FAIL = 50107;
-    protected static final int EVENT_DATA_STATE_RADIO_OFF = 50108;
-
     //***** Time Zones
     protected static final String TIMEZONE_PROPERTY = "persist.sys.timezone";
 
@@ -241,4 +237,3 @@
         pollingContext = new int[1];
     }
 }
-
diff --git a/telephony/java/com/android/internal/telephony/SmsMessageBase.java b/telephony/java/com/android/internal/telephony/SmsMessageBase.java
index 7c32451..1aad38d 100644
--- a/telephony/java/com/android/internal/telephony/SmsMessageBase.java
+++ b/telephony/java/com/android/internal/telephony/SmsMessageBase.java
@@ -20,20 +20,7 @@
 import com.android.internal.telephony.SmsHeader;
 import java.util.Arrays;
 
-import static android.telephony.SmsMessage.ENCODING_7BIT;
-import static android.telephony.SmsMessage.ENCODING_16BIT;
-import static android.telephony.SmsMessage.MAX_USER_DATA_BYTES;
-import static android.telephony.SmsMessage.MAX_USER_DATA_BYTES_WITH_HEADER;
-import static android.telephony.SmsMessage.MAX_USER_DATA_SEPTETS;
-import static android.telephony.SmsMessage.MAX_USER_DATA_SEPTETS_WITH_HEADER;
 import static android.telephony.SmsMessage.MessageClass;
-import static com.android.internal.telephony.SmsAddress.TON_ABBREVIATED;
-import static com.android.internal.telephony.SmsAddress.TON_ALPHANUMERIC;
-import static com.android.internal.telephony.SmsAddress.TON_INTERNATIONAL;
-import static com.android.internal.telephony.SmsAddress.TON_NATIONAL;
-import static com.android.internal.telephony.SmsAddress.TON_NETWORK;
-import static com.android.internal.telephony.SmsAddress.TON_SUBSCRIBER;
-import static com.android.internal.telephony.SmsAddress.TON_UNKNOWN;
 
 /**
  * Base class declaring the specific methods and members for SmsMessage.
@@ -385,4 +372,3 @@
     }
 
 }
-
diff --git a/telephony/java/com/android/internal/telephony/TelephonyEventLog.java b/telephony/java/com/android/internal/telephony/TelephonyEventLog.java
index 1ef3c6c..97f9d7d 100644
--- a/telephony/java/com/android/internal/telephony/TelephonyEventLog.java
+++ b/telephony/java/com/android/internal/telephony/TelephonyEventLog.java
@@ -28,6 +28,6 @@
     public static final int EVENT_LOG_RADIO_PDP_SETUP_FAIL = 50105;
     public static final int EVENT_LOG_CALL_DROP = 50106;
     public static final int EVENT_LOG_CGREG_FAIL = 50107;
-    public static final int EVENT_DATA_STATE_RADIO_OFF = 50108;
+    public static final int EVENT_LOG_DATA_STATE_RADIO_OFF = 50108;
     public static final int EVENT_LOG_PDP_NETWORK_DROP = 50109;
 }
diff --git a/telephony/java/com/android/internal/telephony/cdma/CDMAPhone.java b/telephony/java/com/android/internal/telephony/cdma/CDMAPhone.java
old mode 100644
new mode 100755
index c139619..8ffb7ec
--- a/telephony/java/com/android/internal/telephony/cdma/CDMAPhone.java
+++ b/telephony/java/com/android/internal/telephony/cdma/CDMAPhone.java
@@ -475,6 +475,11 @@
             // we report data connected
 
             ret = DataState.CONNECTED;
+        } else if (mSST == null) {
+            // Radio Technology Change is ongoning, dispose() and removeReferences() have
+            // already been called
+
+            ret = DataState.DISCONNECTED;
         } else if (mSST.getCurrentCdmaDataConnectionState()
                 == ServiceState.RADIO_TECHNOLOGY_UNKNOWN) {
             // If we're out of service, open TCP sockets may still work
diff --git a/telephony/java/com/android/internal/telephony/cdma/CdmaDataConnectionTracker.java b/telephony/java/com/android/internal/telephony/cdma/CdmaDataConnectionTracker.java
index ed617ef..651c5051 100644
--- a/telephony/java/com/android/internal/telephony/cdma/CdmaDataConnectionTracker.java
+++ b/telephony/java/com/android/internal/telephony/cdma/CdmaDataConnectionTracker.java
@@ -64,7 +64,7 @@
     private static final String LOG_TAG = "CDMA";
     private static final boolean DBG = true;
 
-    //***** Instance Variables
+    private CDMAPhone mCdmaPhone;
 
     // Indicates baseband will not auto-attach
     private boolean noAutoAttach = false;
@@ -83,20 +83,19 @@
     private CdmaDataConnection mActiveDataConnection;
 
     /** Defined cdma connection profiles */
-    private static int EXTERNAL_NETWORK_DEFAULT_ID = 0;
-    private static int EXTERNAL_NETWORK_NUM_TYPES  = 1;
+    private static final int EXTERNAL_NETWORK_DEFAULT_ID = 0;
+    private static final int EXTERNAL_NETWORK_NUM_TYPES  = 1;
 
     private boolean[] dataEnabled = new boolean[EXTERNAL_NETWORK_NUM_TYPES];
 
-    //***** Constants
-
     /**
      * Pool size of CdmaDataConnection objects.
      */
     private static final int DATA_CONNECTION_POOL_SIZE = 1;
 
     private static final int POLL_CONNECTION_MILLIS = 5 * 1000;
-    private static final String INTENT_RECONNECT_ALARM = "com.android.internal.telephony.cdma-reconnect";
+    private static final String INTENT_RECONNECT_ALARM =
+            "com.android.internal.telephony.cdma-reconnect";
     private static final String INTENT_RECONNECT_ALARM_EXTRA_REASON = "reason";
 
     // Possibly promoate to base class, the only difference is
@@ -146,6 +145,7 @@
 
     CdmaDataConnectionTracker(CDMAPhone p) {
         super(p);
+        mCdmaPhone = p;
 
         p.mCM.registerForAvailable (this, EVENT_RADIO_AVAILABLE, null);
         p.mCM.registerForOffOrNotAvailable(this, EVENT_RADIO_OFF_OR_NOT_AVAILABLE, null);
@@ -187,15 +187,15 @@
         //Unregister from all events
         phone.mCM.unregisterForAvailable(this);
         phone.mCM.unregisterForOffOrNotAvailable(this);
-        ((CDMAPhone) phone).mRuimRecords.unregisterForRecordsLoaded(this);
+        mCdmaPhone.mRuimRecords.unregisterForRecordsLoaded(this);
         phone.mCM.unregisterForNVReady(this);
         phone.mCM.unregisterForDataStateChanged(this);
-        ((CDMAPhone) phone).mCT.unregisterForVoiceCallEnded(this);
-        ((CDMAPhone) phone).mCT.unregisterForVoiceCallStarted(this);
-        ((CDMAPhone) phone).mSST.unregisterForCdmaDataConnectionAttached(this);
-        ((CDMAPhone) phone).mSST.unregisterForCdmaDataConnectionDetached(this);
-        ((CDMAPhone) phone).mSST.unregisterForRoamingOn(this);
-        ((CDMAPhone) phone).mSST.unregisterForRoamingOff(this);
+        mCdmaPhone.mCT.unregisterForVoiceCallEnded(this);
+        mCdmaPhone.mCT.unregisterForVoiceCallStarted(this);
+        mCdmaPhone.mSST.unregisterForCdmaDataConnectionAttached(this);
+        mCdmaPhone.mSST.unregisterForCdmaDataConnectionDetached(this);
+        mCdmaPhone.mSST.unregisterForRoamingOn(this);
+        mCdmaPhone.mSST.unregisterForRoamingOff(this);
 
         phone.getContext().unregisterReceiver(this.mIntentReceiver);
         destroyAllDataConnectionList();
@@ -228,6 +228,9 @@
         Log.d(LOG_TAG, "Request to enableApnType("+type+")");
         if (TextUtils.equals(type, Phone.APN_TYPE_MMS)) {
             return Phone.APN_ALREADY_ACTIVE;
+        } else if (TextUtils.equals(type, Phone.APN_TYPE_SUPL)) {
+            Log.w(LOG_TAG, "Phone.APN_TYPE_SUPL not enabled for CDMA");
+            return Phone.APN_REQUEST_FAILED;
         } else {
             return Phone.APN_REQUEST_FAILED;
         }
@@ -274,10 +277,10 @@
     public boolean isDataConnectionAsDesired() {
         boolean roaming = phone.getServiceState().getRoaming();
 
-        if ( ((phone.mCM.getRadioState() == CommandsInterface.RadioState.NV_READY) || 
-		        ((CDMAPhone) phone).mRuimRecords.getRecordsLoaded()) &&
-                ((CDMAPhone) phone).mSST.getCurrentCdmaDataConnectionState() == 
-				ServiceState.STATE_IN_SERVICE &&
+        if (((phone.mCM.getRadioState() == CommandsInterface.RadioState.NV_READY) ||
+                 mCdmaPhone.mRuimRecords.getRecordsLoaded()) &&
+                (mCdmaPhone.mSST.getCurrentCdmaDataConnectionState() ==
+                 ServiceState.STATE_IN_SERVICE) &&
                 (!roaming || getDataOnRoamingEnabled()) &&
                 !mIsWifiConnected ) {
             return (state == State.CONNECTED);
@@ -350,7 +353,7 @@
             return true;
         }
 
-        int psState = ((CDMAPhone) phone).mSST.getCurrentCdmaDataConnectionState();
+        int psState = mCdmaPhone.mSST.getCurrentCdmaDataConnectionState();
         boolean roaming = phone.getServiceState().getRoaming();
 
         if ((state == State.IDLE || state == State.SCANNING)
@@ -358,9 +361,9 @@
                     psState == ServiceState.RADIO_TECHNOLOGY_EVDO_0 ||
                     psState == ServiceState.RADIO_TECHNOLOGY_EVDO_A)
                 && ((phone.mCM.getRadioState() == CommandsInterface.RadioState.NV_READY) ||
-                        ((CDMAPhone) phone).mRuimRecords.getRecordsLoaded())
-                && (((CDMAPhone) phone).mSST.isConcurrentVoiceAndData() ||
-                     phone.getState() == Phone.State.IDLE )
+                        mCdmaPhone.mRuimRecords.getRecordsLoaded())
+                && (mCdmaPhone.mSST.isConcurrentVoiceAndData() ||
+                        phone.getState() == Phone.State.IDLE )
                 && isDataAllowed()) {
 
             return setupData(reason);
@@ -371,8 +374,8 @@
                     " dataState=" + state +
                     " PS state=" + psState +
                     " radio state=" + phone.mCM.getRadioState() +
-                    " ruim=" + ((CDMAPhone) phone).mRuimRecords.getRecordsLoaded() +
-                    " concurrentVoice&Data=" + ((CDMAPhone) phone).mSST.isConcurrentVoiceAndData() +
+                    " ruim=" + mCdmaPhone.mRuimRecords.getRecordsLoaded() +
+                    " concurrentVoice&Data=" + mCdmaPhone.mSST.isConcurrentVoiceAndData() +
                     " phoneState=" + phone.getState() +
                     " dataEnabled=" + getAnyDataEnabled() +
                     " roaming=" + roaming +
@@ -778,7 +781,7 @@
      * @override com.android.internal.telephony.DataConnectionTracker
      */
     protected void onVoiceCallStarted() {
-        if (state == State.CONNECTED && !((CDMAPhone) phone).mSST.isConcurrentVoiceAndData()) {
+        if (state == State.CONNECTED && !mCdmaPhone.mSST.isConcurrentVoiceAndData()) {
             stopNetStatPoll();
             phone.notifyDataConnection(Phone.REASON_VOICE_CALL_STARTED);
         }
@@ -789,7 +792,7 @@
      */
     protected void onVoiceCallEnded() {
         if (state == State.CONNECTED) {
-            if (!((CDMAPhone) phone).mSST.isConcurrentVoiceAndData()) {
+            if (!mCdmaPhone.mSST.isConcurrentVoiceAndData()) {
                 startNetStatPoll();
                 phone.notifyDataConnection(Phone.REASON_VOICE_CALL_ENDED);
             } else {
@@ -815,14 +818,13 @@
         CdmaDataConnection dataConn;
 
        for (int i = 0; i < DATA_CONNECTION_POOL_SIZE; i++) {
-            dataConn = new CdmaDataConnection(((CDMAPhone) phone));
+            dataConn = new CdmaDataConnection(mCdmaPhone);
             dataConnectionList.add(dataConn);
        }
     }
 
     private void destroyAllDataConnectionList() {
         if(dataConnectionList != null) {
-            CdmaDataConnection pdp;
             dataConnectionList.removeAll(dataConnectionList);
         }
     }
diff --git a/telephony/java/com/android/internal/telephony/cdma/CdmaServiceStateTracker.java b/telephony/java/com/android/internal/telephony/cdma/CdmaServiceStateTracker.java
index ca40e76..d5cad1c 100644
--- a/telephony/java/com/android/internal/telephony/cdma/CdmaServiceStateTracker.java
+++ b/telephony/java/com/android/internal/telephony/cdma/CdmaServiceStateTracker.java
@@ -388,7 +388,7 @@
                 EventLog.List val = new EventLog.List(
                         dcTracker.getStateInString(),
                         (dcTracker.getAnyDataEnabled() ? 1 : 0) );
-                EventLog.writeEvent(TelephonyEventLog.EVENT_DATA_STATE_RADIO_OFF, val);
+                EventLog.writeEvent(TelephonyEventLog.EVENT_LOG_DATA_STATE_RADIO_OFF, val);
             }
             dcTracker.cleanConnectionBeforeRadioOff();
             
@@ -485,13 +485,17 @@
                         -1, //[3] baseStationLongitude
                          0, //[4] cssIndicator; init with 0, because it is treated as a boolean
                         -1, //[5] systemId
-                        -1  //[6] networkId
+                        -1, //[6] networkId
+                        -1, //[7] TSB-58 Roaming indicator // NEWRIL:TODO UNUSED
+                        -1, //[8] Indicates if current system is in PRL  // NEWRIL:TODO UNUSED
+                        -1, //[9] Is default roaming indicator from PRL // NEWRIL:TODO UNUSED
+                        -1, //[10] If registration state is 3 this is reason for denial // NEWRIL:TODO UNUSED
                 };
 
                 if (states.length > 0) {
                     try {
                         this.mRegistrationState = Integer.parseInt(states[0]);
-                        if (states.length == 10) {
+                        if (states.length >= 10) {
                             for(int i = 0; i < states.length - offset; i++) {
                                 if (states[i + offset] != null
                                   && states[i + offset].length() > 0) {
@@ -536,7 +540,7 @@
             case EVENT_POLL_STATE_OPERATOR_CDMA:
                 String opNames[] = (String[])ar.result;
 
-                if (opNames != null && opNames.length >= 4) {
+                if (opNames != null && opNames.length >= 3) {
                     newSS.setOperatorName (opNames[0], opNames[1], opNames[2]);
                 }
                 break;
diff --git a/telephony/java/com/android/internal/telephony/cdma/RuimFileHandler.java b/telephony/java/com/android/internal/telephony/cdma/RuimFileHandler.java
index 7d392f0..9de6c42 100644
--- a/telephony/java/com/android/internal/telephony/cdma/RuimFileHandler.java
+++ b/telephony/java/com/android/internal/telephony/cdma/RuimFileHandler.java
@@ -17,7 +17,6 @@
 package com.android.internal.telephony.cdma;
 
 import android.os.*;
-import android.os.AsyncResult;
 import android.util.Log;
 
 import com.android.internal.telephony.IccConstants;
@@ -68,6 +67,11 @@
         super.handleMessage(msg);
     }
 
+    protected String getEFPath(int efid) {
+        // TODO(): Implement for CDMA EFs.
+        return getCommonIccEFPath(efid);
+    }
+
     protected void logd(String msg) {
         Log.d(LOG_TAG, "[RuimFileHandler] " + msg);
     }
diff --git a/telephony/java/com/android/internal/telephony/cdma/RuimRecords.java b/telephony/java/com/android/internal/telephony/cdma/RuimRecords.java
index 13408cf..b18a3f1 100644
--- a/telephony/java/com/android/internal/telephony/cdma/RuimRecords.java
+++ b/telephony/java/com/android/internal/telephony/cdma/RuimRecords.java
@@ -53,6 +53,7 @@
     String mdn = null;  // My mobile number
     String h_sid;
     String h_nid;
+    String min2_min1;   // 10 digit MIN value MIN2+MIN1 NEWRIL:TODO currently unused
 
     // is not initialized
 
@@ -214,6 +215,9 @@
                 mdn    = localTemp[0];
                 h_sid  = localTemp[1];
                 h_nid  = localTemp[2];
+                if (localTemp.length >= 3) { // NEWRIL:TODO remove when new ril always returns min2_min1
+                    min2_min1 = localTemp[3];
+                }
 
                 Log.d(LOG_TAG, "MDN: " + mdn);
 
diff --git a/telephony/java/com/android/internal/telephony/cdma/SmsMessage.java b/telephony/java/com/android/internal/telephony/cdma/SmsMessage.java
index e4b474a..677d609 100644
--- a/telephony/java/com/android/internal/telephony/cdma/SmsMessage.java
+++ b/telephony/java/com/android/internal/telephony/cdma/SmsMessage.java
@@ -27,7 +27,6 @@
 import com.android.internal.telephony.SmsMessageBase;
 import com.android.internal.telephony.cdma.sms.BearerData;
 import com.android.internal.telephony.cdma.sms.CdmaSmsAddress;
-import com.android.internal.telephony.cdma.sms.SmsDataCoding;
 import com.android.internal.telephony.cdma.sms.SmsEnvelope;
 import com.android.internal.telephony.cdma.sms.UserData;
 
@@ -41,32 +40,11 @@
 import java.io.UnsupportedEncodingException;
 import java.util.Random;
 
-import static android.telephony.SmsMessage.ENCODING_7BIT;
-import static android.telephony.SmsMessage.ENCODING_8BIT;
-import static android.telephony.SmsMessage.ENCODING_16BIT;
-import static android.telephony.SmsMessage.ENCODING_UNKNOWN;
 import static android.telephony.SmsMessage.MAX_USER_DATA_BYTES;
 import static android.telephony.SmsMessage.MAX_USER_DATA_BYTES_WITH_HEADER;
 import static android.telephony.SmsMessage.MAX_USER_DATA_SEPTETS;
 import static android.telephony.SmsMessage.MAX_USER_DATA_SEPTETS_WITH_HEADER;
 import static android.telephony.SmsMessage.MessageClass;
-import static com.android.internal.telephony.cdma.sms.BearerData.ERROR_NONE;
-import static com.android.internal.telephony.cdma.sms.BearerData.ERROR_TEMPORARY;
-import static com.android.internal.telephony.cdma.sms.BearerData.ERROR_PERMANENT;
-import static com.android.internal.telephony.cdma.sms.BearerData.MESSAGE_TYPE_DELIVER;
-import static com.android.internal.telephony.cdma.sms.BearerData.MESSAGE_TYPE_SUBMIT;
-import static com.android.internal.telephony.cdma.sms.BearerData.MESSAGE_TYPE_CANCELLATION;
-import static com.android.internal.telephony.cdma.sms.BearerData.MESSAGE_TYPE_DELIVERY_ACK;
-import static com.android.internal.telephony.cdma.sms.BearerData.MESSAGE_TYPE_USER_ACK;
-import static com.android.internal.telephony.cdma.sms.BearerData.MESSAGE_TYPE_READ_ACK;
-import static com.android.internal.telephony.cdma.sms.CdmaSmsAddress.SMS_ADDRESS_MAX;
-import static com.android.internal.telephony.cdma.sms.CdmaSmsAddress.SMS_SUBADDRESS_MAX;
-import static com.android.internal.telephony.cdma.sms.SmsEnvelope.SMS_BEARER_DATA_MAX;
-import static com.android.internal.telephony.cdma.sms.UserData.UD_ENCODING_7BIT_ASCII;
-import static com.android.internal.telephony.cdma.sms.UserData.UD_ENCODING_GSM_7BIT_ALPHABET;
-import static com.android.internal.telephony.cdma.sms.UserData.UD_ENCODING_IA5;
-import static com.android.internal.telephony.cdma.sms.UserData.UD_ENCODING_OCTET;
-import static com.android.internal.telephony.cdma.sms.UserData.UD_ENCODING_UNICODE_16;
 
 /**
  * A Short Message Service message.
@@ -153,6 +131,7 @@
         byte[] data;
         byte count;
         int countInt;
+        int addressDigitMode;
 
         //currently not supported by the modem-lib: env.mMessageType
         env.teleService = p.readInt(); //p_cur->uTeleserviceID
@@ -171,7 +150,8 @@
         env.serviceCategory = p.readInt(); //p_cur->uServicecategory
 
         // address
-        addr.digitMode = (byte) (0xFF & p.readInt()); //p_cur->sAddress.digit_mode
+        addressDigitMode = p.readInt();
+        addr.digitMode = (byte) (0xFF & addressDigitMode); //p_cur->sAddress.digit_mode
         addr.numberMode = (byte) (0xFF & p.readInt()); //p_cur->sAddress.number_mode
         addr.ton = p.readInt(); //p_cur->sAddress.number_type
         addr.numberPlan = (byte) (0xFF & p.readInt()); //p_cur->sAddress.number_plan
@@ -181,12 +161,18 @@
         //p_cur->sAddress.digits[digitCount]
         for (int index=0; index < count; index++) {
             data[index] = p.readByte();
+
+            // convert the value if it is 4-bit DTMF to 8 bit
+            if (addressDigitMode == CdmaSmsAddress.DIGIT_MODE_4BIT_DTMF) {
+                data[index] = msg.convertDtmfToAscii(data[index]);
+            }
         }
+
         addr.origBytes = data;
 
         // ignore subaddress
         p.readInt(); //p_cur->sSubAddress.subaddressType
-        p.readByte(); //p_cur->sSubAddress.odd
+        p.readInt(); //p_cur->sSubAddress.odd
         count = p.readByte(); //p_cur->sSubAddress.number_of_digits
         //p_cur->sSubAddress.digits[digitCount] :
         for (int index=0; index < count; index++) {
@@ -297,6 +283,7 @@
         SubmitPdu ret = new SubmitPdu();
         UserData uData = new UserData();
         SmsHeader smsHeader;
+        byte[] data;
 
         // Perform null parameter checks.
         if (message == null || destinationAddress == null) {
@@ -305,21 +292,18 @@
 
         // ** Set UserData + SmsHeader **
         try {
-            // First, try encoding it with the GSM alphabet
-            int septetCount = GsmAlphabet.countGsmSeptets(message, true);
+            // First, try encoding it as 7-bit ASCII
             // User Data (and length)
 
-            uData.userData = message.getBytes();
+            uData.payload = message.getBytes();
 
-            if (uData.userData.length > MAX_USER_DATA_SEPTETS) {
+            if (uData.payload.length > MAX_USER_DATA_SEPTETS) {
                 // Message too long
                 return null;
             }
 
             // desired TP-Data-Coding-Scheme
-            uData.userDataEncoding = UserData.UD_ENCODING_GSM_7BIT_ALPHABET;
-
-            // paddingBits not needed for UD_ENCODING_GSM_7BIT_ALPHABET
+            uData.msgEncoding = UserData.ENCODING_7BIT_ASCII;
 
             // sms header
             if(headerData != null) {
@@ -329,7 +313,13 @@
                 // no user data header available!
             }
 
-        } catch (EncodeException ex) {
+            data  = sms.getEnvelope(destinationAddress, statusReportRequested, uData,
+                    (headerData != null), (null == headerData));
+
+        } catch (Exception ex) {
+            Log.e(LOG_TAG, "getSubmitPdu: 7 bit ASCII encoding in cdma.SMSMesage failed: "
+                    + ex.getMessage());
+            Log.w(LOG_TAG, "getSubmitPdu: The message will be sent as UCS-2 encoded message.");
             byte[] textPart;
             // Encoding to the 7-bit alphabet failed. Let's see if we can
             // send it as a UCS-2 encoded message
@@ -341,15 +331,15 @@
                 return null;
             }
 
-            uData.userData = textPart;
+            uData.payload = textPart;
 
-            if (uData.userData.length > MAX_USER_DATA_BYTES) {
+            if (uData.payload.length > MAX_USER_DATA_BYTES) {
                 // Message too long
                 return null;
             }
 
             // TP-Data-Coding-Scheme
-            uData.userDataEncoding = UserData.UD_ENCODING_UNICODE_16;
+            uData.msgEncoding = UserData.ENCODING_UNICODE_16;
 
             // sms header
             if(headerData != null) {
@@ -358,10 +348,10 @@
             } else {
                 // no user data header available!
             }
-        }
 
-        byte[] data = sms.getEnvelope(destinationAddress, statusReportRequested, uData,
+            data = sms.getEnvelope(destinationAddress, statusReportRequested, uData,
                 (headerData != null), (null == headerData));
+        }
 
         if (null == data) return null;
 
@@ -425,8 +415,8 @@
 
         // TP-Data-Coding-Scheme
         // No class, 8 bit data
-        uData.userDataEncoding = UserData.UD_ENCODING_OCTET;
-        uData.userData = data;
+        uData.msgEncoding = UserData.ENCODING_OCTET;
+        uData.payload = data;
 
         byte[] msgData = sms.getEnvelope(destinationAddress, statusReportRequested, uData,
                 true, true);
@@ -574,6 +564,7 @@
         ByteArrayInputStream bais = new ByteArrayInputStream(pdu);
         DataInputStream dis = new DataInputStream(new BufferedInputStream(bais));
         byte length;
+        int bearerDataLength;
         SmsEnvelope env = new SmsEnvelope();
         CdmaSmsAddress addr = new CdmaSmsAddress();
 
@@ -599,9 +590,9 @@
             env.causeCode = dis.readByte();
 
             //encoded BearerData:
-            length = dis.readByte();
-            env.bearerData = new byte[length];
-            dis.read(env.bearerData, 0, length);
+            bearerDataLength = dis.readInt();
+            env.bearerData = new byte[bearerDataLength];
+            dis.read(env.bearerData, 0, bearerDataLength);
             dis.close();
         } catch (Exception ex) {
             Log.e(LOG_TAG, "createFromPdu: conversion from byte array to object failed: " + ex);
@@ -619,21 +610,21 @@
      * Parses a SMS message from its BearerData stream. (mobile-terminated only)
      */
     protected void parseSms() {
-        mBearerData = SmsDataCoding.decodeCdmaSms(mEnvelope.bearerData);
-        messageRef = mBearerData.messageID;
+        mBearerData = BearerData.decode(mEnvelope.bearerData);
+        messageRef = mBearerData.messageId;
 
         // TP-Message-Type-Indicator
         // (See 3GPP2 C.S0015-B, v2, 4.5.1)
         int messageType = mBearerData.messageType;
 
         switch (messageType) {
-        case MESSAGE_TYPE_USER_ACK:
-        case MESSAGE_TYPE_READ_ACK:
-        case MESSAGE_TYPE_DELIVER:
+        case BearerData.MESSAGE_TYPE_USER_ACK:
+        case BearerData.MESSAGE_TYPE_READ_ACK:
+        case BearerData.MESSAGE_TYPE_DELIVER:
             // Deliver (mobile-terminated only)
             parseSmsDeliver();
             break;
-        case MESSAGE_TYPE_DELIVERY_ACK:
+        case BearerData.MESSAGE_TYPE_DELIVERY_ACK:
             parseSmsDeliveryAck();
             break;
 
@@ -690,40 +681,22 @@
     }
 
     /**
-     * Parses the User Data of an SMS.
+     * Copy parsed user data out from internal datastructures.
      */
     private void parseUserData(UserData uData) {
-        int encodingType;
-
-        if (null == uData) {
+        if (uData == null) {
             return;
         }
 
-        encodingType = uData.userDataEncoding;
-
-        // insert DCS-decoding here when type is supported by ril-library
-
-        userData = uData.userData;
+        userData = uData.payload;
         userDataHeader = uData.userDataHeader;
-
-        switch (encodingType) {
-        case UD_ENCODING_GSM_7BIT_ALPHABET:
-        case UD_ENCODING_UNICODE_16:
-            // user data was already decoded by wmsts-library
-            messageBody = new String(userData);
-            break;
-
-        // data and unsupported encodings:
-        case UD_ENCODING_OCTET:
-        default:
-            messageBody = null;
-            break;
-        }
-
-        if (Config.LOGV) Log.v(LOG_TAG, "SMS message body (raw): '" + messageBody + "'");
+        messageBody = uData.payloadStr;
 
         if (messageBody != null) {
+            if (Config.LOGV) Log.v(LOG_TAG, "SMS message body: '" + messageBody + "'");
             parseMessageBody();
+        } else if ((userData != null) && (Config.LOGV)) {
+            Log.v(LOG_TAG, "SMS payload: '" + IccUtils.bytesToHexString(userData) + "'");
         }
     }
 
@@ -731,7 +704,7 @@
      * {@inheritDoc}
      */
     public MessageClass getMessageClass() {
-        if (BearerData.DISPLAY_IMMEDIATE == mBearerData.displayMode ) {
+        if (BearerData.DISPLAY_MODE_IMMEDIATE == mBearerData.displayMode ) {
             return MessageClass.CLASS_0;
         } else {
             return MessageClass.UNKNOWN;
@@ -771,7 +744,7 @@
         if (useNewId) {
             setNextMessageId();
         }
-        mBearerData.messageID = nextMessageId;
+        mBearerData.messageId = nextMessageId;
 
         // Set the reply options (See C.S0015-B, v2.0, 4.5.11)
         if(statusReportRequested) {
@@ -784,9 +757,6 @@
         mBearerData.readAckReq = false;
         mBearerData.reportReq = false;
 
-        // Set the display mode (See C.S0015-B, v2.0, 4.5.16)
-        mBearerData.displayMode = BearerData.DISPLAY_DEFAULT;
-
         // number of messages: not needed for encoding!
 
         // indicate whether a user data header is available
@@ -795,7 +765,7 @@
         // ** encode BearerData **
         byte[] encodedBearerData = null;
         try {
-            encodedBearerData = SmsDataCoding.encodeCdmaSms(mBearerData);
+            encodedBearerData = BearerData.encode(mBearerData);
         } catch (Exception e) {
             Log.e(LOG_TAG, "doGetSubmitPdu: EncodeCdmaSMS function in JNI interface failed: "
                     + e.getMessage());
@@ -804,7 +774,7 @@
 
         // ** SmsEnvelope **
         env.messageType = SmsEnvelope.MESSAGE_TYPE_POINT_TO_POINT;
-        env.teleService = SmsEnvelope.TELESERVICE_WEMT;
+        env.teleService = SmsEnvelope.TELESERVICE_WMT;
         env.destAddress = mSmsAddress;
         env.bearerReply = RETURN_ACK;
         env.bearerData = encodedBearerData;
@@ -892,7 +862,7 @@
             dos.writeByte(env.errorClass);
             dos.writeByte(env.causeCode);
             //encoded BearerData:
-            dos.writeByte(env.bearerData.length);
+            dos.writeInt(env.bearerData.length);
             dos.write(env.bearerData, 0, env.bearerData.length);
             dos.close();
 
@@ -902,4 +872,37 @@
         }
     }
 
+    /**
+     * Converts a 4-Bit DTMF encoded symbol from the calling address number to ASCII character
+     */
+    private byte convertDtmfToAscii(byte dtmfDigit) {
+        byte asciiDigit;
+
+        switch (dtmfDigit) {
+        case  0: asciiDigit = 68; break; // 'D'
+        case  1: asciiDigit = 49; break; // '1'
+        case  2: asciiDigit = 50; break; // '2'
+        case  3: asciiDigit = 51; break; // '3'
+        case  4: asciiDigit = 52; break; // '4'
+        case  5: asciiDigit = 53; break; // '5'
+        case  6: asciiDigit = 54; break; // '6'
+        case  7: asciiDigit = 55; break; // '7'
+        case  8: asciiDigit = 56; break; // '8'
+        case  9: asciiDigit = 57; break; // '9'
+        case 10: asciiDigit = 48; break; // '0'
+        case 11: asciiDigit = 42; break; // '*'
+        case 12: asciiDigit = 35; break; // '#'
+        case 13: asciiDigit = 65; break; // 'A'
+        case 14: asciiDigit = 66; break; // 'B'
+        case 15: asciiDigit = 67; break; // 'C'
+        default:
+            asciiDigit = 32; // Invalid DTMF code
+            break;
+        }
+
+        return asciiDigit;
+    }
+
+
+
 }
diff --git a/telephony/java/com/android/internal/telephony/cdma/sms/BearerData.java b/telephony/java/com/android/internal/telephony/cdma/sms/BearerData.java
index fec9529..b5952a1 100644
--- a/telephony/java/com/android/internal/telephony/cdma/sms/BearerData.java
+++ b/telephony/java/com/android/internal/telephony/cdma/sms/BearerData.java
@@ -16,43 +16,52 @@
 
 package com.android.internal.telephony.cdma.sms;
 
+import android.util.Log;
+
+import com.android.internal.telephony.GsmAlphabet;
+import com.android.internal.telephony.SmsHeader;
+import com.android.internal.telephony.cdma.sms.UserData;
+
+import com.android.internal.util.HexDump;
+import com.android.internal.util.BitwiseInputStream;
+import com.android.internal.util.BitwiseOutputStream;
+
+/**
+ * XXX
+ *
+ *
+ */
 public final class BearerData{
-
-    // For completeness the following fields are listed, though not used yet.
-    /**
-     * Supported priority modes for CDMA SMS messages
-     * (See 3GPP2 C.S0015-B, v2.0, table 4.5.9-1)
-     */
-    //public static final int PRIORITY_NORMAL        = 0x0;
-    //public static final int PRIORITY_INTERACTIVE   = 0x1;
-    //public static final int PRIORITY_URGENT        = 0x2;
-    //public static final int PRIORITY_EMERGENCY     = 0x3;
+    private final static String LOG_TAG = "SMS";
 
     /**
-     * Supported privacy modes for CDMA SMS messages
-     * (See 3GPP2 C.S0015-B, v2.0, table 4.5.10-1)
+     * Bearer Data Subparameter Indentifiers
+     * (See 3GPP2 C.S0015-B, v2.0, table 4.5-1)
      */
-    //public static final int PRIVACY_NOT_RESTRICTED = 0x0;
-    //public static final int PRIVACY_RESTRICTED     = 0x1;
-    //public static final int PRIVACY_CONFIDENTIAL   = 0x2;
-    //public static final int PRIVACY_SECRET         = 0x3;
-
-    /**
-     * Supported alert modes for CDMA SMS messages
-     * (See 3GPP2 C.S0015-B, v2.0, table 4.5.13-1)
-     */
-    //public static final int ALERT_DEFAULT          = 0x0;
-    //public static final int ALERT_LOW_PRIO         = 0x1;
-    //public static final int ALERT_MEDIUM_PRIO      = 0x2;
-    //public static final int ALERT_HIGH_PRIO        = 0x3;
-
-    /**
-     * Supported display modes for CDMA SMS messages
-     * (See 3GPP2 C.S0015-B, v2.0, table 4.5.16-1)
-     */
-    public static final int DISPLAY_IMMEDIATE      = 0x0;
-    public static final int DISPLAY_DEFAULT        = 0x1;
-    public static final int DISPLAY_USER           = 0x2;
+    private final static byte SUBPARAM_MESSAGE_IDENTIFIER               = 0x00;
+    private final static byte SUBPARAM_USER_DATA                        = 0x01;
+    private final static byte SUBPARAM_USER_REPONSE_CODE                = 0x02;
+    private final static byte SUBPARAM_MESSAGE_CENTER_TIME_STAMP        = 0x03;
+    //private final static byte SUBPARAM_VALIDITY_PERIOD_ABSOLUTE         = 0x04;
+    //private final static byte SUBPARAM_VALIDITY_PERIOD_RELATIVE         = 0x05;
+    //private final static byte SUBPARAM_DEFERRED_DELIVERY_TIME_ABSOLUTE  = 0x06;
+    //private final static byte SUBPARAM_DEFERRED_DELIVERY_TIME_RELATIVE  = 0x07;
+    private final static byte SUBPARAM_PRIORITY_INDICATOR               = 0x08;
+    private final static byte SUBPARAM_PRIVACY_INDICATOR                = 0x09;
+    private final static byte SUBPARAM_REPLY_OPTION                     = 0x0A;
+    private final static byte SUBPARAM_NUMBER_OF_MESSAGES               = 0x0B;
+    private final static byte SUBPARAM_ALERT_ON_MESSAGE_DELIVERY        = 0x0C;
+    private final static byte SUBPARAM_LANGUAGE_INDICATOR               = 0x0D;
+    private final static byte SUBPARAM_CALLBACK_NUMBER                  = 0x0E;
+    private final static byte SUBPARAM_MESSAGE_DISPLAY_MODE             = 0x0F;
+    //private final static byte SUBPARAM_MULTIPLE_ENCODING_USER_DATA      = 0x10;
+    //private final static byte SUBPARAM_MESSAGE_DEPOSIT_INDEX            = 0x11;
+    //private final static byte SUBPARAM_SERVICE_CATEGORY_PROGRAM_DATA    = 0x12;
+    //private final static byte SUBPARAM_SERVICE_CATEGORY_PROGRAM_RESULTS = 0x13;
+    private final static byte SUBPARAM_MESSAGE_STATUS                   = 0x14;
+    //private final static byte SUBPARAM_TP_FAILURE_CAUSE                 = 0x15;
+    //private final static byte SUBPARAM_ENHANCED_VMN                     = 0x16;
+    //private final static byte SUBPARAM_ENHANCED_VMN_ACK                 = 0x17;
 
     /**
      * Supported message types for CDMA SMS messages
@@ -67,9 +76,89 @@
     public static final int MESSAGE_TYPE_DELIVER_REPORT = 0x07;
     public static final int MESSAGE_TYPE_SUBMIT_REPORT  = 0x08;
 
+    public byte messageType;
+
     /**
-     * SMS Message Status Codes
-     * (See 3GPP2 C.S0015-B, v2.0, table 4.5.21-1)
+     * 16-bit value indicating the message ID, which increments modulo 65536.
+     * (Special rules apply for WAP-messages.)
+     * (See 3GPP2 C.S0015-B, v2, 4.5.1)
+     */
+    public int messageId;
+
+    /**
+     * Supported priority modes for CDMA SMS messages
+     * (See 3GPP2 C.S0015-B, v2.0, table 4.5.9-1)
+     */
+    public static final int PRIORITY_NORMAL        = 0x0;
+    public static final int PRIORITY_INTERACTIVE   = 0x1;
+    public static final int PRIORITY_URGENT        = 0x2;
+    public static final int PRIORITY_EMERGENCY     = 0x3;
+
+    public boolean priorityIndicatorSet = false;
+    public byte priority = PRIORITY_NORMAL;
+
+    /**
+     * Supported privacy modes for CDMA SMS messages
+     * (See 3GPP2 C.S0015-B, v2.0, table 4.5.10-1)
+     */
+    public static final int PRIVACY_NOT_RESTRICTED = 0x0;
+    public static final int PRIVACY_RESTRICTED     = 0x1;
+    public static final int PRIVACY_CONFIDENTIAL   = 0x2;
+    public static final int PRIVACY_SECRET         = 0x3;
+
+    public boolean privacyIndicatorSet = false;
+    public byte privacy = PRIVACY_NOT_RESTRICTED;
+
+    /**
+     * Supported alert priority modes for CDMA SMS messages
+     * (See 3GPP2 C.S0015-B, v2.0, table 4.5.13-1)
+     */
+    public static final int ALERT_DEFAULT          = 0x0;
+    public static final int ALERT_LOW_PRIO         = 0x1;
+    public static final int ALERT_MEDIUM_PRIO      = 0x2;
+    public static final int ALERT_HIGH_PRIO        = 0x3;
+
+    public boolean alertIndicatorSet = false;
+    public int alert = ALERT_DEFAULT;
+
+    /**
+     * Supported display modes for CDMA SMS messages.  Display mode is
+     * a 2-bit value used to indicate to the mobile station when to
+     * display the received message.  (See 3GPP2 C.S0015-B, v2,
+     * 4.5.16)
+     */
+    public static final int DISPLAY_MODE_IMMEDIATE      = 0x0;
+    public static final int DISPLAY_MODE_DEFAULT        = 0x1;
+    public static final int DISPLAY_MODE_USER           = 0x2;
+
+    public boolean displayModeSet = false;
+    public byte displayMode = DISPLAY_MODE_DEFAULT;
+
+    /**
+     * Language Indicator values.  NOTE: the spec (3GPP2 C.S0015-B,
+     * v2, 4.5.14) is ambiguous as to the meaning of this field, as it
+     * refers to C.R1001-D but that reference has been crossed out.
+     * It would seem reasonable to assume the values from C.R1001-F
+     * (table 9.2-1) are to be used instead.
+     */
+    public static final int LANGUAGE_UNKNOWN  = 0x00;
+    public static final int LANGUAGE_ENGLISH  = 0x01;
+    public static final int LANGUAGE_FRENCH   = 0x02;
+    public static final int LANGUAGE_SPANISH  = 0x03;
+    public static final int LANGUAGE_JAPANESE = 0x04;
+    public static final int LANGUAGE_KOREAN   = 0x05;
+    public static final int LANGUAGE_CHINESE  = 0x06;
+    public static final int LANGUAGE_HEBREW   = 0x07;
+
+    public boolean languageIndicatorSet = false;
+    public int language = LANGUAGE_UNKNOWN;
+
+    /**
+     * SMS Message Status Codes.  The first component of the Message
+     * status indicates if an error has occurred and whether the error
+     * is considered permanent or temporary.  The second component of
+     * the Message status indicates the cause of the error (if any).
+     * (See 3GPP2 C.S0015-B, v2.0, 4.5.21)
      */
     /* no-error codes */
     public static final int ERROR_NONE                   = 0x00;
@@ -94,22 +183,9 @@
     public static final int ERROR_UNDEFINED              = 0xFF;
     public static final int STATUS_UNDEFINED             = 0xFF;
 
-    /** Bit-mask indicating used fields for SmsDataCoding */
-    public int mask;
-
-    /**
-     * 4-bit value indicating the message type in accordance to
-     *      table 4.5.1-1
-     * (See 3GPP2 C.S0015-B, v2, 4.5.1)
-     */
-    public byte messageType;
-
-    /**
-     * 16-bit value indicating the message ID, which increments modulo 65536.
-     * (Special rules apply for WAP-messages.)
-     * (See 3GPP2 C.S0015-B, v2, 4.5.1)
-     */
-    public int messageID;
+    public boolean messageStatusSet = false;
+    public int errorClass = ERROR_UNDEFINED;
+    public int messageStatus = STATUS_UNDEFINED;
 
     /**
      * 1-bit value that indicates whether a User Data Header is present.
@@ -136,8 +212,6 @@
     //public SmsRelTime validityPeriodRelative;
     //public SmsTime deferredDeliveryTimeAbsolute;
     //public SmsRelTime deferredDeliveryTimeRelative;
-    //public byte priority;
-    //public byte privacy;
 
     /**
      * Reply Option
@@ -157,9 +231,6 @@
      */
     public int numberOfMessages;
 
-    //public int alert;
-    //public int language;
-
     /**
      * 4-bit or 8-bit value that indicates the number to be dialed in reply to a
      * received SMS message.
@@ -167,26 +238,609 @@
      */
     public CdmaSmsAddress callbackNumber;
 
-    /**
-     * 2-bit value that is used to indicate to the mobile station when to display
-     * the received message.
-     * (See 3GPP2 C.S0015-B, v2, 4.5.16)
-     */
-    public byte displayMode = DISPLAY_DEFAULT;
+    private static class CodingException extends Exception {
+        public CodingException(String s) {
+            super(s);
+        }
+    }
+
+    @Override
+    public String toString() {
+        StringBuilder builder = new StringBuilder();
+        builder.append("BearerData:\n");
+        builder.append("  messageType: " + messageType + "\n");
+        builder.append("  messageId: " + (int)messageId + "\n");
+        builder.append("  priority: " + (priorityIndicatorSet ? priority : "not set") + "\n");
+        builder.append("  privacy: " + (privacyIndicatorSet ? privacy : "not set") + "\n");
+        builder.append("  alert: " + (alertIndicatorSet ? alert : "not set") + "\n");
+        builder.append("  displayMode: " + (displayModeSet ? displayMode : "not set") + "\n");
+        builder.append("  language: " + (languageIndicatorSet ? language : "not set") + "\n");
+        builder.append("  errorClass: " + (messageStatusSet ? errorClass : "not set") + "\n");
+        builder.append("  messageStatus: " + (messageStatusSet ? messageStatus : "not set") + "\n");
+        builder.append("  hasUserDataHeader: " + hasUserDataHeader + "\n");
+        builder.append("  timeStamp: " + timeStamp + "\n");
+        builder.append("  userAckReq: " + userAckReq + "\n");
+        builder.append("  deliveryAckReq: " + deliveryAckReq + "\n");
+        builder.append("  readAckReq: " + readAckReq + "\n");
+        builder.append("  reportReq: " + reportReq + "\n");
+        builder.append("  numberOfMessages: " + numberOfMessages + "\n");
+        builder.append("  callbackNumber: " + callbackNumber + "\n");
+        builder.append("  userData: " + userData + "\n");
+        return builder.toString();
+    }
+
+    private static void encodeMessageId(BearerData bData, BitwiseOutputStream outStream)
+        throws BitwiseOutputStream.AccessException
+    {
+        outStream.write(8, 3);
+        outStream.write(4, bData.messageType);
+        outStream.write(8, bData.messageId >> 8);
+        outStream.write(8, bData.messageId);
+        outStream.write(1, bData.hasUserDataHeader ? 1 : 0);
+        outStream.skip(3);
+    }
+
+    private static void encodeUserData(BearerData bData, BitwiseOutputStream outStream)
+        throws BitwiseOutputStream.AccessException
+    {
+        int dataBits = (bData.userData.payload.length * 8) - bData.userData.paddingBits;
+        byte[] headerData = null;
+        if (bData.hasUserDataHeader) {
+            headerData = bData.userData.userDataHeader.toByteArray();
+            dataBits += headerData.length * 8;
+        }
+        int paramBits = dataBits + 13;
+        if ((bData.userData.msgEncoding == UserData.ENCODING_IS91_EXTENDED_PROTOCOL) ||
+            (bData.userData.msgEncoding == UserData.ENCODING_GSM_DCS)) {
+            paramBits += 8;
+        }
+        int paramBytes = (paramBits / 8) + ((paramBits % 8) > 0 ? 1 : 0);
+        int paddingBits = (paramBytes * 8) - paramBits;
+        outStream.write(8, paramBytes);
+        outStream.write(5, bData.userData.msgEncoding);
+        if ((bData.userData.msgEncoding == UserData.ENCODING_IS91_EXTENDED_PROTOCOL) ||
+            (bData.userData.msgEncoding == UserData.ENCODING_GSM_DCS)) {
+            outStream.write(8, bData.userData.msgType);
+        }
+        outStream.write(8, bData.userData.numFields);
+        if (headerData != null) outStream.writeByteArray(headerData.length * 8, headerData);
+        outStream.writeByteArray(dataBits, bData.userData.payload);
+        if (paddingBits > 0) outStream.write(paddingBits, 0);
+    }
+
+    private static void encodeReplyOption(BearerData bData, BitwiseOutputStream outStream)
+        throws BitwiseOutputStream.AccessException
+    {
+        outStream.write(8, 1);
+        outStream.write(1, bData.userAckReq     ? 1 : 0);
+        outStream.write(1, bData.deliveryAckReq ? 1 : 0);
+        outStream.write(1, bData.readAckReq     ? 1 : 0);
+        outStream.write(1, bData.reportReq      ? 1 : 0);
+        outStream.write(4, 0);
+    }
+
+    private static byte[] encodeDtmfSmsAddress(String address) {
+        int digits = address.length();
+        int dataBits = digits * 4;
+        int dataBytes = (dataBits / 8);
+        dataBytes += (dataBits % 8) > 0 ? 1 : 0;
+        byte[] rawData = new byte[dataBytes];
+        for (int i = 0; i < digits; i++) {
+            char c = address.charAt(i);
+            int val = 0;
+            if ((c >= '1') && (c <= '9')) val = c - '0';
+            else if (c == '0') val = 10;
+            else if (c == '*') val = 11;
+            else if (c == '#') val = 12;
+            else return null;
+            rawData[i / 2] |= val << (4 - ((i % 2) * 4));
+        }
+        return rawData;
+    }
+
+    private static void encodeCdmaSmsAddress(CdmaSmsAddress addr) throws CodingException {
+        if (addr.digitMode == CdmaSmsAddress.DIGIT_MODE_8BIT_CHAR) {
+            try {
+                addr.origBytes = addr.address.getBytes("US-ASCII");
+            } catch (java.io.UnsupportedEncodingException ex) {
+                throw new CodingException("invalid SMS address, cannot convert to ASCII");
+            }
+        } else {
+            addr.origBytes = encodeDtmfSmsAddress(addr.address);
+        }
+    }
+
+    private static void encodeCallbackNumber(BearerData bData, BitwiseOutputStream outStream)
+        throws BitwiseOutputStream.AccessException, CodingException
+    {
+        CdmaSmsAddress addr = bData.callbackNumber;
+        encodeCdmaSmsAddress(addr);
+        int paramBits = 9;
+        int dataBits = 0;
+        if (addr.digitMode == CdmaSmsAddress.DIGIT_MODE_8BIT_CHAR) {
+            paramBits += 7;
+            dataBits = addr.numberOfDigits * 8;
+        } else {
+            dataBits = addr.numberOfDigits * 4;
+        }
+        paramBits += dataBits;
+        int paramBytes = (paramBits / 8) + ((paramBits % 8) > 0 ? 1 : 0);
+        int paddingBits = (paramBytes * 8) - paramBits;
+        outStream.write(8, paramBytes);
+        outStream.write(1, addr.digitMode);
+        if (addr.digitMode == CdmaSmsAddress.DIGIT_MODE_8BIT_CHAR) {
+            outStream.write(3, addr.ton);
+            outStream.write(4, addr.numberPlan);
+        }
+        outStream.write(8, addr.numberOfDigits);
+        outStream.writeByteArray(dataBits, addr.origBytes);
+        if (paddingBits > 0) outStream.write(paddingBits, 0);
+    }
+
+    private static void encodeMsgStatus(BearerData bData, BitwiseOutputStream outStream)
+        throws BitwiseOutputStream.AccessException
+    {
+        outStream.write(8, 1);
+        outStream.write(2, bData.errorClass);
+        outStream.write(6, bData.messageStatus);
+    }
+
+    private static void encodeMsgCount(BearerData bData, BitwiseOutputStream outStream)
+        throws BitwiseOutputStream.AccessException
+    {
+        outStream.write(8, 1);
+        outStream.write(8, bData.numberOfMessages);
+    }
+
+    private static void encodeMsgCenterTimeStamp(BearerData bData, BitwiseOutputStream outStream)
+        throws BitwiseOutputStream.AccessException
+    {
+        outStream.write(8, 6);
+        outStream.writeByteArray(6 * 8, bData.timeStamp);
+    }
+
+    private static void encodePrivacyIndicator(BearerData bData, BitwiseOutputStream outStream)
+        throws BitwiseOutputStream.AccessException
+    {
+        outStream.write(8, 1);
+        outStream.write(2, bData.privacy);
+        outStream.skip(6);
+    }
+
+    private static void encodeLanguageIndicator(BearerData bData, BitwiseOutputStream outStream)
+        throws BitwiseOutputStream.AccessException
+    {
+        outStream.write(8, 1);
+        outStream.write(8, bData.language);
+    }
+
+    private static void encodeDisplayMode(BearerData bData, BitwiseOutputStream outStream)
+        throws BitwiseOutputStream.AccessException
+    {
+        outStream.write(8, 1);
+        outStream.write(2, bData.displayMode);
+        outStream.skip(6);
+    }
+
+    private static void encodePriorityIndicator(BearerData bData, BitwiseOutputStream outStream)
+        throws BitwiseOutputStream.AccessException
+    {
+        outStream.write(8, 1);
+        outStream.write(2, bData.priority);
+        outStream.skip(6);
+    }
+
+    private static void encodeMsgDeliveryAlert(BearerData bData, BitwiseOutputStream outStream)
+        throws BitwiseOutputStream.AccessException
+    {
+        outStream.write(8, 1);
+        outStream.write(2, bData.alert);
+        outStream.skip(6);
+    }
 
     /**
-     * First component of the Message status, that indicates if an error has occurred
-     * and whether the error is considered permanent or temporary.
-     * (See 3GPP2 C.S0015-B, v2, 4.5.21)
+     * Create serialized representation for BearerData object.
+     * (See 3GPP2 C.R1001-F, v1.0, section 4.5 for layout details)
+     *
+     * @param bearerData an instance of BearerData.
+     *
+     * @return data byta array of raw encoded SMS bearer data.
      */
-    public int errorClass = ERROR_UNDEFINED;
+    public static byte[] encode(BearerData bData) {
+        try {
+            BitwiseOutputStream outStream = new BitwiseOutputStream(200);
+            outStream.write(8, SUBPARAM_MESSAGE_IDENTIFIER);
+            encodeMessageId(bData, outStream);
+            if (bData.userData != null) {
+                outStream.write(8, SUBPARAM_USER_DATA);
+                encodeUserData(bData, outStream);
+            }
+            if (bData.callbackNumber != null) {
+                outStream.write(8, SUBPARAM_CALLBACK_NUMBER);
+                encodeCallbackNumber(bData, outStream);
+            }
+            if (bData.userAckReq || bData.deliveryAckReq || bData.readAckReq || bData.reportReq) {
+                outStream.write(8, SUBPARAM_REPLY_OPTION);
+                encodeReplyOption(bData, outStream);
+            }
+            if (bData.numberOfMessages != 0) {
+                outStream.write(8, SUBPARAM_NUMBER_OF_MESSAGES);
+                encodeMsgCount(bData, outStream);
+            }
+            if (bData.timeStamp != null) {
+                outStream.write(8, SUBPARAM_MESSAGE_CENTER_TIME_STAMP);
+                encodeMsgCenterTimeStamp(bData, outStream);
+            }
+            if (bData.privacyIndicatorSet) {
+                outStream.write(8, SUBPARAM_PRIVACY_INDICATOR);
+                encodePrivacyIndicator(bData, outStream);
+            }
+            if (bData.languageIndicatorSet) {
+                outStream.write(8, SUBPARAM_LANGUAGE_INDICATOR);
+                encodeLanguageIndicator(bData, outStream);
+            }
+            if (bData.displayModeSet) {
+                outStream.write(8, SUBPARAM_MESSAGE_DISPLAY_MODE);
+                encodeDisplayMode(bData, outStream);
+            }
+            if (bData.priorityIndicatorSet) {
+                outStream.write(8, SUBPARAM_PRIORITY_INDICATOR);
+                encodePriorityIndicator(bData, outStream);
+            }
+            if (bData.alertIndicatorSet) {
+                outStream.write(8, SUBPARAM_ALERT_ON_MESSAGE_DELIVERY);
+                encodeMsgDeliveryAlert(bData, outStream);
+            }
+            if (bData.messageStatusSet) {
+                outStream.write(8, SUBPARAM_MESSAGE_STATUS);
+                encodeMsgStatus(bData, outStream);
+            }
+            return outStream.toByteArray();
+        } catch (BitwiseOutputStream.AccessException ex) {
+            Log.e(LOG_TAG, "BearerData encode failed: " + ex);
+        } catch (CodingException ex) {
+            Log.e(LOG_TAG, "BearerData encode failed: " + ex);
+        }
+        return null;
+   }
+
+    private static void decodeMessageId(BearerData bData, BitwiseInputStream inStream)
+        throws BitwiseInputStream.AccessException, CodingException
+    {
+        if (inStream.read(8) != 3) {
+            throw new CodingException("MESSAGE_IDENTIFIER subparam size incorrect");
+        }
+        bData.messageType = inStream.read(4);
+        bData.messageId = inStream.read(8) << 8;
+        bData.messageId |= inStream.read(8);
+        bData.hasUserDataHeader = (inStream.read(1) == 1);
+        inStream.skip(3);
+    }
+
+    private static void decodeUserData(BearerData bData, BitwiseInputStream inStream)
+        throws BitwiseInputStream.AccessException
+    {
+        byte paramBytes = inStream.read(8);
+        bData.userData = new UserData();
+        bData.userData.msgEncoding = inStream.read(5);
+        bData.userData.msgType = 0;
+        int consumedBits = 5;
+        if ((bData.userData.msgEncoding == UserData.ENCODING_IS91_EXTENDED_PROTOCOL) ||
+            (bData.userData.msgEncoding == UserData.ENCODING_GSM_DCS)) {
+            bData.userData.msgType = inStream.read(8);
+            consumedBits += 8;
+        }
+        bData.userData.numFields = inStream.read(8);
+        consumedBits += 8;
+        int dataBits = (paramBytes * 8) - consumedBits;
+        bData.userData.payload = inStream.readByteArray(dataBits);
+    }
+
+    private static String decodePayloadStr(byte[] data, int offset, int numFields, String format)
+        throws CodingException
+    {
+        try {
+            return new String(data, offset, numFields, format);
+        } catch (java.io.UnsupportedEncodingException ex) {
+            throw new CodingException("invalid ASCII user data code");
+        }
+    }
+
+    private static String decodeIa5(byte[] data, int offset, int numFields) {
+        try {
+            StringBuffer strBuf = new StringBuffer(numFields);
+            BitwiseInputStream inStream = new BitwiseInputStream(data);
+            inStream.skip(offset);
+            int wantedBits = numFields * 7;
+            if (inStream.available() < wantedBits) {
+                throw new CodingException("insufficient data (wanted " + wantedBits +
+                                          " bits, but only have " + inStream.available() + ")");
+            }
+            for (int i = 0; i < numFields; i++) {
+                int charCode = inStream.read(7);
+                if ((charCode < UserData.IA5_MAP_BASE_INDEX) ||
+                        (charCode > UserData.IA5_MAP_MAX_INDEX)) {
+                    throw new CodingException("unsupported AI5 character code (" + charCode + ")");
+                }
+                strBuf.append(UserData.IA5_MAP[charCode - UserData.IA5_MAP_BASE_INDEX]);
+            }
+            return strBuf.toString();
+        } catch (BitwiseInputStream.AccessException ex) {
+            Log.e(LOG_TAG, "UserData AI5 decode failed: " + ex);
+        } catch (CodingException ex) {
+            Log.e(LOG_TAG, "UserData AI5 decode failed: " + ex);
+        }
+        return null;
+    }
+
+    private static void decodeUserDataPayload(UserData userData, boolean hasUserDataHeader)
+        throws CodingException
+    {
+        int offset = 0;
+        if (hasUserDataHeader) {
+            int UdhLen = userData.payload[0];
+            byte[] headerData = new byte[UdhLen];
+            System.arraycopy(userData.payload, 1, headerData, 0, UdhLen);
+            userData.userDataHeader = SmsHeader.parse(headerData);
+        }
+        switch (userData.msgEncoding) {
+        case UserData.ENCODING_OCTET:
+            break;
+        case UserData.ENCODING_7BIT_ASCII:
+            userData.payloadStr = decodePayloadStr(userData.payload, offset,
+                                                   userData.numFields, "US-ASCII");
+            break;
+        case UserData.ENCODING_IA5:
+            userData.payloadStr = decodeIa5(userData.payload, offset, userData.numFields);
+            break;
+        case UserData.ENCODING_UNICODE_16:
+            userData.payloadStr = decodePayloadStr(userData.payload, offset,
+                                                   userData.numFields * 2, "UTF-16");
+            break;
+        case UserData.ENCODING_GSM_7BIT_ALPHABET:
+            userData.payloadStr = GsmAlphabet.gsm7BitPackedToString(userData.payload,
+                                                                    offset, userData.numFields);
+            break;
+        default:
+            throw new CodingException("unsupported user data encoding ("
+                                      + userData.msgEncoding + ")");
+        }
+    }
+
+    private static void decodeReplyOption(BearerData bData, BitwiseInputStream inStream)
+        throws BitwiseInputStream.AccessException, CodingException
+    {
+        byte paramBytes = inStream.read(8);
+        if (paramBytes != 1) {
+            throw new CodingException("REPLY_OPTION subparam size incorrect");
+        }
+        bData.userAckReq     = (inStream.read(1) == 1);
+        bData.deliveryAckReq = (inStream.read(1) == 1);
+        bData.readAckReq     = (inStream.read(1) == 1);
+        bData.reportReq      = (inStream.read(1) == 1);
+        inStream.skip(4);
+    }
+
+    private static void decodeMsgCount(BearerData bData, BitwiseInputStream inStream)
+        throws BitwiseInputStream.AccessException, CodingException
+    {
+        if (inStream.read(8) != 1) {
+            throw new CodingException("NUMBER_OF_MESSAGES subparam size incorrect");
+        }
+        bData.numberOfMessages = inStream.read(8);
+    }
+
+    private static String decodeDtmfSmsAddress(byte[] rawData, int numFields)
+        throws CodingException
+    {
+        /* DTMF 4-bit digit encoding, defined in at
+         * 3GPP2 C.S005-D, v2.0, table 2.7.1.3.2.4-4 */
+        StringBuffer strBuf = new StringBuffer(numFields);
+        for (int i = 0; i < numFields; i++) {
+            int val = 0x0F & (rawData[i / 2] >>> (4 - ((i % 2) * 4)));
+            if ((val >= 1) && (val <= 9)) strBuf.append(Integer.toString(val, 10));
+            else if (val == 10) strBuf.append('0');
+            else if (val == 11) strBuf.append('*');
+            else if (val == 12) strBuf.append('#');
+            else throw new CodingException("invalid SMS address DTMF code (" + val + ")");
+        }
+        return strBuf.toString();
+    }
+
+    private static void decodeSmsAddress(CdmaSmsAddress addr) throws CodingException {
+        if (addr.digitMode == CdmaSmsAddress.DIGIT_MODE_8BIT_CHAR) {
+            try {
+                /* As specified in 3GPP2 C.S0015-B, v2, 4.5.15 -- actually
+                 * just 7-bit ASCII encoding, with the MSB being zero. */
+                addr.address = new String(addr.origBytes, 0, addr.origBytes.length, "US-ASCII");
+            } catch (java.io.UnsupportedEncodingException ex) {
+                throw new CodingException("invalid SMS address ASCII code");
+            }
+        } else {
+            addr.address = decodeDtmfSmsAddress(addr.origBytes, addr.numberOfDigits);
+        }
+    }
+
+    private static void decodeCallbackNumber(BearerData bData, BitwiseInputStream inStream)
+        throws BitwiseInputStream.AccessException, CodingException
+    {
+        byte paramBytes = inStream.read(8);
+        CdmaSmsAddress addr = new CdmaSmsAddress();
+        addr.digitMode = inStream.read(1);
+        byte fieldBits = 4;
+        byte consumedBits = 1;
+        if (addr.digitMode == CdmaSmsAddress.DIGIT_MODE_8BIT_CHAR) {
+            addr.ton = inStream.read(3);
+            addr.numberPlan = inStream.read(4);
+            fieldBits = 8;
+            consumedBits += 7;
+        }
+        addr.numberOfDigits = inStream.read(8);
+        consumedBits += 8;
+        int remainingBits = (paramBytes * 8) - consumedBits;
+        int dataBits = addr.numberOfDigits * fieldBits;
+        int paddingBits = remainingBits - dataBits;
+        if (remainingBits < dataBits) {
+            throw new CodingException("CALLBACK_NUMBER subparam encoding size error (" +
+                                      "remainingBits " + remainingBits + ", dataBits " +
+                                      dataBits + ", paddingBits " + paddingBits + ")");
+        }
+        addr.origBytes = inStream.readByteArray(dataBits);
+        inStream.skip(paddingBits);
+        decodeSmsAddress(addr);
+        bData.callbackNumber = addr;
+    }
+
+    private static void decodeMsgStatus(BearerData bData, BitwiseInputStream inStream)
+        throws BitwiseInputStream.AccessException, CodingException
+    {
+        if (inStream.read(8) != 1) {
+            throw new CodingException("MESSAGE_STATUS subparam size incorrect");
+        }
+        bData.errorClass = inStream.read(2);
+        bData.messageStatus = inStream.read(6);
+        bData.messageStatusSet = true;
+    }
+
+    private static void decodeMsgCenterTimeStamp(BearerData bData,
+                                                 BitwiseInputStream inStream)
+        throws BitwiseInputStream.AccessException, CodingException
+    {
+        if (inStream.read(8) != 6) {
+            throw new CodingException("MESSAGE_CENTER_TIME_STAMP subparam size incorrect");
+        }
+        bData.timeStamp = inStream.readByteArray(6 * 8);
+    }
+
+    private static void decodePrivacyIndicator(BearerData bData, BitwiseInputStream inStream)
+        throws BitwiseInputStream.AccessException, CodingException
+    {
+        if (inStream.read(8) != 1) {
+            throw new CodingException("PRIVACY_INDICATOR subparam size incorrect");
+        }
+        bData.privacy = inStream.read(2);
+        inStream.skip(6);
+        bData.privacyIndicatorSet = true;
+    }
+
+    private static void decodeLanguageIndicator(BearerData bData, BitwiseInputStream inStream)
+        throws BitwiseInputStream.AccessException, CodingException
+    {
+        if (inStream.read(8) != 1) {
+            throw new CodingException("LANGUAGE_INDICATOR subparam size incorrect");
+        }
+        bData.language = inStream.read(8);
+        bData.languageIndicatorSet = true;
+    }
+
+    private static void decodeDisplayMode(BearerData bData, BitwiseInputStream inStream)
+        throws BitwiseInputStream.AccessException, CodingException
+    {
+        if (inStream.read(8) != 1) {
+            throw new CodingException("DISPLAY_MODE subparam size incorrect");
+        }
+        bData.displayMode = inStream.read(2);
+        inStream.skip(6);
+        bData.displayModeSet = true;
+    }
+
+    private static void decodePriorityIndicator(BearerData bData, BitwiseInputStream inStream)
+        throws BitwiseInputStream.AccessException, CodingException
+    {
+        if (inStream.read(8) != 1) {
+            throw new CodingException("PRIORITY_INDICATOR subparam size incorrect");
+        }
+        bData.priority = inStream.read(2);
+        inStream.skip(6);
+        bData.priorityIndicatorSet = true;
+    }
+
+    private static void decodeMsgDeliveryAlert(BearerData bData, BitwiseInputStream inStream)
+        throws BitwiseInputStream.AccessException, CodingException
+    {
+        if (inStream.read(8) != 1) {
+            throw new CodingException("ALERT_ON_MESSAGE_DELIVERY subparam size incorrect");
+        }
+        bData.alert = inStream.read(2);
+        inStream.skip(6);
+        bData.alertIndicatorSet = true;
+    }
 
     /**
-     * Second component of the Message status, that indicates if an error has occurred
-     * and the cause of the error.
-     * (See 3GPP2 C.S0015-B, v2, 4.5.21)
+     * Create BearerData object from serialized representation.
+     * (See 3GPP2 C.R1001-F, v1.0, section 4.5 for layout details)
+     *
+     * @param smsData byte array of raw encoded SMS bearer data.
+     *
+     * @return an instance of BearerData.
      */
-    public int messageStatus = STATUS_UNDEFINED;
-
+    public static BearerData decode(byte[] smsData) {
+        try {
+            BitwiseInputStream inStream = new BitwiseInputStream(smsData);
+            BearerData bData = new BearerData();
+            int foundSubparamMask = 0;
+            while (inStream.available() > 0) {
+                int subparamId = inStream.read(8);
+                int subparamIdBit = 1 << subparamId;
+                if ((foundSubparamMask & subparamIdBit) != 0) {
+                    throw new CodingException("illegal duplicate subparameter (" +
+                                              subparamId + ")");
+                }
+                foundSubparamMask |= subparamIdBit;
+                switch (subparamId) {
+                case SUBPARAM_MESSAGE_IDENTIFIER:
+                    decodeMessageId(bData, inStream);
+                    break;
+                case SUBPARAM_USER_DATA:
+                    decodeUserData(bData, inStream);
+                    break;
+                case SUBPARAM_REPLY_OPTION:
+                    decodeReplyOption(bData, inStream);
+                    break;
+                case SUBPARAM_NUMBER_OF_MESSAGES:
+                    decodeMsgCount(bData, inStream);
+                    break;
+                case SUBPARAM_CALLBACK_NUMBER:
+                    decodeCallbackNumber(bData, inStream);
+                    break;
+                case SUBPARAM_MESSAGE_STATUS:
+                    decodeMsgStatus(bData, inStream);
+                    break;
+                case SUBPARAM_MESSAGE_CENTER_TIME_STAMP:
+                    decodeMsgCenterTimeStamp(bData, inStream);
+                    break;
+                case SUBPARAM_PRIVACY_INDICATOR:
+                    decodePrivacyIndicator(bData, inStream);
+                    break;
+                case SUBPARAM_LANGUAGE_INDICATOR:
+                    decodeLanguageIndicator(bData, inStream);
+                    break;
+                case SUBPARAM_MESSAGE_DISPLAY_MODE:
+                    decodeDisplayMode(bData, inStream);
+                    break;
+                case SUBPARAM_PRIORITY_INDICATOR:
+                    decodePriorityIndicator(bData, inStream);
+                    break;
+                case SUBPARAM_ALERT_ON_MESSAGE_DELIVERY:
+                    decodeMsgDeliveryAlert(bData, inStream);
+                    break;
+                default:
+                    throw new CodingException("unsupported bearer data subparameter ("
+                                              + subparamId + ")");
+                }
+            }
+            if ((foundSubparamMask & (1 << SUBPARAM_MESSAGE_IDENTIFIER)) == 0) {
+                throw new CodingException("missing MESSAGE_IDENTIFIER subparam");
+            }
+            if (bData.userData != null) {
+                decodeUserDataPayload(bData.userData, bData.hasUserDataHeader);
+            }
+            return bData;
+        } catch (BitwiseInputStream.AccessException ex) {
+            Log.e(LOG_TAG, "BearerData decode failed: " + ex);
+        } catch (CodingException ex) {
+            Log.e(LOG_TAG, "BearerData decode failed: " + ex);
+        }
+        return null;
+    }
 }
-
diff --git a/telephony/java/com/android/internal/telephony/cdma/sms/CdmaSmsAddress.java b/telephony/java/com/android/internal/telephony/cdma/sms/CdmaSmsAddress.java
index 1643cab..440debb 100644
--- a/telephony/java/com/android/internal/telephony/cdma/sms/CdmaSmsAddress.java
+++ b/telephony/java/com/android/internal/telephony/cdma/sms/CdmaSmsAddress.java
@@ -17,6 +17,7 @@
 package com.android.internal.telephony.cdma.sms;
 
 import com.android.internal.telephony.SmsAddress;
+import com.android.internal.util.HexDump;
 
 public class CdmaSmsAddress extends SmsAddress {
     /**
@@ -95,4 +96,18 @@
     public CdmaSmsAddress(){
     }
 
+    @Override
+    public String toString() {
+        StringBuilder builder = new StringBuilder();
+        builder.append("CdmaSmsAddress:\n");
+        builder.append("  digitMode: " + digitMode + "\n");
+        builder.append("  numberMode: " + numberMode + "\n");
+        builder.append("  numberPlan: " + numberPlan + "\n");
+        builder.append("  numberOfDigits: " + numberOfDigits + "\n");
+        builder.append("  ton: " + ton + "\n");
+        builder.append("  address: " + address + "\n");
+        builder.append("  origBytes: " + HexDump.toHexString(origBytes) + "\n");
+        return builder.toString();
+    }
+
 }
diff --git a/telephony/java/com/android/internal/telephony/cdma/sms/SmsDataCoding.java b/telephony/java/com/android/internal/telephony/cdma/sms/SmsDataCoding.java
deleted file mode 100644
index 6ba7463..0000000
--- a/telephony/java/com/android/internal/telephony/cdma/sms/SmsDataCoding.java
+++ /dev/null
@@ -1,371 +0,0 @@
-/*
- * Copyright (C) 2007 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.internal.telephony.cdma.sms;
-
-import com.android.internal.telephony.SmsHeader;
-
-/*
- * The SMSDataCoding class encodes and decodes CDMA SMS messages.
- */
-public class SmsDataCoding {
-    private final static String TAG = "CDMA_SMS_JNI";
-
-    private final static int CDMA_SMS_WMS_MASK_BD_NULL             =   0x00000000;
-    private final static int CDMA_SMS_WMS_MASK_BD_MSG_ID           =   0x00000001;
-    private final static int CDMA_SMS_WMS_MASK_BD_USER_DATA        =   0x00000002;
-//    private final static int CDMA_SMS_WMS_MASK_BD_USER_RESP        =   0x00000004;
-    private final static int CDMA_SMS_WMS_MASK_BD_MC_TIME          =   0x00000008;
-//    private final static int CDMA_SMS_WMS_MASK_BD_VALID_ABS        =   0x00000010;
-//    private final static int CDMA_SMS_WMS_MASK_BD_VALID_REL        =   0x00000020;
-//    private final static int CDMA_SMS_WMS_MASK_BD_DEFER_ABS        =   0x00000040;
-//    private final static int CDMA_SMS_WMS_MASK_BD_DEFER_REL        =   0x00000080;
-//    private final static int CDMA_SMS_WMS_MASK_BD_PRIORITY         =   0x00000100;
-//    private final static int CDMA_SMS_WMS_MASK_BD_PRIVACY          =   0x00000200;
-//    private final static int CDMA_SMS_WMS_MASK_BD_REPLY_OPTION     =   0x00000400;
-    private final static int CDMA_SMS_WMS_MASK_BD_NUM_OF_MSGS      =   0x00000800;
-//    private final static int CDMA_SMS_WMS_MASK_BD_ALERT            =   0x00001000;
-//    private final static int CDMA_SMS_WMS_MASK_BD_LANGUAGE         =   0x00002000;
-    private final static int CDMA_SMS_WMS_MASK_BD_CALLBACK         =   0x00004000;
-    private final static int CDMA_SMS_WMS_MASK_BD_DISPLAY_MODE     =   0x00008000;
-//    private final static int CDMA_SMS_WMS_MASK_BD_SCPT_DATA        =   0x00010000;
-//    private final static int CDMA_SMS_WMS_MASK_BD_SCPT_RESULT      =   0x00020000;
-//    private final static int CDMA_SMS_WMS_MASK_BD_DEPOSIT_INDEX    =   0x00040000;
-//    private final static int CDMA_SMS_WMS_MASK_BD_DELIVERY_STATUS  =   0x00080000;
-//    private final static int CDMA_SMS_WMS_MASK_BD_IP_ADDRESS       =   0x10000000;
-//    private final static int CDMA_SMS_WMS_MASK_BD_RSN_NO_NOTIFY    =   0x20000000;
-//    private final static int CDMA_SMS_WMS_MASK_BD_OTHER            =   0x40000000;
-
-    /**
-     * Successful operation.
-     */
-    private static final int JNI_CDMA_SMS_SUCCESS = 0;
-
-    /**
-     * General failure.
-     */
-    private static final int JNI_CDMA_SMS_FAILURE = 1;
-
-    /**
-     * Data length is out of length.
-     */
-    private static final int JNI_CDMA_SMS_DATA_LEN_OUT_OF_RANGE = 2;
-
-    /**
-     * Class name unknown.
-     */
-    private static final int JNI_CDMA_SMS_CLASS_UNKNOWN = 3;
-
-    /**
-     * Field ID unknown.
-     */
-    private static final int JNI_CDMA_SMS_FIELD_ID_UNKNOWN = 4;
-
-    /**
-     * Memory allocation failed.
-     */
-    private static final int JNI_CDMA_SMS_OUT_OF_MEMORY = 5;
-
-    /**
-     * Encode SMS.
-     *
-     * @param bearerData    an instance of BearerData.
-     *
-     * @return the encoded SMS as byte[].
-     */
-    public static byte[] encodeCdmaSms(BearerData bearerData) {
-        byte[] encodedSms;
-
-        if( nativeCdmaSmsConstructClientBD() == JNI_CDMA_SMS_FAILURE){
-            return null;
-        }
-
-        // check bearer data and generate bit mask
-        generateBearerDataBitMask(bearerData);
-        encodedSms = startEncoding(bearerData);
-
-        if( nativeCdmaSmsDestructClientBD() == JNI_CDMA_SMS_FAILURE){
-            return null;
-        }
-        return encodedSms;
-    }
-
-    /**
-     * Decode SMS.
-     *
-     * @param SmsData    the encoded SMS.
-     *
-     * @return an instance of BearerData.
-     */
-    public static BearerData decodeCdmaSms(byte[] SmsData) {
-        BearerData bearerData;
-
-        if( nativeCdmaSmsConstructClientBD() == JNI_CDMA_SMS_FAILURE){
-            return null;
-        }
-
-        bearerData = startDecoding(SmsData);
-
-        if( nativeCdmaSmsDestructClientBD() == JNI_CDMA_SMS_FAILURE){
-            return null;
-        }
-        return bearerData;
-    }
-
-    private static void generateBearerDataBitMask(BearerData bearerData) {
-        // initial
-        bearerData.mask = CDMA_SMS_WMS_MASK_BD_NULL;
-
-        // check message type
-        if (bearerData.messageType != 0){
-            bearerData.mask |= CDMA_SMS_WMS_MASK_BD_MSG_ID;
-        }
-
-        // check mUserData
-        if (bearerData.userData != null){
-            bearerData.mask |= CDMA_SMS_WMS_MASK_BD_USER_DATA;
-        }
-
-        // check mTimeStamp
-        if (bearerData.timeStamp != null){
-            bearerData.mask |= CDMA_SMS_WMS_MASK_BD_MC_TIME;
-        }
-
-        // check mNumberOfMessages
-        if (bearerData.numberOfMessages > 0){
-            bearerData.mask |= CDMA_SMS_WMS_MASK_BD_NUM_OF_MSGS;
-        }
-
-        // check mCallbackNumber
-        if(bearerData.callbackNumber != null){
-            bearerData.mask |= CDMA_SMS_WMS_MASK_BD_CALLBACK;
-        }
-
-        // check DisplayMode
-        if(bearerData.displayMode == BearerData.DISPLAY_DEFAULT   ||
-           bearerData.displayMode == BearerData.DISPLAY_IMMEDIATE ||
-           bearerData.displayMode == BearerData.DISPLAY_USER){
-            bearerData.mask |= CDMA_SMS_WMS_MASK_BD_DISPLAY_MODE;
-        }
-    }
-
-    private static byte[] startEncoding(BearerData bearerData) {
-        int m_id;
-        byte[] m_data;
-        int dataLength;
-        byte[] encodedSms;
-        int nbrOfHeaders = 0;
-
-        if( nativeCdmaSmsSetBearerDataPrimitives(bearerData) == JNI_CDMA_SMS_FAILURE){
-            return null;
-        }
-
-        if ((bearerData.mask & CDMA_SMS_WMS_MASK_BD_USER_DATA) == CDMA_SMS_WMS_MASK_BD_USER_DATA){
-            if( nativeCdmaSmsSetUserData(bearerData.userData) == JNI_CDMA_SMS_FAILURE){
-                return null;
-            }
-
-            if (bearerData.userData.userDataHeader != null){
-                nbrOfHeaders = bearerData.userData.userDataHeader.nbrOfHeaders;
-            }
-
-            for (int i = 0; i < nbrOfHeaders; i++) {
-                m_id = bearerData.userData.userDataHeader.getElements().get(i).getID();
-                m_data = bearerData.userData.userDataHeader.getElements().get(i).getData();
-                dataLength = m_data.length;
-                if( nativeCdmaSmsSetUserDataHeader(m_id, m_data, dataLength, i)
-                        == JNI_CDMA_SMS_FAILURE){
-                    return null;
-                }
-            }
-        }
-
-        if ((bearerData.mask & CDMA_SMS_WMS_MASK_BD_CALLBACK) == CDMA_SMS_WMS_MASK_BD_CALLBACK) {
-            if( nativeCdmaSmsSetSmsAddress(bearerData.callbackNumber) == JNI_CDMA_SMS_FAILURE){
-                return null;
-            }
-        }
-
-        /* call native method to encode SMS */
-        encodedSms = nativeCdmaSmsEncodeSms();
-
-        return encodedSms;
-    }
-
-    private static BearerData startDecoding(byte[] SmsData) {
-        BearerData bData = new BearerData();
-        byte[] udhData;
-
-        /* call native method to decode SMS */
-        if( nativeCdmaSmsDecodeSms(SmsData) == JNI_CDMA_SMS_FAILURE){
-            return null;
-        }
-
-        if( nativeCdmaSmsGetBearerDataPrimitives(bData) == JNI_CDMA_SMS_FAILURE){
-            return null;
-        }
-
-        if ((bData.mask & CDMA_SMS_WMS_MASK_BD_USER_DATA) == CDMA_SMS_WMS_MASK_BD_USER_DATA) {
-            bData.userData = new UserData();
-            if( nativeCdmaSmsGetUserData(bData.userData) == JNI_CDMA_SMS_FAILURE){
-                return null;
-            }
-
-            udhData = nativeCdmaSmsGetUserDataHeader();
-            if (udhData != null) {
-                bData.userData.userDataHeader = SmsHeader.parse(udhData);
-            }
-        }
-
-        if ((bData.mask & CDMA_SMS_WMS_MASK_BD_CALLBACK) == CDMA_SMS_WMS_MASK_BD_CALLBACK) {
-            bData.callbackNumber = new CdmaSmsAddress();
-            if( nativeCdmaSmsGetSmsAddress(bData.callbackNumber) == JNI_CDMA_SMS_FAILURE){
-                return null;
-            }
-        }
-
-        return bData;
-    }
-
-    // native methods
-
-    /**
-     * native method: Allocate memory for clientBD structure
-     *
-     * @return #JNI_CDMA_SMS_SUCCESS if succeed.
-     *         #JNI_CDMA_SMS_FAILURE if fail.
-     */
-    private static native int nativeCdmaSmsConstructClientBD();
-
-    /**
-     * native method: Free memory used for clientBD structure
-     *
-     * @return #JNI_CDMA_SMS_SUCCESS if succeed.
-     *         #JNI_CDMA_SMS_FAILURE if fail.
-     */
-    private static native int nativeCdmaSmsDestructClientBD();
-
-    /**
-     * native method: fill clientBD structure with bearerData primitives
-     *
-     * @param bearerData    an instance of BearerData.
-     *
-     * @return #JNI_CDMA_SMS_SUCCESS if succeed.
-     *         #JNI_CDMA_SMS_FAILURE if fail.
-     */
-    private static native int nativeCdmaSmsSetBearerDataPrimitives(BearerData bearerData);
-
-    /**
-     * native method: fill bearerData primitives with clientBD variables
-     *
-     * @param bearerData    an instance of BearerData.
-     *
-     * @return #JNI_CDMA_SMS_SUCCESS if succeed.
-     *         #JNI_CDMA_SMS_FAILURE if fail.
-     */
-    private static native int nativeCdmaSmsGetBearerDataPrimitives(BearerData bearerData);
-
-    /**
-     * native method: fill clientBD.user_data with UserData primitives
-     *
-     * @param userData    an instance of UserData.
-     *
-     * @return #JNI_CDMA_SMS_SUCCESS if succeed.
-     *         #JNI_CDMA_SMS_FAILURE if fail.
-     */
-    private static native int nativeCdmaSmsSetUserData(UserData userData);
-
-    /**
-     * native method: fill UserData primitives with clientBD.user_data
-     *
-     * @param userData    an instance of UserData.
-     *
-     * @return #JNI_CDMA_SMS_SUCCESS if succeed.
-     *         #JNI_CDMA_SMS_FAILURE if fail.
-     */
-    private static native int nativeCdmaSmsGetUserData(UserData userData);
-
-    /**
-     * native method: fill clientBD.user_data.headers with UserDataHeader primitives
-     *
-     * @param ID         ID of element.
-     * @param data       element data.
-     * @param dataLength data length
-     * @param index      index of element
-     *
-     * @return #JNI_CDMA_SMS_SUCCESS if succeed.
-     *         #JNI_CDMA_SMS_FAILURE if fail.
-     */
-    private static native int nativeCdmaSmsSetUserDataHeader(
-            int ID, byte[] data, int dataLength, int index);
-
-    /**
-     * native method: fill UserDataHeader primitives with clientBD.user_data.headers
-     *
-     * @return   user data headers
-     */
-    private static native byte[] nativeCdmaSmsGetUserDataHeader();
-
-    /**
-     * native method: fill clientBD.callback with SmsAddress primitives
-     *
-     * @param smsAddr    an instance of SmsAddress.
-     *
-     * @return #JNI_CDMA_SMS_SUCCESS if succeed.
-     *         #JNI_CDMA_SMS_FAILURE if fail.
-     */
-    private static native int nativeCdmaSmsSetSmsAddress(CdmaSmsAddress smsAddr);
-
-    /**
-     * native method: fill SmsAddress primitives with clientBD.callback
-     *
-     * @param smsAddr    an instance of SmsAddress.
-     *
-     * @return #JNI_CDMA_SMS_SUCCESS if succeed.
-     *         #JNI_CDMA_SMS_FAILURE if fail.
-     */
-    private static native int nativeCdmaSmsGetSmsAddress(CdmaSmsAddress smsAddr);
-
-    /**
-     * native method: call encoding functions and get encoded SMS
-     *
-     * @return   the encoded SMS
-     */
-    private static native byte[] nativeCdmaSmsEncodeSms();
-
-    /**
-     * native method: call decode functions
-     *
-     * @param encodedSMS    encoded SMS.
-     *
-     * @return #JNI_CDMA_SMS_SUCCESS if succeed.
-     *         #JNI_CDMA_SMS_FAILURE if fail.
-     */
-    private static native int nativeCdmaSmsDecodeSms(byte[] encodedSMS);
-
-    /**
-     * Load the shared library to link the native methods.
-     */
-    static {
-        try {
-            System.loadLibrary("cdma_sms_jni");
-        }
-        catch (UnsatisfiedLinkError ule) {
-            System.err.println("WARNING: Could not load cdma_sms_jni.so");
-        }
-    }
-}
-
diff --git a/telephony/java/com/android/internal/telephony/cdma/sms/UserData.java b/telephony/java/com/android/internal/telephony/cdma/sms/UserData.java
index e761469..f916089 100644
--- a/telephony/java/com/android/internal/telephony/cdma/sms/UserData.java
+++ b/telephony/java/com/android/internal/telephony/cdma/sms/UserData.java
@@ -17,24 +17,44 @@
 package com.android.internal.telephony.cdma.sms;
 
 import com.android.internal.telephony.SmsHeader;
+import com.android.internal.util.HexDump;
 
 public class UserData{
 
     /**
-     * Supported user data encoding types
+     * User data encoding types.
      * (See 3GPP2 C.R1001-F, v1.0, table 9.1-1)
      */
-    public static final int UD_ENCODING_OCTET                      = 0x00;
-    //public static final int UD_ENCODING_EXTENDED_PROTOCOL          = 0x01;
-    public static final int UD_ENCODING_7BIT_ASCII                 = 0x02;
-    public static final int UD_ENCODING_IA5                        = 0x03;
-    public static final int UD_ENCODING_UNICODE_16                 = 0x04;
-    //public static final int UD_ENCODING_SHIFT_JIS                  = 0x05;
-    //public static final int UD_ENCODING_KOREAN                     = 0x06;
-    //public static final int UD_ENCODING_LATIN_HEBREW               = 0x07;
-    //public static final int UD_ENCODING_LATIN                      = 0x08;
-    public static final int UD_ENCODING_GSM_7BIT_ALPHABET          = 0x09;
-    //public static final int UD_ENCODING_GSM_DCS                    = 0x0A;
+    public static final int ENCODING_OCTET                      = 0x00;
+    public static final int ENCODING_IS91_EXTENDED_PROTOCOL     = 0x01;
+    public static final int ENCODING_7BIT_ASCII                 = 0x02;
+    public static final int ENCODING_IA5                        = 0x03;
+    public static final int ENCODING_UNICODE_16                 = 0x04;
+    //public static final int ENCODING_SHIFT_JIS                  = 0x05;
+    //public static final int ENCODING_KOREAN                     = 0x06;
+    //public static final int ENCODING_LATIN_HEBREW               = 0x07;
+    //public static final int ENCODING_LATIN                      = 0x08;
+    public static final int ENCODING_GSM_7BIT_ALPHABET          = 0x09;
+    public static final int ENCODING_GSM_DCS                    = 0x0A;
+
+    /**
+     * IA5 data encoding character mappings.
+     * (See CCITT Rec. T.50 Tables 1 and 3)
+     */
+    public static final char[] IA5_MAP = {
+        ' ', '!', '"', '#', '$', '%', '&', '\'', '(', ')', '*', '+', ',', '-', '.', '/',
+        '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', ':', ';', '<', '=', '>', '?',
+        '@', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O',
+        'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', '[', '\\', ']', '^', '_',
+        '`', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o',
+        'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', '{', '|', '}', '~'};
+
+    /**
+     * Mapping for IA5 values less than 32 are flow control signals
+     * and not used here.
+     */
+    public static final int IA5_MAP_BASE_INDEX = 0x20;
+    public static final int IA5_MAP_MAX_INDEX = IA5_MAP_BASE_INDEX + IA5_MAP.length - 1;
 
     /**
      * Contains the data header of the user data
@@ -44,20 +64,37 @@
     /**
      * Contains the data encoding type for the SMS message
      */
-    public int userDataEncoding;
+    public int msgEncoding;
 
-    // needed when encoding is IS91 or DCS (not supported yet):
-    //public int messageType;
+    // XXX needed when encoding is IS91 or DCS (not supported yet):
+    public int msgType;
 
     /**
      * Number of invalid bits in the last byte of data.
      */
     public int paddingBits;
 
+    public int numFields;
+
     /**
      * Contains the user data of a SMS message
      * (See 3GPP2 C.S0015-B, v2, 4.5.2)
      */
-    public byte[] userData;
+    public byte[] payload;
+    public String payloadStr;
+
+    @Override
+    public String toString() {
+        StringBuilder builder = new StringBuilder();
+        builder.append("UserData:\n");
+        builder.append("  msgEncoding: " + msgEncoding + "\n");
+        builder.append("  msgType: " + msgType + "\n");
+        builder.append("  paddingBits: " + paddingBits + "\n");
+        builder.append("  numFields: " + (int)numFields + "\n");
+        builder.append("  userDataHeader: " + userDataHeader + "\n");
+        builder.append("  payload: '" + HexDump.toHexString(payload) + "'");
+        builder.append(", payloadStr: '" + payloadStr + "'");
+        return builder.toString();
+    }
 
 }
diff --git a/telephony/java/com/android/internal/telephony/gsm/GSMPhone.java b/telephony/java/com/android/internal/telephony/gsm/GSMPhone.java
old mode 100644
new mode 100755
index d1ae997..a2d3c5e
--- a/telephony/java/com/android/internal/telephony/gsm/GSMPhone.java
+++ b/telephony/java/com/android/internal/telephony/gsm/GSMPhone.java
@@ -316,6 +316,11 @@
             // we report data connected
 
             ret = DataState.CONNECTED;
+        } else if (mSST == null) {
+            // Radio Technology Change is ongoning, dispose() and removeReferences() have
+            // already been called
+
+            ret = DataState.DISCONNECTED;
         } else if (mSST.getCurrentGprsState()
                 != ServiceState.STATE_IN_SERVICE) {
             // If we're out of service, open TCP sockets may still work
diff --git a/telephony/java/com/android/internal/telephony/gsm/GsmDataConnectionTracker.java b/telephony/java/com/android/internal/telephony/gsm/GsmDataConnectionTracker.java
index e2da7cb..9e6ebc4 100644
--- a/telephony/java/com/android/internal/telephony/gsm/GsmDataConnectionTracker.java
+++ b/telephony/java/com/android/internal/telephony/gsm/GsmDataConnectionTracker.java
@@ -131,7 +131,8 @@
 
     private static int APN_DEFAULT_ID = 0;
     private static int APN_MMS_ID = 1;
-    private static int APN_NUM_TYPES = 2;
+    private static int APN_SUPL_ID = 2;
+    private static int APN_NUM_TYPES = 3;
 
     private boolean[] dataEnabled = new boolean[APN_NUM_TYPES];
 
@@ -153,13 +154,6 @@
     private static final String INTENT_RECONNECT_ALARM = "com.android.internal.telephony.gprs-reconnect";
     private static final String INTENT_RECONNECT_ALARM_EXTRA_REASON = "reason";
 
-    //***** Tag IDs for EventLog
-    private static final int EVENT_LOG_RADIO_RESET_COUNTDOWN_TRIGGERED = 50101;
-    private static final int EVENT_LOG_RADIO_RESET = 50102;
-    private static final int EVENT_LOG_PDP_RESET = 50103;
-    private static final int EVENT_LOG_REREGISTER_NETWORK = 50104;
-    private static final int EVENT_LOG_RADIO_PDP_SETUP_FAIL = 50105;
-
     static final Uri PREFERAPN_URI = Uri.parse("content://telephony/carriers/preferapn");
     static final String APN_ID = "apn_id";
     private boolean canSetPreferApn = false;
@@ -322,8 +316,8 @@
 
     /**
      * Ensure that we are connected to an APN of the specified type.
-     * @param type the APN type (currently the only valid value
-     * is {@link Phone#APN_TYPE_MMS})
+     * @param type the APN type (currently the only valid values
+     * are {@link Phone#APN_TYPE_MMS} and {@link Phone#APN_TYPE_SUPL})
      * @return the result of the operation. Success is indicated by
      * a return value of either {@code Phone.APN_ALREADY_ACTIVE} or
      * {@code Phone.APN_REQUEST_STARTED}. In the latter case, a broadcast
@@ -331,9 +325,11 @@
      * the APN has been established.
      */
     protected int enableApnType(String type) {
-        if (!TextUtils.equals(type, Phone.APN_TYPE_MMS)) {
+        if (!TextUtils.equals(type, Phone.APN_TYPE_MMS) &&
+                !TextUtils.equals(type, Phone.APN_TYPE_SUPL)) {
             return Phone.APN_REQUEST_FAILED;
         }
+
         // If already active, return
         Log.d(LOG_TAG, "enableApnType("+type+")");
         if (isApnTypeActive(type)) {
@@ -366,12 +362,15 @@
      * The APN of the specified type is no longer needed. Ensure that if
      * use of the default APN has not been explicitly disabled, we are connected
      * to the default APN.
-     * @param type the APN type. The only valid value currently is {@link Phone#APN_TYPE_MMS}.
+     * @param type the APN type. The only valid values are currently 
+     * {@link Phone#APN_TYPE_MMS} and {@link Phone#APN_TYPE_SUPL}.
      * @return
      */
     protected int disableApnType(String type) {
         Log.d(LOG_TAG, "disableApnType("+type+")");
-        if (TextUtils.equals(type, Phone.APN_TYPE_MMS)) {
+        if ((TextUtils.equals(type, Phone.APN_TYPE_MMS) ||
+                TextUtils.equals(type, Phone.APN_TYPE_SUPL))
+                && isEnabled(type)) {
             removeMessages(EVENT_RESTORE_DEFAULT_APN);
             setEnabled(type, false);
             if (isApnTypeActive(Phone.APN_TYPE_DEFAULT)) {
@@ -439,6 +438,8 @@
             return dataEnabled[APN_DEFAULT_ID];
         } else if (TextUtils.equals(apnType, Phone.APN_TYPE_MMS)) {
             return dataEnabled[APN_MMS_ID];
+        } else if (TextUtils.equals(apnType, Phone.APN_TYPE_SUPL)) {
+            return dataEnabled[APN_SUPL_ID];
         } else {
             return false;
         }
@@ -450,9 +451,12 @@
             dataEnabled[APN_DEFAULT_ID] = enable;
         } else if (TextUtils.equals(apnType, Phone.APN_TYPE_MMS)) {
             dataEnabled[APN_MMS_ID] = enable;
+        } else if (TextUtils.equals(apnType, Phone.APN_TYPE_SUPL)) {
+            dataEnabled[APN_SUPL_ID] = enable;
         }
         Log.d(LOG_TAG, "dataEnabled[DEFAULT_APN]=" + dataEnabled[APN_DEFAULT_ID] +
-                " dataEnabled[MMS_APN]=" + dataEnabled[APN_MMS_ID]);
+                " dataEnabled[MMS_APN]=" + dataEnabled[APN_MMS_ID] +
+                " dataEnabled[SUPL_APN]=" + dataEnabled[APN_SUPL_ID]);
     }
 
     /**
@@ -476,13 +480,14 @@
             return trySetupData(Phone.REASON_DATA_ENABLED);
         } else if (!enable) {
             setEnabled(Phone.APN_TYPE_DEFAULT, false);
-            // Don't tear down if there is an active APN and it handles MMS.
+            // Don't tear down if there is an active APN and it handles MMS or SUPL.
             // TODO: This isn't very general.
-            if (!isApnTypeActive(Phone.APN_TYPE_MMS) || !isEnabled(Phone.APN_TYPE_MMS)) {
-                cleanUpConnection(true, Phone.REASON_DATA_DISABLED);
-                return true;
+            if ((isApnTypeActive(Phone.APN_TYPE_MMS) && isEnabled(Phone.APN_TYPE_MMS)) ||
+                (isApnTypeActive(Phone.APN_TYPE_SUPL) && isEnabled(Phone.APN_TYPE_SUPL))) {
+                return false;
             }
-            return false;
+            cleanUpConnection(true, Phone.REASON_DATA_DISABLED);
+            return true;
         } else {
             // isEnabled && enable
             return true;
@@ -513,7 +518,7 @@
      * {@code true} otherwise.
      */
     public boolean getAnyDataEnabled() {
-        return dataEnabled[APN_DEFAULT_ID] || dataEnabled[APN_MMS_ID];
+        return dataEnabled[APN_DEFAULT_ID] || dataEnabled[APN_MMS_ID] || dataEnabled[APN_SUPL_ID];
     }
 
     /**
@@ -785,7 +790,7 @@
     private boolean
     pdpStatesHasActiveCID (ArrayList<PDPContextState> states, int cid) {
         for (int i = 0, s = states.size() ; i < s ; i++) {
-            if (states.get(i).cid == cid) return states.get(i).active;
+            if (states.get(i).cid == cid) return (states.get(i).active != 0);
         }
 
         return false;
@@ -831,57 +836,38 @@
             return;
         }
 
+        if (state == State.CONNECTED) {
+            // The way things are supposed to work, the PDP list
+            // should not contain the CID after it disconnects.
+            // However, the way things really work, sometimes the PDP
+            // context is still listed with active = false, which
+            // makes it hard to distinguish an activating context from
+            // an activated-and-then deactivated one.
+            if (!pdpStatesHasCID(pdpStates, cidActive)) {
+                // It looks like the PDP context has deactivated.
+                // Tear everything down and try to reconnect.
 
-        // This is how things are supposed to work:
-        // The PDP list is supposed to be empty of the CID
-        // when it disconnects
+                Log.i(LOG_TAG, "PDP connection has dropped. Reconnecting");
 
-        if (state == State.CONNECTED
-                && !pdpStatesHasCID(pdpStates, cidActive)) {
+                // Add an event log when the network drops PDP
+                int cid = -1;
+                GsmCellLocation loc = ((GsmCellLocation)phone.getCellLocation());
+                if (loc != null) cid = loc.getCid();
+                EventLog.List val = new EventLog.List(cid,
+                        TelephonyManager.getDefault().getNetworkType());
+                EventLog.writeEvent(TelephonyEventLog.EVENT_LOG_PDP_NETWORK_DROP, val);
 
-            // It looks like the PDP context has deactivated
-            // Tear everything down and try to reconnect
-
-            Log.i(LOG_TAG, "PDP connection has dropped. Reconnecting");
-
-            // Add an event log when the network drops PDP
-            int cid = -1;
-            GsmCellLocation loc = ((GsmCellLocation)phone.getCellLocation());
-            if (loc != null) cid = loc.getCid();
-
-            EventLog.List val = new EventLog.List(cid,
-                    TelephonyManager.getDefault().getNetworkType());
-
-            EventLog.writeEvent(TelephonyEventLog.EVENT_LOG_PDP_NETWORK_DROP, val);
-
-            cleanUpConnection(true, null);
-
-            return;
-        }
-
-        if (true) {
-            //
-            // Workaround for issue #655426
-            //
-
-            // --------------------------
-
-            // This is how some things work now: the PDP context is still
-            // listed with active = false, which makes it hard to
-            // distinguish an activating context from an activated-and-then
-            // deactivated one.
-            //
-            // Here, we only consider this authoritative if we asked for the
-            // PDP list. If it was an unsolicited response, we poll again
-            // to make sure everyone agrees on the initial state
-
-            if (state == State.CONNECTED
-                    && !pdpStatesHasActiveCID(pdpStates, cidActive)) {
+                cleanUpConnection(true, null);
+                return;
+            } else if (!pdpStatesHasActiveCID(pdpStates, cidActive)) {
+                // Here, we only consider this authoritative if we asked for the
+                // PDP list. If it was an unsolicited response, we poll again
+                // to make sure everyone agrees on the initial state.
 
                 if (!explicitPoll) {
                     // We think it disconnected but aren't sure...poll from our side
                     phone.mCM.getPDPContextList(
-                        this.obtainMessage(EVENT_GET_PDP_LIST_COMPLETE));
+                            this.obtainMessage(EVENT_GET_PDP_LIST_COMPLETE));
                 } else {
                     Log.i(LOG_TAG, "PDP connection has dropped (active=false case). "
                                     + " Reconnecting");
@@ -890,10 +876,8 @@
                     int cid = -1;
                     GsmCellLocation loc = ((GsmCellLocation)phone.getCellLocation());
                     if (loc != null) cid = loc.getCid();
-
                     EventLog.List val = new EventLog.List(cid,
                             TelephonyManager.getDefault().getNetworkType());
-
                     EventLog.writeEvent(TelephonyEventLog.EVENT_LOG_PDP_NETWORK_DROP, val);
 
                     cleanUpConnection(true, null);
@@ -1316,7 +1300,7 @@
              * rather an app that inadvertantly fails to reset to the
              * default APN, or that dies before doing so.
              */
-            if (dataEnabled[APN_MMS_ID]) {
+            if (dataEnabled[APN_MMS_ID] || dataEnabled[APN_SUPL_ID]) {
                 removeMessages(EVENT_RESTORE_DEFAULT_APN);
                 sendMessageDelayed(obtainMessage(EVENT_RESTORE_DEFAULT_APN),
                         getRestoreDefaultApnDelay());
diff --git a/telephony/java/com/android/internal/telephony/gsm/GsmServiceStateTracker.java b/telephony/java/com/android/internal/telephony/gsm/GsmServiceStateTracker.java
index 8ecf245..9ab1002 100644
--- a/telephony/java/com/android/internal/telephony/gsm/GsmServiceStateTracker.java
+++ b/telephony/java/com/android/internal/telephony/gsm/GsmServiceStateTracker.java
@@ -539,7 +539,7 @@
                 EventLog.List val = new EventLog.List(
                         dcTracker.getStateInString(),
                         (dcTracker.getAnyDataEnabled() ? 1 : 0) );
-                EventLog.writeEvent(TelephonyEventLog.EVENT_DATA_STATE_RADIO_OFF, val);
+                EventLog.writeEvent(TelephonyEventLog.EVENT_LOG_DATA_STATE_RADIO_OFF, val);
             }
             dcTracker.cleanConnectionBeforeRadioOff();
             
diff --git a/telephony/java/com/android/internal/telephony/gsm/PDPContextState.java b/telephony/java/com/android/internal/telephony/gsm/PDPContextState.java
index feb78f8..31cdacf 100644
--- a/telephony/java/com/android/internal/telephony/gsm/PDPContextState.java
+++ b/telephony/java/com/android/internal/telephony/gsm/PDPContextState.java
@@ -21,7 +21,7 @@
  */
 public class PDPContextState {
     public int cid;
-    public boolean active;
+    public int active;
     public String type;
     public String apn;
     public String address;
diff --git a/telephony/java/com/android/internal/telephony/gsm/SIMFileHandler.java b/telephony/java/com/android/internal/telephony/gsm/SIMFileHandler.java
index ead1327..a08cdde 100644
--- a/telephony/java/com/android/internal/telephony/gsm/SIMFileHandler.java
+++ b/telephony/java/com/android/internal/telephony/gsm/SIMFileHandler.java
@@ -16,26 +16,19 @@
 
 package com.android.internal.telephony.gsm;
 
-import android.os.*;
-import android.os.AsyncResult;
+import android.os.Message;
 import android.util.Log;
 
 import com.android.internal.telephony.IccConstants;
-import com.android.internal.telephony.IccException;
 import com.android.internal.telephony.IccFileHandler;
-import com.android.internal.telephony.IccFileTypeMismatch;
-import com.android.internal.telephony.IccIoResult;
-import com.android.internal.telephony.IccUtils;
-import com.android.internal.telephony.PhoneProxy;
-
-import java.util.ArrayList;
 
 /**
  * {@hide}
  */
-public final class SIMFileHandler extends IccFileHandler {
+public final class SIMFileHandler extends IccFileHandler implements IccConstants {
     static final String LOG_TAG = "GSM";
 
+
     //***** Instance Variables
 
     //***** Constructor
@@ -59,6 +52,37 @@
         super.handleMessage(msg);
     }
 
+    protected String getEFPath(int efid) {
+        // TODO(): Make changes when USIM is supported
+        // TODO(): DF_GSM can be 7F20 or 7F21 to handle backward compatibility.
+        // Implement this after discussion with OEMs.
+        switch(efid) {
+        case EF_SMS:
+            return MF_SIM + DF_TELECOM;
+
+        case EF_EXT6:
+        case EF_MWIS:
+        case EF_MBI:
+        case EF_SPN:
+        case EF_AD:
+        case EF_MBDN:
+        case EF_PNN:
+        case EF_SPDI:
+        case EF_SST:
+        case EF_CFIS:
+            return MF_SIM + DF_GSM;
+
+        case EF_MAILBOX_CPHS:
+        case EF_VOICE_MAIL_INDICATOR_CPHS:
+        case EF_CFF_CPHS:
+        case EF_SPN_CPHS:
+        case EF_SPN_SHORT_CPHS:
+        case EF_INFO_CPHS:
+            return MF_SIM + DF_GSM;
+        }
+        return getCommonIccEFPath(efid);
+    }
+
     protected void logd(String msg) {
         Log.d(LOG_TAG, "[SIMFileHandler] " + msg);
     }
diff --git a/telephony/java/com/android/internal/telephony/gsm/SIMRecords.java b/telephony/java/com/android/internal/telephony/gsm/SIMRecords.java
index 09a17f5..f9015d9 100644
--- a/telephony/java/com/android/internal/telephony/gsm/SIMRecords.java
+++ b/telephony/java/com/android/internal/telephony/gsm/SIMRecords.java
@@ -1099,14 +1099,9 @@
 
             // Note: Data may include trailing FF's.  That's OK; message
             // should still parse correctly.
-            byte[] nba = new byte[n - 1];
-            System.arraycopy(ba, 1, nba, 0, n - 1);
-
-            String pdu = IccUtils.bytesToHexString(nba);
-            // XXX first line is bogus
-            SmsMessage message = SmsMessage.newFromCMT(
-                                new String[] { "", pdu });
-
+            byte[] pdu = new byte[n - 1];
+            System.arraycopy(ba, 1, pdu, 0, n - 1);
+            SmsMessage message = SmsMessage.createFromPdu(pdu);
 
             ((GSMPhone) phone).mSMS.dispatchMessage(message);
         }
@@ -1130,14 +1125,9 @@
 
                 // Note: Data may include trailing FF's.  That's OK; message
                 // should still parse correctly.
-                byte[] nba = new byte[n - 1];
-                System.arraycopy(ba, 1, nba, 0, n - 1);
-
-                String pdu = IccUtils.bytesToHexString(nba);
-                // XXX first line is bogus
-                SmsMessage message = SmsMessage.newFromCMT(
-                        new String[] { "", pdu });
-
+                byte[] pdu = new byte[n - 1];
+                System.arraycopy(ba, 1, pdu, 0, n - 1);
+                SmsMessage message = SmsMessage.createFromPdu(pdu);
 
                 ((GSMPhone) phone).mSMS.dispatchMessage(message);
 
@@ -1499,6 +1489,3 @@
     }
 
 }
-
-
-
diff --git a/telephony/java/com/android/internal/telephony/test/SimulatedCommands.java b/telephony/java/com/android/internal/telephony/test/SimulatedCommands.java
index 3e53654..cb09cea 100644
--- a/telephony/java/com/android/internal/telephony/test/SimulatedCommands.java
+++ b/telephony/java/com/android/internal/telephony/test/SimulatedCommands.java
@@ -832,22 +832,30 @@
     }
 
     /**
-     * response.obj.result is an String[3]
-     * response.obj.result[0] is registration state 0-5 from TS 27.007 7.2
-     * response.obj.result[1] is LAC if registered or NULL if not
-     * response.obj.result[2] is CID if registered or NULL if not
-     * valid LAC are 0x0000 - 0xffff
-     * valid CID are 0x00000000 - 0xffffffff
+     * response.obj.result is an String[14]
+     * See ril.h for details
      *
      * Please note that registration state 4 ("unknown") is treated
      * as "out of service" above
      */
     public void getRegistrationState (Message result) {
-        String ret[] = new String[3];
+        String ret[] = new String[14];
 
         ret[0] = "5"; // registered roam
         ret[1] = null;
         ret[2] = null;
+        ret[3] = null;
+        ret[4] = null;
+        ret[5] = null;
+        ret[6] = null;
+        ret[7] = null;
+        ret[8] = null;
+        ret[9] = null;
+        ret[10] = null;
+        ret[11] = null;
+        ret[12] = null;
+        ret[13] = null;
+        ret[14] = null;
 
         resultSuccess(result, ret);
     }
diff --git a/telephony/jni/cdmasms/Android.mk b/telephony/jni/cdmasms/Android.mk
deleted file mode 100644
index b0c96b4..0000000
--- a/telephony/jni/cdmasms/Android.mk
+++ /dev/null
@@ -1,24 +0,0 @@
-LOCAL_PATH:= $(call my-dir)
-include $(CLEAR_VARS)
-
-LOCAL_SRC_FILES:= \
-  cdma_sms_jni.cpp
-
-LOCAL_SHARED_LIBRARIES := \
-	libcutils \
-	libutils \
-	libandroid_runtime \
-	libnativehelper
-
-LOCAL_MODULE:= libcdma_sms_jni
-
-LOCAL_C_INCLUDES += \
-	$(JNI_H_INCLUDE) \
-	hardware/ril/include/telephony
-
-LOCAL_C_INCLUDES += hardware/ril/reference-cdma-sms
-LOCAL_SHARED_LIBRARIES += libreference-cdma-sms
-LOCAL_CFLAGS += -DREFERENCE_CDMA_SMS
-
-LOCAL_PRELINK_MODULE := false
-include $(BUILD_SHARED_LIBRARY)
diff --git a/telephony/jni/cdmasms/cdma_sms_jni.cpp b/telephony/jni/cdmasms/cdma_sms_jni.cpp
deleted file mode 100644
index 2a8e825..0000000
--- a/telephony/jni/cdmasms/cdma_sms_jni.cpp
+++ /dev/null
@@ -1,1300 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/**
- * @file cdma_sms_jni.cpp
- *
- * This file implement the Java Native Interface
- * for encoding and decoding of SMS
- */
-
-
-#include <nativehelper/jni.h>
-#include <nativehelper/JNIHelp.h>
-#include <android_runtime/AndroidRuntime.h>
-#include <cdma_sms_jni.h>
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif //__cplusplus
-
-#include <reference-cdma-sms.h>
-
-#ifdef __cplusplus
-}
-#endif //__cplusplus
-
-#undef LOG_TAG
-#define LOG_TAG "CDMA"
-#include <utils/Log.h>
-
-static RIL_CDMA_SMS_ClientBd *clientBdData = NULL;
-
-
-static jint getObjectIntField(JNIEnv * env, jobject obj, const char *name, jint * value)
-{
-    jclass clazz;
-    jfieldID field;
-
-#ifdef DBG_LOG_LEVEL_B
-    LOGD("getObjectIntField():");
-#endif
-
-    clazz = env->GetObjectClass(obj);
-    if (NULL == clazz) {
-        jniThrowException(env, "java/lang/Exception", NULL);
-        return JNI_FAILURE;
-    }
-
-    field = env->GetFieldID(clazz, name, "I");
-    env->DeleteLocalRef(clazz);
-
-    if (NULL == field) {
-        jniThrowException(env, "java/lang/NoSuchFieldException", name);
-        return JNI_FAILURE;
-    }
-
-    *value = env->GetIntField(obj, field);
-
-#ifdef DBG_LOG_LEVEL_B
-    LOGD("  %s = %d\n", name, *value);
-#endif
-
-    return JNI_SUCCESS;
-}
-
-static jint setObjectIntField(JNIEnv * env, jobject obj, const char *name, jint value)
-{
-    jclass clazz;
-    jfieldID field;
-
-#ifdef DBG_LOG_LEVEL_B
-    LOGD("setObjectIntField(): %s = %d\n", name, value);
-#endif
-
-    clazz = env->GetObjectClass(obj);
-    if (NULL == clazz) {
-        jniThrowException(env, "java/lang/Exception", NULL);
-        return JNI_FAILURE;
-    }
-
-    field = env->GetFieldID(clazz, name, "I");
-    env->DeleteLocalRef(clazz);
-
-    if (NULL == field) {
-        jniThrowException(env, "java/lang/NoSuchFieldException", name);
-        return JNI_FAILURE;
-    }
-
-    env->SetIntField(obj, field, value);
-
-    return JNI_SUCCESS;
-}
-
-static jint getObjectByteField(JNIEnv * env, jobject obj, const char *name, jbyte * value)
-{
-    jclass clazz;
-    jfieldID field;
-
-#ifdef DBG_LOG_LEVEL_B
-    LOGD("getObjectByteField():");
-#endif
-
-    clazz = env->GetObjectClass(obj);
-    if (NULL == clazz) {
-        jniThrowException(env, "java/lang/Exception", NULL);
-        return JNI_FAILURE;
-    }
-
-    field = env->GetFieldID(clazz, name, "B");
-    env->DeleteLocalRef(clazz);
-
-    if (NULL == field) {
-        jniThrowException(env, "java/lang/NoSuchFieldException", name);
-        return JNI_FAILURE;
-    }
-
-    *value = env->GetByteField(obj, field);
-
-#ifdef DBG_LOG_LEVEL_B
-    LOGD("  %s = %02x\n", name, *value);
-#endif
-
-    return JNI_SUCCESS;
-}
-
-static jint setObjectByteField(JNIEnv * env, jobject obj, const char *name, jbyte value)
-{
-    jclass clazz;
-    jfieldID field;
-#ifdef DBG_LOG_LEVEL_B
-    LOGD("setObjectByteField(): %s = 0x%02x\n", name, value);
-#endif
-
-    clazz = env->GetObjectClass(obj);
-    if (NULL == clazz) {
-        jniThrowException(env, "java/lang/Exception", NULL);
-        return JNI_FAILURE;
-    }
-
-    field = env->GetFieldID(clazz, name, "B");
-    env->DeleteLocalRef(clazz);
-
-    if (NULL == field) {
-        jniThrowException(env, "java/lang/NoSuchFieldException", name);
-        return JNI_FAILURE;
-    }
-
-    env->SetByteField(obj, field, value);
-
-    return JNI_SUCCESS;
-}
-
-static jint getObjectBooleanField(JNIEnv * env, jobject obj, const char *name, jboolean * value)
-{
-    jclass clazz;
-    jfieldID field;
-
-#ifdef DBG_LOG_LEVEL_B
-    LOGD("getObjectBooleanField():");
-#endif
-
-    clazz = env->GetObjectClass(obj);
-    if (NULL == clazz) {
-        jniThrowException(env, "java/lang/Exception", NULL);
-        return JNI_FAILURE;
-    }
-
-    field = env->GetFieldID(clazz, name, "Z");
-    env->DeleteLocalRef(clazz);
-
-    if (NULL == field) {
-        jniThrowException(env, "java/lang/NoSuchFieldException", name);
-        return JNI_FAILURE;
-    }
-
-    *value = env->GetBooleanField(obj, field);
-
-#ifdef DBG_LOG_LEVEL_B
-    LOGD("  %s = %d\n", name, *value);
-#endif
-
-    return JNI_SUCCESS;
-}
-
-static jint setObjectBooleanField(JNIEnv * env, jobject obj, const char *name, jboolean value)
-{
-    jclass clazz;
-    jfieldID field;
-
-#ifdef DBG_LOG_LEVEL_B
-    LOGD("setObjectBooleanField(): %s = %d\n", name, value);
-#endif
-
-    clazz = env->GetObjectClass(obj);
-    if (NULL == clazz) {
-        jniThrowException(env, "java/lang/Exception", NULL);
-        return JNI_FAILURE;
-    }
-
-    field = env->GetFieldID(clazz, name, "Z");
-    env->DeleteLocalRef(clazz);
-
-    if (NULL == field) {
-        jniThrowException(env, "java/lang/NoSuchFieldException", name);
-        return JNI_FAILURE;
-    }
-
-    env->SetBooleanField(obj, field, value);
-
-    return JNI_SUCCESS;
-}
-
-static jint getObjectByteArrayField(JNIEnv * env, jobject obj, const char *name, jbyte* arrData, int* length)
-{
-    jclass clazz;
-    jfieldID field;
-    jbyte * data_buf;
-
-#ifdef DBG_LOG_LEVEL_B
-    LOGD("getObjectByteArrayField(): %s\n", name);
-#endif
-
-    clazz = env->GetObjectClass(obj);
-    if (NULL == clazz) {
-        jniThrowException(env, "java/lang/Exception", NULL);
-        return JNI_FAILURE;
-    }
-
-    field = env->GetFieldID(clazz, name, "[B");
-    env->DeleteLocalRef(clazz);
-
-    if (NULL == field) {
-        jniThrowException(env, "java/lang/NoSuchFieldException", name);
-        return JNI_FAILURE;
-    }
-
-    jbyteArray buffer = (jbyteArray)(env->GetObjectField(obj, field));
-    if (buffer != NULL) {
-        int len = env->GetArrayLength(buffer);
-        data_buf = env->GetByteArrayElements(buffer, NULL);
-        for (int i=0; i<len; i++) {
-            *arrData++ = data_buf[i];
-#ifdef DBG_LOG_LEVEL_B
-            LOGD("  [%d] = 0x%02x\n", i, data_buf[i]);
-#endif
-        }
-        *length = len;
-    } else {
-        jniThrowException(env, "java/lang/NullPointerException", NULL);
-        return JNI_FAILURE;
-    }
-
-    return JNI_SUCCESS;
-}
-
-static jint setObjectByteArrayField(JNIEnv * env, jobject obj, const char *name, jbyte* arrData, int length)
-{
-    jclass clazz;
-    jfieldID field;
-    jbyte* byte_buf;
-
-#ifdef DBG_LOG_LEVEL_B
-    LOGD("setObjectByteArrayField(): %s\n", name);
-#endif
-
-    clazz = env->GetObjectClass(obj);
-    if (NULL == clazz) {
-        jniThrowException(env, "java/lang/Exception", NULL);
-        return JNI_FAILURE;
-    }
-
-    field = env->GetFieldID(clazz, name, "[B");
-    env->DeleteLocalRef(clazz);
-
-    if (NULL == field) {
-        jniThrowException(env, "java/lang/NoSuchFieldException", name);
-        return JNI_FAILURE;
-    }
-
-    jbyteArray buffer = (jbyteArray)(env->GetObjectField(obj, field));
-    if (buffer == NULL) {
-#ifdef DBG_LOG_LEVEL_B
-        LOGD("setObjectByteArrayField(): %s = null\n", name);
-#endif
-        buffer = env->NewByteArray(length);
-        env->SetObjectField(obj, field, buffer);
-    }
-
-    if (buffer != NULL) {
-#ifdef DBG_LOG_LEVEL_B
-        for (int i=0; i<length; i++) {
-            LOGD("  [%d] = 0x%02x\n", i, arrData[i]);
-        }
-#endif
-        env->SetByteArrayRegion(buffer, 0, length, arrData);
-    } else {
-        jniThrowException(env, "java/lang/NullPointerException", NULL);
-        return JNI_FAILURE;
-    }
-
-    return JNI_SUCCESS;
-}
-
-
-/* native interface */
-JNIEXPORT jint JNICALL
-Java_com_android_internal_telephony_cdma_sms_SmsDataCoding_nativeCdmaSmsConstructClientBD
-  (JNIEnv * env, jobject obj)
-{
-#ifdef DBG_LOG_LEVEL_B
-    LOGD("nativeCdmaSmsConstructClientBD()...\n");
-#endif
-
-    clientBdData = (RIL_CDMA_SMS_ClientBd *)malloc(sizeof(RIL_CDMA_SMS_ClientBd));
-    if (NULL == clientBdData) {
-        jniThrowException(env, "java/lang/OutOfMemoryError", "clientBdData memory allocation failed");
-        return JNI_FAILURE;
-    }
-    memset(clientBdData, 0, sizeof(RIL_CDMA_SMS_ClientBd));
-    return JNI_SUCCESS;
-}
-
-
-/* native interface */
-JNIEXPORT jint JNICALL
-Java_com_android_internal_telephony_cdma_sms_SmsDataCoding_nativeCdmaSmsDestructClientBD
-  (JNIEnv * env, jobject obj)
-{
-#ifdef DBG_LOG_LEVEL_B
-    LOGD("nativeCdmaSmsDestructClientBD()...\n");
-#endif
-
-    if (clientBdData == NULL) {
-        jniThrowException(env, "java/lang/NullPointerException", "clientBdData is null");
-        return JNI_FAILURE;
-    }
-    free(clientBdData);
-    return JNI_SUCCESS;
-}
-
-
-/* native interface */
-JNIEXPORT jint JNICALL
-Java_com_android_internal_telephony_cdma_sms_SmsDataCoding_nativeCdmaSmsSetBearerDataPrimitives
-  (JNIEnv * env, jobject obj, jobject bearerData)
-{
-    jbyteArray mc_time = NULL;
-    jbyte mctime_buffer[6];
-    int length;
-    jint intData;
-    jbyte byteData;
-    jboolean booleanData;
-
-#ifdef DBG_LOG_LEVEL_B
-    LOGD("nativeCdmaSmsSetBearerDataPrimitives()...\n");
-#endif
-
-    // mask
-    if (getObjectIntField(env, bearerData, "mask", &intData) != JNI_SUCCESS)
-        return JNI_FAILURE;
-    clientBdData->mask = intData;
-#ifdef DBG_LOG_LEVEL_A
-    LOGD("clientBdData->mask = 0x%x\n", clientBdData->mask);
-#endif
-
-    // message_id.type
-    if (getObjectByteField(env, bearerData, "messageType", &byteData) != JNI_SUCCESS)
-        return JNI_FAILURE;
-    clientBdData->message_id.type = (RIL_CDMA_SMS_BdMessageType)(byteData);
-#ifdef DBG_LOG_LEVEL_A
-    LOGD("clientBdData->message_id.type = 0x%02x\n", clientBdData->message_id.type);
-#endif
-
-    // message_id.id_number
-    if ((clientBdData->mask & WMS_MASK_BD_MSG_ID) == WMS_MASK_BD_MSG_ID) {
-        if (getObjectIntField(env, bearerData, "messageID", &intData) != JNI_SUCCESS)
-            return JNI_FAILURE;
-        clientBdData->message_id.id_number = (RIL_CDMA_SMS_MessageNumber)(intData);
-#ifdef DBG_LOG_LEVEL_A
-        LOGD("clientBdData->message_id.id_number = %d\n", clientBdData->message_id.id_number);
-#endif
-    }
-
-    // message_id.udh_present
-    if (getObjectBooleanField(env, bearerData, "hasUserDataHeader", &booleanData) != JNI_SUCCESS)
-        return JNI_FAILURE;
-    clientBdData->message_id.udh_present = (unsigned char)(booleanData);
-#ifdef DBG_LOG_LEVEL_A
-    LOGD("clientBdData->message_id.udh_present = %d\n", clientBdData->message_id.udh_present);
-#endif
-
-    // user_response
-    // TODO
-
-    // mc_time
-    if ((clientBdData->mask & WMS_MASK_BD_MC_TIME) == WMS_MASK_BD_MC_TIME) {
-        if (getObjectByteArrayField(env, bearerData, "timeStamp", mctime_buffer, &length) != JNI_SUCCESS)
-            return JNI_FAILURE;
-        if (mctime_buffer != NULL) {
-            clientBdData->mc_time.year     = mctime_buffer[0];
-            clientBdData->mc_time.month    = mctime_buffer[1];
-            clientBdData->mc_time.day      = mctime_buffer[2];
-            clientBdData->mc_time.hour     = mctime_buffer[3];
-            clientBdData->mc_time.minute   = mctime_buffer[4];
-            clientBdData->mc_time.second   = mctime_buffer[5];
-#ifdef DBG_LOG_LEVEL_A
-            LOGD("clientBdData->mc_time.year   = %d\n", clientBdData->mc_time.year);
-            LOGD("clientBdData->mc_time.month  = %d\n", clientBdData->mc_time.month);
-            LOGD("clientBdData->mc_time.day    = %d\n", clientBdData->mc_time.day);
-            LOGD("clientBdData->mc_time.hour   = %d\n", clientBdData->mc_time.hour);
-            LOGD("clientBdData->mc_time.minute = %d\n", clientBdData->mc_time.minute);
-            LOGD("clientBdData->mc_time.second = %d\n", clientBdData->mc_time.second);
-#endif
-        }
-    }
-
-    // clientBdData->mc_time.timezone
-    // TODO
-
-    // validity_absolute;
-    // TODO
-
-    // validity_relative;
-    // TODO
-
-    // deferred_absolute
-    // TODO
-
-    // deferred_relative;
-    // TODO
-
-    // priority
-    // TODO
-
-    // privacy
-    // TODO
-
-    if ((clientBdData->mask & WMS_MASK_BD_REPLY_OPTION) == WMS_MASK_BD_REPLY_OPTION) {
-        // reply_option.user_ack_requested
-        if (getObjectBooleanField(env, bearerData, "userAckReq", &booleanData) != JNI_SUCCESS)
-            return JNI_FAILURE;
-        clientBdData->reply_option.user_ack_requested = (unsigned char)(booleanData);
-#ifdef DBG_LOG_LEVEL_A
-        LOGD("clientBdData->reply_option.user_ack_requested = %d\n", clientBdData->reply_option.user_ack_requested);
-#endif
-        // reply_option.user_ack_requested
-        if (getObjectBooleanField(env, bearerData, "deliveryAckReq", &booleanData) != JNI_SUCCESS)
-            return JNI_FAILURE;
-        clientBdData->reply_option.delivery_ack_requested = (unsigned char)(booleanData);
-#ifdef DBG_LOG_LEVEL_A
-        LOGD("clientBdData->reply_option.delivery_ack_requested = %d\n", clientBdData->reply_option.delivery_ack_requested);
-#endif
-        // reply_option.user_ack_requested
-        if (getObjectBooleanField(env, bearerData, "readAckReq", &booleanData) != JNI_SUCCESS)
-            return JNI_FAILURE;
-        clientBdData->reply_option.read_ack_requested = (unsigned char)(booleanData);
-#ifdef DBG_LOG_LEVEL_A
-            LOGD("clientBdData->reply_option.read_ack_requested = %d\n", clientBdData->reply_option.read_ack_requested);
-#endif
-    }
-
-    // num_messages
-    if ((clientBdData->mask & WMS_MASK_BD_NUM_OF_MSGS) == WMS_MASK_BD_NUM_OF_MSGS) {
-        if (getObjectIntField(env, bearerData, "numberOfMessages", &intData) != JNI_SUCCESS)
-            return JNI_FAILURE;
-        clientBdData->num_messages = (unsigned char)(intData);
-#ifdef DBG_LOG_LEVEL_A
-        LOGD("clientBdData->num_messages = %d\n", clientBdData->num_messages);
-#endif
-    }
-
-    // alert_mode
-    // TODO
-
-    // language
-    // TODO
-
-    // display_mode
-    if ((clientBdData->mask & WMS_MASK_BD_DISPLAY_MODE) == WMS_MASK_BD_DISPLAY_MODE) {
-        if (getObjectByteField(env, bearerData, "displayMode", &byteData) != JNI_SUCCESS)
-            return JNI_FAILURE;
-        clientBdData->display_mode = (RIL_CDMA_SMS_DisplayMode)(byteData);
-#ifdef DBG_LOG_LEVEL_A
-        LOGD("clientBdData->display_mode = 0x%02x\n", clientBdData->display_mode);
-#endif
-    }
-
-    // delivery_status
-    if ((clientBdData->mask & WMS_MASK_BD_DELIVERY_STATUS) == WMS_MASK_BD_DELIVERY_STATUS) {
-        // delivery_status.error_class
-        if (getObjectIntField(env, bearerData, "errorClass", &intData) != JNI_SUCCESS)
-            return JNI_FAILURE;
-        clientBdData->delivery_status.error_class = (RIL_CDMA_SMS_ErrorClass)(intData);
-#ifdef DBG_LOG_LEVEL_A
-        LOGD("clientBdData->delivery_status.error_class = %d\n", clientBdData->delivery_status.error_class);
-#endif
-        // delivery_status.status
-        if (getObjectIntField(env, bearerData, "messageStatus", &intData) != JNI_SUCCESS)
-            return JNI_FAILURE;
-        clientBdData->delivery_status.status = (RIL_CDMA_SMS_DeliveryStatusE)(intData);
-#ifdef DBG_LOG_LEVEL_A
-        LOGD("clientBdData->delivery_status.status = %d\n", clientBdData->delivery_status.status);
-#endif
-    }
-
-    // deposit_index
-    // TODO
-
-    // ip_address
-    // TODO
-
-    // rsn_no_notify
-    // TODO
-
-    // other
-    // TODO
-
-    return JNI_SUCCESS;
-}
-
-
-/* native interface */
-JNIEXPORT jint JNICALL
-Java_com_android_internal_telephony_cdma_sms_SmsDataCoding_nativeCdmaSmsGetBearerDataPrimitives
-  (JNIEnv * env, jobject obj, jobject bearerData)
-{
-    jclass BearerDataClass;
-    jfieldID field;
-    jbyte mctime_buffer[6];
-    jbyteArray addr_array;
-    int length;
-
-#ifdef DBG_LOG_LEVEL_B
-    LOGD("nativeCdmaSmsGetBearerDataPrimitives()...\n");
-#endif
-
-    // mask
-#ifdef DBG_LOG_LEVEL_A
-    LOGD("clientBdData->mask = 0x%x\n", clientBdData->mask);
-#endif
-    if (setObjectIntField(env, bearerData, "mask", clientBdData->mask) != JNI_SUCCESS)
-        return JNI_FAILURE;
-
-    // message_id.type
-#ifdef DBG_LOG_LEVEL_A
-    LOGD("clientBdData->message_id.type = 0x%02x\n", clientBdData->message_id.type);
-#endif
-    if (setObjectByteField(env, bearerData, "messageType", (jbyte)clientBdData->message_id.type) != JNI_SUCCESS)
-        return JNI_FAILURE;
-
-    // message_id.id_number
-    if ((clientBdData->mask & WMS_MASK_BD_MSG_ID) == WMS_MASK_BD_MSG_ID) {
-#ifdef DBG_LOG_LEVEL_A
-        LOGD("clientBdData->message_id.id_number = %d\n", clientBdData->message_id.id_number);
-#endif
-        if (setObjectIntField(env, bearerData, "messageID", clientBdData->message_id.id_number) != JNI_SUCCESS)
-            return JNI_FAILURE;
-    }
-
-    // message_id.udh_present
-#ifdef DBG_LOG_LEVEL_A
-    LOGD("clientBdData->message_id.udh_present = %d\n", clientBdData->message_id.udh_present);
-#endif
-    if (setObjectBooleanField(env, bearerData, "hasUserDataHeader", (jboolean)clientBdData->message_id.udh_present) != JNI_SUCCESS)
-        return JNI_FAILURE;
-
-    // user_response
-    // TODO
-
-    // mc_time
-    if ((clientBdData->mask & WMS_MASK_BD_MC_TIME) == WMS_MASK_BD_MC_TIME) {
-        jclass clazz= env->GetObjectClass(bearerData);
-        if (NULL == clazz)
-            return JNI_FAILURE;
-        jfieldID field = env->GetFieldID(clazz, "timeStamp", "[B");
-        env->DeleteLocalRef(clazz);
-
-        addr_array = env->NewByteArray((jsize)6);
-        env->SetObjectField(bearerData, field, addr_array);
-
-#ifdef DBG_LOG_LEVEL_A
-        LOGD("clientBdData->mc_time.year   = %d\n", clientBdData->mc_time.year);
-        LOGD("clientBdData->mc_time.month  = %d\n", clientBdData->mc_time.month);
-        LOGD("clientBdData->mc_time.day    = %d\n", clientBdData->mc_time.day);
-        LOGD("clientBdData->mc_time.hour   = %d\n", clientBdData->mc_time.hour);
-        LOGD("clientBdData->mc_time.minute = %d\n", clientBdData->mc_time.minute);
-        LOGD("clientBdData->mc_time.second = %d\n", clientBdData->mc_time.second);
-#endif
-        mctime_buffer[0] = clientBdData->mc_time.year;
-        mctime_buffer[1] = clientBdData->mc_time.month;
-        mctime_buffer[2] = clientBdData->mc_time.day;
-        mctime_buffer[3] = clientBdData->mc_time.hour;
-        mctime_buffer[4] = clientBdData->mc_time.minute;
-        mctime_buffer[5] = clientBdData->mc_time.second;
-        length = sizeof(mctime_buffer) / sizeof(jbyte);
-        if (setObjectByteArrayField(env, bearerData, "timeStamp", mctime_buffer, length) != JNI_SUCCESS)
-            return JNI_FAILURE;
-    }
-
-    // clientBdData->mc_time.timezone
-    // TODO
-
-    // validity_absolute;
-    // TODO
-
-    // validity_relative;
-    // TODO
-
-    // deferred_absolute
-    // TODO
-
-    // deferred_relative;
-    // TODO
-
-    // priority
-    // TODO
-
-    // privacy
-    // TODO
-
-    if ((clientBdData->mask & WMS_MASK_BD_REPLY_OPTION) == WMS_MASK_BD_REPLY_OPTION) {
-        // reply_option.user_ack_requested
-#ifdef DBG_LOG_LEVEL_A
-        LOGD("clientBdData->reply_option.user_ack_requested = %d\n", clientBdData->reply_option.user_ack_requested);
-#endif
-        if (setObjectBooleanField(env, bearerData, "userAckReq", (jboolean)clientBdData->reply_option.user_ack_requested) != JNI_SUCCESS)
-            return JNI_FAILURE;
-
-        // reply_option.user_ack_requested
-#ifdef DBG_LOG_LEVEL_A
-        LOGD("clientBdData->reply_option.delivery_ack_requested = %d\n", clientBdData->reply_option.delivery_ack_requested);
-#endif
-        if (setObjectBooleanField(env, bearerData, "deliveryAckReq", (jboolean)clientBdData->reply_option.delivery_ack_requested) != JNI_SUCCESS)
-            return JNI_FAILURE;
-
-        // reply_option.user_ack_requested
-#ifdef DBG_LOG_LEVEL_A
-        LOGD("clientBdData->reply_option.read_ack_requested = %d\n", clientBdData->reply_option.read_ack_requested);
-#endif
-        if (setObjectBooleanField(env, bearerData, "readAckReq", (jboolean)clientBdData->reply_option.read_ack_requested) != JNI_SUCCESS)
-            return JNI_FAILURE;
-    }
-
-    // num_messages
-    if ((clientBdData->mask & WMS_MASK_BD_NUM_OF_MSGS) == WMS_MASK_BD_NUM_OF_MSGS) {
-#ifdef DBG_LOG_LEVEL_A
-        LOGD("clientBdData->num_messages = %d\n", clientBdData->num_messages);
-#endif
-        if (setObjectIntField(env, bearerData, "numberOfMessages", (int)clientBdData->num_messages) != JNI_SUCCESS)
-            return JNI_FAILURE;
-    }
-
-    // alert_mode
-    // TODO
-
-    // language
-    // TODO
-
-    // display_mode
-    if ((clientBdData->mask & WMS_MASK_BD_DISPLAY_MODE) == WMS_MASK_BD_DISPLAY_MODE) {
-#ifdef DBG_LOG_LEVEL_A
-        LOGD("clientBdData->display_mode = 0x%02x\n", clientBdData->display_mode);
-#endif
-        if (setObjectByteField(env, bearerData, "displayMode", (jbyte)clientBdData->display_mode) != JNI_SUCCESS)
-            return JNI_FAILURE;
-    }
-
-    // delivery_status
-    if ((clientBdData->mask & WMS_MASK_BD_DELIVERY_STATUS) == WMS_MASK_BD_DELIVERY_STATUS) {
-#ifdef DBG_LOG_LEVEL_A
-        LOGD("clientBdData->delivery_status.error_class = %d\n", clientBdData->delivery_status.error_class);
-#endif
-        // delivery_status.error_class
-        if (setObjectIntField(env, bearerData, "errorClass", (int)clientBdData->delivery_status.error_class) != JNI_SUCCESS)
-            return JNI_FAILURE;
-#ifdef DBG_LOG_LEVEL_A
-        LOGD("clientBdData->delivery_status.status = %d\n", clientBdData->delivery_status.status);
-#endif
-        // delivery_status.status
-        if (setObjectIntField(env, bearerData, "messageStatus", (int)clientBdData->delivery_status.status) != JNI_SUCCESS)
-            return JNI_FAILURE;
-    }
-
-    // deposit_index
-    // TODO
-
-    // ip_address
-    // TODO
-
-    // rsn_no_notify
-    // TODO
-
-    // other
-    // TODO
-
-    return JNI_SUCCESS;
-}
-
-
-/* native interface */
-JNIEXPORT jint JNICALL
-Java_com_android_internal_telephony_cdma_sms_SmsDataCoding_nativeCdmaSmsSetUserData
-  (JNIEnv * env, jobject obj, jobject userData)
-{
-    jclass UserDataClass;
-    jfieldID field;
-    jbyteArray arrData = NULL;
-    jbyte data_buf[RIL_CDMA_SMS_USER_DATA_MAX];
-    int length;
-    jint intData;
-    jbyte byteData;
-    jboolean booleanData;
-
-#ifdef DBG_LOG_LEVEL_B
-    LOGD("nativeCdmaSmsSetUserData()...\n");
-#endif
-
-    // set num_headers to 0 here, increment later
-    clientBdData->user_data.num_headers = 0;
-
-    // user_data.encoding
-    if (getObjectIntField(env, userData, "userDataEncoding", &intData) != JNI_SUCCESS)
-        return JNI_FAILURE;
-    clientBdData->user_data.encoding = (RIL_CDMA_SMS_UserDataEncoding)(intData);
-#ifdef DBG_LOG_LEVEL_A
-    LOGD("clientBdData->user_data.encoding = %d\n", clientBdData->user_data.encoding);
-#endif
-
-    // is91ep_type
-    // TODO
-
-    // user_data.padding_bits
-    if (getObjectIntField(env, userData, "paddingBits", &intData) != JNI_SUCCESS)
-        return JNI_FAILURE;
-    clientBdData->user_data.padding_bits = (unsigned char)(intData);
-#ifdef DBG_LOG_LEVEL_A
-    LOGD("clientBdData->user_data.padding_bits = %d\n", clientBdData->user_data.padding_bits);
-#endif
-
-    // user_data.data
-    if (getObjectByteArrayField(env, userData, "userData", data_buf, &length) != JNI_SUCCESS )
-        return JNI_FAILURE;
-    for (int i = 0; i < length; i++) {
-        clientBdData->user_data.data[i] = data_buf[i];
-#ifdef DBG_LOG_LEVEL_A
-        LOGD("clientBdData->user_data.data[%d] = 0x%02x\n", i, clientBdData->user_data.data[i]);
-#endif
-    }
-
-    // user_data.data_len
-    // TODO
-
-    // number_of_digits
-    clientBdData->user_data.number_of_digits = (unsigned char)(length);
-#ifdef DBG_LOG_LEVEL_A
-    LOGD("clientBdData->user_data.number_of_digits = %d\n", clientBdData->user_data.number_of_digits);
-#endif
-
-    return JNI_SUCCESS;
-}
-
-
-/* native interface */
-JNIEXPORT jint JNICALL
-Java_com_android_internal_telephony_cdma_sms_SmsDataCoding_nativeCdmaSmsGetUserData
-  (JNIEnv * env, jobject obj, jobject userData)
-{
-    jclass UserDataClass;
-    jfieldID field;
-    jbyte *data_buf;
-    int length;
-
-#ifdef DBG_LOG_LEVEL_B
-    LOGD("nativeCdmaSmsGetUserData()...\n");
-#endif
-
-    // user_data.num_headers
-//    if (setObjectIntField(env, userData, "mNumberOfHeaders", (int)clientBdData->user_data.num_headers) != JNI_SUCCESS)
-//        return JNI_FAILURE;
-
-    // user_data.encoding
-#ifdef DBG_LOG_LEVEL_A
-    LOGD("clientBdData->user_data.encoding = %d\n", clientBdData->user_data.encoding);
-#endif
-    if (setObjectIntField(env, userData, "userDataEncoding", clientBdData->user_data.encoding) != JNI_SUCCESS)
-        return JNI_FAILURE;
-
-    // is91ep_type
-    // TODO
-
-    // user_data.data_len
-//    if (setObjectIntField(env, userData, "mDataLength", (int)clientBdData->user_data.data_len) != JNI_SUCCESS)
-//        return JNI_FAILURE;
-
-    // user_data.padding_bits
-#ifdef DBG_LOG_LEVEL_A
-    LOGD("clientBdData->user_data.padding_bits = %d\n", clientBdData->user_data.padding_bits);
-#endif
-    if (setObjectIntField(env, userData, "paddingBits", (int)clientBdData->user_data.padding_bits) != JNI_SUCCESS)
-        return JNI_FAILURE;
-
-    // user_data.data
-#ifdef DBG_LOG_LEVEL_A
-    LOGD("clientBdData->user_data.data_len = %d\n", clientBdData->user_data.data_len);
-#endif
-    length = clientBdData->user_data.data_len;
-#ifdef DBG_LOG_LEVEL_A
-    for (int i = 0; i < length; i++) {
-        LOGD("clientBdData->user_data.data[%d] = 0x%02x\n", i, clientBdData->user_data.data[i]);
-    }
-#endif
-    data_buf = (jbyte*)clientBdData->user_data.data;
-    if (setObjectByteArrayField(env, userData, "userData", data_buf, length) != JNI_SUCCESS)
-        return JNI_FAILURE;
-
-    // number_of_digits
-    // TODO
-
-    return JNI_SUCCESS;
-}
-
-
-/* native interface */
-JNIEXPORT jint JNICALL Java_com_android_internal_telephony_cdma_sms_SmsDataCoding_nativeCdmaSmsSetUserDataHeader
-  (JNIEnv * env, jobject obj, jint ID, jbyteArray data, jint length, jint index)
-{
-    jbyte data_buf[length];
-
-#ifdef DBG_LOG_LEVEL_B
-    LOGD("nativeCdmaSmsSetUserDataHeader()...\n");
-#endif
-
-    env->GetByteArrayRegion(data, 0, length, data_buf);
-
-    // user_data.headers[index].header_id
-    clientBdData->user_data.headers[index].header_id = (RIL_CDMA_SMS_UdhId)(ID);
-
-    // user_data.headers[index].u
-    // TODO: add support for all udh id's
-    switch(clientBdData->user_data.headers[index].header_id)
-    {
-        case RIL_CDMA_SMS_UDH_CONCAT_8:
-            clientBdData->user_data.headers[index].u.concat_8.msg_ref  = data_buf[0];
-            clientBdData->user_data.headers[index].u.concat_8.total_sm = data_buf[1];
-            clientBdData->user_data.headers[index].u.concat_8.seq_num  = data_buf[2];
-#ifdef DBG_LOG_LEVEL_A
-            LOGD("clientBdData->user_data.headers[%d].u.concat_8.msg_ref  = 0x%02x\n", index, clientBdData->user_data.headers[index].u.concat_8.msg_ref);
-            LOGD("clientBdData->user_data.headers[%d].u.concat_8.total_sm = 0x%02x\n", index, clientBdData->user_data.headers[index].u.concat_8.total_sm);
-            LOGD("clientBdData->user_data.headers[%d].u.concat_8.seq_num  = 0x%02x\n", index, clientBdData->user_data.headers[index].u.concat_8.seq_num);
-#endif
-        break;
-        case RIL_CDMA_SMS_UDH_SPECIAL_SM:
-            clientBdData->user_data.headers[index].u.special_sm.msg_waiting      = (RIL_CDMA_SMS_GWMsgWaiting)(
-                                                                                   (data_buf[0] << 23) | (data_buf[1] << 15) |
-                                                                                   (data_buf[2] << 7)  |  data_buf[3]);
-            clientBdData->user_data.headers[index].u.special_sm.msg_waiting_kind = (RIL_CDMA_SMS_GWMsgWaitingKind)(
-                                                                                   (data_buf[4] << 23) | (data_buf[5] << 15) |
-                                                                                   (data_buf[6] << 7)  |  data_buf[7]);
-            clientBdData->user_data.headers[index].u.special_sm.message_count    =  data_buf[8];
-#ifdef DBG_LOG_LEVEL_A
-            LOGD("clientBdData->user_data.headers[%d].u.special_sm.msg_waiting      = 0x%04x\n", index, clientBdData->user_data.headers[index].u.special_sm.msg_waiting);
-            LOGD("clientBdData->user_data.headers[%d].u.special_sm.msg_waiting_kind = 0x%04x\n", index, clientBdData->user_data.headers[index].u.special_sm.msg_waiting_kind);
-            LOGD("clientBdData->user_data.headers[%d].u.special_sm.message_count    = 0x%02x\n", index, clientBdData->user_data.headers[index].u.special_sm.message_count);
-#endif
-        break;
-        case RIL_CDMA_SMS_UDH_PORT_8:
-            clientBdData->user_data.headers[index].u.wap_8.dest_port = data_buf[0];
-            clientBdData->user_data.headers[index].u.wap_8.orig_port = data_buf[1];
-#ifdef DBG_LOG_LEVEL_A
-            LOGD("clientBdData->user_data.headers[%d].u.wap_8.dest_port = 0x%02x\n", index, clientBdData->user_data.headers[index].u.wap_8.dest_port);
-            LOGD("clientBdData->user_data.headers[%d].u.wap_8.orig_port = 0x%02x\n", index, clientBdData->user_data.headers[index].u.wap_8.orig_port);
-#endif
-        break;
-        case RIL_CDMA_SMS_UDH_PORT_16:
-            clientBdData->user_data.headers[index].u.wap_16.dest_port = (data_buf[0] << 7) | data_buf[1]; // unsigned short
-            clientBdData->user_data.headers[index].u.wap_16.orig_port = (data_buf[2] << 7) | data_buf[3]; // unsigned short
-#ifdef DBG_LOG_LEVEL_A
-            LOGD("clientBdData->user_data.headers[%d].u.wap_16.dest_port = 0x%04x\n", index, clientBdData->user_data.headers[index].u.wap_16.dest_port);
-            LOGD("clientBdData->user_data.headers[%d].u.wap_16.orig_port = 0x%04x\n", index, clientBdData->user_data.headers[index].u.wap_16.orig_port);
-#endif
-        break;
-        case RIL_CDMA_SMS_UDH_CONCAT_16:
-            clientBdData->user_data.headers[index].u.concat_16.msg_ref  = (data_buf[0] << 7) | data_buf[1]; // unsigned short
-            clientBdData->user_data.headers[index].u.concat_16.total_sm =  data_buf[2];
-            clientBdData->user_data.headers[index].u.concat_16.seq_num  =  data_buf[3];
-#ifdef DBG_LOG_LEVEL_A
-            LOGD("clientBdData->user_data.headers[%d].u.concat_16.msg_ref  = 0x%04x\n", index, clientBdData->user_data.headers[index].u.concat_16.msg_ref);
-            LOGD("clientBdData->user_data.headers[%d].u.concat_16.total_sm = 0x%04x\n", index, clientBdData->user_data.headers[index].u.concat_16.total_sm);
-            LOGD("clientBdData->user_data.headers[%d].u.concat_16.seq_num  = 0x%04x\n", index, clientBdData->user_data.headers[index].u.concat_16.seq_num);
-#endif
-        break;
-        default:
-        break;
-    }
-
-    // increment num_of_headers
-    clientBdData->user_data.num_headers++;
-
-    return JNI_SUCCESS;
-}
-
-
-/* native interface */
-JNIEXPORT jbyteArray JNICALL
-Java_com_android_internal_telephony_cdma_sms_SmsDataCoding_nativeCdmaSmsGetUserDataHeader
-  (JNIEnv * env, jobject obj)
-{
-    jbyteArray arrData = NULL;
-    jbyte data_buf[sizeof(clientBdData->user_data.headers)];
-    int length = 0;
-
-#ifdef DBG_LOG_LEVEL_B
-    LOGD("nativeCdmaSmsGetUserDataHeader()...\n");
-#endif
-
-#ifdef DBG_LOG_LEVEL_A
-    LOGD("clientBdData->user_data.num_headers = %d, size = %d\n", clientBdData->user_data.num_headers, sizeof(clientBdData->user_data.headers));
-#endif
-
-    for (int index = 0; index < clientBdData->user_data.num_headers; index++) {
-        // user_data.headers[index].header_id
-        data_buf[length++] = (jbyte)clientBdData->user_data.headers[index].header_id;
-#ifdef DBG_LOG_LEVEL_A
-        LOGD("clientBdData->user_data.headers[%d].header_id = %d", index, clientBdData->user_data.headers[index].header_id);
-#endif
-
-        // user_data.headers[index].u
-        // TODO: add support for all udh id's
-        switch(clientBdData->user_data.headers[index].header_id)
-        {
-            case RIL_CDMA_SMS_UDH_CONCAT_8:
-#ifdef DBG_LOG_LEVEL_A
-                LOGD("clientBdData->user_data.headers[%d].u.concat_8.msg_ref  = 0x%02x\n", index, clientBdData->user_data.headers[index].u.concat_8.msg_ref);
-                LOGD("clientBdData->user_data.headers[%d].u.concat_8.total_sm = 0x%02x\n", index, clientBdData->user_data.headers[index].u.concat_8.total_sm);
-                LOGD("clientBdData->user_data.headers[%d].u.concat_8.seq_num  = 0x%02x\n", index, clientBdData->user_data.headers[index].u.concat_8.seq_num);
-#endif
-                data_buf[length++] = 3;
-                data_buf[length++] = clientBdData->user_data.headers[index].u.concat_8.msg_ref;
-                data_buf[length++] = clientBdData->user_data.headers[index].u.concat_8.total_sm;
-                data_buf[length++] = clientBdData->user_data.headers[index].u.concat_8.seq_num;
-            break;
-            case RIL_CDMA_SMS_UDH_SPECIAL_SM:
-#ifdef DBG_LOG_LEVEL_A
-                LOGD("clientBdData->user_data.headers[%d].u.special_sm.msg_waiting      = 0x%04x\n", index, clientBdData->user_data.headers[index].u.special_sm.msg_waiting);
-                LOGD("clientBdData->user_data.headers[%d].u.special_sm.msg_waiting_kind = 0x%04x\n", index, clientBdData->user_data.headers[index].u.special_sm.msg_waiting_kind);
-                LOGD("clientBdData->user_data.headers[%d].u.special_sm.message_count    = 0x%02x\n", index, clientBdData->user_data.headers[index].u.special_sm.message_count);
-#endif
-                data_buf[length++] = 9;
-                data_buf[length++] = (clientBdData->user_data.headers[index].u.special_sm.msg_waiting & 0xFF000000) >> 23; // int
-                data_buf[length++] = (clientBdData->user_data.headers[index].u.special_sm.msg_waiting & 0x00FF0000) >> 15;
-                data_buf[length++] = (clientBdData->user_data.headers[index].u.special_sm.msg_waiting & 0x0000FF00) >> 7;
-                data_buf[length++] =  clientBdData->user_data.headers[index].u.special_sm.msg_waiting & 0x000000FF;
-                data_buf[length++] = (clientBdData->user_data.headers[index].u.special_sm.msg_waiting_kind & 0xFF000000) >> 23; // int
-                data_buf[length++] = (clientBdData->user_data.headers[index].u.special_sm.msg_waiting_kind & 0x00FF0000) >> 15;
-                data_buf[length++] = (clientBdData->user_data.headers[index].u.special_sm.msg_waiting_kind & 0x0000FF00) >> 7;
-                data_buf[length++] =  clientBdData->user_data.headers[index].u.special_sm.msg_waiting_kind & 0x000000FF;
-                data_buf[length++] =  clientBdData->user_data.headers[index].u.special_sm.message_count;
-            break;
-            case RIL_CDMA_SMS_UDH_PORT_8:
-#ifdef DBG_LOG_LEVEL_A
-                LOGD("clientBdData->user_data.headers[%d].u.wap_8.dest_port = 0x%02x\n", index, clientBdData->user_data.headers[index].u.wap_8.dest_port);
-                LOGD("clientBdData->user_data.headers[%d].u.wap_8.orig_port = 0x%02x\n", index, clientBdData->user_data.headers[index].u.wap_8.orig_port);
-#endif
-                data_buf[length++] = 2;
-                data_buf[length++] = clientBdData->user_data.headers[index].u.wap_8.dest_port;
-                data_buf[length++] = clientBdData->user_data.headers[index].u.wap_8.orig_port;
-            break;
-            case RIL_CDMA_SMS_UDH_PORT_16:
-#ifdef DBG_LOG_LEVEL_A
-                LOGD("clientBdData->user_data.headers[%d].u.wap_16.dest_port = 0x%04x\n", index, clientBdData->user_data.headers[index].u.wap_16.dest_port);
-                LOGD("clientBdData->user_data.headers[%d].u.wap_16.orig_port = 0x%04x\n", index, clientBdData->user_data.headers[index].u.wap_16.orig_port);
-#endif
-                data_buf[length++] = 4;
-                data_buf[length++] = (clientBdData->user_data.headers[index].u.wap_16.dest_port & 0xFF00) >> 7; // unsigned short
-                data_buf[length++] =  clientBdData->user_data.headers[index].u.wap_16.dest_port & 0x00FF;
-                data_buf[length++] = (clientBdData->user_data.headers[index].u.wap_16.orig_port & 0xFF00) >> 7; // unsigned short
-                data_buf[length++] =  clientBdData->user_data.headers[index].u.wap_16.orig_port & 0x00FF;
-            break;
-            case RIL_CDMA_SMS_UDH_CONCAT_16:
-#ifdef DBG_LOG_LEVEL_A
-                LOGD("clientBdData->user_data.headers[%d].u.concat_16.msg_ref  = 0x%04x\n", index, clientBdData->user_data.headers[index].u.concat_16.msg_ref);
-                LOGD("clientBdData->user_data.headers[%d].u.concat_16.total_sm = 0x%04x\n", index, clientBdData->user_data.headers[index].u.concat_16.total_sm);
-                LOGD("clientBdData->user_data.headers[%d].u.concat_16.seq_num  = 0x%04x\n", index, clientBdData->user_data.headers[index].u.concat_16.seq_num);
-#endif
-                data_buf[length++] = 4;
-                data_buf[length++] = (clientBdData->user_data.headers[index].u.concat_16.msg_ref & 0xFF00) >> 7; // unsigned short
-                data_buf[length++] =  clientBdData->user_data.headers[index].u.concat_16.msg_ref & 0x00FF;
-                data_buf[length++] =  clientBdData->user_data.headers[index].u.concat_16.total_sm;
-                data_buf[length++] =  clientBdData->user_data.headers[index].u.concat_16.seq_num;
-            break;
-            default:
-            break;
-        }
-    }
-
-    if (length != 0) {
-        arrData = env->NewByteArray((jsize)length);
-        env->SetByteArrayRegion(arrData, 0, length, data_buf);
-    }
-
-    return arrData;
-}
-
-
-/* native interface */
-JNIEXPORT jint JNICALL
-Java_com_android_internal_telephony_cdma_sms_SmsDataCoding_nativeCdmaSmsSetSmsAddress
-  (JNIEnv * env, jobject obj, jobject smsAddress)
-{
-    jclass SmsAddressClass;
-    jfieldID field;
-    jbyteArray arrData = NULL;
-    jbyte byte_buf[RIL_CDMA_SMS_ADDRESS_MAX];
-    int length;
-    jint intData;
-    jbyte byteData;
-    jboolean booleanData;
-
-#ifdef DBG_LOG_LEVEL_B
-    LOGD("nativeCdmaSmsSetSmsAddress()...\n");
-#endif
-
-    // callback.digit_mode
-    if (getObjectByteField(env, smsAddress, "digitMode", &byteData) != JNI_SUCCESS)
-        return JNI_FAILURE;
-    clientBdData->callback.digit_mode = (RIL_CDMA_SMS_DigitMode)(byteData);
-#ifdef DBG_LOG_LEVEL_A
-    LOGD("clientBdData->callback.digit_mode = 0x%02x\n", clientBdData->callback.digit_mode);
-#endif
-
-    // callback.number_mode
-    if (getObjectByteField(env, smsAddress, "numberMode", &byteData) != JNI_SUCCESS)
-        return JNI_FAILURE;
-    clientBdData->callback.number_mode = (RIL_CDMA_SMS_NumberMode)(byteData);
-#ifdef DBG_LOG_LEVEL_A
-    LOGD("clientBdData->callback.number_mode = 0x%02x\n", clientBdData->callback.number_mode);
-#endif
-
-    // callback.number_type
-    if (getObjectIntField(env, smsAddress, "ton", &intData) != JNI_SUCCESS)
-        return JNI_FAILURE;
-    clientBdData->callback.number_type = (RIL_CDMA_SMS_NumberType)(intData);
-#ifdef DBG_LOG_LEVEL_A
-    LOGD("clientBdData->callback.number_type = %d\n", clientBdData->callback.number_type);
-#endif
-
-    // callback.number_plan
-    if (getObjectByteField(env, smsAddress, "numberPlan", &byteData) != JNI_SUCCESS)
-        return JNI_FAILURE;
-    clientBdData->callback.number_plan = (RIL_CDMA_SMS_NumberPlan)(byteData);
-#ifdef DBG_LOG_LEVEL_A
-    LOGD("clientBdData->callback.number_plan = 0x%02x\n", clientBdData->callback.number_plan);
-#endif
-
-    // callback.number_of_digits
-    if (getObjectByteField(env, smsAddress, "numberOfDigits", &byteData) != JNI_SUCCESS)
-        return JNI_FAILURE;
-    clientBdData->callback.number_of_digits = byteData;
-#ifdef DBG_LOG_LEVEL_A
-    LOGD("clientBdData->callback.number_of_digits = %d\n",clientBdData->callback.number_of_digits);
-#endif
-
-    // callback.digits
-    if (getObjectByteArrayField(env, smsAddress, "origBytes", byte_buf, &length) != JNI_SUCCESS)
-        return JNI_FAILURE;
-    for (int i = 0; i < clientBdData->callback.number_of_digits; i++) {
-        clientBdData->callback.digits[i] = byte_buf[i];
-#ifdef DBG_LOG_LEVEL_A
-        LOGD("clientBdData->callback.digits[%d] = 0x%02x\n", i, clientBdData->callback.digits[i]);
-#endif
-    }
-
-    return JNI_SUCCESS;
-}
-
-
-/* native interface */
-JNIEXPORT jint JNICALL
-Java_com_android_internal_telephony_cdma_sms_SmsDataCoding_nativeCdmaSmsGetSmsAddress
-  (JNIEnv * env, jobject obj, jobject smsAddress)
-{
-    jclass SmsAddressClass;
-    jfieldID field;
-    jbyteArray arrData = NULL;
-    jbyte *byte_buf;
-    int length;
-
-#ifdef DBG_LOG_LEVEL_B
-    LOGD("nativeCdmaSmsGetSmsAddress()...\n");
-#endif
-
-    // callback.digit_mode
-#ifdef DBG_LOG_LEVEL_A
-    LOGD("clientBdData->callback.digit_mode = 0x%02x\n", clientBdData->callback.digit_mode);
-#endif
-    if (setObjectByteField(env, smsAddress, "digitMode", (jbyte)clientBdData->callback.digit_mode) != JNI_SUCCESS)
-        return JNI_FAILURE;
-
-    // callback.number_mode
-#ifdef DBG_LOG_LEVEL_A
-    LOGD("clientBdData->callback.number_mode = 0x%02x\n", clientBdData->callback.number_mode);
-#endif
-    if (setObjectByteField(env, smsAddress, "numberMode", (jbyte)clientBdData->callback.number_mode) != JNI_SUCCESS)
-        return JNI_FAILURE;
-
-    // callback.number_type
-#ifdef DBG_LOG_LEVEL_A
-    LOGD("clientBdData->callback.number_type = %d\n", clientBdData->callback.number_type);
-#endif
-    if (setObjectIntField(env, smsAddress, "ton", (jint)clientBdData->callback.number_type) != JNI_SUCCESS)
-        return JNI_FAILURE;
-
-    // callback.number_plan
-#ifdef DBG_LOG_LEVEL_A
-    LOGD("clientBdData->callback.number_plan = 0x%02x\n", clientBdData->callback.number_plan);
-#endif
-    if (setObjectByteField(env, smsAddress, "numberPlan", (jbyte)clientBdData->callback.number_plan) != JNI_SUCCESS)
-        return JNI_FAILURE;
-
-    // callback.number_of_digits
-#ifdef DBG_LOG_LEVEL_A
-    LOGD("clientBdData->callback.number_of_digits = %d\n", clientBdData->callback.number_of_digits);
-#endif
-    if (setObjectByteField(env, smsAddress, "numberOfDigits", (jbyte)clientBdData->callback.number_of_digits) != JNI_SUCCESS)
-        return JNI_FAILURE;
-
-    // callback.digits
-    byte_buf = (jbyte*)clientBdData->callback.digits;
-    length = clientBdData->callback.number_of_digits;
-#ifdef DBG_LOG_LEVEL_A
-    for (int i = 0; i < length; i++) {
-        LOGD("clientBdData->callback.digits[%d] = 0x%02x\n", i, clientBdData->callback.digits[i]);
-    }
-#endif
-
-    if (setObjectByteArrayField(env, smsAddress, "origBytes", byte_buf, length) != JNI_SUCCESS)
-        return JNI_FAILURE;
-
-    return JNI_SUCCESS;
-}
-
-
-/* native interface */
-JNIEXPORT jbyteArray JNICALL
-Java_com_android_internal_telephony_cdma_sms_SmsDataCoding_nativeCdmaSmsEncodeSms
-  (JNIEnv * env, jobject obj)
-{
-    RIL_CDMA_Encoded_SMS *encoded_sms = (RIL_CDMA_Encoded_SMS *)malloc(sizeof(RIL_CDMA_Encoded_SMS));
-    jbyte* data_buf;
-    jint result = JNI_SUCCESS;
-    jbyteArray encodedSMS;
-
-#ifdef DBG_LOG_LEVEL_B
-    LOGD("nativeCdmaSmsEncodeSms(): entry\n");
-#endif
-
-    if (NULL == encoded_sms) {
-        jniThrowException(env, "java/lang/NullPointerException", "encoded_sms is null");
-        return NULL;
-    }
-    memset(encoded_sms, 0, sizeof(RIL_CDMA_Encoded_SMS));
-
-    // call CDMA SMS encode function
-    if(wmsts_ril_cdma_encode_sms(clientBdData, encoded_sms) != RIL_E_SUCCESS) {
-        jniThrowException(env, "java/lang/Exception", "CDMA SMS Encoding failed");
-        return NULL;
-    }
-
-#ifdef DBG_LOG_LEVEL_A
-    LOGD("  EncodeSMS: length = %i\n", encoded_sms->length);
-#endif
-    encodedSMS = env->NewByteArray((jsize)encoded_sms->length);
-    env->SetByteArrayRegion(encodedSMS, 0, encoded_sms->length, (jbyte*)encoded_sms->data);
-    free(encoded_sms);
-
-    return encodedSMS;
-}
-
-
-/* native interface */
-JNIEXPORT jint JNICALL
-Java_com_android_internal_telephony_cdma_sms_SmsDataCoding_nativeCdmaSmsDecodeSms
-  (JNIEnv * env, jobject obj, jbyteArray encodedSMS)
-{
-    RIL_CDMA_Encoded_SMS *encoded_sms = (RIL_CDMA_Encoded_SMS *)malloc(sizeof(RIL_CDMA_Encoded_SMS));
-    jbyte* data_buf;
-    jint result = JNI_SUCCESS;
-    jsize length;
-
-#ifdef DBG_LOG_LEVEL_B
-    LOGD("nativeCdmaSmsDecodeSms(): entry\n");
-#endif
-
-    if (NULL == encoded_sms) {
-        jniThrowException(env, "java/lang/NullPointerException", "encoded_sms is null");
-        return JNI_FAILURE;
-    }
-    memset(encoded_sms, 0, sizeof(RIL_CDMA_Encoded_SMS));
-
-    length = env->GetArrayLength(encodedSMS);
-    if (length < 0 || length > 255) {
-        jniThrowException(env, "java/lang/ArrayIndexOutOfBounds", "wrong encoded SMS data length");
-        return JNI_FAILURE;
-    }
-    encoded_sms->length = length;
-#ifdef DBG_LOG_LEVEL_A
-    LOGD("  DecodeSMS: arrayLength = %d\n", encoded_sms->length);
-#endif
-    data_buf = env->GetByteArrayElements(encodedSMS, NULL);
-    encoded_sms->data = (unsigned char*)data_buf;
-    env->ReleaseByteArrayElements(encodedSMS, data_buf, 0);
-
-    // call CDMA SMS decode function
-    if(wmsts_ril_cdma_decode_sms(encoded_sms, clientBdData) != RIL_E_SUCCESS) {
-        jniThrowException(env, "java/lang/Exception", "CDMA SMS Decoding failed");
-        result = JNI_FAILURE;
-    }
-
-    free(encoded_sms);
-
-    return result;
-}
-
-
-// ---------------------------------------------------------------------------
-
-static const char *classPathName = "com/android/internal/telephony/cdma/sms/SmsDataCoding";
-
-static JNINativeMethod methods[] = {
-    /* name, signature, funcPtr */
-    {"nativeCdmaSmsConstructClientBD", "()I",
-      (void*)Java_com_android_internal_telephony_cdma_sms_SmsDataCoding_nativeCdmaSmsConstructClientBD },
-    {"nativeCdmaSmsDestructClientBD", "()I",
-      (void*)Java_com_android_internal_telephony_cdma_sms_SmsDataCoding_nativeCdmaSmsDestructClientBD },
-    {"nativeCdmaSmsSetBearerDataPrimitives", "(Lcom/android/internal/telephony/cdma/sms/BearerData;)I",
-      (void*)Java_com_android_internal_telephony_cdma_sms_SmsDataCoding_nativeCdmaSmsSetBearerDataPrimitives },
-    {"nativeCdmaSmsGetBearerDataPrimitives", "(Lcom/android/internal/telephony/cdma/sms/BearerData;)I",
-      (void*)Java_com_android_internal_telephony_cdma_sms_SmsDataCoding_nativeCdmaSmsGetBearerDataPrimitives },
-    {"nativeCdmaSmsSetUserData", "(Lcom/android/internal/telephony/cdma/sms/UserData;)I",
-      (void*)Java_com_android_internal_telephony_cdma_sms_SmsDataCoding_nativeCdmaSmsSetUserData },
-    {"nativeCdmaSmsGetUserData", "(Lcom/android/internal/telephony/cdma/sms/UserData;)I",
-      (void*)Java_com_android_internal_telephony_cdma_sms_SmsDataCoding_nativeCdmaSmsGetUserData },
-    {"nativeCdmaSmsSetUserDataHeader", "(I[BII)I",
-      (void*)Java_com_android_internal_telephony_cdma_sms_SmsDataCoding_nativeCdmaSmsSetUserDataHeader },
-    {"nativeCdmaSmsGetUserDataHeader", "()[B",
-      (void*)Java_com_android_internal_telephony_cdma_sms_SmsDataCoding_nativeCdmaSmsGetUserDataHeader },
-    {"nativeCdmaSmsSetSmsAddress", "(Lcom/android/internal/telephony/cdma/sms/CdmaSmsAddress;)I",
-      (void*)Java_com_android_internal_telephony_cdma_sms_SmsDataCoding_nativeCdmaSmsSetSmsAddress },
-    {"nativeCdmaSmsGetSmsAddress", "(Lcom/android/internal/telephony/cdma/sms/CdmaSmsAddress;)I",
-      (void*)Java_com_android_internal_telephony_cdma_sms_SmsDataCoding_nativeCdmaSmsGetSmsAddress },
-    {"nativeCdmaSmsEncodeSms", "()[B",
-      (void*)Java_com_android_internal_telephony_cdma_sms_SmsDataCoding_nativeCdmaSmsEncodeSms },
-    {"nativeCdmaSmsDecodeSms", "([B)I",
-      (void*)Java_com_android_internal_telephony_cdma_sms_SmsDataCoding_nativeCdmaSmsDecodeSms },
-};
-
-int register_android_cdma_sms_methods(JNIEnv *_env)
-{
-    return android::AndroidRuntime::registerNativeMethods(
-            _env, classPathName, methods, NELEM(methods));
-}
-
-// ---------------------------------------------------------------------------
-
-jint JNI_OnLoad(JavaVM* vm, void* reserved)
-{
-    JNIEnv* env = NULL;
-    jint result = -1;
-
-    if (vm->GetEnv((void**) &env, JNI_VERSION_1_4) != JNI_OK) {
-        LOGE("ERROR: GetEnv failed\n");
-        goto bail;
-    }
-    assert(env != NULL);
-
-    if (register_android_cdma_sms_methods(env) < 0) {
-        LOGE("ERROR: CDMA SMS native registration failed\n");
-        goto bail;
-    }
-
-    /* success -- return valid version number */
-    result = JNI_VERSION_1_4;
-
-bail:
-    return result;
-}
diff --git a/telephony/jni/cdmasms/cdma_sms_jni.h b/telephony/jni/cdmasms/cdma_sms_jni.h
deleted file mode 100644
index 253c006..0000000
--- a/telephony/jni/cdmasms/cdma_sms_jni.h
+++ /dev/null
@@ -1,159 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/* DO NOT EDIT THIS FILE - it is machine generated */
-#include <jni.h>
-/* Header for class com_android_internal_telephony_cdma_sms_SmsDataCoding */
-
-#ifndef _Included_com_android_internal_telephony_cdma_sms_SmsDataCoding
-#define _Included_com_android_internal_telephony_cdma_sms_SmsDataCoding
-#ifdef __cplusplus
-extern "C" {
-#endif
-#undef com_android_internal_telephony_cdma_sms_SmsDataCoding_CDMA_SMS_WMS_MASK_BD_NULL
-#define com_android_internal_telephony_cdma_sms_SmsDataCoding_CDMA_SMS_WMS_MASK_BD_NULL 0L
-#undef com_android_internal_telephony_cdma_sms_SmsDataCoding_CDMA_SMS_WMS_MASK_BD_MSG_ID
-#define com_android_internal_telephony_cdma_sms_SmsDataCoding_CDMA_SMS_WMS_MASK_BD_MSG_ID 1L
-#undef com_android_internal_telephony_cdma_sms_SmsDataCoding_CDMA_SMS_WMS_MASK_BD_USER_DATA
-#define com_android_internal_telephony_cdma_sms_SmsDataCoding_CDMA_SMS_WMS_MASK_BD_USER_DATA 2L
-#undef com_android_internal_telephony_cdma_sms_SmsDataCoding_CDMA_SMS_WMS_MASK_BD_MC_TIME
-#define com_android_internal_telephony_cdma_sms_SmsDataCoding_CDMA_SMS_WMS_MASK_BD_MC_TIME 8L
-#undef com_android_internal_telephony_cdma_sms_SmsDataCoding_CDMA_SMS_WMS_MASK_BD_NUM_OF_MSGS
-#define com_android_internal_telephony_cdma_sms_SmsDataCoding_CDMA_SMS_WMS_MASK_BD_NUM_OF_MSGS 2048L
-#undef com_android_internal_telephony_cdma_sms_SmsDataCoding_CDMA_SMS_WMS_MASK_BD_CALLBACK
-#define com_android_internal_telephony_cdma_sms_SmsDataCoding_CDMA_SMS_WMS_MASK_BD_CALLBACK 16384L
-#undef com_android_internal_telephony_cdma_sms_SmsDataCoding_CDMA_SMS_WMS_MASK_BD_DISPLAY_MODE
-#define com_android_internal_telephony_cdma_sms_SmsDataCoding_CDMA_SMS_WMS_MASK_BD_DISPLAY_MODE 32768L
-#undef com_android_internal_telephony_cdma_sms_SmsDataCoding_JNI_CDMA_SMS_SUCCESS
-#define com_android_internal_telephony_cdma_sms_SmsDataCoding_JNI_CDMA_SMS_SUCCESS 0L
-#undef com_android_internal_telephony_cdma_sms_SmsDataCoding_JNI_CDMA_SMS_FAILURE
-#define com_android_internal_telephony_cdma_sms_SmsDataCoding_JNI_CDMA_SMS_FAILURE 1L
-#undef com_android_internal_telephony_cdma_sms_SmsDataCoding_JNI_CDMA_SMS_DATA_LEN_OUT_OF_RANGE
-#define com_android_internal_telephony_cdma_sms_SmsDataCoding_JNI_CDMA_SMS_DATA_LEN_OUT_OF_RANGE 2L
-#undef com_android_internal_telephony_cdma_sms_SmsDataCoding_JNI_CDMA_SMS_CLASS_UNKNOWN
-#define com_android_internal_telephony_cdma_sms_SmsDataCoding_JNI_CDMA_SMS_CLASS_UNKNOWN 3L
-#undef com_android_internal_telephony_cdma_sms_SmsDataCoding_JNI_CDMA_SMS_FIELD_ID_UNKNOWN
-#define com_android_internal_telephony_cdma_sms_SmsDataCoding_JNI_CDMA_SMS_FIELD_ID_UNKNOWN 4L
-#undef com_android_internal_telephony_cdma_sms_SmsDataCoding_JNI_CDMA_SMS_OUT_OF_MEMORY
-#define com_android_internal_telephony_cdma_sms_SmsDataCoding_JNI_CDMA_SMS_OUT_OF_MEMORY 5L
-/*
- * Class:     com_android_internal_telephony_cdma_sms_SmsDataCoding
- * Method:    nativeCdmaSmsConstructClientBD
- * Signature: ()I
- */
-JNIEXPORT jint JNICALL Java_com_android_internal_telephony_cdma_sms_SmsDataCoding_nativeCdmaSmsConstructClientBD
-  (JNIEnv *, jobject);
-
-/*
- * Class:     com_android_internal_telephony_cdma_sms_SmsDataCoding
- * Method:    nativeCdmaSmsDestructClientBD
- * Signature: ()I
- */
-JNIEXPORT jint JNICALL Java_com_android_internal_telephony_cdma_sms_SmsDataCoding_nativeCdmaSmsDestructClientBD
-  (JNIEnv *, jobject);
-
-/*
- * Class:     com_android_internal_telephony_cdma_sms_SmsDataCoding
- * Method:    nativeCdmaSmsSetBearerDataPrimitives
- * Signature: (Lcom/android/internal/telephony/cdma/sms/BearerData;)I
- */
-JNIEXPORT jint JNICALL Java_com_android_internal_telephony_cdma_sms_SmsDataCoding_nativeCdmaSmsSetBearerDataPrimitives
-  (JNIEnv *, jobject, jobject);
-
-/*
- * Class:     com_android_internal_telephony_cdma_sms_SmsDataCoding
- * Method:    nativeCdmaSmsGetBearerDataPrimitives
- * Signature: (Lcom/android/internal/telephony/cdma/sms/BearerData;)I
- */
-JNIEXPORT jint JNICALL Java_com_android_internal_telephony_cdma_sms_SmsDataCoding_nativeCdmaSmsGetBearerDataPrimitives
-  (JNIEnv *, jobject, jobject);
-
-/*
- * Class:     com_android_internal_telephony_cdma_sms_SmsDataCoding
- * Method:    nativeCdmaSmsSetUserData
- * Signature: (Lcom/android/internal/telephony/cdma/sms/UserData;)I
- */
-JNIEXPORT jint JNICALL Java_com_android_internal_telephony_cdma_sms_SmsDataCoding_nativeCdmaSmsSetUserData
-  (JNIEnv *, jobject, jobject);
-
-/*
- * Class:     com_android_internal_telephony_cdma_sms_SmsDataCoding
- * Method:    nativeCdmaSmsGetUserData
- * Signature: (Lcom/android/internal/telephony/cdma/sms/UserData;)I
- */
-JNIEXPORT jint JNICALL Java_com_android_internal_telephony_cdma_sms_SmsDataCoding_nativeCdmaSmsGetUserData
-  (JNIEnv *, jobject, jobject);
-
-/*
- * Class:     com_android_internal_telephony_cdma_sms_SmsDataCoding
- * Method:    nativeCdmaSmsSetUserDataHeader
- * Signature: (I[BII)I
- */
-JNIEXPORT jint JNICALL Java_com_android_internal_telephony_cdma_sms_SmsDataCoding_nativeCdmaSmsSetUserDataHeader
-  (JNIEnv *, jobject, jint, jbyteArray, jint, jint);
-
-/*
- * Class:     com_android_internal_telephony_cdma_sms_SmsDataCoding
- * Method:    nativeCdmaSmsGetUserDataHeader
- * Signature: ()[B
- */
-JNIEXPORT jbyteArray JNICALL Java_com_android_internal_telephony_cdma_sms_SmsDataCoding_nativeCdmaSmsGetUserDataHeader
-  (JNIEnv *, jobject);
-
-/*
- * Class:     com_android_internal_telephony_cdma_sms_SmsDataCoding
- * Method:    nativeCdmaSmsSetSmsAddress
- * Signature: (Lcom/android/internal/telephony/cdma/sms/CdmaSmsAddress;)I
- */
-JNIEXPORT jint JNICALL Java_com_android_internal_telephony_cdma_sms_SmsDataCoding_nativeCdmaSmsSetSmsAddress
-  (JNIEnv *, jobject, jobject);
-
-/*
- * Class:     com_android_internal_telephony_cdma_sms_SmsDataCoding
- * Method:    nativeCdmaSmsGetSmsAddress
- * Signature: (Lcom/android/internal/telephony/cdma/sms/CdmaSmsAddress;)I
- */
-JNIEXPORT jint JNICALL Java_com_android_internal_telephony_cdma_sms_SmsDataCoding_nativeCdmaSmsGetSmsAddress
-  (JNIEnv *, jobject, jobject);
-
-/*
- * Class:     com_android_internal_telephony_cdma_sms_SmsDataCoding
- * Method:    nativeCdmaSmsEncodeSms
- * Signature: ()[B
- */
-JNIEXPORT jbyteArray JNICALL Java_com_android_internal_telephony_cdma_sms_SmsDataCoding_nativeCdmaSmsEncodeSms
-  (JNIEnv *, jobject);
-
-/*
- * Class:     com_android_internal_telephony_cdma_sms_SmsDataCoding
- * Method:    nativeCdmaSmsDecodeSms
- * Signature: ([B)I
- */
-JNIEXPORT jint JNICALL Java_com_android_internal_telephony_cdma_sms_SmsDataCoding_nativeCdmaSmsDecodeSms
-  (JNIEnv *, jobject, jbyteArray);
-
-/**
- * CDMA SMS return value defines
- */
-#define JNI_SUCCESS \
-com_android_internal_telephony_cdma_sms_SmsDataCoding_JNI_CDMA_SMS_SUCCESS  /**< Successful operation */
-#define JNI_FAILURE \
-com_android_internal_telephony_cdma_sms_SmsDataCoding_JNI_CDMA_SMS_FAILURE  /**< General failure */
-
-#ifdef __cplusplus
-}
-#endif
-#endif
diff --git a/test-runner/android/test/TestLocationProvider.java b/test-runner/android/test/TestLocationProvider.java
index 69747d2..0fc3d16 100644
--- a/test-runner/android/test/TestLocationProvider.java
+++ b/test-runner/android/test/TestLocationProvider.java
@@ -20,10 +20,11 @@
 import android.location.Criteria;
 import android.location.ILocationManager;
 import android.location.Location;
-import android.location.LocationProviderImpl;
 import android.os.Bundle;
 import android.os.SystemClock;
 
+import com.android.internal.location.LocationProviderImpl;
+
 /**
  * @hide - This is part of a framework that is under development and should not be used for
  * active development.
diff --git a/tests/AndroidTests/res/values-320x200/configVarying.xml b/tests/AndroidTests/res/values-32dpi/configVarying.xml
similarity index 86%
copy from tests/AndroidTests/res/values-320x200/configVarying.xml
copy to tests/AndroidTests/res/values-32dpi/configVarying.xml
index ca2a286..f903f0f 100644
--- a/tests/AndroidTests/res/values-320x200/configVarying.xml
+++ b/tests/AndroidTests/res/values-32dpi/configVarying.xml
@@ -15,8 +15,8 @@
 -->
 
 <resources>
-    <item type="configVarying" name="simple">simple 320x200</item>
+    <item type="configVarying" name="simple">simple 32dpi</item>
     <bag type="configVarying" name="bag">
-        <item name="testString">bag 320x200</item>
+        <item name="testString">bag 32dpi</item>
     </bag>
 </resources>
diff --git a/tests/AndroidTests/res/values-320x200/configVarying.xml b/tests/AndroidTests/res/values-640x400/configVarying.xml
similarity index 86%
copy from tests/AndroidTests/res/values-320x200/configVarying.xml
copy to tests/AndroidTests/res/values-640x400/configVarying.xml
index ca2a286..30332c0 100644
--- a/tests/AndroidTests/res/values-320x200/configVarying.xml
+++ b/tests/AndroidTests/res/values-640x400/configVarying.xml
@@ -15,8 +15,8 @@
 -->
 
 <resources>
-    <item type="configVarying" name="simple">simple 320x200</item>
+    <item type="configVarying" name="simple">simple 640x400</item>
     <bag type="configVarying" name="bag">
-        <item name="testString">bag 320x200</item>
+        <item name="testString">bag 640x400</item>
     </bag>
 </resources>
diff --git a/tests/AndroidTests/res/values-finger/configVarying.xml b/tests/AndroidTests/res/values-finger/configVarying.xml
deleted file mode 100644
index 674787e..0000000
--- a/tests/AndroidTests/res/values-finger/configVarying.xml
+++ /dev/null
@@ -1,22 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2007 The Android Open Source Project
-
-     Licensed under the Apache License, Version 2.0 (the "License");
-     you may not use this file except in compliance with the License.
-     You may obtain a copy of the License at
-  
-          http://www.apache.org/licenses/LICENSE-2.0
-  
-     Unless required by applicable law or agreed to in writing, software
-     distributed under the License is distributed on an "AS IS" BASIS,
-     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-     See the License for the specific language governing permissions and
-     limitations under the License.
--->
-
-<resources>
-    <item type="configVarying" name="simple">simple finger</item>
-    <bag type="configVarying" name="bag">
-        <item name="testString">bag finger</item>
-    </bag>
-</resources>
diff --git a/tests/AndroidTests/res/values-320x200/configVarying.xml b/tests/AndroidTests/res/values-fr-rFR/configVarying.xml
similarity index 86%
rename from tests/AndroidTests/res/values-320x200/configVarying.xml
rename to tests/AndroidTests/res/values-fr-rFR/configVarying.xml
index ca2a286..5ecac7c 100644
--- a/tests/AndroidTests/res/values-320x200/configVarying.xml
+++ b/tests/AndroidTests/res/values-fr-rFR/configVarying.xml
@@ -15,8 +15,8 @@
 -->
 
 <resources>
-    <item type="configVarying" name="simple">simple 320x200</item>
+    <item type="configVarying" name="simple">simple fr FR</item>
     <bag type="configVarying" name="bag">
-        <item name="testString">bag 320x200</item>
+        <item name="testString">bag fr FR</item>
     </bag>
 </resources>
diff --git a/tests/AndroidTests/res/values-320x200/configVarying.xml b/tests/AndroidTests/res/values-fr/configVarying.xml
similarity index 86%
copy from tests/AndroidTests/res/values-320x200/configVarying.xml
copy to tests/AndroidTests/res/values-fr/configVarying.xml
index ca2a286..8413b5a 100644
--- a/tests/AndroidTests/res/values-320x200/configVarying.xml
+++ b/tests/AndroidTests/res/values-fr/configVarying.xml
@@ -15,8 +15,8 @@
 -->
 
 <resources>
-    <item type="configVarying" name="simple">simple 320x200</item>
+    <item type="configVarying" name="simple">simple fr</item>
     <bag type="configVarying" name="bag">
-        <item name="testString">bag 320x200</item>
+        <item name="testString">bag fr</item>
     </bag>
 </resources>
diff --git a/tests/AndroidTests/res/values-keyshidden/configVarying.xml b/tests/AndroidTests/res/values-keyshidden/configVarying.xml
deleted file mode 100644
index fdffc4d..0000000
--- a/tests/AndroidTests/res/values-keyshidden/configVarying.xml
+++ /dev/null
@@ -1,22 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2007 The Android Open Source Project
-
-     Licensed under the Apache License, Version 2.0 (the "License");
-     you may not use this file except in compliance with the License.
-     You may obtain a copy of the License at
-  
-          http://www.apache.org/licenses/LICENSE-2.0
-  
-     Unless required by applicable law or agreed to in writing, software
-     distributed under the License is distributed on an "AS IS" BASIS,
-     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-     See the License for the specific language governing permissions and
-     limitations under the License.
--->
-
-<resources>
-    <item type="configVarying" name="simple">simple keyshidden</item>
-    <bag type="configVarying" name="bag">
-        <item name="testString">bag keyshidden</item>
-    </bag>
-</resources>
diff --git a/tests/AndroidTests/res/values-trackball/configVarying.xml b/tests/AndroidTests/res/values-mcc110-xx/configVarying.xml
similarity index 86%
rename from tests/AndroidTests/res/values-trackball/configVarying.xml
rename to tests/AndroidTests/res/values-mcc110-xx/configVarying.xml
index 0dec300..82e2435 100644
--- a/tests/AndroidTests/res/values-trackball/configVarying.xml
+++ b/tests/AndroidTests/res/values-mcc110-xx/configVarying.xml
@@ -15,8 +15,8 @@
 -->
 
 <resources>
-    <item type="configVarying" name="simple">simple trackball</item>
+    <item type="configVarying" name="simple">simple mcc110 xx</item>
     <bag type="configVarying" name="bag">
-        <item name="testString">bag trackball</item>
+        <item name="testString">bag mcc110 xx</item>
     </bag>
 </resources>
diff --git a/tests/AndroidTests/res/values-320x200/configVarying.xml b/tests/AndroidTests/res/values-mcc112/configVarying.xml
similarity index 86%
copy from tests/AndroidTests/res/values-320x200/configVarying.xml
copy to tests/AndroidTests/res/values-mcc112/configVarying.xml
index ca2a286..9c05d77 100644
--- a/tests/AndroidTests/res/values-320x200/configVarying.xml
+++ b/tests/AndroidTests/res/values-mcc112/configVarying.xml
@@ -15,8 +15,8 @@
 -->
 
 <resources>
-    <item type="configVarying" name="simple">simple 320x200</item>
+    <item type="configVarying" name="simple">simple mcc112</item>
     <bag type="configVarying" name="bag">
-        <item name="testString">bag 320x200</item>
+        <item name="testString">bag mcc112</item>
     </bag>
 </resources>
diff --git a/tests/AndroidTests/res/values-trackball/configVarying.xml b/tests/AndroidTests/res/values-mnc220-xx/configVarying.xml
similarity index 86%
copy from tests/AndroidTests/res/values-trackball/configVarying.xml
copy to tests/AndroidTests/res/values-mnc220-xx/configVarying.xml
index 0dec300..fbc7888 100644
--- a/tests/AndroidTests/res/values-trackball/configVarying.xml
+++ b/tests/AndroidTests/res/values-mnc220-xx/configVarying.xml
@@ -15,8 +15,8 @@
 -->
 
 <resources>
-    <item type="configVarying" name="simple">simple trackball</item>
+    <item type="configVarying" name="simple">simple mnc220 xx</item>
     <bag type="configVarying" name="bag">
-        <item name="testString">bag trackball</item>
+        <item name="testString">bag mnc220 xx</item>
     </bag>
 </resources>
diff --git a/tests/AndroidTests/res/values-320x200/configVarying.xml b/tests/AndroidTests/res/values-mnc222-32dpi/configVarying.xml
similarity index 85%
copy from tests/AndroidTests/res/values-320x200/configVarying.xml
copy to tests/AndroidTests/res/values-mnc222-32dpi/configVarying.xml
index ca2a286..03bea33 100644
--- a/tests/AndroidTests/res/values-320x200/configVarying.xml
+++ b/tests/AndroidTests/res/values-mnc222-32dpi/configVarying.xml
@@ -15,8 +15,8 @@
 -->
 
 <resources>
-    <item type="configVarying" name="simple">simple 320x200</item>
+    <item type="configVarying" name="simple">simple mnc222 32dpi</item>
     <bag type="configVarying" name="bag">
-        <item name="testString">bag 320x200</item>
+        <item name="testString">bag mnc222 32dpi</item>
     </bag>
 </resources>
diff --git a/tests/AndroidTests/res/values-320x200/configVarying.xml b/tests/AndroidTests/res/values-mnc223/configVarying.xml
similarity index 86%
copy from tests/AndroidTests/res/values-320x200/configVarying.xml
copy to tests/AndroidTests/res/values-mnc223/configVarying.xml
index ca2a286..8936cbc 100644
--- a/tests/AndroidTests/res/values-320x200/configVarying.xml
+++ b/tests/AndroidTests/res/values-mnc223/configVarying.xml
@@ -15,8 +15,8 @@
 -->
 
 <resources>
-    <item type="configVarying" name="simple">simple 320x200</item>
+    <item type="configVarying" name="simple">simple mnc223</item>
     <bag type="configVarying" name="bag">
-        <item name="testString">bag 320x200</item>
+        <item name="testString">bag mnc223</item>
     </bag>
 </resources>
diff --git a/tests/AndroidTests/res/values-port/configVarying.xml b/tests/AndroidTests/res/values-port/configVarying.xml
deleted file mode 100644
index 0e1f247..0000000
--- a/tests/AndroidTests/res/values-port/configVarying.xml
+++ /dev/null
@@ -1,22 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2007 The Android Open Source Project
-
-     Licensed under the Apache License, Version 2.0 (the "License");
-     you may not use this file except in compliance with the License.
-     You may obtain a copy of the License at
-  
-          http://www.apache.org/licenses/LICENSE-2.0
-  
-     Unless required by applicable law or agreed to in writing, software
-     distributed under the License is distributed on an "AS IS" BASIS,
-     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-     See the License for the specific language governing permissions and
-     limitations under the License.
--->
-
-<resources>
-    <item type="configVarying" name="simple">simple portrait</item>
-    <bag type="configVarying" name="bag">
-        <item name="testString">bag portrait</item>
-    </bag>
-</resources>
diff --git a/tests/AndroidTests/res/values-qwerty/configVarying.xml b/tests/AndroidTests/res/values-qwerty/configVarying.xml
deleted file mode 100644
index 939f682..0000000
--- a/tests/AndroidTests/res/values-qwerty/configVarying.xml
+++ /dev/null
@@ -1,22 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2007 The Android Open Source Project
-
-     Licensed under the Apache License, Version 2.0 (the "License");
-     you may not use this file except in compliance with the License.
-     You may obtain a copy of the License at
-  
-          http://www.apache.org/licenses/LICENSE-2.0
-  
-     Unless required by applicable law or agreed to in writing, software
-     distributed under the License is distributed on an "AS IS" BASIS,
-     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-     See the License for the specific language governing permissions and
-     limitations under the License.
--->
-
-<resources>
-    <item type="configVarying" name="simple">simple qwerty</item>
-    <bag type="configVarying" name="bag">
-        <item name="testString">bag qwerty</item>
-    </bag>
-</resources>
diff --git a/tests/AndroidTests/src/com/android/unit_tests/BitwiseStreamsTest.java b/tests/AndroidTests/src/com/android/unit_tests/BitwiseStreamsTest.java
new file mode 100644
index 0000000..a935247
--- /dev/null
+++ b/tests/AndroidTests/src/com/android/unit_tests/BitwiseStreamsTest.java
@@ -0,0 +1,113 @@
+/*
+ * Copyright (C) 2006 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.unit_tests;
+
+import com.android.internal.util.BitwiseInputStream;
+import com.android.internal.util.BitwiseOutputStream;
+import com.android.internal.util.HexDump;
+
+import android.test.AndroidTestCase;
+import android.test.suitebuilder.annotation.SmallTest;
+
+import android.util.Log;
+
+public class BitwiseStreamsTest extends AndroidTestCase {
+    private final static String LOG_TAG = "BitwiseStreamsTest";
+
+    @SmallTest
+    public void testOne() throws Exception {
+        int offset = 3;
+        byte[] inBuf = HexDump.hexStringToByteArray("FFDD");
+        BitwiseOutputStream outStream = new BitwiseOutputStream(30);
+        outStream.skip(offset);
+        for (int i = 0; i < inBuf.length; i++) outStream.write(8, inBuf[i]);
+        byte[] outBuf = outStream.toByteArray();
+        BitwiseInputStream inStream = new BitwiseInputStream(outBuf);
+        byte[] inBufDup = new byte[inBuf.length];
+        inStream.skip(offset);
+        for (int i = 0; i < inBufDup.length; i++) inBufDup[i] = inStream.read(8);
+        assertEquals(HexDump.toHexString(inBuf), HexDump.toHexString(inBufDup));
+    }
+
+    @SmallTest
+    public void testTwo() throws Exception {
+        int offset = 3;
+        byte[] inBuf = HexDump.hexStringToByteArray("11d4f29c0e9ad3c36e72584e064d9b53");
+        BitwiseOutputStream outStream = new BitwiseOutputStream(30);
+        outStream.skip(offset);
+        for (int i = 0; i < inBuf.length; i++) outStream.write(8, inBuf[i]);
+        BitwiseInputStream inStream = new BitwiseInputStream(outStream.toByteArray());
+        inStream.skip(offset);
+        byte[] inBufDup = new byte[inBuf.length];
+        for (int i = 0; i < inBufDup.length; i++) inBufDup[i] = inStream.read(8);
+        assertEquals(HexDump.toHexString(inBuf), HexDump.toHexString(inBufDup));
+    }
+
+    @SmallTest
+    public void testThree() throws Exception {
+        int offset = 4;
+        byte[] inBuf = HexDump.hexStringToByteArray("00031040900112488ea794e0");
+        BitwiseOutputStream outStream = new BitwiseOutputStream(30);
+        outStream.skip(offset);
+        for (int i = 0; i < inBuf.length; i++) outStream.write(8, inBuf[i]);
+        BitwiseInputStream inStream = new BitwiseInputStream(outStream.toByteArray());
+        inStream.skip(offset);
+        byte[] inBufDup = new byte[inBuf.length];
+        for (int i = 0; i < inBufDup.length; i++) inBufDup[i] = inStream.read(8);
+        assertEquals(HexDump.toHexString(inBuf), HexDump.toHexString(inBufDup));
+    }
+
+    @SmallTest
+    public void testFour() throws Exception {
+        int offset = 7;
+        byte[] inBuf = HexDump.hexStringToByteArray("00031040900112488ea794e0");
+        BitwiseOutputStream outStream = new BitwiseOutputStream(30);
+        outStream.skip(offset);
+        for (int i = 0; i < inBuf.length; i++) {
+            outStream.write(5, inBuf[i] >>> 3);
+            outStream.write(3, inBuf[i] & 0x07);
+        }
+        BitwiseInputStream inStream = new BitwiseInputStream(outStream.toByteArray());
+        inStream.skip(offset);
+        byte[] inBufDup = new byte[inBuf.length];
+        for (int i = 0; i < inBufDup.length; i++) inBufDup[i] = inStream.read(8);
+        assertEquals(HexDump.toHexString(inBuf), HexDump.toHexString(inBufDup));
+    }
+
+    @SmallTest
+    public void testFive() throws Exception {
+        int num_runs = 10;
+        long start = android.os.SystemClock.elapsedRealtime();
+        for (int run = 0; run < num_runs; run++) {
+            int offset = run % 8;
+            byte[] inBuf = HexDump.hexStringToByteArray("00031040900112488ea794e0");
+            BitwiseOutputStream outStream = new BitwiseOutputStream(30);
+            outStream.skip(offset);
+            for (int i = 0; i < inBuf.length; i++) {
+                outStream.write(5, inBuf[i] >>> 3);
+                outStream.write(3, inBuf[i] & 0x07);
+            }
+            BitwiseInputStream inStream = new BitwiseInputStream(outStream.toByteArray());
+            inStream.skip(offset);
+            byte[] inBufDup = new byte[inBuf.length];
+            for (int i = 0; i < inBufDup.length; i++) inBufDup[i] = inStream.read(8);
+            assertEquals(HexDump.toHexString(inBuf), HexDump.toHexString(inBufDup));
+        }
+        long end = android.os.SystemClock.elapsedRealtime();
+        Log.d(LOG_TAG, "repeated encode-decode took " + (end - start) + " ms");
+    }
+}
diff --git a/tests/AndroidTests/src/com/android/unit_tests/CdmaSmsTest.java b/tests/AndroidTests/src/com/android/unit_tests/CdmaSmsTest.java
new file mode 100644
index 0000000..9ff80c7
--- /dev/null
+++ b/tests/AndroidTests/src/com/android/unit_tests/CdmaSmsTest.java
@@ -0,0 +1,415 @@
+/*
+ * Copyright (C) 2006 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.unit_tests;
+
+import com.android.internal.telephony.GsmAlphabet;
+import com.android.internal.telephony.SmsHeader;
+import com.android.internal.telephony.cdma.sms.BearerData;
+import com.android.internal.telephony.cdma.sms.UserData;
+import com.android.internal.telephony.cdma.sms.CdmaSmsAddress;
+import com.android.internal.util.BitwiseInputStream;
+import com.android.internal.util.BitwiseOutputStream;
+import com.android.internal.util.HexDump;
+
+import android.test.AndroidTestCase;
+import android.test.suitebuilder.annotation.SmallTest;
+
+import java.util.Iterator;
+
+import android.util.Log;
+
+public class CdmaSmsTest extends AndroidTestCase {
+    private final static String LOG_TAG = "Cdma_Sms_Test";
+
+    private static UserData makeUserData(String msg) {
+        UserData userData = new UserData();
+        byte[] payload;
+        try {
+            payload = GsmAlphabet.stringToGsm7BitPacked(msg);
+            userData.payload = new byte[payload.length - 1];
+            for (int i = 0; i < userData.payload.length; i++) userData.payload[i] = payload[i + 1];
+            userData.numFields = payload[0];
+            userData.paddingBits = (userData.payload.length * 8) - (userData.numFields * 7);
+            userData.paddingBits = 0; // XXX this is better, wtf?
+            userData.msgEncoding = UserData.ENCODING_GSM_7BIT_ALPHABET;
+        } catch (com.android.internal.telephony.EncodeException ex) {
+            assertEquals(1, 0);
+        }
+        return userData;
+    }
+
+    @SmallTest
+    public void testStandardSms() throws Exception {
+        String pdu = "00031040900112488ea794e074d69e1b7392c270326cde9e98";
+        BearerData bearerData = BearerData.decode(HexDump.hexStringToByteArray(pdu));
+        assertEquals("Test standard SMS", bearerData.userData.payloadStr);
+    }
+
+    @SmallTest
+    public void testStandardSmsFeedback() throws Exception {
+        BearerData bearerData = new BearerData();
+        bearerData.messageType = BearerData.MESSAGE_TYPE_DELIVER;
+        bearerData.messageId = 0;
+        bearerData.hasUserDataHeader = false;
+        String payloadStr = "Test standard SMS";
+        bearerData.userData = makeUserData(payloadStr);
+        byte []encodedSms = BearerData.encode(bearerData);
+        BearerData revBearerData = BearerData.decode(encodedSms);
+        assertEquals(BearerData.MESSAGE_TYPE_DELIVER, revBearerData.messageType);
+        assertEquals(0, revBearerData.messageId);
+        assertEquals(false, revBearerData.hasUserDataHeader);
+        assertEquals(UserData.ENCODING_GSM_7BIT_ALPHABET, revBearerData.userData.msgEncoding);
+        assertEquals(payloadStr.length(), revBearerData.userData.numFields);
+        assertEquals(payloadStr, revBearerData.userData.payloadStr);
+    }
+
+    @SmallTest
+    public void testAltUserDataFeedback() throws Exception {
+        try {
+            BearerData bearerData = new BearerData();
+            bearerData.messageType = BearerData.MESSAGE_TYPE_DELIVER;
+            bearerData.messageId = 0;
+            bearerData.hasUserDataHeader = false;
+            UserData userData = new UserData();
+            String str1 = "test ascii user data encoding";
+            userData.payload = str1.getBytes("US-ASCII");
+            userData.numFields = str1.length();
+            userData.paddingBits = 0;
+            userData.msgEncoding = UserData.ENCODING_7BIT_ASCII;
+            bearerData.userData = userData;
+            byte []encodedSms = BearerData.encode(bearerData);
+            BearerData revBearerData = BearerData.decode(encodedSms);
+            assertEquals(str1, revBearerData.userData.payloadStr);
+            String str2 = "\u0160u\u1E5B\u0301r\u1ECFg\uD835\uDC1At\u00E9\u4E002\u3042";
+            userData.payload = str2.getBytes("UTF-16");
+            userData.numFields = str2.length() + 1;
+            userData.msgEncoding = UserData.ENCODING_UNICODE_16;
+            encodedSms = BearerData.encode(bearerData);
+            revBearerData = BearerData.decode(encodedSms);
+            assertEquals(str2, revBearerData.userData.payloadStr);
+        } catch (java.io.UnsupportedEncodingException ex) {
+            throw new RuntimeException("user data encoding error");
+        }
+    }
+
+    @SmallTest
+    public void testReplyOption() throws Exception {
+        String pdu1 = "0003104090011648b6a794e0705476bf77bceae934fe5f6d94d87450080a0180";
+        BearerData bd1 = BearerData.decode(HexDump.hexStringToByteArray(pdu1));
+        assertEquals("Test Acknowledgement 1", bd1.userData.payloadStr);
+        assertEquals(true, bd1.userAckReq);
+        assertEquals(false, bd1.deliveryAckReq);
+        assertEquals(false, bd1.readAckReq);
+        assertEquals(false, bd1.reportReq);
+        String pdu2 = "0003104090011648b6a794e0705476bf77bceae934fe5f6d94d87490080a0140";
+        BearerData bd2 = BearerData.decode(HexDump.hexStringToByteArray(pdu2));
+        assertEquals("Test Acknowledgement 2", bd2.userData.payloadStr);
+        assertEquals(false, bd2.userAckReq);
+        assertEquals(true, bd2.deliveryAckReq);
+        assertEquals(false, bd2.readAckReq);
+        assertEquals(false, bd2.reportReq);
+        String pdu3 = "0003104090011648b6a794e0705476bf77bceae934fe5f6d94d874d0080a0120";
+        BearerData bd3 = BearerData.decode(HexDump.hexStringToByteArray(pdu3));
+        assertEquals("Test Acknowledgement 3", bd3.userData.payloadStr);
+        assertEquals(false, bd3.userAckReq);
+        assertEquals(false, bd3.deliveryAckReq);
+        assertEquals(true, bd3.readAckReq);
+        assertEquals(false, bd3.reportReq);
+        String pdu4 = "0003104090011648b6a794e0705476bf77bceae934fe5f6d94d87510080a0110";
+        BearerData bd4 = BearerData.decode(HexDump.hexStringToByteArray(pdu4));
+        assertEquals("Test Acknowledgement 4", bd4.userData.payloadStr);
+        assertEquals(false, bd4.userAckReq);
+        assertEquals(false, bd4.deliveryAckReq);
+        assertEquals(false, bd4.readAckReq);
+        assertEquals(true, bd4.reportReq);
+    }
+
+    @SmallTest
+    public void testReplyOptionFeedback() throws Exception {
+        BearerData bearerData = new BearerData();
+        bearerData.messageType = BearerData.MESSAGE_TYPE_DELIVER;
+        bearerData.messageId = 0;
+        bearerData.hasUserDataHeader = false;
+        bearerData.userData = makeUserData("test reply option");
+        bearerData.userAckReq = true;
+        byte []encodedSms = BearerData.encode(bearerData);
+        BearerData revBearerData = BearerData.decode(encodedSms);
+        assertEquals(true, revBearerData.userAckReq);
+        assertEquals(false, revBearerData.deliveryAckReq);
+        assertEquals(false, revBearerData.readAckReq);
+        assertEquals(false, revBearerData.reportReq);
+        bearerData.userAckReq = false;
+        bearerData.deliveryAckReq = true;
+        encodedSms = BearerData.encode(bearerData);
+        revBearerData = BearerData.decode(encodedSms);
+        assertEquals(false, revBearerData.userAckReq);
+        assertEquals(true, revBearerData.deliveryAckReq);
+        assertEquals(false, revBearerData.readAckReq);
+        assertEquals(false, revBearerData.reportReq);
+        bearerData.deliveryAckReq = false;
+        bearerData.readAckReq = true;
+        encodedSms = BearerData.encode(bearerData);
+        revBearerData = BearerData.decode(encodedSms);
+        assertEquals(false, revBearerData.userAckReq);
+        assertEquals(false, revBearerData.deliveryAckReq);
+        assertEquals(true, revBearerData.readAckReq);
+        assertEquals(false, revBearerData.reportReq);
+        bearerData.readAckReq = false;
+        bearerData.reportReq = true;
+        encodedSms = BearerData.encode(bearerData);
+        revBearerData = BearerData.decode(encodedSms);
+        assertEquals(false, revBearerData.userAckReq);
+        assertEquals(false, revBearerData.deliveryAckReq);
+        assertEquals(false, revBearerData.readAckReq);
+        assertEquals(true, revBearerData.reportReq);
+    }
+
+    @SmallTest
+    public void testNumberOfMessages() throws Exception {
+        String pdu1 = "000310409001124896a794e07595f69f199540ea759a0dc8e00b0163";
+        BearerData bd1 = BearerData.decode(HexDump.hexStringToByteArray(pdu1));
+        assertEquals("Test Voice mail 99", bd1.userData.payloadStr);
+        assertEquals(99, bd1.numberOfMessages);
+        String pdu2 = "00031040900113489ea794e07595f69f199540ea759a0988c0600b0164";
+        BearerData bd2 = BearerData.decode(HexDump.hexStringToByteArray(pdu2));
+        assertEquals("Test Voice mail 100", bd2.userData.payloadStr);
+        assertEquals(100, bd2.numberOfMessages);
+    }
+
+    @SmallTest
+    public void testNumberOfMessagesFeedback() throws Exception {
+        BearerData bearerData = new BearerData();
+        bearerData.messageType = BearerData.MESSAGE_TYPE_DELIVER;
+        bearerData.messageId = 0;
+        bearerData.hasUserDataHeader = false;
+        bearerData.userData = makeUserData("test message count");
+        bearerData.numberOfMessages = 27;
+        byte []encodedSms = BearerData.encode(bearerData);
+        BearerData revBearerData = BearerData.decode(encodedSms);
+        assertEquals(bearerData.numberOfMessages, revBearerData.numberOfMessages);
+    }
+
+    @SmallTest
+    public void testCallbackNum() throws Exception {
+        String pdu1 = "00031040900112488ea794e070d436cb638bc5e035ce2f97900e06910431323334";
+        BearerData bd1 = BearerData.decode(HexDump.hexStringToByteArray(pdu1));
+        assertEquals("Test Callback nbr", bd1.userData.payloadStr);
+        assertEquals(CdmaSmsAddress.DIGIT_MODE_8BIT_CHAR, bd1.callbackNumber.digitMode);
+        assertEquals(CdmaSmsAddress.TON_INTERNATIONAL_OR_IP, bd1.callbackNumber.ton);
+        assertEquals(CdmaSmsAddress.NUMBER_MODE_NOT_DATA_NETWORK, bd1.callbackNumber.numberMode);
+        assertEquals(CdmaSmsAddress.NUMBERING_PLAN_ISDN_TELEPHONY, bd1.callbackNumber.numberPlan);
+        assertEquals("1234", bd1.callbackNumber.address);
+    }
+
+    @SmallTest
+    public void testCallbackNumFeedback() throws Exception {
+        BearerData bearerData = new BearerData();
+        bearerData.messageType = BearerData.MESSAGE_TYPE_DELIVER;
+        bearerData.messageId = 0;
+        bearerData.hasUserDataHeader = false;
+        bearerData.userData = makeUserData("test callback number");
+        CdmaSmsAddress addr = new CdmaSmsAddress();
+        addr.digitMode = CdmaSmsAddress.DIGIT_MODE_8BIT_CHAR;
+        addr.ton = CdmaSmsAddress.TON_NATIONAL_OR_EMAIL;
+        addr.numberMode = CdmaSmsAddress.NUMBER_MODE_NOT_DATA_NETWORK;
+        addr.numberPlan = CdmaSmsAddress.NUMBERING_PLAN_UNKNOWN;
+        addr.address = "8005551212";
+        addr.numberOfDigits = (byte)addr.address.length();
+        bearerData.callbackNumber = addr;
+        byte []encodedSms = BearerData.encode(bearerData);
+        BearerData revBearerData = BearerData.decode(encodedSms);
+        CdmaSmsAddress revAddr = revBearerData.callbackNumber;
+        assertEquals(addr.digitMode, revAddr.digitMode);
+        assertEquals(addr.ton, revAddr.ton);
+        assertEquals(addr.numberMode, revAddr.numberMode);
+        assertEquals(addr.numberPlan, revAddr.numberPlan);
+        assertEquals(addr.numberOfDigits, revAddr.numberOfDigits);
+        assertEquals(addr.address, revAddr.address);
+        addr.address = "8*55#1012";
+        addr.numberOfDigits = (byte)addr.address.length();
+        addr.digitMode = CdmaSmsAddress.DIGIT_MODE_4BIT_DTMF;
+        encodedSms = BearerData.encode(bearerData);
+        revBearerData = BearerData.decode(encodedSms);
+        revAddr = revBearerData.callbackNumber;
+        assertEquals(addr.digitMode, revAddr.digitMode);
+        assertEquals(addr.numberOfDigits, revAddr.numberOfDigits);
+        assertEquals(addr.address, revAddr.address);
+    }
+
+    @SmallTest
+    public void testMsgCenterTimeStampFeedback() throws Exception {
+        BearerData bearerData = new BearerData();
+        bearerData.messageType = BearerData.MESSAGE_TYPE_DELIVER;
+        bearerData.messageId = 0;
+        bearerData.hasUserDataHeader = false;
+        bearerData.userData = makeUserData("test message center timestamp");
+        bearerData.timeStamp = HexDump.hexStringToByteArray("112233445566");
+        byte []encodedSms = BearerData.encode(bearerData);
+        BearerData revBearerData = BearerData.decode(encodedSms);
+        assertEquals(HexDump.toHexString(bearerData.timeStamp),
+                     HexDump.toHexString(revBearerData.timeStamp));
+    }
+
+    @SmallTest
+    public void testPrivacyIndicator() throws Exception {
+        String pdu1 = "0003104090010c485f4194dfea34becf61b840090140";
+        BearerData bd1 = BearerData.decode(HexDump.hexStringToByteArray(pdu1));
+        assertEquals(bd1.privacy, BearerData.PRIVACY_RESTRICTED);
+        String pdu2 = "0003104090010c485f4194dfea34becf61b840090180";
+        BearerData bd2 = BearerData.decode(HexDump.hexStringToByteArray(pdu2));
+        assertEquals(bd2.privacy, BearerData.PRIVACY_CONFIDENTIAL);
+        String pdu3 = "0003104090010c485f4194dfea34becf61b8400901c0";
+        BearerData bd3 = BearerData.decode(HexDump.hexStringToByteArray(pdu3));
+        assertEquals(bd3.privacy, BearerData.PRIVACY_SECRET);
+    }
+
+    @SmallTest
+    public void testPrivacyIndicatorFeedback() throws Exception {
+        BearerData bearerData = new BearerData();
+        bearerData.messageType = BearerData.MESSAGE_TYPE_DELIVER;
+        bearerData.messageId = 0;
+        bearerData.hasUserDataHeader = false;
+        String payloadStr = "test privacy indicator";
+        bearerData.userData = makeUserData(payloadStr);
+        bearerData.privacy = BearerData.PRIVACY_SECRET;
+        bearerData.privacyIndicatorSet = true;
+        byte []encodedSms = BearerData.encode(bearerData);
+        BearerData revBearerData = BearerData.decode(encodedSms);
+        assertEquals(revBearerData.userData.payloadStr, payloadStr);
+        assertEquals(revBearerData.privacyIndicatorSet, true);
+        assertEquals(revBearerData.privacy, BearerData.PRIVACY_SECRET);
+        bearerData.privacy = BearerData.PRIVACY_RESTRICTED;
+        encodedSms = BearerData.encode(bearerData);
+        revBearerData = BearerData.decode(encodedSms);
+        assertEquals(revBearerData.privacy, BearerData.PRIVACY_RESTRICTED);
+    }
+
+    @SmallTest
+    public void testMsgDeliveryAlert() throws Exception {
+        String pdu1 = "0003104090010d4866a794e07055965b91d040300c0100";
+        BearerData bd1 = BearerData.decode(HexDump.hexStringToByteArray(pdu1));
+        assertEquals(bd1.alert, 0);
+        assertEquals(bd1.userData.payloadStr, "Test Alert 0");
+        String pdu2 = "0003104090010d4866a794e07055965b91d140300c0140";
+        BearerData bd2 = BearerData.decode(HexDump.hexStringToByteArray(pdu2));
+        assertEquals(bd2.alert, 1);
+        assertEquals(bd2.userData.payloadStr, "Test Alert 1");
+        String pdu3 = "0003104090010d4866a794e07055965b91d240300c0180";
+        BearerData bd3 = BearerData.decode(HexDump.hexStringToByteArray(pdu3));
+        assertEquals(bd3.alert, 2);
+        assertEquals(bd3.userData.payloadStr, "Test Alert 2");
+        String pdu4 = "0003104090010d4866a794e07055965b91d340300c01c0";
+        BearerData bd4 = BearerData.decode(HexDump.hexStringToByteArray(pdu4));
+        assertEquals(bd4.alert, 3);
+        assertEquals(bd4.userData.payloadStr, "Test Alert 3");
+    }
+
+    @SmallTest
+    public void testMsgDeliveryAlertFeedback() throws Exception {
+        BearerData bearerData = new BearerData();
+        bearerData.messageType = BearerData.MESSAGE_TYPE_DELIVER;
+        bearerData.messageId = 0;
+        bearerData.hasUserDataHeader = false;
+        String payloadStr = "test message delivery alert";
+        bearerData.userData = makeUserData(payloadStr);
+        bearerData.alert = BearerData.ALERT_MEDIUM_PRIO;
+        bearerData.alertIndicatorSet = true;
+        byte []encodedSms = BearerData.encode(bearerData);
+        BearerData revBearerData = BearerData.decode(encodedSms);
+        assertEquals(revBearerData.userData.payloadStr, payloadStr);
+        assertEquals(revBearerData.alertIndicatorSet, true);
+        assertEquals(revBearerData.alert, bearerData.alert);
+        bearerData.alert = BearerData.ALERT_HIGH_PRIO;
+        encodedSms = BearerData.encode(bearerData);
+        revBearerData = BearerData.decode(encodedSms);
+        assertEquals(revBearerData.userData.payloadStr, payloadStr);
+        assertEquals(revBearerData.alertIndicatorSet, true);
+        assertEquals(revBearerData.alert, bearerData.alert);
+    }
+
+    @SmallTest
+    public void testLanguageIndicator() throws Exception {
+        String pdu1 = "0003104090011748bea794e0731436ef3bd7c2e0352eef27a1c263fe58080d0101";
+        BearerData bd1 = BearerData.decode(HexDump.hexStringToByteArray(pdu1));
+        assertEquals(bd1.userData.payloadStr, "Test Language indicator");
+        assertEquals(bd1.language, BearerData.LANGUAGE_ENGLISH);
+        String pdu2 = "0003104090011748bea794e0731436ef3bd7c2e0352eef27a1c263fe58080d0106";
+        BearerData bd2 = BearerData.decode(HexDump.hexStringToByteArray(pdu2));
+        assertEquals(bd2.userData.payloadStr, "Test Language indicator");
+        assertEquals(bd2.language, BearerData.LANGUAGE_CHINESE);
+    }
+
+    @SmallTest
+    public void testLanguageIndicatorFeedback() throws Exception {
+        BearerData bearerData = new BearerData();
+        bearerData.messageType = BearerData.MESSAGE_TYPE_DELIVER;
+        bearerData.messageId = 0;
+        bearerData.hasUserDataHeader = false;
+        String payloadStr = "test language indicator";
+        bearerData.userData = makeUserData(payloadStr);
+        bearerData.language = BearerData.LANGUAGE_ENGLISH;
+        bearerData.languageIndicatorSet = true;
+        byte []encodedSms = BearerData.encode(bearerData);
+        BearerData revBearerData = BearerData.decode(encodedSms);
+        assertEquals(revBearerData.userData.payloadStr, payloadStr);
+        assertEquals(revBearerData.languageIndicatorSet, true);
+        assertEquals(revBearerData.language, bearerData.language);
+        bearerData.language = BearerData.LANGUAGE_KOREAN;
+        encodedSms = BearerData.encode(bearerData);
+        revBearerData = BearerData.decode(encodedSms);
+        assertEquals(revBearerData.userData.payloadStr, payloadStr);
+        assertEquals(revBearerData.languageIndicatorSet, true);
+        assertEquals(revBearerData.language, bearerData.language);
+    }
+
+    @SmallTest
+    public void testDisplayMode() throws Exception {
+        String pdu1 = "0003104090010c485f4194dfea34becf61b8400f0100";
+        BearerData bd1 = BearerData.decode(HexDump.hexStringToByteArray(pdu1));
+        //Log.d(LOG_TAG, "bd1 = " + bd1);
+        assertEquals(bd1.displayMode, BearerData.DISPLAY_MODE_IMMEDIATE);
+        String pdu2 = "0003104090010c485f4194dfea34becf61b8400f0140";
+        BearerData bd2 = BearerData.decode(HexDump.hexStringToByteArray(pdu2));
+        assertEquals(bd2.displayMode, BearerData.DISPLAY_MODE_DEFAULT);
+        String pdu3 = "0003104090010c485f4194dfea34becf61b8400f0180";
+        BearerData bd3 = BearerData.decode(HexDump.hexStringToByteArray(pdu3));
+        assertEquals(bd3.displayMode, BearerData.DISPLAY_MODE_USER);
+    }
+
+    @SmallTest
+    public void testDisplayModeFeedback() throws Exception {
+        BearerData bearerData = new BearerData();
+        bearerData.messageType = BearerData.MESSAGE_TYPE_DELIVER;
+        bearerData.messageId = 0;
+        bearerData.hasUserDataHeader = false;
+        String payloadStr = "test display mode";
+        bearerData.userData = makeUserData(payloadStr);
+        bearerData.displayMode = BearerData.DISPLAY_MODE_IMMEDIATE;
+        bearerData.displayModeSet = true;
+        byte []encodedSms = BearerData.encode(bearerData);
+        BearerData revBearerData = BearerData.decode(encodedSms);
+        assertEquals(revBearerData.userData.payloadStr, payloadStr);
+        assertEquals(revBearerData.displayModeSet, true);
+        assertEquals(revBearerData.displayMode, bearerData.displayMode);
+        bearerData.displayMode = BearerData.DISPLAY_MODE_USER;
+        encodedSms = BearerData.encode(bearerData);
+        revBearerData = BearerData.decode(encodedSms);
+        assertEquals(revBearerData.userData.payloadStr, payloadStr);
+        assertEquals(revBearerData.displayModeSet, true);
+        assertEquals(revBearerData.displayMode, bearerData.displayMode);
+    }
+}
diff --git a/tests/AndroidTests/src/com/android/unit_tests/content/ConfigTest.java b/tests/AndroidTests/src/com/android/unit_tests/content/ConfigTest.java
index 1ea83c3..e6639d3 100644
--- a/tests/AndroidTests/src/com/android/unit_tests/content/ConfigTest.java
+++ b/tests/AndroidTests/src/com/android/unit_tests/content/ConfigTest.java
@@ -98,7 +98,7 @@
             mMetrics = new DisplayMetrics();
             mMetrics.widthPixels = 200;
             mMetrics.heightPixels = 320;
-            mMetrics.density = 120;
+            mMetrics.density = 1;
         }
 
         void setProperty(properties p, int value) {
@@ -131,7 +131,9 @@
                     mMetrics.heightPixels = value;
                     break;
                 case DENSITY:
-                    mMetrics.density = value;
+                    // this is the ratio from the standard
+
+                    mMetrics.density = (((float)value)/((float)DisplayMetrics.DEFAULT_DENSITY));
                     break;
                 default:
                     assert(false);
@@ -187,18 +189,16 @@
          */
         TotalConfig config = new TotalConfig();
         Resources res = config.getResources();
-// got simple 240dpi
-//        checkValue(res, R.configVarying.simple, "simple default");
-//        checkValue(res, R.configVarying.bag,
-//                R.styleable.TestConfig, new String[]{"bag default"});
+        checkValue(res, R.configVarying.simple, "simple default");
+        checkValue(res, R.configVarying.bag,
+                R.styleable.TestConfig, new String[]{"bag default"});
 
         config = new TotalConfig();
         config.setProperty(properties.LANGUAGE, "xx");
         res = config.getResources();
-// got simple xx 32dpi
-//        checkValue(res, R.configVarying.simple, "simple xx");
-//        checkValue(res, R.configVarying.bag,
-//                R.styleable.TestConfig, new String[]{"bag xx"});
+        checkValue(res, R.configVarying.simple, "simple xx");
+        checkValue(res, R.configVarying.bag,
+                R.styleable.TestConfig, new String[]{"bag xx"});
 
         config = new TotalConfig();
         config.setProperty(properties.LANGUAGE, "xx");
@@ -225,116 +225,66 @@
         config = new TotalConfig();
         config.setProperty(properties.TOUCHSCREEN, Configuration.TOUCHSCREEN_NOTOUCH);
         res = config.getResources();
-// got simple 240dpi
-//        checkValue(res, R.configVarying.simple, "simple notouch");
-//        checkValue(res, R.configVarying.bag,
-//                R.styleable.TestConfig, new String[]{"bag notouch"});
-
-        config = new TotalConfig();
-        config.setProperty(properties.TOUCHSCREEN, Configuration.TOUCHSCREEN_FINGER);
-        res = config.getResources();
-// got simple 240dpi
-//        checkValue(res, R.configVarying.simple, "simple finger");
-//        checkValue(res, R.configVarying.bag,
-//                R.styleable.TestConfig, new String[]{"bag finger"});
+        checkValue(res, R.configVarying.simple, "simple notouch");
+        checkValue(res, R.configVarying.bag,
+                R.styleable.TestConfig, new String[]{"bag notouch"});
 
         config = new TotalConfig();
         config.setProperty(properties.TOUCHSCREEN, Configuration.TOUCHSCREEN_STYLUS);
         res = config.getResources();
-// got simple 32dpi stylus
-//        checkValue(res, R.configVarying.simple, "simple stylus");
-//        checkValue(res, R.configVarying.bag,
-//                R.styleable.TestConfig, new String[]{"bag stylus"});
+        checkValue(res, R.configVarying.simple, "simple stylus");
+        checkValue(res, R.configVarying.bag,
+                R.styleable.TestConfig, new String[]{"bag stylus"});
 
         config = new TotalConfig();
         config.setProperty(properties.KEYBOARD, Configuration.KEYBOARD_NOKEYS);
         res = config.getResources();
-// got simple 240dpi
-//        checkValue(res, R.configVarying.simple, "simple nokeys");
-//        checkValue(res, R.configVarying.bag,
-//                R.styleable.TestConfig, new String[]{"bag nokeys"});
-
-        config = new TotalConfig();
-        config.setProperty(properties.KEYBOARD, Configuration.KEYBOARD_QWERTY);
-        res = config.getResources();
-// got simple 240dpi
-//        checkValue(res, R.configVarying.simple, "simple qwerty");
-//        checkValue(res, R.configVarying.bag,
-//                R.styleable.TestConfig, new String[]{"bag qwerty"});
+        checkValue(res, R.configVarying.simple, "simple nokeys");
+        checkValue(res, R.configVarying.bag,
+                R.styleable.TestConfig, new String[]{"bag nokeys"});
 
         config = new TotalConfig();
         config.setProperty(properties.KEYBOARD, Configuration.KEYBOARD_12KEY);
         res = config.getResources();
-// got simple 240dpi
-//        checkValue(res, R.configVarying.simple, "simple 12key");
-//        checkValue(res, R.configVarying.bag,
-//                R.styleable.TestConfig, new String[]{"bag 12key"});
-
-        config = new TotalConfig();
-        config.setProperty(properties.KEYBOARDHIDDEN, Configuration.KEYBOARDHIDDEN_YES);
-        res = config.getResources();
-// got simple 240dpi
-//        checkValue(res, R.configVarying.simple, "simple keyshidden");
-//        checkValue(res, R.configVarying.bag,
-//                R.styleable.TestConfig, new String[]{"bag keyshidden"});
+        checkValue(res, R.configVarying.simple, "simple 12key");
+        checkValue(res, R.configVarying.bag,
+                R.styleable.TestConfig, new String[]{"bag 12key"});
 
         config = new TotalConfig();
         config.setProperty(properties.KEYBOARDHIDDEN, Configuration.KEYBOARDHIDDEN_NO);
         res = config.getResources();
-// got simple 32dpi keysexposed
-//        checkValue(res, R.configVarying.simple, "simple keysexposed");
-//        checkValue(res, R.configVarying.bag,
-//                R.styleable.TestConfig, new String[]{"bag keysexposed"});
+        checkValue(res, R.configVarying.simple, "simple keysexposed");
+        checkValue(res, R.configVarying.bag,
+                R.styleable.TestConfig, new String[]{"bag keysexposed"});
 
         config = new TotalConfig();
         config.setProperty(properties.NAVIGATION, Configuration.NAVIGATION_NONAV);
         res = config.getResources();
-// got simple 240dpi
-//        checkValue(res, R.configVarying.simple, "simple nonav");
-//        checkValue(res, R.configVarying.bag,
-//                R.styleable.TestConfig, new String[]{"bag nonav"});
+        checkValue(res, R.configVarying.simple, "simple nonav");
+        checkValue(res, R.configVarying.bag,
+                R.styleable.TestConfig, new String[]{"bag nonav"});
 
         config = new TotalConfig();
         config.setProperty(properties.NAVIGATION, Configuration.NAVIGATION_DPAD);
         res = config.getResources();
-// got simple 240dpi
-//        checkValue(res, R.configVarying.simple, "simple dpad");
-//        checkValue(res, R.configVarying.bag,
-//                R.styleable.TestConfig, new String[]{"bag dpad"});
-
-        config = new TotalConfig();
-        config.setProperty(properties.NAVIGATION, Configuration.NAVIGATION_TRACKBALL);
-        res = config.getResources();
-// got simple 240dpi
-//        checkValue(res, R.configVarying.simple, "simple trackball");
-//        checkValue(res, R.configVarying.bag,
-//                R.styleable.TestConfig, new String[]{"bag trackball"});
+        checkValue(res, R.configVarying.simple, "simple dpad");
+        checkValue(res, R.configVarying.bag,
+                R.styleable.TestConfig, new String[]{"bag dpad"});
 
         config = new TotalConfig();
         config.setProperty(properties.NAVIGATION, Configuration.NAVIGATION_WHEEL);
         res = config.getResources();
-// got simple 240dpi
-//        checkValue(res, R.configVarying.simple, "simple wheel");
-//        checkValue(res, R.configVarying.bag,
-//                R.styleable.TestConfig, new String[]{"bag wheel"});
-
-        config = new TotalConfig();
-        config.setProperty(properties.HEIGHT, 320);
-        config.setProperty(properties.WIDTH, 200);
-        res = config.getResources();
-// got simple 240dpi
-//        checkValue(res, R.configVarying.simple, "simple 320x200");
-//        checkValue(res, R.configVarying.bag,
-//                R.styleable.TestConfig, new String[]{"bag 320x200"});
+        checkValue(res, R.configVarying.simple, "simple wheel");
+        checkValue(res, R.configVarying.bag,
+                R.styleable.TestConfig, new String[]{"bag wheel"});
 
         config = new TotalConfig();
         config.setProperty(properties.HEIGHT, 480);
         config.setProperty(properties.WIDTH, 320);
         res = config.getResources();
-// got simple 240dpi
-//        checkValue(res, R.configVarying.simple, "simple 480x320");
-//        checkValue(res, R.configVarying.bag,
-//                R.styleable.TestConfig, new String[]{"bag 480x320"});
+        checkValue(res, R.configVarying.simple, "simple 480x320");
+        checkValue(res, R.configVarying.bag,
+                R.styleable.TestConfig, new String[]{"bag 480x320"});
 
         config = new TotalConfig();
         config.setProperty(properties.DENSITY, 240);
@@ -344,36 +294,91 @@
                 R.styleable.TestConfig, new String[]{"bag 240dpi"});
 
         config = new TotalConfig();
-        config.setProperty(properties.DENSITY, 120);
-        res = config.getResources();
-// got simple 240dpi
-//        checkValue(res, R.configVarying.simple, "simple 120dpi");
-//        checkValue(res, R.configVarying.bag,
-//                R.styleable.TestConfig, new String[]{"bag 120dpi"});
-
-        config = new TotalConfig();
         config.setProperty(properties.ORIENTATION, Configuration.ORIENTATION_LANDSCAPE);
         res = config.getResources();
-// got simple 240dpi
-//        checkValue(res, R.configVarying.simple, "simple landscape");
-//        checkValue(res, R.configVarying.bag,
-//                R.styleable.TestConfig, new String[]{"bag landscape"});
-
-        config = new TotalConfig();
-        config.setProperty(properties.ORIENTATION, Configuration.ORIENTATION_PORTRAIT);
-        res = config.getResources();
-// got simple 240dpi
-//        checkValue(res, R.configVarying.simple, "simple portrait");
-//        checkValue(res, R.configVarying.bag,
-//                R.styleable.TestConfig, new String[]{"bag portrait"});
+        checkValue(res, R.configVarying.simple, "simple landscape");
+        checkValue(res, R.configVarying.bag,
+                R.styleable.TestConfig, new String[]{"bag landscape"});
 
         config = new TotalConfig();
         config.setProperty(properties.ORIENTATION, Configuration.ORIENTATION_SQUARE);
         res = config.getResources();
-// got simple square 32dpi
-//        checkValue(res, R.configVarying.simple, "simple square");
-//        checkValue(res, R.configVarying.bag,
-//                R.styleable.TestConfig, new String[]{"bag square"});
+        checkValue(res, R.configVarying.simple, "simple square");
+        checkValue(res, R.configVarying.bag,
+                R.styleable.TestConfig, new String[]{"bag square"});
+    }
+
+    @MediumTest
+    public void testDensity() throws Exception {
+        // have 32, 240 and the default 160 content.
+        // rule is that closest wins, with down scaling (larger content)
+        // being twice as nice as upscaling.
+        // transition at H/2 * (-1 +/- sqrt(1+8L/H))
+        // SO, X < 49 goes to 32
+        // 49 >= X < 182 goes to 160
+        // X >= 182 goes to 240
+        TotalConfig config = new TotalConfig();
+        config.setProperty(properties.DENSITY, 2);
+        Resources res = config.getResources();
+        checkValue(res, R.configVarying.simple, "simple 32dpi");
+        checkValue(res, R.configVarying.bag,
+                R.styleable.TestConfig, new String[]{"bag 32dpi"});
+
+        config = new TotalConfig();
+        config.setProperty(properties.DENSITY, 32);
+        res = config.getResources();
+        checkValue(res, R.configVarying.simple, "simple 32dpi");
+        checkValue(res, R.configVarying.bag,
+                R.styleable.TestConfig, new String[]{"bag 32dpi"});
+
+        config = new TotalConfig();
+        config.setProperty(properties.DENSITY, 48);
+        res = config.getResources();
+        checkValue(res, R.configVarying.simple, "simple 32dpi");
+        checkValue(res, R.configVarying.bag,
+                R.styleable.TestConfig, new String[]{"bag 32dpi"});
+
+        config = new TotalConfig();
+        config.setProperty(properties.DENSITY, 49);
+        res = config.getResources();
+        checkValue(res, R.configVarying.simple, "simple default");
+        checkValue(res, R.configVarying.bag,
+                R.styleable.TestConfig, new String[]{"bag default"});
+
+        config = new TotalConfig();
+        config.setProperty(properties.DENSITY, 150);
+        res = config.getResources();
+        checkValue(res, R.configVarying.simple, "simple default");
+        checkValue(res, R.configVarying.bag,
+                R.styleable.TestConfig, new String[]{"bag default"});
+
+        config = new TotalConfig();
+        config.setProperty(properties.DENSITY, 181);
+        res = config.getResources();
+        checkValue(res, R.configVarying.simple, "simple default");
+        checkValue(res, R.configVarying.bag,
+                R.styleable.TestConfig, new String[]{"bag default"});
+
+        config = new TotalConfig();
+        config.setProperty(properties.DENSITY, 182);
+        res = config.getResources();
+        checkValue(res, R.configVarying.simple, "simple 240dpi");
+        checkValue(res, R.configVarying.bag,
+                R.styleable.TestConfig, new String[]{"bag 240dpi"});
+
+        config = new TotalConfig();
+        config.setProperty(properties.DENSITY, 239);
+        res = config.getResources();
+        checkValue(res, R.configVarying.simple, "simple 240dpi");
+        checkValue(res, R.configVarying.bag,
+                R.styleable.TestConfig, new String[]{"bag 240dpi"});
+
+        config = new TotalConfig();
+        config.setProperty(properties.DENSITY, 490);
+        res = config.getResources();
+        checkValue(res, R.configVarying.simple, "simple 240dpi");
+        checkValue(res, R.configVarying.bag,
+                R.styleable.TestConfig, new String[]{"bag 240dpi"});
     }
 
 // TODO - add tests for special cases - ie, other key params seem ignored if 
@@ -407,10 +412,9 @@
         config = new TotalConfig();
         config.setProperty(properties.MNC, 333);
         res = config.getResources();
-// got simple 24dpi
-//        checkValue(res, R.configVarying.simple, "simple default");
-//        checkValue(res, R.configVarying.bag,
-//                R.styleable.TestConfig, new String[]{"bag default"});
+        checkValue(res, R.configVarying.simple, "simple default");
+        checkValue(res, R.configVarying.bag,
+                R.styleable.TestConfig, new String[]{"bag default"});
     }
 
     @MediumTest
@@ -419,13 +423,31 @@
          * Verify that in cases of ties, the specific ordering is followed
          */
 
-        /* full A + B + C doesn't exist.  Do we get A + C or B + C? 
+        /**
+         * Precidence order: mcc, mnc, locale, orientation, density,
+         * touchscreen, hidden, keyboard, navigation, width-height
+         */
+
+        /**
+         * verify mcc trumps mnc.  Have 110-xx, 220-xx but no 110-220
+         * so with is selected?  Should be mcc110-xx. 
          */
         TotalConfig config = new TotalConfig();
+        config.setProperty(properties.MCC, 110);
+        config.setProperty(properties.MNC, 220);
+        config.setProperty(properties.LANGUAGE, "xx");
+        Resources res = config.getResources();
+        checkValue(res, R.configVarying.simple, "simple mcc110 xx");
+        checkValue(res, R.configVarying.bag,
+                R.styleable.TestConfig, new String[]{"bag mcc110 xx"});
+
+        /* full A + B + C doesn't exist.  Do we get A + C or B + C? 
+         */
+        config = new TotalConfig();
         config.setProperty(properties.MCC, 111);
         config.setProperty(properties.MNC, 222);
         config.setProperty(properties.LANGUAGE, "xx");
-        Resources res = config.getResources();
+        res = config.getResources();
         checkValue(res, R.configVarying.simple, "simple mcc111 mnc222");
         checkValue(res, R.configVarying.bag,
                 R.styleable.TestConfig, new String[]{"bag mcc111 mnc222"});
@@ -433,7 +455,8 @@
         config = new TotalConfig();
         config.setProperty(properties.MNC, 222);
         config.setProperty(properties.LANGUAGE, "xx");
-        config.setProperty(properties.ORIENTATION, Configuration.ORIENTATION_SQUARE);
+        config.setProperty(properties.ORIENTATION, 
+                Configuration.ORIENTATION_SQUARE);
         res = config.getResources();
         checkValue(res, R.configVarying.simple, "simple mnc222 xx");
         checkValue(res, R.configVarying.bag,
@@ -441,60 +464,77 @@
 
         config = new TotalConfig();
         config.setProperty(properties.LANGUAGE, "xx");
-        config.setProperty(properties.ORIENTATION, Configuration.ORIENTATION_SQUARE);
+        config.setProperty(properties.ORIENTATION, 
+                Configuration.ORIENTATION_SQUARE);
         config.setProperty(properties.DENSITY, 32);
         res = config.getResources();
-        checkValue(res, R.configVarying.simple, "simple xx 32dpi");
+        checkValue(res, R.configVarying.simple, "simple xx square");
         checkValue(res, R.configVarying.bag,
-                R.styleable.TestConfig, new String[]{"bag xx 32dpi"});
+                R.styleable.TestConfig, new String[]{"bag xx square"});
 
         config = new TotalConfig();
-        config.setProperty(properties.ORIENTATION, Configuration.ORIENTATION_SQUARE);
+        config.setProperty(properties.ORIENTATION, 
+                Configuration.ORIENTATION_SQUARE);
         config.setProperty(properties.DENSITY, 32);
-        config.setProperty(properties.TOUCHSCREEN, Configuration.TOUCHSCREEN_STYLUS);
+        config.setProperty(properties.TOUCHSCREEN, 
+                Configuration.TOUCHSCREEN_STYLUS);
+        res = config.getResources();
+        checkValue(res, R.configVarying.simple, "simple square 32dpi");
+        checkValue(res, R.configVarying.bag,
+                R.styleable.TestConfig, new String[]{"bag square 32dpi"});
+
+        config = new TotalConfig();
+        config.setProperty(properties.DENSITY, 32);
+        config.setProperty(properties.TOUCHSCREEN, 
+                Configuration.TOUCHSCREEN_STYLUS);
+        config.setProperty(properties.KEYBOARDHIDDEN, 
+                Configuration.KEYBOARDHIDDEN_NO);
         res = config.getResources();
         checkValue(res, R.configVarying.simple, "simple 32dpi stylus");
         checkValue(res, R.configVarying.bag,
                 R.styleable.TestConfig, new String[]{"bag 32dpi stylus"});
 
         config = new TotalConfig();
-        config.setProperty(properties.DENSITY, 32);
-        config.setProperty(properties.TOUCHSCREEN, Configuration.TOUCHSCREEN_STYLUS);
-        config.setProperty(properties.KEYBOARDHIDDEN, Configuration.KEYBOARDHIDDEN_NO);
+        config.setProperty(properties.TOUCHSCREEN, 
+                Configuration.TOUCHSCREEN_STYLUS);
+        config.setProperty(properties.KEYBOARDHIDDEN, 
+                Configuration.KEYBOARDHIDDEN_NO);
+        config.setProperty(properties.KEYBOARD, Configuration.KEYBOARD_12KEY);
         res = config.getResources();
-        checkValue(res, R.configVarying.simple, "simple 32dpi stylus");
+        checkValue(res, R.configVarying.simple, "simple stylus keysexposed");
         checkValue(res, R.configVarying.bag,
-                R.styleable.TestConfig, new String[]{"bag 32dpi stylus"});
+                R.styleable.TestConfig, new String[]{"bag stylus keysexposed"});
 
         config = new TotalConfig();
-        config.setProperty(properties.TOUCHSCREEN, Configuration.TOUCHSCREEN_STYLUS);
-        config.setProperty(properties.KEYBOARDHIDDEN, Configuration.KEYBOARDHIDDEN_NO);
+        config.setProperty(properties.KEYBOARDHIDDEN, 
+                Configuration.KEYBOARDHIDDEN_NO);
         config.setProperty(properties.KEYBOARD, Configuration.KEYBOARD_12KEY);
+        config.setProperty(properties.NAVIGATION, 
+                Configuration.NAVIGATION_DPAD);
         res = config.getResources();
-// got simple 32dpi stylus
-//        checkValue(res, R.configVarying.simple, "simple stylus 12key");
-//        checkValue(res, R.configVarying.bag,
-//                R.styleable.TestConfig, new String[]{"bag stylus 12key"});
-
-        config = new TotalConfig();
-        config.setProperty(properties.KEYBOARDHIDDEN, Configuration.KEYBOARDHIDDEN_NO);
-        config.setProperty(properties.KEYBOARD, Configuration.KEYBOARD_12KEY);
-        config.setProperty(properties.NAVIGATION, Configuration.NAVIGATION_DPAD);
-        res = config.getResources();
-// got simple 32dpi exposed
-//        checkValue(res, R.configVarying.simple, "simple stylus keysexposed");
-//        checkValue(res, R.configVarying.bag,
-//                R.styleable.TestConfig, new String[]{"bag stylus keysexposed"});
+        checkValue(res, R.configVarying.simple, "simple keysexposed 12key");
+        checkValue(res, R.configVarying.bag,
+                R.styleable.TestConfig, new String[]{"bag keysexposed 12key"});
 
         config = new TotalConfig();
         config.setProperty(properties.KEYBOARD, Configuration.KEYBOARD_12KEY);
-        config.setProperty(properties.NAVIGATION, Configuration.NAVIGATION_DPAD);
+        config.setProperty(properties.NAVIGATION, 
+                Configuration.NAVIGATION_DPAD);
         config.setProperty(properties.HEIGHT, 63);
         config.setProperty(properties.WIDTH, 57);
         res = config.getResources();
-// got simple 240dpi
-//        checkValue(res, R.configVarying.simple, "simple 12key dpad");
-//        checkValue(res, R.configVarying.bag,
-//                R.styleable.TestConfig, new String[]{"bag 12key dpad"});
+        checkValue(res, R.configVarying.simple, "simple 12key dpad");
+        checkValue(res, R.configVarying.bag,
+                R.styleable.TestConfig, new String[]{"bag 12key dpad"});
+
+        config = new TotalConfig();
+        config.setProperty(properties.NAVIGATION, 
+                Configuration.NAVIGATION_DPAD);
+        config.setProperty(properties.HEIGHT, 640);
+        config.setProperty(properties.WIDTH, 400);
+        res = config.getResources();
+        checkValue(res, R.configVarying.simple, "simple dpad");
+        checkValue(res, R.configVarying.bag,
+                R.styleable.TestConfig, new String[]{"bag dpad"});
     }
 }
diff --git a/tests/sketch/Android.mk b/tests/sketch/Android.mk
new file mode 100644
index 0000000..814e370
--- /dev/null
+++ b/tests/sketch/Android.mk
@@ -0,0 +1,8 @@
+LOCAL_PATH:= $(call my-dir)
+include $(CLEAR_VARS)
+
+LOCAL_SRC_FILES := $(call all-subdir-java-files)
+
+LOCAL_PACKAGE_NAME := Sketch
+
+include $(BUILD_PACKAGE)
diff --git a/tests/sketch/AndroidManifest.xml b/tests/sketch/AndroidManifest.xml
new file mode 100755
index 0000000..c44b54e
--- /dev/null
+++ b/tests/sketch/AndroidManifest.xml
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2008 The Android Open Source Project
+
+     Licensed under the Apache License, Version 2.0 (the "License");
+     you may not use this file except in compliance with the License.
+     You may obtain a copy of the License at
+  
+          http://www.apache.org/licenses/LICENSE-2.0
+  
+     Unless required by applicable law or agreed to in writing, software
+     distributed under the License is distributed on an "AS IS" BASIS,
+     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+     See the License for the specific language governing permissions and
+     limitations under the License.
+-->
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+      package="com.android.gesture"
+      android:versionCode="1"
+      android:versionName="1.0.0">
+      <application android:icon="@drawable/icon" android:label="@string/app_name">
+        <activity android:name="com.android.gesture.example.GestureEntryDemo"
+                  android:label="@string/app_name">
+            <intent-filter>
+                <action android:name="android.intent.action.MAIN" />
+                <category android:name="android.intent.category.LAUNCHER" />
+            </intent-filter>
+        </activity>
+        <activity android:name="com.android.gesture.example.GestureLibViewer"/>
+    </application>
+</manifest> 
diff --git a/tests/sketch/res/drawable/icon.png b/tests/sketch/res/drawable/icon.png
new file mode 100755
index 0000000..7502484
--- /dev/null
+++ b/tests/sketch/res/drawable/icon.png
Binary files differ
diff --git a/tests/sketch/res/layout/demo.xml b/tests/sketch/res/layout/demo.xml
new file mode 100755
index 0000000..e516229
--- /dev/null
+++ b/tests/sketch/res/layout/demo.xml
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2008 The Android Open Source Project
+
+     Licensed under the Apache License, Version 2.0 (the "License");
+     you may not use this file except in compliance with the License.
+     You may obtain a copy of the License at
+  
+          http://www.apache.org/licenses/LICENSE-2.0
+  
+     Unless required by applicable law or agreed to in writing, software
+     distributed under the License is distributed on an "AS IS" BASIS,
+     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+     See the License for the specific language governing permissions and
+     limitations under the License.
+-->
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:orientation="vertical"
+    android:layout_width="fill_parent"
+    android:layout_height="wrap_content">
+    <Spinner 
+        android:id="@+id/spinner"
+        android:layout_width="fill_parent"
+        android:layout_height="wrap_content"
+        android:drawSelectorOnTop="true"
+        android:prompt="@string/recognition_result"/>
+    
+    <com.android.gesture.GesturePad 
+        android:id="@+id/drawingpad"
+        android:layout_width="fill_parent"
+        android:layout_height="wrap_content"
+        android:layout_weight="1"/>
+    
+</LinearLayout>
diff --git a/tests/sketch/res/layout/gestureviewer.xml b/tests/sketch/res/layout/gestureviewer.xml
new file mode 100755
index 0000000..5302d34
--- /dev/null
+++ b/tests/sketch/res/layout/gestureviewer.xml
@@ -0,0 +1,58 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2008 The Android Open Source Project
+
+     Licensed under the Apache License, Version 2.0 (the "License");
+     you may not use this file except in compliance with the License.
+     You may obtain a copy of the License at
+  
+          http://www.apache.org/licenses/LICENSE-2.0
+  
+     Unless required by applicable law or agreed to in writing, software
+     distributed under the License is distributed on an "AS IS" BASIS,
+     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+     See the License for the specific language governing permissions and
+     limitations under the License.
+-->
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:orientation="vertical"
+    android:layout_width="fill_parent"
+    android:layout_height="wrap_content">
+    
+    <Spinner 
+        android:id="@+id/spinner"
+        android:layout_width="fill_parent"
+        android:layout_height="wrap_content"
+        android:drawSelectorOnTop="true"
+        android:prompt="@string/recognition_result"/>
+    
+    <com.android.gesture.GesturePad 
+        android:id="@+id/drawingpad"
+        android:layout_width="fill_parent"
+        android:layout_height="wrap_content"
+        android:layout_weight="1"/>
+
+    <LinearLayout 
+        android:orientation="horizontal"
+        android:layout_width="fill_parent"
+        android:layout_height="wrap_content">        
+       <Button 
+          android:id="@+id/previous"
+          android:text="@string/previous"
+          android:layout_width="wrap_content"
+          android:layout_height="wrap_content"
+          android:layout_weight="1"/>
+       <Button 
+          android:id="@+id/remove"
+          android:text="@string/remove"
+          android:layout_width="wrap_content"
+          android:layout_height="wrap_content"
+          android:layout_weight="1"/>
+       <Button 
+          android:id="@+id/next"
+          android:text="@string/next"
+          android:layout_width="wrap_content"
+          android:layout_height="wrap_content"
+          android:layout_weight="1"/>
+    </LinearLayout>
+    
+</LinearLayout>
diff --git a/tests/sketch/res/layout/newgesture_dialog.xml b/tests/sketch/res/layout/newgesture_dialog.xml
new file mode 100755
index 0000000..6e45d81
--- /dev/null
+++ b/tests/sketch/res/layout/newgesture_dialog.xml
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2008 The Android Open Source Project
+
+     Licensed under the Apache License, Version 2.0 (the "License");
+     you may not use this file except in compliance with the License.
+     You may obtain a copy of the License at
+  
+          http://www.apache.org/licenses/LICENSE-2.0
+  
+     Unless required by applicable law or agreed to in writing, software
+     distributed under the License is distributed on an "AS IS" BASIS,
+     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+     See the License for the specific language governing permissions and
+     limitations under the License.
+-->
+
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="fill_parent"
+    android:layout_height="wrap_content"
+    android:orientation="vertical">
+            
+    <EditText
+        android:id="@+id/gesturename_edit"
+        android:layout_height="wrap_content"
+        android:layout_width="fill_parent"
+        android:layout_marginLeft="20dip"
+        android:layout_marginRight="20dip"
+        android:scrollHorizontally="true"
+        android:autoText="false"
+        android:capitalize="none"
+        android:gravity="fill_horizontal"
+        android:textAppearance="?android:attr/textAppearanceMedium" />
+        
+</LinearLayout>
diff --git a/tests/sketch/res/values/strings.xml b/tests/sketch/res/values/strings.xml
new file mode 100755
index 0000000..4c6aa20
--- /dev/null
+++ b/tests/sketch/res/values/strings.xml
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2008 The Android Open Source Project
+
+     Licensed under the Apache License, Version 2.0 (the "License");
+     you may not use this file except in compliance with the License.
+     You may obtain a copy of the License at
+  
+          http://www.apache.org/licenses/LICENSE-2.0
+  
+     Unless required by applicable law or agreed to in writing, software
+     distributed under the License is distributed on an "AS IS" BASIS,
+     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+     See the License for the specific language governing permissions and
+     limitations under the License.
+-->
+<resources>
+    <string name="app_name">Gesture Demo</string>
+    <string name="recognition_result">Recognition Result</string>
+    <string name="clear">Clear</string>
+    <string name="newgesture">Add</string>
+    <string name="viewgesture">View</string>
+    <string name="newgesture_dialog_ok">OK</string>
+    <string name="newgesture_dialog_cancel">Cancel</string>
+    <string name="newgesture_text_entry">Gesture Name</string>
+    <string name="previous">Previous</string>
+    <string name="remove">Remove</string>
+    <string name="next">Next</string>
+</resources>
diff --git a/tests/sketch/src/com/android/gesture/Gesture.java b/tests/sketch/src/com/android/gesture/Gesture.java
new file mode 100755
index 0000000..29c07ad
--- /dev/null
+++ b/tests/sketch/src/com/android/gesture/Gesture.java
@@ -0,0 +1,361 @@
+/*
+ * Copyright (C) 2008-2009 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.gesture;
+
+import android.graphics.Bitmap;
+import android.graphics.Canvas;
+import android.graphics.Matrix;
+import android.graphics.Paint;
+import android.graphics.Path;
+import android.graphics.PointF;
+import android.graphics.RectF;
+import android.os.Parcel;
+import android.os.Parcelable;
+
+import com.android.gesture.recognizer.RecognitionUtil;
+
+import org.xmlpull.v1.XmlSerializer;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.StringTokenizer;
+
+/**
+ * A single stroke gesture.
+ */
+
+public class Gesture implements Parcelable {
+
+    private RectF mBBX;
+    private float mLength = 0;
+    private int mColor;
+    private float mWidth;
+    private ArrayList<PointF> mPtsBuffer = new ArrayList<PointF>();
+    private long mTimestamp = 0;
+    private long mID;
+    
+    private static final long systemStartupTime = System.currentTimeMillis();
+    private static int instanceCount = 0; 
+
+    public Gesture() {
+        mID = systemStartupTime + instanceCount++;
+    }
+
+    public void setColor(int c) {
+        mColor = c;
+    }
+    
+    public void setStrokeWidth(float w) {
+        mWidth = w;
+    }
+    
+    public int getColor() {
+        return mColor;
+    }
+    
+    public float getStrokeWidth() {
+        return mWidth;
+    }
+  
+    public ArrayList<PointF> getPoints() {
+        return this.mPtsBuffer;
+    }
+  
+    public int numOfPoints() {
+        return this.mPtsBuffer.size();
+    }
+
+    public void addPoint(float x, float y) {
+        mPtsBuffer.add(new PointF(x, y));
+        if (mBBX == null) {
+            mBBX = new RectF();
+            mBBX.top = y;
+            mBBX.left = x;
+            mBBX.right = x;
+            mBBX.bottom = y;
+            mLength = 0;
+        }
+        else {
+            PointF lst = mPtsBuffer.get(mPtsBuffer.size()-2);
+            mLength += Math.sqrt(Math.pow(x-lst.x, 2)+Math.pow(y-lst.y, 2));
+            mBBX.union(x, y);
+        }
+        mTimestamp = System.currentTimeMillis();
+    }
+
+    /**
+     * @return the length of the gesture
+     */
+    public float getLength() {
+        return this.mLength;
+    }
+  
+    public RectF getBBX() {
+        return mBBX;
+    }
+  
+    public void setID(long id) {
+        mID = id;
+    }
+    
+    public long getID() {
+        return mID;
+    }
+    
+    public long getTimeStamp() {
+        return mTimestamp;
+    }
+    
+    public void setTimestamp(long t) {
+  	    this.mTimestamp = t;
+    }
+    
+    /**
+     * draw the gesture
+     * @param canvas
+     */
+    public void draw(Canvas canvas) {
+        Paint paint = new Paint();
+        paint.setAntiAlias(true);
+        paint.setDither(true);
+        paint.setColor(mColor);
+        paint.setStyle(Paint.Style.STROKE);
+        paint.setStrokeJoin(Paint.Join.ROUND);
+        paint.setStrokeCap(Paint.Cap.ROUND);
+        paint.setStrokeWidth(mWidth);
+        
+        Path path = null;
+        float mX = 0, mY = 0;
+        Iterator<PointF> it = mPtsBuffer.iterator();
+        while (it.hasNext()) {
+          PointF p = it.next();
+          float x = p.x;
+          float y = p.y;
+          if (path == null) {
+            path = new Path();
+            path.moveTo(x, y);
+            mX = x;
+            mY = y;
+          } else {
+            float dx = Math.abs(x - mX);
+            float dy = Math.abs(y - mY);
+            if (dx >= 3 || dy >= 3) {
+                path.quadTo(mX, mY, (x + mX)/2, (y + mY)/2);
+                mX = x;
+                mY = y;
+            }
+          }
+        }
+        
+        canvas.drawPath(path, paint);
+    }
+    
+    /**
+     * convert the gesture to a Path
+     * @param width the width of the bounding box of the target path
+     * @param height the height of the bounding box of the target path
+     * @param numSample the num of points needed
+     * @return the path
+     */
+    public Path toPath(float width, float height, int numSample) {
+        float[] pts = RecognitionUtil.resample(this, numSample);
+        RectF rect = this.getBBX();
+        float scale = height / rect.height();
+        Matrix matrix = new Matrix();
+        matrix.setTranslate(-rect.left, -rect.top);
+        Matrix scalem = new Matrix();
+        scalem.setScale(scale, scale);
+        matrix.postConcat(scalem);
+        Matrix translate = new Matrix();
+        matrix.postConcat(translate);
+        matrix.mapPoints(pts);
+        
+        Path path = null;
+        float mX = 0, mY = 0;
+        for (int i=0; i<pts.length-1; i+=2) {
+          float x = pts[i];
+          float y = pts[i+1];
+          if (path == null) {
+            path = new Path();
+            path.moveTo(x, y);
+            mX = x;
+            mY = y;
+          } else {
+            float dx = Math.abs(x - mX);
+            float dy = Math.abs(y - mY);
+            if (dx >= 3 || dy >= 3) {
+                path.quadTo(mX, mY, (x + mX)/2, (y + mY)/2);
+                mX = x;
+                mY = y;
+            }
+          }
+        }
+        return path;
+    }
+  
+    /**
+     * get a bitmap thumbnail of the gesture with a transparent background
+     * @param w
+     * @param h
+     * @param edge
+     * @param numSample
+     * @param foreground
+     * @return
+     */
+    public Bitmap toBitmap(int w, int h, 
+        int edge, int numSample) {
+        RectF bbx = this.getBBX();
+        Bitmap bitmap = Bitmap.createBitmap(w, h, Bitmap.Config.ARGB_8888);
+        Path path = this.toPath(w - 2 * edge, h - 2 * edge, numSample);
+        Canvas c = new Canvas(bitmap);
+        //c.drawColor(background);
+        c.translate(edge, edge);
+        Paint paint = new Paint();
+        paint.setAntiAlias(true);
+        paint.setDither(true);
+        paint.setColor(mColor);
+        paint.setStyle(Paint.Style.STROKE);
+        paint.setStrokeJoin(Paint.Join.ROUND);
+        paint.setStrokeCap(Paint.Cap.ROUND);
+        paint.setStrokeWidth(2);
+        c.drawPath(path, paint);
+        return bitmap;
+    }
+    
+    /**
+     * save the gesture as XML
+     * @param namespace
+     * @param serializer
+     * @throws IOException
+     */
+    public void toXML(String namespace, XmlSerializer serializer) throws IOException {
+        serializer.startTag(namespace, "stroke");
+        serializer.attribute(namespace, "timestamp", Long.toString(mTimestamp));
+        serializer.attribute(namespace, "id", Long.toString(mID));
+        serializer.attribute(namespace, "color", Integer.toString(mColor));
+        serializer.attribute(namespace, "width", Float.toString(mWidth));
+        Iterator it = this.mPtsBuffer.iterator();
+        String pts = "";
+        while (it.hasNext()) {
+        	PointF fp = (PointF)it.next();
+        	if (pts.length() > 0)
+        		pts += ",";
+        	pts += fp.x + "," + fp.y;
+        }
+        serializer.text(pts);
+        serializer.endTag(namespace, "stroke");
+    }
+    
+    
+    public void createFromString(String str) {
+        StringTokenizer st = new StringTokenizer(str, "#");
+        
+        String para = st.nextToken();
+        StringTokenizer innerst = new StringTokenizer(para, ",");
+        this.mBBX = new RectF();
+        this.mBBX.left = Float.parseFloat(innerst.nextToken());
+        this.mBBX.top = Float.parseFloat(innerst.nextToken());
+        this.mBBX.right = Float.parseFloat(innerst.nextToken());
+        this.mBBX.bottom = Float.parseFloat(innerst.nextToken());
+        
+        para = st.nextToken();
+        innerst = new StringTokenizer(para, ",");
+        while (innerst.hasMoreTokens()) {
+          String s = innerst.nextToken().trim();
+          if (s.length()==0)
+            break;
+          float x = Float.parseFloat(s);
+          float y = Float.parseFloat(innerst.nextToken());
+          this.mPtsBuffer.add(new PointF(x, y));
+        }
+  
+        para = st.nextToken();
+        this.mColor = Integer.parseInt(para);
+        
+        para = st.nextToken();
+        this.mWidth = Float.parseFloat(para);
+        
+        para = st.nextToken();
+        this.mLength = Float.parseFloat(para);
+        
+        para = st.nextToken();
+        this.mTimestamp = Long.parseLong(para);
+    }
+    
+    @Override
+    public String toString() {
+        String str = "";
+        
+        str += "#" + this.mBBX.left + "," + this.mBBX.top + "," +
+               this.mBBX.right + "," + this.mBBX.bottom;
+        
+        str += "#";
+        Iterator<PointF> it = this.mPtsBuffer.iterator();
+        while (it.hasNext()) {
+          PointF fp = it.next();
+          str += fp.x + "," + fp.y + ","; 
+        }
+
+        str += "#";
+        str += this.mColor;
+        
+        str += "#";
+        str += this.mWidth;
+        
+        str += "#";
+        str += this.mLength;
+        
+        str += "#";
+        str += this.mTimestamp;
+  
+        return str;
+    }
+    
+    public static final Parcelable.Creator CREATOR = new Parcelable.Creator() {
+        public Gesture createFromParcel(Parcel in) {
+            String str = in.readString();
+            Gesture stk = new Gesture();
+            stk.createFromString(str);
+            return stk;
+        }
+    
+        public Gesture[] newArray(int size) {
+            return new Gesture[size];
+        }
+    };
+    
+    public static Gesture buildFromArray(byte[] bytes) {
+        String str = new String(bytes);
+        Gesture stk = new Gesture();
+        stk.createFromString(str);
+        return stk;
+    }
+    
+    public static byte[] saveToArray(Gesture stk) {
+        String str = stk.toString();   
+        return str.getBytes();
+    }
+    
+    public void writeToParcel(Parcel out, int flags) {
+        out.writeString(this.toString());
+    }
+      
+    public int describeContents() {
+        return CONTENTS_FILE_DESCRIPTOR;
+    }
+}
diff --git a/tests/sketch/src/com/android/gesture/GestureLib.java b/tests/sketch/src/com/android/gesture/GestureLib.java
new file mode 100755
index 0000000..d0a25f2
--- /dev/null
+++ b/tests/sketch/src/com/android/gesture/GestureLib.java
@@ -0,0 +1,280 @@
+/*
+ * Copyright (C) 2008-2009 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.gesture;
+
+import android.util.Log;
+import android.util.Xml;
+import android.util.Xml.Encoding;
+
+import com.android.gesture.recognizer.Classifier;
+import com.android.gesture.recognizer.Instance;
+import com.android.gesture.recognizer.NearestNeighbor;
+import com.android.gesture.recognizer.Prediction;
+
+import org.xml.sax.Attributes;
+import org.xml.sax.ContentHandler;
+import org.xml.sax.Locator;
+import org.xml.sax.SAXException;
+import org.xmlpull.v1.XmlSerializer;
+
+import java.io.BufferedInputStream;
+import java.io.BufferedOutputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Set;
+import java.util.StringTokenizer;
+
+public class GestureLib {
+  
+    private static final String LOGTAG = "GestureLib";
+    private static String namespace = "ink";
+    private final String datapath;
+    private HashMap<String, ArrayList<Gesture>> name2gestures =
+          new HashMap<String, ArrayList<Gesture>>();
+    private Classifier mClassifier;
+
+    public GestureLib(String path) {
+        datapath = path;
+        mClassifier = new NearestNeighbor();
+    }
+    
+    public Classifier getClassifier() {
+        return mClassifier;
+    }
+    
+    /**
+     * get all the labels in the library
+     * @return a set of strings
+     */
+    public Set<String> getLabels() {
+        return name2gestures.keySet();
+    }
+    
+    public ArrayList<Prediction> recognize(Gesture gesture) {
+        Instance instance = Instance.createInstance(gesture, null);
+        return mClassifier.classify(instance);
+    }
+    
+    public void addGesture(String name, Gesture gesture) {
+        Log.v(LOGTAG, "add an example for gesture: " + name);
+        ArrayList<Gesture> gestures = name2gestures.get(name);
+        if (gestures == null) {
+            gestures = new ArrayList<Gesture>();
+            name2gestures.put(name, gestures);
+        }
+        gestures.add(gesture);
+        mClassifier.addInstance(
+            Instance.createInstance(gesture, name));
+    }
+    
+    public void removeGesture(String name, Gesture gesture) {
+      ArrayList<Gesture> gestures = name2gestures.get(name);
+      if (gestures == null) {
+          return;
+      } 
+      
+      gestures.remove(gesture);
+      
+      // if there are no more samples, remove the entry automatically 
+      if (gestures.isEmpty()) {
+          name2gestures.remove(name);
+      }
+      
+      mClassifier.removeInstance(gesture.getID());
+    }
+    
+    public ArrayList<Gesture> getGestures(String label) {
+        ArrayList<Gesture> gestures = name2gestures.get(label);
+        if (gestures != null)
+            return (ArrayList<Gesture>)gestures.clone();
+        else
+            return null;
+    }
+    
+    public void load() {
+        String filename = datapath
+                        + File.separator + "gestures.xml";
+        File f = new File(filename);
+        if (f.exists()) {
+            try {
+                loadInk(filename, null);
+            }
+            catch (SAXException ex) {
+                ex.printStackTrace();
+            } catch (IOException ex) {
+                ex.printStackTrace();
+            }
+        }
+    }
+    
+    public void save() {
+        try {
+            compactSave();
+        } catch (IOException e) {
+            // TODO Auto-generated catch block
+            e.printStackTrace();
+        }
+    }
+    
+    private void compactSave() throws IOException {
+        File f = new File(datapath);
+        if (f.exists() == false) {
+            f.mkdirs();
+        }
+        String filename = datapath + File.separator + "gestures.xml";
+        Log.v(LOGTAG, "save to " + filename);
+        BufferedOutputStream fos = new BufferedOutputStream(
+            new FileOutputStream(filename)); 
+        
+        PrintWriter writer = new PrintWriter(fos);
+        XmlSerializer serializer = Xml.newSerializer();
+        serializer.setOutput(writer);
+        serializer.startDocument(Encoding.ISO_8859_1.name(), null);
+        serializer.startTag(namespace, "gestures");
+        Iterator<String> it = name2gestures.keySet().iterator();
+        while (it.hasNext()) {
+            String key = it.next();
+            ArrayList<Gesture> gestures = name2gestures.get(key);
+            saveGestures(serializer, key, gestures);
+        }
+        
+        serializer.endTag(namespace, "gestures");
+        serializer.endDocument();
+        serializer.flush();
+        writer.close();
+        fos.close();    
+    }
+    
+    private static void saveGestures(XmlSerializer serializer,
+        String name, ArrayList<Gesture> strokes) throws IOException {
+        serializer.startTag(namespace, "gesture");
+        serializer.startTag(namespace, "name");
+        serializer.text(name);
+        serializer.endTag(namespace, "name");
+        Iterator<Gesture> it = strokes.iterator();
+        while (it.hasNext()) {
+          Gesture stk = it.next();
+          stk.toXML(namespace, serializer);
+        }
+        serializer.endTag(namespace, "gesture");
+    }
+  
+    private void loadInk(String filename, String label) throws SAXException, IOException {
+        Log.v(LOGTAG, "load from " + filename);
+        BufferedInputStream in = new BufferedInputStream(
+            new FileInputStream(filename));
+        Xml.parse(in, Encoding.ISO_8859_1, new CompactInkHandler());
+        in.close();
+    }
+
+    class CompactInkHandler implements ContentHandler {
+        
+        Gesture currentGesture = null;
+        StringBuffer buffer = null;
+        String gestureName;
+        ArrayList<Gesture> gestures;
+        
+        CompactInkHandler() {
+        }
+        
+        // Receive notification of character data.
+        public void characters(char[] ch, int start, int length) {
+            buffer.append(ch, start, length);
+        }
+    
+        //Receive notification of the end of a document.
+        public void   endDocument() {
+        }
+        
+        // Receive notification of the end of an element.
+        public void   endElement(String uri, String localName, String qName) {
+            if (localName.equals("gesture")) {
+              name2gestures.put(gestureName, gestures);
+              gestures = null;
+            } else if (localName.equals("name")) {
+              gestureName = buffer.toString();
+            } else if (localName.equals("stroke")) {
+              StringTokenizer tokenizer = new StringTokenizer(buffer.toString(), ",");
+              while (tokenizer.hasMoreTokens()) {
+                  String str = tokenizer.nextToken();
+                  float x = Float.parseFloat(str);
+                  str = tokenizer.nextToken();
+                  float y = Float.parseFloat(str);
+                  try
+                  {
+                      currentGesture.addPoint(x, y);
+                  }
+                  catch(Exception ex) {
+                      ex.printStackTrace();
+                  }
+              }
+              gestures.add(currentGesture);
+              mClassifier.addInstance(
+                  Instance.createInstance(currentGesture, gestureName));
+              currentGesture = null;
+            }
+        }
+        
+        // End the scope of a prefix-URI mapping.
+        public void   endPrefixMapping(String prefix) {
+        }
+          
+        //Receive notification of ignorable whitespace in element content.
+        public void   ignorableWhitespace(char[] ch, int start, int length) {
+        }
+          
+        //Receive notification of a processing instruction.            
+        public void   processingInstruction(String target, String data) {
+        }
+          
+        // Receive an object for locating the origin of SAX document events.
+        public void   setDocumentLocator(Locator locator) {
+        }
+          
+        // Receive notification of a skipped entity.
+        public void   skippedEntity(String name) {
+        }
+          
+        // Receive notification of the beginning of a document.
+        public void   startDocument() {
+        }
+          
+        // Receive notification of the beginning of an element.
+        public void   startElement(String uri, String localName, String qName, Attributes atts) {
+            if (localName.equals("gesture")) {
+                gestures = new ArrayList<Gesture>();
+            } else if (localName.equals("name")) {
+                buffer = new StringBuffer();
+            } else if (localName.equals("stroke")) {
+                currentGesture = new Gesture();
+                currentGesture.setTimestamp(Long.parseLong(atts.getValue(namespace, "timestamp")));
+                currentGesture.setColor(Integer.parseInt(atts.getValue(namespace, "color")));
+                currentGesture.setStrokeWidth(Float.parseFloat(atts.getValue(namespace, "width")));
+                buffer = new StringBuffer();
+            }
+        }
+          
+        public void   startPrefixMapping(String prefix, String uri) {
+        }
+    }
+}
diff --git a/tests/sketch/src/com/android/gesture/GestureListener.java b/tests/sketch/src/com/android/gesture/GestureListener.java
new file mode 100755
index 0000000..ebb4149
--- /dev/null
+++ b/tests/sketch/src/com/android/gesture/GestureListener.java
@@ -0,0 +1,25 @@
+/*
+ * Copyright (C) 2008-2009 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.gesture;
+
+import android.view.MotionEvent;
+
+public interface GestureListener {
+    public void onStartGesture(GesturePad pad, MotionEvent event);
+    public void onGesture(GesturePad pad, MotionEvent event);
+    public void onFinishGesture(GesturePad pad, MotionEvent event);
+}
diff --git a/tests/sketch/src/com/android/gesture/GesturePad.java b/tests/sketch/src/com/android/gesture/GesturePad.java
new file mode 100755
index 0000000..45a09e6
--- /dev/null
+++ b/tests/sketch/src/com/android/gesture/GesturePad.java
@@ -0,0 +1,371 @@
+/*
+ * Copyright (C) 2008 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.gesture;
+
+import android.content.Context;
+import android.graphics.Bitmap;
+import android.graphics.Canvas;
+import android.graphics.Color;
+import android.graphics.Matrix;
+import android.graphics.Paint;
+import android.graphics.Path;
+import android.graphics.PointF;
+import android.os.Handler;
+import android.util.AttributeSet;
+import android.view.MotionEvent;
+import android.view.View;
+import java.util.ArrayList;
+import java.util.Iterator;
+
+/**
+ * A view for rendering and processing gestures
+ */
+
+public class GesturePad extends View {
+
+    public static final float TOUCH_TOLERANCE = 4;
+    public static final int default_foreground = Color.argb(255, 255, 255, 0);
+    private int         background = Color.argb(0, 0, 0, 0);
+    private int         foreground = default_foreground;
+    private int         uncertain_foreground = Color.argb(55, 255, 255, 0);
+    private Bitmap      mBitmap;
+    private Canvas      mCanvas;
+    private Path        mPath;
+    private Paint       mBitmapPaint;
+    private Paint       mPaint;
+    private Paint       mDebugPaint;
+    private float       mX, mY;
+    private boolean     mEnableInput = true; 
+    private boolean     mEnableRendering = true;
+    private boolean     mCacheGesture = true;
+    private Gesture       mCurrentGesture = null;
+    ArrayList<GestureListener> mGestureListeners = new ArrayList<GestureListener>();
+
+    private boolean     mShouldFadingOut = true;
+    private boolean     mIsFadingOut = false;
+    private float       mFadingAlpha = 1;
+    
+    private boolean     reconstruct = false;
+    
+    private ArrayList<Path> debug = new ArrayList<Path>();
+    private Handler mHandler = new Handler();
+    
+    private Runnable mFadingOut = new Runnable() {
+      public void run() {
+          mFadingAlpha -= 0.03f;
+          if (mFadingAlpha <= 0) {
+              mIsFadingOut = false;
+              mPath.reset();
+          } else {
+              mHandler.postDelayed(this, 100);
+          }
+          invalidate();
+      }
+   };
+
+    public GesturePad(Context context) {
+        super(context);
+        init();
+    }
+  
+    public GesturePad(Context context, AttributeSet attrs) {
+        super(context, attrs);
+        init();
+    }
+    
+    public boolean isEnableRendering() {
+        return this.mEnableRendering;
+    }
+    
+    public Gesture getCurrentGesture() {
+        return mCurrentGesture;
+    }
+    
+    public Paint getPaint() {
+        return mPaint;
+    }
+    
+    public void setColor(int c) {
+        this.foreground = c;
+    }
+    
+    public void setFadingAlpha(float f) {
+        mFadingAlpha = f;
+    }
+    
+    public void setCurrentGesture(Gesture stk) {
+        this.mCurrentGesture = stk;
+        reconstruct = true;
+    }
+    
+    private void init() {
+        mDebugPaint = new Paint();
+        mDebugPaint.setColor(Color.WHITE);
+        mDebugPaint.setStrokeWidth(4);
+        mDebugPaint.setAntiAlias(true);
+        mDebugPaint.setStyle(Paint.Style.STROKE);
+        
+        mPaint = new Paint();
+        mPaint.setAntiAlias(true);
+        mPaint.setDither(true);
+        mPaint.setColor(foreground);
+        mPaint.setStyle(Paint.Style.STROKE);
+        mPaint.setStrokeJoin(Paint.Join.ROUND);
+        mPaint.setStrokeCap(Paint.Cap.ROUND);
+        mPaint.setStrokeWidth(12);
+        
+        mBitmapPaint = new Paint(Paint.DITHER_FLAG);
+        mPath = new Path();
+        
+        reconstruct = false;
+    }
+
+    public void cacheGesture(boolean b) {
+        mCacheGesture = b;
+    }
+      
+    public void enableRendering(boolean b) {
+        mEnableRendering = b;
+    }
+  
+    
+    @Override
+    protected void onSizeChanged(int w, int h, int oldw, int oldh) {
+        // TODO Auto-generated method stub
+        super.onSizeChanged(w, h, oldw, oldh);
+        
+        if (w <=0 || h <=0)
+            return;
+        
+        int width = w>oldw? w : oldw;
+        int height = h>oldh? h : oldh;
+        Bitmap newBitmap = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);
+        mCanvas = new Canvas(newBitmap);
+        
+        if (mBitmap != null) {
+            mCanvas.drawColor(background);
+            mCanvas.drawBitmap(mBitmap, 0, 0, mBitmapPaint);
+            mCanvas.drawPath(mPath, mPaint);
+        }
+        
+        mBitmap = newBitmap;
+    }
+
+    public void addGestureListener(GestureListener l) {
+        this.mGestureListeners.add(l);
+    }
+  
+    public void removeGestureListener(GestureListener l) {
+        this.mGestureListeners.remove(l);
+    }
+  
+    @Override
+    protected void onDraw(Canvas canvas) {
+        canvas.drawColor(background);
+        
+        if (mCacheGesture)
+            canvas.drawBitmap(mBitmap, 0, 0, mBitmapPaint);
+        
+        if (mIsFadingOut) {
+            int color = foreground;
+            int alpha = (int)(Color.alpha(color) * mFadingAlpha);
+            mPaint.setColor(Color.argb(alpha, 
+                Color.red(color), 
+                Color.green(color), 
+                Color.blue(color)));
+        } else if (mEnableRendering == false) {
+            mPaint.setColor(uncertain_foreground);
+        } else {
+            mPaint.setColor(foreground);
+        }
+        
+        if (reconstruct) {
+            
+            if (this.mCurrentGesture != null) {
+                float xedge = 30;
+                float yedge = 30;
+                float w = this.getWidth() - 2 * xedge;
+                float h = this.getHeight() - 2 * yedge;
+                float sx =  w / this.mCurrentGesture.getBBX().width();
+                float sy = h / mCurrentGesture.getBBX().height();
+                float scale = sx>sy?sy:sx;
+                convertFromStroke(mCurrentGesture);
+                Matrix matrix = new Matrix();
+                matrix.preTranslate(-mCurrentGesture.getBBX().centerX(), -mCurrentGesture.getBBX().centerY());
+                matrix.postScale(scale, scale);
+                matrix.postTranslate(this.getWidth()/2, this.getHeight()/2);
+                this.mPath.transform(matrix);
+            } else {
+                mPath.reset();
+            }
+            
+            reconstruct = false;
+        }
+        
+        canvas.drawPath(mPath, mPaint);
+        
+        Iterator<Path> it = debug.iterator();
+        while (it.hasNext()) {
+            Path path = it.next();
+            canvas.drawPath(path, mDebugPaint);
+        }
+    }
+    
+    public void clearDebugPath() {
+        debug.clear();
+    }
+    
+    public void addDebugPath(Path path) {
+        debug.add(path);
+    }
+    
+    public void addDebugPath(ArrayList<Path> paths) {
+        debug.addAll(paths);
+    }
+    
+    public void clear() {
+        mPath = new Path();
+        this.mCurrentGesture = null;
+        mCanvas.drawColor(background);
+        this.invalidate();
+    }
+    
+    private void convertFromStroke(Gesture stk) {
+        mPath = null;
+        Iterator it = stk.getPoints().iterator();
+        while (it.hasNext()) {
+            PointF p = (PointF) it.next();
+            if (mPath == null) {
+                mPath = new Path();
+                mPath.moveTo(p.x, p.y);
+                mX = p.x;
+                mY = p.y;
+            } else {
+                float dx = Math.abs(p.x - mX);
+                float dy = Math.abs(p.y - mY);
+                if (dx >= TOUCH_TOLERANCE || dy >= TOUCH_TOLERANCE) {
+                    mPath.quadTo(mX, mY, (p.x + mX)/2, (p.y + mY)/2);
+                    mX = p.x;
+                    mY = p.y;
+                }
+            }
+        }
+        mPath.lineTo(mX, mY);
+    }
+    
+    public void setEnableInput(boolean b) {
+        mEnableInput = b;
+    }
+    
+    public boolean isEnableInput() {
+        return mEnableInput;
+    }
+    
+    @Override
+    public boolean onTouchEvent(MotionEvent event) {
+      
+        if(mEnableInput == false) 
+            return true;
+        
+        switch (event.getAction()) {
+            case MotionEvent.ACTION_DOWN:
+                touch_start(event);
+                invalidate();
+                break;
+            case MotionEvent.ACTION_MOVE:
+                touch_move(event);
+                invalidate();
+                break;
+            case MotionEvent.ACTION_UP:
+                touch_up(event);
+                invalidate();
+                break;
+        }
+        return true;
+    }
+    
+    private void touch_start(MotionEvent event) {
+        mIsFadingOut = false;
+        mHandler.removeCallbacks(mFadingOut);
+      
+        float x = event.getX();
+        float y = event.getY();
+
+        mCurrentGesture = new Gesture();
+        mCurrentGesture.addPoint(x, y);
+        
+        mPath.reset();
+        mPath.moveTo(x, y);
+        mX = x;
+        mY = y;
+        
+        Iterator<GestureListener> it = mGestureListeners.iterator();
+        while (it.hasNext()) {
+            it.next().onStartGesture(this, event);
+        }
+    }
+    
+    private void touch_move(MotionEvent event) {
+        float x = event.getX();
+        float y = event.getY();
+
+        float dx = Math.abs(x - mX);
+        float dy = Math.abs(y - mY);
+        if (dx >= TOUCH_TOLERANCE || dy >= TOUCH_TOLERANCE) {
+            mPath.quadTo(mX, mY, (x + mX)/2, (y + mY)/2);
+            mX = x;
+            mY = y;
+        }
+        
+        mCurrentGesture.addPoint(x, y);
+        
+        Iterator<GestureListener> it = mGestureListeners.iterator();
+        while (it.hasNext()) {
+            it.next().onGesture(this, event);
+        }
+    }
+    
+    public void setFadingOut(boolean b) {
+        mShouldFadingOut = b;
+        mIsFadingOut = false;
+    }
+    
+    public boolean shouldFadingOut() {
+        return mShouldFadingOut;
+    }
+    
+    private void touch_up(MotionEvent event) {
+        mPath.lineTo(mX, mY);
+        
+        if (mCacheGesture)
+            mCanvas.drawPath(mPath, mPaint);
+        
+        // kill this so we don't double draw
+        if (shouldFadingOut()) {
+            mFadingAlpha = 1;
+            mIsFadingOut = true;
+            mHandler.removeCallbacks(mFadingOut);
+            mHandler.postDelayed(mFadingOut, 100);
+        }
+        
+        Iterator<GestureListener> it = mGestureListeners.iterator();
+        while (it.hasNext()) {
+            it.next().onFinishGesture(this, event);
+        }
+    }
+
+}
diff --git a/tests/sketch/src/com/android/gesture/example/GestureEntryDemo.java b/tests/sketch/src/com/android/gesture/example/GestureEntryDemo.java
new file mode 100755
index 0000000..8fee21a
--- /dev/null
+++ b/tests/sketch/src/com/android/gesture/example/GestureEntryDemo.java
@@ -0,0 +1,220 @@
+/*
+ * Copyright (C) 2008 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.gesture.example;
+
+import android.app.Activity;
+import android.app.AlertDialog;
+import android.app.Dialog;
+import android.content.DialogInterface;
+import android.content.Intent;
+import android.os.Bundle;
+import android.view.LayoutInflater;
+import android.view.Menu;
+import android.view.MenuItem;
+import android.view.MotionEvent;
+import android.view.View;
+import android.widget.AdapterView;
+import android.widget.ArrayAdapter;
+import android.widget.EditText;
+import android.widget.Spinner;
+import android.widget.AdapterView.OnItemSelectedListener;
+
+import com.android.gesture.Gesture;
+import com.android.gesture.GestureLib;
+import com.android.gesture.GestureListener;
+import com.android.gesture.GesturePad;
+import com.android.gesture.R;
+import com.android.gesture.recognizer.Prediction;
+
+import java.util.ArrayList;
+
+/**
+ * The demo shows how to construct a gesture-based user interface on Android.
+ */
+
+public class GestureEntryDemo extends Activity {
+  
+    private static final int DIALOG_NEW_ENTRY = 1;
+    private static final int NEW_ID = Menu.FIRST;
+    private static final int VIEW_ID = Menu.FIRST + 1;
+
+    GesturePad  mView;
+    Spinner     mResult;
+    GestureLib  mRecognizer;
+    boolean     mChangedByRecognizer = false;
+    
+    @Override
+    public void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+        setContentView(R.layout.demo);
+        
+        // init the recognizer
+        mRecognizer = new GestureLib("/sdcard/gestureentry");
+        mRecognizer.load();
+        
+        // create the spinner for showing the recognition results
+        // the spinner also allows a user to correct a prediction
+        mResult = (Spinner) findViewById(R.id.spinner);
+        mResult.setOnItemSelectedListener(new OnItemSelectedListener() {
+
+            public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
+                // TODO Auto-generated method stub
+                // correct the recognition result by adding the new example
+                if (mChangedByRecognizer == false) {
+                    mRecognizer.addGesture(parent.getSelectedItem().toString(), 
+                      mView.getCurrentGesture());
+                } else {
+                    mChangedByRecognizer = false;
+                }
+            }
+  
+            public void onNothingSelected(AdapterView<?> parent) {
+              // TODO Auto-generated method stub
+              
+            }
+          
+        });
+        
+        // create the area for drawing a gesture
+        mView = (GesturePad)this.findViewById(R.id.drawingpad);
+        mView.cacheGesture(false);
+        mView.setFadingOut(false);
+        mView.addGestureListener(new GestureListener() {
+            public void onFinishGesture(GesturePad patch, MotionEvent event) {
+                // TODO Auto-generated method stub
+                recognize(patch.getCurrentGesture());
+            }
+            public void onGesture(GesturePad patch, MotionEvent event) {
+              // TODO Auto-generated method stub
+              
+            }
+            public void onStartGesture(GesturePad patch, MotionEvent event) {
+              // TODO Auto-generated method stub
+              
+            }
+        });
+        
+        
+        if (savedInstanceState != null) {
+            mView.setCurrentGesture(
+                (Gesture)savedInstanceState.getParcelable("gesture"));
+        }
+    }
+    
+    @Override
+    protected Dialog onCreateDialog(int id) {
+        // create the dialog for adding a new entry
+        LayoutInflater factory = LayoutInflater.from(this);
+        final View textEntryView =
+             factory.inflate(R.layout.newgesture_dialog, null);
+        return new AlertDialog.Builder(GestureEntryDemo.this)
+            .setTitle(R.string.newgesture_text_entry)
+            .setView(textEntryView)
+            .setPositiveButton(R.string.newgesture_dialog_ok, 
+                new DialogInterface.OnClickListener() {
+                public void onClick(DialogInterface dialog, int whichButton) {
+                    /* User clicked OK so do some stuff */
+                    EditText edittext =
+                      (EditText)((AlertDialog)dialog).findViewById(R.id.gesturename_edit);
+                    String text = edittext.getText().toString().trim();
+                    if (text.length() > 0) {
+                        mRecognizer.addGesture(text, mView.getCurrentGesture());
+                    }
+                }
+            })
+            .setNegativeButton(R.string.newgesture_dialog_cancel,
+                new DialogInterface.OnClickListener() {
+                public void onClick(DialogInterface dialog, int whichButton) {
+                    /* User clicked cancel so do some stuff */
+                }
+            })
+            .create();
+    }
+    
+    @Override
+    public boolean onCreateOptionsMenu(Menu menu) {
+        // TODO Auto-generated method stub
+        super.onCreateOptionsMenu(menu);
+        menu.add(0, NEW_ID, 0, R.string.newgesture)
+                .setShortcut('0', 'n')
+                .setIcon(android.R.drawable.ic_menu_add);
+        menu.add(0, VIEW_ID, 0, R.string.viewgesture)
+                .setShortcut('1', 'v')
+                .setIcon(android.R.drawable.ic_menu_view);
+        return true;
+    }
+    
+    @Override
+    public boolean onOptionsItemSelected(MenuItem item) {
+        // Handle all of the possible menu actions.
+        switch (item.getItemId()) {
+            case NEW_ID:
+                // if there has been a gesture on the canvas
+                if (mView.getCurrentGesture() != null) {
+                    showDialog(DIALOG_NEW_ENTRY);
+                }
+                break;
+                
+            case VIEW_ID:
+                startActivityForResult(
+                    new Intent(this, GestureLibViewer.class), VIEW_ID);
+                break;
+        }
+        
+        return super.onOptionsItemSelected(item);
+    }
+    
+    
+    @Override
+    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
+        mRecognizer.load();
+        mView.clear();
+    }
+    
+    @Override
+    protected void onPause() {
+        // TODO Auto-generated method stub
+        super.onPause();
+        mRecognizer.save();
+    }
+    
+    
+    @Override
+    protected void onPrepareDialog(int id, Dialog dialog) {
+        // TODO Auto-generated method stub
+        super.onPrepareDialog(id, dialog);
+    }
+
+    @Override
+    protected void onSaveInstanceState(Bundle outState) {
+        // TODO Auto-generated method stub
+        super.onSaveInstanceState(outState);
+        outState.putParcelable("gesture", mView.getCurrentGesture());
+        mRecognizer.save();
+    }
+
+    public void recognize(Gesture ink) {
+        mChangedByRecognizer = true;
+        ArrayList<Prediction> predictions = mRecognizer.recognize(ink);
+        ArrayAdapter adapter = new ArrayAdapter(this, 
+                    android.R.layout.simple_spinner_item, predictions);
+        adapter.setDropDownViewResource(
+                    android.R.layout.simple_spinner_dropdown_item);
+        mResult.setAdapter(adapter);
+    }
+
+}
diff --git a/tests/sketch/src/com/android/gesture/example/GestureLibViewer.java b/tests/sketch/src/com/android/gesture/example/GestureLibViewer.java
new file mode 100755
index 0000000..7ae7fc5
--- /dev/null
+++ b/tests/sketch/src/com/android/gesture/example/GestureLibViewer.java
@@ -0,0 +1,257 @@
+/*
+ * Copyright (C) 2008 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.gesture.example;
+
+import android.app.Activity;
+import android.graphics.Matrix;
+import android.graphics.Path;
+import android.os.Bundle;
+import android.view.KeyEvent;
+import android.view.View;
+import android.view.View.OnClickListener;
+import android.widget.AdapterView;
+import android.widget.ArrayAdapter;
+import android.widget.Button;
+import android.widget.Spinner;
+import android.widget.AdapterView.OnItemSelectedListener;
+
+import com.android.gesture.Gesture;
+import com.android.gesture.GestureLib;
+import com.android.gesture.GesturePad;
+import com.android.gesture.R;
+import com.android.gesture.recognizer.Instance;
+
+import java.util.ArrayList;
+import java.util.Collections;
+
+/**
+ * GestureLibViewer is for viewing existing gestures and 
+ * removing unwanted gestures.
+ */
+
+public class GestureLibViewer  extends Activity {
+  
+    GesturePad          mView;
+    Spinner             mResult;
+    GestureLib          mRecognizer;
+    ArrayList<Gesture>  mSamples;
+    int                 mCurrentGestureIndex;
+    
+    @Override
+    public void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+        setContentView(R.layout.gestureviewer);
+        
+        // create the area for drawing a glyph
+        mView = (GesturePad)this.findViewById(R.id.drawingpad);
+        mView.cacheGesture(false);
+        mView.setFadingOut(false);
+        mView.setEnableInput(false);
+        
+        // init the recognizer
+        mRecognizer = new GestureLib("/sdcard/gestureentry");
+        mRecognizer.load();
+
+        mResult = (Spinner) findViewById(R.id.spinner);
+        ArrayList<String> list = new ArrayList<String>();
+        list.addAll(mRecognizer.getLabels());
+        Collections.sort(list);
+        ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, 
+                    android.R.layout.simple_spinner_item, 
+                    list);
+        adapter.setDropDownViewResource(
+                    android.R.layout.simple_spinner_dropdown_item);
+        mResult.setAdapter(adapter);
+        mSamples = mRecognizer.getGestures(list.get(0));
+        if (mSamples.isEmpty() == false) {
+            mCurrentGestureIndex = 0;
+            Gesture gesture = mSamples.get(mCurrentGestureIndex);
+            mView.setCurrentGesture(gesture);
+            mView.clearDebugPath();
+            mView.addDebugPath(
+                toPath(mRecognizer.getClassifier().getInstance(gesture.getID())));
+        }
+        
+        mResult.setOnItemSelectedListener(new OnItemSelectedListener() {
+            public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
+                // TODO Auto-generated method stub
+                mSamples = mRecognizer.getGestures(
+                    (String)mResult.getSelectedItem());
+                if (mSamples.isEmpty() == false) {
+                    mCurrentGestureIndex = 0;
+                    Gesture gesture = mSamples.get(mCurrentGestureIndex);
+                    mView.setCurrentGesture(gesture);
+                    mView.clearDebugPath();
+                    mView.addDebugPath(
+                        toPath(mRecognizer.getClassifier().getInstance(gesture.getID())));
+                }
+                mView.invalidate();
+            }
+  
+            public void onNothingSelected(AdapterView<?> parent) {
+              // TODO Auto-generated method stub
+              
+            }
+          
+        });
+        
+        Button remove = (Button)this.findViewById(R.id.remove);
+        remove.setOnClickListener(new OnClickListener() {
+            public void onClick(View v) {
+                // TODO Auto-generated method stub
+                if (mSamples.isEmpty())
+                    return;
+                
+                String name = (String)mResult.getSelectedItem();
+                Gesture gesture = mSamples.get(mCurrentGestureIndex);
+                mRecognizer.removeGesture(name, gesture);
+                
+                mSamples = mRecognizer.getGestures(name);
+                
+                if (mSamples == null) {
+                    // delete the entire entry
+                    mCurrentGestureIndex = 0;
+                    ArrayList<String> list = new ArrayList<String>();
+                    list.addAll(mRecognizer.getLabels());
+                    Collections.sort(list);
+                    ArrayAdapter<String> adapter = new ArrayAdapter<String>(
+                                GestureLibViewer.this, 
+                                android.R.layout.simple_spinner_item, 
+                                list);
+                    adapter.setDropDownViewResource(
+                                android.R.layout.simple_spinner_dropdown_item);
+                    mResult.setAdapter(adapter);
+                } else {
+                    if (mCurrentGestureIndex > mSamples.size()-1) {
+                        mCurrentGestureIndex--;
+                    }
+                    gesture = mSamples.get(mCurrentGestureIndex);
+                    mView.setCurrentGesture(gesture);
+                    mView.clearDebugPath();
+                    mView.addDebugPath(
+                        toPath(mRecognizer.getClassifier().getInstance(gesture.getID())));
+                    mView.invalidate();
+                }
+            }
+        });
+        
+        Button next = (Button)this.findViewById(R.id.next);
+        next.setOnClickListener(new OnClickListener() {
+            public void onClick(View v) {
+                // TODO Auto-generated method stub
+                if (mCurrentGestureIndex >= mSamples.size()-1)
+                    return;
+                
+                mCurrentGestureIndex++;
+                Gesture gesture = mSamples.get(mCurrentGestureIndex);
+                mView.setCurrentGesture(gesture);
+                mView.clearDebugPath();
+                mView.addDebugPath(
+                    toPath(mRecognizer.getClassifier().getInstance(gesture.getID())));
+                mView.invalidate();
+            }
+        });
+
+        Button previous = (Button)this.findViewById(R.id.previous);
+        previous.setOnClickListener(new OnClickListener() {
+            public void onClick(View v) {
+                // TODO Auto-generated method stub
+                if (mCurrentGestureIndex >= 1 &&
+                    mSamples.isEmpty() == false) {
+                    mCurrentGestureIndex--;
+                    Gesture gesture = mSamples.get(mCurrentGestureIndex);
+                    mView.setCurrentGesture(gesture);
+                    mView.clearDebugPath();
+                    mView.addDebugPath(
+                        toPath(mRecognizer.getClassifier().getInstance(gesture.getID())));
+                    mView.invalidate();
+                }
+            }
+        });
+    }
+    
+    public static ArrayList<Path> toPath(Instance instance) {
+        ArrayList<Path> paths = new ArrayList();
+        Path path = null;
+        float minx = 0, miny = 0;
+        float mX = 0, mY = 0;
+        for (int i=0; i<instance.vector.length; i+=2) {
+            float x = instance.vector[i];
+            float y = instance.vector[i+1];
+            if (x < minx)
+                minx = x;
+            if (y < miny)
+                miny = y;
+            if (path == null) {
+              path = new Path();
+              path.moveTo(x, y);
+              mX = x;
+              mY = y;
+            } else {
+              float dx = Math.abs(x - mX);
+              float dy = Math.abs(y - mY);
+              if (dx >= 3 || dy >= 3) {
+                  path.quadTo(mX, mY, (x + mX)/2, (y + mY)/2);
+                  mX = x;
+                  mY = y;
+              }
+            }
+        }
+        Matrix matrix = new Matrix();
+        matrix.setTranslate(-minx + 10, -miny + 10);
+        path.transform(matrix);
+        paths.add(path);
+        
+        path = new Path();
+        path.moveTo(instance.vector[0]-5, instance.vector[1]-5);
+        path.lineTo(instance.vector[0]-5, instance.vector[1]+5);
+        path.lineTo(instance.vector[0]+5, instance.vector[1]+5);
+        path.lineTo(instance.vector[0]+5, instance.vector[1]-5);
+        path.close();
+        path.transform(matrix);
+        paths.add(path);
+        
+        return paths;
+    }
+    
+    @Override
+    public boolean onKeyUp(int keyCode, KeyEvent event) {
+      // TODO Auto-generated method stub
+      if (keyCode == KeyEvent.KEYCODE_BACK) {
+          mRecognizer.save();
+          this.setResult(RESULT_OK);
+          finish();
+          return true;
+      }
+      else
+        return false;
+    }
+    
+    @Override
+    protected void onPause() {
+        // TODO Auto-generated method stub
+        super.onPause();
+        mRecognizer.save();
+    }
+
+    @Override
+    protected void onSaveInstanceState(Bundle outState) {
+        // TODO Auto-generated method stub
+        super.onSaveInstanceState(outState);
+        mRecognizer.save();
+    }
+}
diff --git a/tests/sketch/src/com/android/gesture/recognizer/Classifier.java b/tests/sketch/src/com/android/gesture/recognizer/Classifier.java
new file mode 100755
index 0000000..584e0a5
--- /dev/null
+++ b/tests/sketch/src/com/android/gesture/recognizer/Classifier.java
@@ -0,0 +1,42 @@
+/*
+ * Copyright (C) 2008 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.gesture.recognizer;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+
+/**
+ * The abstract class of Classifier
+ */
+public abstract class Classifier {
+	
+	HashMap<Long, Instance> mInstances = new HashMap<Long, Instance>();
+	
+	public void addInstance(Instance instance) {
+		mInstances.put(instance.id, instance);
+	}
+	
+	public Instance getInstance(long id) {
+	    return mInstances.get(id);
+	}
+	
+	public void removeInstance(long id) {
+	    mInstances.remove(id);
+	}
+	
+	public abstract ArrayList<Prediction> classify(Instance instance);
+}
diff --git a/tests/sketch/src/com/android/gesture/recognizer/Instance.java b/tests/sketch/src/com/android/gesture/recognizer/Instance.java
new file mode 100755
index 0000000..2eaa1c2
--- /dev/null
+++ b/tests/sketch/src/com/android/gesture/recognizer/Instance.java
@@ -0,0 +1,78 @@
+/*
+ * Copyright (C) 2008 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+package com.android.gesture.recognizer;
+
+import android.graphics.PointF;
+
+import com.android.gesture.Gesture;
+
+/**
+ * An instance represents a sample if the label is available or a query if
+ * the label is null.
+ */
+public class Instance {
+
+    private final static float[] targetOrientations = {
+        0, 45, 90, 135, 180, -0, -45, -90, -135, -180
+    };
+    
+    // the feature vector
+    public final float[] vector;
+    // the label can be null
+	public final String	label;
+	// the length of the vector
+	public final float length;
+	// the id of the instance
+	public final long id;
+
+	Instance(long d, float[] v, String l) {
+		id = d;
+		vector = v;
+		label = l;
+		float sum = 0;
+		for (int i = 0; i < vector.length; i++) {
+			sum += vector[i] * vector[i];
+		}
+		length = (float)Math.sqrt(sum);
+	}
+	
+    public static Instance createInstance(Gesture gesture, String label) {
+        float[] pts = RecognitionUtil.resample(gesture, 64);
+        PointF center = RecognitionUtil.computeCentroid(pts);
+        float inductiveOrientation = (float)Math.atan2(pts[1] - center.y, 
+                pts[0] - center.x);
+        inductiveOrientation *= 180 / Math.PI;
+        
+        float minDeviation = Float.MAX_VALUE;
+        for (int i=0; i<targetOrientations.length; i++) {
+            float delta = targetOrientations[i] - inductiveOrientation;
+            if (Math.abs(delta) < Math.abs(minDeviation)) {
+                minDeviation = delta;
+            }
+        }
+        
+        android.graphics.Matrix m = new android.graphics.Matrix();
+        m.setTranslate(-center.x, -center.y);
+        android.graphics.Matrix rotation = new android.graphics.Matrix();
+        rotation.setRotate(minDeviation);
+        m.postConcat(rotation);
+        m.mapPoints(pts);
+
+        return new Instance(gesture.getID(), pts, label);
+    }
+}
diff --git a/tests/sketch/src/com/android/gesture/recognizer/NearestNeighbor.java b/tests/sketch/src/com/android/gesture/recognizer/NearestNeighbor.java
new file mode 100755
index 0000000..cb8a9d3
--- /dev/null
+++ b/tests/sketch/src/com/android/gesture/recognizer/NearestNeighbor.java
@@ -0,0 +1,90 @@
+/*
+ * Copyright (C) 2008 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.gesture.recognizer;
+
+import android.util.Log;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.Iterator;
+import java.util.TreeMap;
+
+public class NearestNeighbor extends Classifier {
+  
+    private static final String LOGTAG = "NearestNeighbor";
+    private static final double variance = 0.25; // std = 0.5
+    
+    public ArrayList<Prediction> classify(Instance instance) {
+    
+        ArrayList<Prediction> list = new ArrayList<Prediction>();
+        Iterator<Instance> it = mInstances.values().iterator();
+        Log.v(LOGTAG, mInstances.size() + " instances found");
+        TreeMap<String, Double> label2score = new TreeMap<String, Double>();
+        while (it.hasNext()) {
+            Instance sample = it.next();
+            double dis = RecognitionUtil.cosineDistance(sample, instance);
+            double weight = Math.exp(-dis*dis/(2 * variance));
+            Log.v(LOGTAG, sample.label + " = " + dis + " weight = " + weight);
+            Double score = label2score.get(sample.label);
+            if (score == null) {
+                score = weight;
+            }
+            else {
+                score += weight;
+            }
+            label2score.put(sample.label, score);
+        }
+        
+        double sum = 0;
+        Iterator it2 = label2score.keySet().iterator();
+        while (it2.hasNext()) {
+            String name = (String)it2.next();
+            double score = label2score.get(name);
+            sum += score;
+            list.add(new Prediction(name, score));
+        }
+        
+        it2 = list.iterator();
+        while (it2.hasNext()) {
+            Prediction name = (Prediction)it2.next();
+            name.score /= sum;
+        }
+    
+        
+        Collections.sort(list, new Comparator<Prediction>() {
+            public int compare(Prediction object1, Prediction object2) {
+                // TODO Auto-generated method stub
+                double score1 = object1.score;
+                double score2 = object2.score;
+                if (score1 > score2)
+                    return -1;
+                else if (score1 < score2)
+                    return 1;
+                else
+                    return 0;
+            }
+        });
+        
+        it2 = list.iterator();
+        while (it2.hasNext()) {
+            Prediction name = (Prediction)it2.next();
+            Log.v(LOGTAG, "prediction [" + name.label + " = " + name.score + "]");
+        }
+        
+        return list;
+    }
+}
diff --git a/tests/sketch/src/com/android/gesture/recognizer/Prediction.java b/tests/sketch/src/com/android/gesture/recognizer/Prediction.java
new file mode 100755
index 0000000..c318754
--- /dev/null
+++ b/tests/sketch/src/com/android/gesture/recognizer/Prediction.java
@@ -0,0 +1,36 @@
+/*
+ * Copyright (C) 2008 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.gesture.recognizer;
+
+/**
+ * 
+ * A recognition result that includes the label and its score
+ */
+public class Prediction {
+	public final String label;
+	public double score;
+	
+	public Prediction(String l, double s) {
+		label = l;
+		score = s;
+	}
+	
+	@Override
+    public String toString() {
+	    return label;
+	}
+}
diff --git a/tests/sketch/src/com/android/gesture/recognizer/RecognitionUtil.java b/tests/sketch/src/com/android/gesture/recognizer/RecognitionUtil.java
new file mode 100755
index 0000000..9146b95
--- /dev/null
+++ b/tests/sketch/src/com/android/gesture/recognizer/RecognitionUtil.java
@@ -0,0 +1,190 @@
+/*
+ * Copyright (C) 2008-2009 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.gesture.recognizer;
+
+import android.graphics.PointF;
+
+import com.android.gesture.Gesture;
+
+import java.util.Iterator;
+
+/**
+ * 
+ * Utilities for recognition.
+ */
+
+public class RecognitionUtil {
+  
+    /**
+     * Re-sample a list of points to a given number
+     * @param stk
+     * @param num
+     * @return
+     */
+    public static float[] resample(Gesture gesture, int num) {
+        final float increment = gesture.getLength()/(num - 1);
+        float[] newstk = new float[num*2];
+        float distanceSoFar = 0;
+        Iterator<PointF> it = gesture.getPoints().iterator();
+        PointF lstPoint = it.next();
+        int index = 0;
+        PointF currentPoint = null;
+        try
+        {
+            newstk[index] = lstPoint.x;
+            index++;
+            newstk[index] = lstPoint.y;
+            index++;
+            while (it.hasNext()) {
+                if (currentPoint == null)
+                    currentPoint = it.next();
+                float deltaX = currentPoint.x - lstPoint.x;
+                float deltaY = currentPoint.y - lstPoint.y;
+                float distance = (float)Math.sqrt(deltaX*deltaX+deltaY*deltaY);
+                if (distanceSoFar+distance >= increment) {
+                    float ratio = (increment - distanceSoFar) / distance;
+                    float nx = lstPoint.x + ratio * deltaX;
+                    float ny = lstPoint.y + ratio * deltaY;
+                    newstk[index] = nx;
+                    index++;
+                    newstk[index] = ny;
+                    index++;
+                    lstPoint = new PointF(nx, ny);
+                    distanceSoFar = 0;
+                }
+                else {
+                    lstPoint = currentPoint;
+                    currentPoint = null;
+                    distanceSoFar += distance;
+                }
+            }
+        }
+        catch(Exception ex) {
+            ex.printStackTrace();
+        }
+    
+        for(int i = index; i < newstk.length -1; i+=2) {
+            newstk[i] = lstPoint.x;
+            newstk[i+1] = lstPoint.y;
+        }
+        return newstk;
+    }
+
+    /**
+     * Calculate the centroid of a list of points
+     * @param points
+     * @return the centroid
+     */
+    public static PointF computeCentroid(float[] points) {
+        float centerX = 0;
+        float centerY = 0;
+        for(int i=0; i<points.length; i++)
+        {
+            centerX += points[i];
+            i++;
+            centerY += points[i];
+        }
+        centerX = 2 * centerX/points.length;
+        centerY = 2 * centerY/points.length;
+        return new PointF(centerX, centerY);
+    }
+
+    /**
+     * calculate the variance-covariance matrix, treat each point as a sample
+     * @param points
+     * @return
+     */
+    public static double[][] computeCoVariance(float[] points) {
+        double[][] array = new double[2][2];
+        array[0][0] = 0;
+        array[0][1] = 0;
+        array[1][0] = 0;
+        array[1][1] = 0;
+        for(int i=0; i<points.length; i++)
+        {
+            float x = points[i];
+            i++;
+            float y = points[i];
+            array[0][0] += x * x;
+            array[0][1] += x * y;
+            array[1][0] = array[0][1];
+            array[1][1] += y * y;
+        }
+        array[0][0] /= (points.length/2);
+        array[0][1] /= (points.length/2);
+        array[1][0] /= (points.length/2);
+        array[1][1] /= (points.length/2);
+        
+        return array;
+    }
+    
+
+    public static float computeTotalLength(float[] points) {
+        float sum = 0;
+        for (int i=0; i<points.length - 4; i+=2) {
+            float dx = points[i+2] - points[i];
+            float dy = points[i+3] - points[i+1];
+            sum += Math.sqrt(dx*dx + dy*dy);
+        }
+        return sum;
+    }
+    
+    public static double computeStraightness(float[] points) {
+        float totalLen = computeTotalLength(points);
+        float dx = points[2] - points[0];
+        float dy = points[3] - points[1];
+        return Math.sqrt(dx*dx + dy*dy) / totalLen;
+    }
+
+    public static double computeStraightness(float[] points, float totalLen) {
+        float dx = points[2] - points[0];
+        float dy = points[3] - points[1];
+        return Math.sqrt(dx*dx + dy*dy) / totalLen;
+    }
+
+    public static double averageEuclidDistance(float[] stk1, float[] stk2) {
+        double distance = 0;
+        for (int i = 0; i < stk1.length; i += 2) {
+            distance += PointF.length(stk1[i] - stk2[i], stk1[i+1] - stk2[i+1]);
+        }
+        return distance/stk1.length;
+    }
+    
+    public static double squaredEuclidDistance(float[] stk1, float[] stk2) {
+        double squaredDistance = 0;
+        for (int i = 0; i < stk1.length; i++) {
+            float difference = stk1[i] - stk2[i];
+            squaredDistance += difference * difference;
+        }
+        return squaredDistance/stk1.length;
+    }
+    
+    /**
+     * Calculate the cosine distance between two instances
+     * @param in1
+     * @param in2
+     * @return the angle between 0 and Math.PI
+     */
+    public static double cosineDistance(Instance in1, Instance in2) {
+        float sum = 0;
+        for (int i = 0; i < in1.vector.length; i++) {
+            sum += in1.vector[i] * in2.vector[i];
+        }
+        return Math.acos(sum / (in1.length * in2.length));
+    }
+
+}
diff --git a/tools/layoutlib/bridge/.gitignore b/tools/layoutlib/bridge/.gitignore
new file mode 100644
index 0000000..efa6632
--- /dev/null
+++ b/tools/layoutlib/bridge/.gitignore
@@ -0,0 +1 @@
+bin/*
\ No newline at end of file