summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--core/java/android/bluetooth/BluetoothA2dp.java16
-rw-r--r--core/java/android/bluetooth/IBluetoothA2dp.aidl1
-rw-r--r--core/java/android/server/BluetoothA2dpService.java10
-rw-r--r--core/java/android/server/BluetoothEventLoop.java6
-rw-r--r--core/jni/android_opengl_GLES11.cpp41
-rw-r--r--core/jni/android_opengl_GLES11Ext.cpp79
-rw-r--r--core/jni/com_google_android_gles_jni_GLImpl.cpp101
-rw-r--r--opengl/java/android/opengl/GLES11.java24
-rw-r--r--opengl/java/android/opengl/GLES11Ext.java58
-rw-r--r--opengl/java/android/opengl/GLES20.java27
-rw-r--r--opengl/java/android/opengl/GLLogWrapper.java45
-rw-r--r--opengl/java/com/google/android/gles_jni/GLImpl.java76
-rw-r--r--opengl/libs/GLES_CM/gl.cpp21
-rw-r--r--opengl/tools/glgen/specs/gles11/checks.spec4
-rw-r--r--opengl/tools/glgen/specs/jsr239/glspec-checks4
-rw-r--r--opengl/tools/glgen/src/JniCodeEmitter.java45
-rw-r--r--opengl/tools/glgen/stubs/gles11/GLES11ExtHeader.java-if10
-rw-r--r--opengl/tools/glgen/stubs/gles11/GLES11ExtcHeader.cpp21
-rw-r--r--opengl/tools/glgen/stubs/gles11/GLES11Header.java-if1
-rw-r--r--opengl/tools/glgen/stubs/gles11/GLES11cHeader.cpp20
-rw-r--r--opengl/tools/glgen/stubs/gles11/GLES20Header.java-if1
-rw-r--r--opengl/tools/glgen/stubs/jsr239/GLCHeader.cpp6
-rw-r--r--opengl/tools/glgen/stubs/jsr239/GLImplHeader.java-impl3
-rw-r--r--services/java/com/android/server/ConnectivityService.java28
-rw-r--r--services/java/com/android/server/WifiService.java29
-rw-r--r--services/java/com/android/server/status/StatusBarPolicy.java21
26 files changed, 554 insertions, 144 deletions
diff --git a/core/java/android/bluetooth/BluetoothA2dp.java b/core/java/android/bluetooth/BluetoothA2dp.java
index 7df3637..fda9b81 100644
--- a/core/java/android/bluetooth/BluetoothA2dp.java
+++ b/core/java/android/bluetooth/BluetoothA2dp.java
@@ -199,6 +199,22 @@ public final class BluetoothA2dp {
}
}
+ /** Check if any A2DP sink is in Non Disconnected state
+ * i.e playing, connected, connecting, disconnecting.
+ * @return a unmodifiable set of connected A2DP sinks, or null on error.
+ * @hide
+ */
+ public Set<BluetoothDevice> getNonDisconnectedSinks() {
+ if (DBG) log("getNonDisconnectedSinks()");
+ try {
+ return Collections.unmodifiableSet(
+ new HashSet<BluetoothDevice>(Arrays.asList(mService.getNonDisconnectedSinks())));
+ } catch (RemoteException e) {
+ Log.e(TAG, "", e);
+ return null;
+ }
+ }
+
/** Get the state of an A2DP sink
* @param device Remote BT device.
* @return State code, one of STATE_
diff --git a/core/java/android/bluetooth/IBluetoothA2dp.aidl b/core/java/android/bluetooth/IBluetoothA2dp.aidl
index 002cf4e..168fe3b 100644
--- a/core/java/android/bluetooth/IBluetoothA2dp.aidl
+++ b/core/java/android/bluetooth/IBluetoothA2dp.aidl
@@ -29,6 +29,7 @@ interface IBluetoothA2dp {
boolean suspendSink(in BluetoothDevice device);
boolean resumeSink(in BluetoothDevice device);
BluetoothDevice[] getConnectedSinks(); // change to Set<> once AIDL supports
+ BluetoothDevice[] getNonDisconnectedSinks(); // change to Set<> once AIDL supports
int getSinkState(in BluetoothDevice device);
boolean setSinkPriority(in BluetoothDevice device, int priority);
int getSinkPriority(in BluetoothDevice device);
diff --git a/core/java/android/server/BluetoothA2dpService.java b/core/java/android/server/BluetoothA2dpService.java
index 46de708..f2e132b 100644
--- a/core/java/android/server/BluetoothA2dpService.java
+++ b/core/java/android/server/BluetoothA2dpService.java
@@ -376,6 +376,16 @@ public class BluetoothA2dpService extends IBluetoothA2dp.Stub {
return sinks.toArray(new BluetoothDevice[sinks.size()]);
}
+ public synchronized BluetoothDevice[] getNonDisconnectedSinks() {
+ mContext.enforceCallingOrSelfPermission(BLUETOOTH_PERM, "Need BLUETOOTH permission");
+ Set<BluetoothDevice> sinks = lookupSinksMatchingStates(
+ new int[] {BluetoothA2dp.STATE_CONNECTED,
+ BluetoothA2dp.STATE_PLAYING,
+ BluetoothA2dp.STATE_CONNECTING,
+ BluetoothA2dp.STATE_DISCONNECTING});
+ return sinks.toArray(new BluetoothDevice[sinks.size()]);
+ }
+
public synchronized int getSinkState(BluetoothDevice device) {
mContext.enforceCallingOrSelfPermission(BLUETOOTH_PERM, "Need BLUETOOTH permission");
Integer state = mAudioDevices.get(device);
diff --git a/core/java/android/server/BluetoothEventLoop.java b/core/java/android/server/BluetoothEventLoop.java
index e960491..0d0d245 100644
--- a/core/java/android/server/BluetoothEventLoop.java
+++ b/core/java/android/server/BluetoothEventLoop.java
@@ -546,12 +546,14 @@ class BluetoothEventLoop {
boolean authorized = false;
ParcelUuid uuid = ParcelUuid.fromString(deviceUuid);
+ BluetoothA2dp a2dp = new BluetoothA2dp(mContext);
+
// Bluez sends the UUID of the local service being accessed, _not_ the
// remote service
if (mBluetoothService.isEnabled() &&
(BluetoothUuid.isAudioSource(uuid) || BluetoothUuid.isAvrcpTarget(uuid)
- || BluetoothUuid.isAdvAudioDist(uuid))) {
- BluetoothA2dp a2dp = new BluetoothA2dp(mContext);
+ || BluetoothUuid.isAdvAudioDist(uuid)) &&
+ (a2dp.getNonDisconnectedSinks().size() == 0)) {
BluetoothDevice device = mAdapter.getRemoteDevice(address);
authorized = a2dp.getSinkPriority(device) > BluetoothA2dp.PRIORITY_OFF;
if (authorized) {
diff --git a/core/jni/android_opengl_GLES11.cpp b/core/jni/android_opengl_GLES11.cpp
index 44213ed..0f71b9f 100644
--- a/core/jni/android_opengl_GLES11.cpp
+++ b/core/jni/android_opengl_GLES11.cpp
@@ -24,6 +24,13 @@
#include <GLES/gl.h>
#include <GLES/glext.h>
+/* special calls implemented in Android's GLES wrapper used to more
+ * efficiently bound-check passed arrays */
+extern "C" {
+GL_API void GL_APIENTRY glPointSizePointerOESBounds(GLenum type, GLsizei stride,
+ const GLvoid *ptr, GLsizei count);
+}
+
static int initialized = 0;
static jclass nioAccessClass;
@@ -122,6 +129,19 @@ releasePointer(JNIEnv *_env, jarray array, void *data, jboolean commit)
commit ? 0 : JNI_ABORT);
}
+static void *
+getDirectBufferPointer(JNIEnv *_env, jobject buffer) {
+ char* buf = (char*) _env->GetDirectBufferAddress(buffer);
+ if (buf) {
+ jint position = _env->GetIntField(buffer, positionID);
+ jint elementSizeShift = _env->GetIntField(buffer, elementSizeShiftID);
+ buf += position << elementSizeShift;
+ } else {
+ _env->ThrowNew(IAEClass, "Must use a native order direct Buffer");
+ }
+ return (void*) buf;
+}
+
// --------------------------------------------------------------------------
/* void glBindBuffer ( GLenum target, GLuint buffer ) */
@@ -2035,21 +2055,24 @@ exit:
/* 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) {
+android_glPointSizePointerOESBounds__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);
- glPointSizePointerOES(
+ if (pointer_buf) {
+ pointer = (GLvoid *) getDirectBufferPointer(_env, pointer_buf);
+ if ( ! pointer ) {
+ return;
+ }
+ }
+ glPointSizePointerOESBounds(
(GLenum)type,
(GLsizei)stride,
- (GLvoid *)pointer
+ (GLvoid *)pointer,
+ (GLsizei)remaining
);
- if (_array) {
- releasePointer(_env, _array, pointer, JNI_FALSE);
- }
}
/* void glTexCoordPointer ( GLint size, GLenum type, GLsizei stride, GLint offset ) */
@@ -2454,7 +2477,7 @@ static JNINativeMethod methods[] = {
{"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 },
+{"glPointSizePointerOESBounds", "(IILjava/nio/Buffer;I)V", (void *) android_glPointSizePointerOESBounds__IILjava_nio_Buffer_2I },
{"glTexCoordPointer", "(IIII)V", (void *) android_glTexCoordPointer__IIII },
{"glTexEnvi", "(III)V", (void *) android_glTexEnvi__III },
{"glTexEnviv", "(II[II)V", (void *) android_glTexEnviv__II_3II },
diff --git a/core/jni/android_opengl_GLES11Ext.cpp b/core/jni/android_opengl_GLES11Ext.cpp
index 6f3495c..942a0d9 100644
--- a/core/jni/android_opengl_GLES11Ext.cpp
+++ b/core/jni/android_opengl_GLES11Ext.cpp
@@ -24,6 +24,15 @@
#include <GLES/gl.h>
#include <GLES/glext.h>
+/* special calls implemented in Android's GLES wrapper used to more
+ * efficiently bound-check passed arrays */
+extern "C" {
+GL_API void GL_APIENTRY glMatrixIndexPointerOESBounds(GLint size, GLenum type, GLsizei stride,
+ const GLvoid *ptr, GLsizei count);
+GL_API void GL_APIENTRY glWeightPointerOESBounds(GLint size, GLenum type, GLsizei stride,
+ const GLvoid *ptr, GLsizei count);
+}
+
static int initialized = 0;
static jclass nioAccessClass;
@@ -122,6 +131,18 @@ releasePointer(JNIEnv *_env, jarray array, void *data, jboolean commit)
commit ? 0 : JNI_ABORT);
}
+static void *
+getDirectBufferPointer(JNIEnv *_env, jobject buffer) {
+ char* buf = (char*) _env->GetDirectBufferAddress(buffer);
+ if (buf) {
+ jint position = _env->GetIntField(buffer, positionID);
+ jint elementSizeShift = _env->GetIntField(buffer, elementSizeShiftID);
+ buf += position << elementSizeShift;
+ } else {
+ _env->ThrowNew(IAEClass, "Must use a native order direct Buffer");
+ }
+ return (void*) buf;
+}
// --------------------------------------------------------------------------
/* void glBlendEquationSeparateOES ( GLenum modeRGB, GLenum modeAlpha ) */
@@ -1771,32 +1792,62 @@ android_glGenerateMipmapOES__I
static void
android_glCurrentPaletteMatrixOES__I
(JNIEnv *_env, jobject _this, jint matrixpaletteindex) {
- _env->ThrowNew(UOEClass,
- "glCurrentPaletteMatrixOES");
+ glCurrentPaletteMatrixOES(
+ (GLuint)matrixpaletteindex
+ );
}
/* void glLoadPaletteFromModelViewMatrixOES ( void ) */
static void
android_glLoadPaletteFromModelViewMatrixOES__
(JNIEnv *_env, jobject _this) {
- _env->ThrowNew(UOEClass,
- "glLoadPaletteFromModelViewMatrixOES");
+ 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");
+android_glMatrixIndexPointerOESBounds__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;
+
+ if (pointer_buf) {
+ pointer = (GLvoid *) getDirectBufferPointer(_env, pointer_buf);
+ if ( ! pointer ) {
+ return;
+ }
+ }
+ glMatrixIndexPointerOESBounds(
+ (GLint)size,
+ (GLenum)type,
+ (GLsizei)stride,
+ (GLvoid *)pointer,
+ (GLsizei)remaining
+ );
}
/* 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");
+android_glWeightPointerOESBounds__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;
+
+ if (pointer_buf) {
+ pointer = (GLvoid *) getDirectBufferPointer(_env, pointer_buf);
+ if ( ! pointer ) {
+ return;
+ }
+ }
+ glWeightPointerOESBounds(
+ (GLint)size,
+ (GLenum)type,
+ (GLsizei)stride,
+ (GLvoid *)pointer,
+ (GLsizei)remaining
+ );
}
/* void glDepthRangefOES ( GLclampf zNear, GLclampf zFar ) */
@@ -2426,8 +2477,8 @@ static JNINativeMethod methods[] = {
{"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 },
+{"glMatrixIndexPointerOESBounds", "(IIILjava/nio/Buffer;I)V", (void *) android_glMatrixIndexPointerOESBounds__IIILjava_nio_Buffer_2I },
+{"glWeightPointerOESBounds", "(IIILjava/nio/Buffer;I)V", (void *) android_glWeightPointerOESBounds__IIILjava_nio_Buffer_2I },
{"glDepthRangefOES", "(FF)V", (void *) android_glDepthRangefOES__FF },
{"glFrustumfOES", "(FFFFFF)V", (void *) android_glFrustumfOES__FFFFFF },
{"glOrthofOES", "(FFFFFF)V", (void *) android_glOrthofOES__FFFFFF },
diff --git a/core/jni/com_google_android_gles_jni_GLImpl.cpp b/core/jni/com_google_android_gles_jni_GLImpl.cpp
index 3e0aea5..93e4d2b 100644
--- a/core/jni/com_google_android_gles_jni_GLImpl.cpp
+++ b/core/jni/com_google_android_gles_jni_GLImpl.cpp
@@ -35,6 +35,12 @@ GL_API void GL_APIENTRY glTexCoordPointerBounds(GLint size, GLenum type,
GLsizei stride, const GLvoid *pointer, GLsizei count);
GL_API void GL_APIENTRY glVertexPointerBounds(GLint size, GLenum type,
GLsizei stride, const GLvoid *pointer, GLsizei count);
+GL_API void GL_APIENTRY glPointSizePointerOESBounds(GLenum type,
+ GLsizei stride, const GLvoid *pointer, GLsizei count);
+GL_API void GL_APIENTRY glMatrixIndexPointerOESBounds(GLint size, GLenum type,
+ GLsizei stride, const GLvoid *pointer, GLsizei count);
+GL_API void GL_APIENTRY glWeightPointerOESBounds(GLint size, GLenum type,
+ GLsizei stride, const GLvoid *pointer, GLsizei count);
}
static int initialized = 0;
@@ -5391,21 +5397,24 @@ exit:
/* 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) {
+android_glPointSizePointerOESBounds__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);
- glPointSizePointerOES(
+ if (pointer_buf) {
+ pointer = (GLvoid *) getDirectBufferPointer(_env, pointer_buf);
+ if ( ! pointer ) {
+ return;
+ }
+ }
+ glPointSizePointerOESBounds(
(GLenum)type,
(GLsizei)stride,
- (GLvoid *)pointer
+ (GLvoid *)pointer,
+ (GLsizei)remaining
);
- if (_array) {
- releasePointer(_env, _array, pointer, JNI_FALSE);
- }
}
/* void glTexCoordPointer ( GLint size, GLenum type, GLsizei stride, GLint offset ) */
@@ -5754,8 +5763,9 @@ android_glVertexPointer__IIII
static void
android_glCurrentPaletteMatrixOES__I
(JNIEnv *_env, jobject _this, jint matrixpaletteindex) {
- _env->ThrowNew(UOEClass,
- "glCurrentPaletteMatrixOES");
+ glCurrentPaletteMatrixOES(
+ (GLuint)matrixpaletteindex
+ );
}
/* void glDrawTexfOES ( GLfloat x, GLfloat y, GLfloat z, GLfloat width, GLfloat height ) */
@@ -6050,40 +6060,77 @@ exit:
static void
android_glLoadPaletteFromModelViewMatrixOES__
(JNIEnv *_env, jobject _this) {
- _env->ThrowNew(UOEClass,
- "glLoadPaletteFromModelViewMatrixOES");
+ 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");
+android_glMatrixIndexPointerOESBounds__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;
+
+ if (pointer_buf) {
+ pointer = (GLvoid *) getDirectBufferPointer(_env, pointer_buf);
+ if ( ! pointer ) {
+ return;
+ }
+ }
+ glMatrixIndexPointerOESBounds(
+ (GLint)size,
+ (GLenum)type,
+ (GLsizei)stride,
+ (GLvoid *)pointer,
+ (GLsizei)remaining
+ );
}
/* void glMatrixIndexPointerOES ( GLint size, GLenum type, GLsizei stride, GLint offset ) */
static void
android_glMatrixIndexPointerOES__IIII
(JNIEnv *_env, jobject _this, jint size, jint type, jint stride, jint offset) {
- _env->ThrowNew(UOEClass,
- "glMatrixIndexPointerOES");
+ glMatrixIndexPointerOES(
+ (GLint)size,
+ (GLenum)type,
+ (GLsizei)stride,
+ (const GLvoid *)offset
+ );
}
/* 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");
+android_glWeightPointerOESBounds__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;
+
+ if (pointer_buf) {
+ pointer = (GLvoid *) getDirectBufferPointer(_env, pointer_buf);
+ if ( ! pointer ) {
+ return;
+ }
+ }
+ glWeightPointerOESBounds(
+ (GLint)size,
+ (GLenum)type,
+ (GLsizei)stride,
+ (GLvoid *)pointer,
+ (GLsizei)remaining
+ );
}
/* void glWeightPointerOES ( GLint size, GLenum type, GLsizei stride, GLint offset ) */
static void
android_glWeightPointerOES__IIII
(JNIEnv *_env, jobject _this, jint size, jint type, jint stride, jint offset) {
- _env->ThrowNew(UOEClass,
- "glWeightPointerOES");
+ glWeightPointerOES(
+ (GLint)size,
+ (GLenum)type,
+ (GLsizei)stride,
+ (const GLvoid *)offset
+ );
}
/* void glBindFramebufferOES ( GLint target, GLint framebuffer ) */
@@ -6584,7 +6631,7 @@ static JNINativeMethod methods[] = {
{"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 },
+{"glPointSizePointerOESBounds", "(IILjava/nio/Buffer;I)V", (void *) android_glPointSizePointerOESBounds__IILjava_nio_Buffer_2I },
{"glTexCoordPointer", "(IIII)V", (void *) android_glTexCoordPointer__IIII },
{"glTexEnvi", "(III)V", (void *) android_glTexEnvi__III },
{"glTexEnviv", "(II[II)V", (void *) android_glTexEnviv__II_3II },
@@ -6611,9 +6658,9 @@ static JNINativeMethod methods[] = {
{"glDrawTexxvOES", "([II)V", (void *) android_glDrawTexxvOES___3II },
{"glDrawTexxvOES", "(Ljava/nio/IntBuffer;)V", (void *) android_glDrawTexxvOES__Ljava_nio_IntBuffer_2 },
{"glLoadPaletteFromModelViewMatrixOES", "()V", (void *) android_glLoadPaletteFromModelViewMatrixOES__ },
-{"glMatrixIndexPointerOES", "(IIILjava/nio/Buffer;)V", (void *) android_glMatrixIndexPointerOES__IIILjava_nio_Buffer_2 },
+{"glMatrixIndexPointerOESBounds", "(IIILjava/nio/Buffer;I)V", (void *) android_glMatrixIndexPointerOESBounds__IIILjava_nio_Buffer_2I },
{"glMatrixIndexPointerOES", "(IIII)V", (void *) android_glMatrixIndexPointerOES__IIII },
-{"glWeightPointerOES", "(IIILjava/nio/Buffer;)V", (void *) android_glWeightPointerOES__IIILjava_nio_Buffer_2 },
+{"glWeightPointerOESBounds", "(IIILjava/nio/Buffer;I)V", (void *) android_glWeightPointerOESBounds__IIILjava_nio_Buffer_2I },
{"glWeightPointerOES", "(IIII)V", (void *) android_glWeightPointerOES__IIII },
{"glBindFramebufferOES", "(II)V", (void *) android_glBindFramebufferOES__II },
{"glBindRenderbufferOES", "(II)V", (void *) android_glBindRenderbufferOES__II },
diff --git a/opengl/java/android/opengl/GLES11.java b/opengl/java/android/opengl/GLES11.java
index 3399af7..1ca179b 100644
--- a/opengl/java/android/opengl/GLES11.java
+++ b/opengl/java/android/opengl/GLES11.java
@@ -150,6 +150,7 @@ public class GLES11 extends GLES10 {
_nativeClassInit();
}
+ private static Buffer _pointSizePointerOES;
// C function void glBindBuffer ( GLenum target, GLuint buffer )
public static native void glBindBuffer(
@@ -596,12 +597,31 @@ public class GLES11 extends GLES10 {
// C function void glPointSizePointerOES ( GLenum type, GLsizei stride, const GLvoid *pointer )
- public static native void glPointSizePointerOES(
+ private static native void glPointSizePointerOESBounds(
int type,
int stride,
- java.nio.Buffer pointer
+ java.nio.Buffer pointer,
+ int remaining
);
+ public static void glPointSizePointerOES(
+ int type,
+ int stride,
+ java.nio.Buffer pointer
+ ) {
+ glPointSizePointerOESBounds(
+ type,
+ stride,
+ pointer,
+ pointer.remaining()
+ );
+ if (((type == GL_FLOAT) ||
+ (type == GL_FIXED)) &&
+ (stride >= 0)) {
+ _pointSizePointerOES = pointer;
+ }
+ }
+
// C function void glTexCoordPointer ( GLint size, GLenum type, GLsizei stride, GLint offset )
public static native void glTexCoordPointer(
diff --git a/opengl/java/android/opengl/GLES11Ext.java b/opengl/java/android/opengl/GLES11Ext.java
index 4384e9e..25d5467 100644
--- a/opengl/java/android/opengl/GLES11Ext.java
+++ b/opengl/java/android/opengl/GLES11Ext.java
@@ -19,6 +19,8 @@
package android.opengl;
+import java.nio.Buffer;
+
public class GLES11Ext {
public static final int GL_BLEND_EQUATION_RGB_OES = 0x8009;
public static final int GL_BLEND_EQUATION_ALPHA_OES = 0x883D;
@@ -129,6 +131,12 @@ public class GLES11Ext {
_nativeClassInit();
}
+ private static final int GL_BYTE = GLES10.GL_BYTE;
+ private static final int GL_FIXED = GLES10.GL_FIXED;
+ private static final int GL_FLOAT = GLES10.GL_FLOAT;
+ private static final int GL_SHORT = GLES10.GL_SHORT;
+
+ private static Buffer _matrixIndexPointerOES;
// C function void glBlendEquationSeparateOES ( GLenum modeRGB, GLenum modeAlpha )
public static native void glBlendEquationSeparateOES(
@@ -866,22 +874,64 @@ public class GLES11Ext {
// C function void glMatrixIndexPointerOES ( GLint size, GLenum type, GLsizei stride, const GLvoid *pointer )
- public static native void glMatrixIndexPointerOES(
+ private static native void glMatrixIndexPointerOESBounds(
int size,
int type,
int stride,
- java.nio.Buffer pointer
+ java.nio.Buffer pointer,
+ int remaining
);
+ public static void glMatrixIndexPointerOES(
+ int size,
+ int type,
+ int stride,
+ java.nio.Buffer pointer
+ ) {
+ glMatrixIndexPointerOESBounds(
+ size,
+ type,
+ stride,
+ pointer,
+ pointer.remaining()
+ );
+ if (((size == 2) ||
+ (size == 3) ||
+ (size == 4)) &&
+ ((type == GL_FLOAT) ||
+ (type == GL_BYTE) ||
+ (type == GL_SHORT) ||
+ (type == GL_FIXED)) &&
+ (stride >= 0)) {
+ _matrixIndexPointerOES = pointer;
+ }
+ }
+
// C function void glWeightPointerOES ( GLint size, GLenum type, GLsizei stride, const GLvoid *pointer )
- public static native void glWeightPointerOES(
+ private static native void glWeightPointerOESBounds(
int size,
int type,
int stride,
- java.nio.Buffer pointer
+ java.nio.Buffer pointer,
+ int remaining
);
+ public static void glWeightPointerOES(
+ int size,
+ int type,
+ int stride,
+ java.nio.Buffer pointer
+ ) {
+ glWeightPointerOESBounds(
+ size,
+ type,
+ stride,
+ pointer,
+ pointer.remaining()
+ );
+ }
+
// C function void glDepthRangefOES ( GLclampf zNear, GLclampf zFar )
public static native void glDepthRangefOES(
diff --git a/opengl/java/android/opengl/GLES20.java b/opengl/java/android/opengl/GLES20.java
index 01e82de..b8aac0e 100644
--- a/opengl/java/android/opengl/GLES20.java
+++ b/opengl/java/android/opengl/GLES20.java
@@ -2,16 +2,16 @@
**
** 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
+** 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.
*/
@@ -19,8 +19,7 @@
package android.opengl;
-/** OpenGL ES 2.0. This class exposes the core OpenGL ES 2.0 APIs.
- * All the methods are static.
+/** OpenGL ES 2.0
*/
public class GLES20 {
public static final int GL_ACTIVE_TEXTURE = 0x84E0;
@@ -49,7 +48,7 @@ public class GLES20 {
public static final int GL_SRC_ALPHA_SATURATE = 0x0308;
public static final int GL_FUNC_ADD = 0x8006;
public static final int GL_BLEND_EQUATION = 0x8009;
- public static final int GL_BLEND_EQUATION_RGB = 0x8009;
+ public static final int GL_BLEND_EQUATION_RGB = 0x8009; /* same as BLEND_EQUATION */
public static final int GL_BLEND_EQUATION_ALPHA = 0x883D;
public static final int GL_FUNC_SUBTRACT = 0x800A;
public static final int GL_FUNC_REVERSE_SUBTRACT = 0x800B;
@@ -328,7 +327,7 @@ public class GLES20 {
native private static void _nativeClassInit();
static {
- _nativeClassInit();
+ _nativeClassInit();
}
// C function void glActiveTexture ( GLenum texture )
@@ -980,7 +979,7 @@ public class GLES20 {
);
// C function void glGetProgramInfoLog( GLuint program, GLsizei maxLength, GLsizei * length,
- // GLchar * infoLog);
+ // GLchar * infoLog);
public static native String glGetProgramInfoLog(
int program
@@ -1020,7 +1019,7 @@ public class GLES20 {
);
// C function void glGetShaderInfoLog( GLuint shader, GLsizei maxLength, GLsizei * length,
- // GLchar * infoLog);
+ // GLchar * infoLog);
public static native String glGetShaderInfoLog(
int shader
diff --git a/opengl/java/android/opengl/GLLogWrapper.java b/opengl/java/android/opengl/GLLogWrapper.java
index 97a6424..6e97f67 100644
--- a/opengl/java/android/opengl/GLLogWrapper.java
+++ b/opengl/java/android/opengl/GLLogWrapper.java
@@ -932,83 +932,83 @@ class GLLogWrapper extends GLWrapperBase {
boolean convertWholeBuffer = (byteCount < 0);
if (input instanceof ByteBuffer) {
ByteBuffer input2 = (ByteBuffer) input;
+ int position = input2.position();
if (convertWholeBuffer) {
- byteCount = input2.limit();
+ byteCount = input2.limit() - position;
}
result = ByteBuffer.allocate(byteCount).order(input2.order());
- int position = input2.position();
for (int i = 0; i < byteCount; i++) {
result.put(input2.get());
}
input2.position(position);
} else if (input instanceof CharBuffer) {
CharBuffer input2 = (CharBuffer) input;
+ int position = input2.position();
if (convertWholeBuffer) {
- byteCount = input2.limit() * 2;
+ byteCount = (input2.limit() - position) * 2;
}
result = ByteBuffer.allocate(byteCount).order(input2.order());
CharBuffer result2 = result.asCharBuffer();
- int position = input2.position();
for (int i = 0; i < byteCount / 2; i++) {
result2.put(input2.get());
}
input2.position(position);
} else if (input instanceof ShortBuffer) {
ShortBuffer input2 = (ShortBuffer) input;
+ int position = input2.position();
if (convertWholeBuffer) {
- byteCount = input2.limit() * 2;
+ byteCount = (input2.limit() - position)* 2;
}
result = ByteBuffer.allocate(byteCount).order(input2.order());
ShortBuffer result2 = result.asShortBuffer();
- int position = input2.position();
for (int i = 0; i < byteCount / 2; i++) {
result2.put(input2.get());
}
input2.position(position);
} else if (input instanceof IntBuffer) {
IntBuffer input2 = (IntBuffer) input;
+ int position = input2.position();
if (convertWholeBuffer) {
- byteCount = input2.limit() * 4;
+ byteCount = (input2.limit() - position) * 4;
}
result = ByteBuffer.allocate(byteCount).order(input2.order());
IntBuffer result2 = result.asIntBuffer();
- int position = input2.position();
for (int i = 0; i < byteCount / 4; i++) {
result2.put(input2.get());
}
input2.position(position);
} else if (input instanceof FloatBuffer) {
FloatBuffer input2 = (FloatBuffer) input;
+ int position = input2.position();
if (convertWholeBuffer) {
- byteCount = input2.limit() * 4;
+ byteCount = (input2.limit() - position) * 4;
}
result = ByteBuffer.allocate(byteCount).order(input2.order());
FloatBuffer result2 = result.asFloatBuffer();
- int position = input2.position();
for (int i = 0; i < byteCount / 4; i++) {
result2.put(input2.get());
}
input2.position(position);
} else if (input instanceof DoubleBuffer) {
DoubleBuffer input2 = (DoubleBuffer) input;
+ int position = input2.position();
if (convertWholeBuffer) {
- byteCount = input2.limit() * 8;
+ byteCount = (input2.limit() - position) * 8;
}
result = ByteBuffer.allocate(byteCount).order(input2.order());
DoubleBuffer result2 = result.asDoubleBuffer();
- int position = input2.position();
for (int i = 0; i < byteCount / 8; i++) {
result2.put(input2.get());
}
input2.position(position);
} else if (input instanceof LongBuffer) {
LongBuffer input2 = (LongBuffer) input;
+ int position = input2.position();
if (convertWholeBuffer) {
- byteCount = input2.limit() * 8;
+ byteCount = (input2.limit() - position) * 8;
}
result = ByteBuffer.allocate(byteCount).order(input2.order());
LongBuffer result2 = result.asLongBuffer();
- int position = input2.position();
for (int i = 0; i < byteCount / 8; i++) {
result2.put(input2.get());
}
@@ -1064,8 +1064,8 @@ class GLLogWrapper extends GLWrapperBase {
}
builder.append(" ");
builder.append(name + ":{");
- if (pointer == null) {
- builder.append("undefined");
+ if (pointer == null || pointer.mTempByteBuffer == null ) {
+ builder.append("undefined }");
return;
}
if (pointer.mStride < 0) {
@@ -3464,6 +3464,9 @@ class GLLogWrapper extends GLWrapperBase {
public Buffer mPointer;
public ByteBuffer mTempByteBuffer; // Only valid during glDrawXXX calls
+ public PointerInfo() {
+ }
+
public PointerInfo(int size, int type, int stride, Buffer pointer) {
mSize = size;
mType = type;
@@ -3493,7 +3496,7 @@ class GLLogWrapper extends GLWrapperBase {
}
public void bindByteBuffer() {
- mTempByteBuffer = toByteBuffer(-1, mPointer);
+ mTempByteBuffer = mPointer == null ? null : toByteBuffer(-1, mPointer);
}
public void unbindByteBuffer() {
@@ -3505,10 +3508,10 @@ class GLLogWrapper extends GLWrapperBase {
private boolean mLogArgumentNames;
private int mArgCount;
- private PointerInfo mColorPointer;
- private PointerInfo mNormalPointer;
- private PointerInfo mTexCoordPointer;
- private PointerInfo mVertexPointer;
+ private PointerInfo mColorPointer = new PointerInfo();
+ private PointerInfo mNormalPointer = new PointerInfo();
+ private PointerInfo mTexCoordPointer = new PointerInfo();
+ private PointerInfo mVertexPointer = new PointerInfo();
boolean mColorArrayEnabled;
boolean mNormalArrayEnabled;
diff --git a/opengl/java/com/google/android/gles_jni/GLImpl.java b/opengl/java/com/google/android/gles_jni/GLImpl.java
index 36b6ea0..01a9c91 100644
--- a/opengl/java/com/google/android/gles_jni/GLImpl.java
+++ b/opengl/java/com/google/android/gles_jni/GLImpl.java
@@ -45,6 +45,9 @@ public class GLImpl implements GL10, GL10Ext, GL11, GL11Ext, GL11ExtensionPack {
Buffer _normalPointer = null;
Buffer _texCoordPointer = null;
Buffer _vertexPointer = null;
+ Buffer _pointSizePointerOES = null;
+ Buffer _matrixIndexPointerOES = null;
+ Buffer _weightPointerOES = null;
public GLImpl() {
}
@@ -1582,12 +1585,31 @@ public class GLImpl implements GL10, GL10Ext, GL11, GL11Ext, GL11ExtensionPack {
// C function void glPointSizePointerOES ( GLenum type, GLsizei stride, const GLvoid *pointer )
- public native void glPointSizePointerOES(
+ private native void glPointSizePointerOESBounds(
int type,
int stride,
- java.nio.Buffer pointer
+ java.nio.Buffer pointer,
+ int remaining
);
+ public void glPointSizePointerOES(
+ int type,
+ int stride,
+ java.nio.Buffer pointer
+ ) {
+ glPointSizePointerOESBounds(
+ type,
+ stride,
+ pointer,
+ pointer.remaining()
+ );
+ if (((type == GL_FLOAT) ||
+ (type == GL_FIXED)) &&
+ (stride >= 0)) {
+ _pointSizePointerOES = pointer;
+ }
+ }
+
// C function void glTexCoordPointer ( GLint size, GLenum type, GLsizei stride, GLint offset )
public native void glTexCoordPointer(
@@ -1795,13 +1817,39 @@ public class GLImpl implements GL10, GL10Ext, GL11, GL11Ext, GL11ExtensionPack {
// C function void glMatrixIndexPointerOES ( GLint size, GLenum type, GLsizei stride, const GLvoid *pointer )
- public native void glMatrixIndexPointerOES(
+ private native void glMatrixIndexPointerOESBounds(
int size,
int type,
int stride,
- java.nio.Buffer pointer
+ java.nio.Buffer pointer,
+ int remaining
);
+ public void glMatrixIndexPointerOES(
+ int size,
+ int type,
+ int stride,
+ java.nio.Buffer pointer
+ ) {
+ glMatrixIndexPointerOESBounds(
+ size,
+ type,
+ stride,
+ pointer,
+ pointer.remaining()
+ );
+ if (((size == 2) ||
+ (size == 3) ||
+ (size == 4)) &&
+ ((type == GL_FLOAT) ||
+ (type == GL_BYTE) ||
+ (type == GL_SHORT) ||
+ (type == GL_FIXED)) &&
+ (stride >= 0)) {
+ _matrixIndexPointerOES = pointer;
+ }
+ }
+
// C function void glMatrixIndexPointerOES ( GLint size, GLenum type, GLsizei stride, GLint offset )
public native void glMatrixIndexPointerOES(
@@ -1813,13 +1861,29 @@ public class GLImpl implements GL10, GL10Ext, GL11, GL11Ext, GL11ExtensionPack {
// C function void glWeightPointerOES ( GLint size, GLenum type, GLsizei stride, const GLvoid *pointer )
- public native void glWeightPointerOES(
+ private native void glWeightPointerOESBounds(
int size,
int type,
int stride,
- java.nio.Buffer pointer
+ java.nio.Buffer pointer,
+ int remaining
);
+ public void glWeightPointerOES(
+ int size,
+ int type,
+ int stride,
+ java.nio.Buffer pointer
+ ) {
+ glWeightPointerOESBounds(
+ size,
+ type,
+ stride,
+ pointer,
+ pointer.remaining()
+ );
+ }
+
// C function void glWeightPointerOES ( GLint size, GLenum type, GLsizei stride, GLint offset )
public native void glWeightPointerOES(
diff --git a/opengl/libs/GLES_CM/gl.cpp b/opengl/libs/GLES_CM/gl.cpp
index 0c9352e..e7757a8 100644
--- a/opengl/libs/GLES_CM/gl.cpp
+++ b/opengl/libs/GLES_CM/gl.cpp
@@ -47,6 +47,12 @@ GL_API void GL_APIENTRY glTexCoordPointerBounds(GLint size, GLenum type,
GLsizei stride, const GLvoid *pointer, GLsizei count);
GL_API void GL_APIENTRY glVertexPointerBounds(GLint size, GLenum type,
GLsizei stride, const GLvoid *pointer, GLsizei count);
+GL_API void GL_APIENTRY glPointSizePointerOESBounds(GLenum type,
+ GLsizei stride, const GLvoid *pointer, GLsizei count);
+GL_API void GL_APIENTRY glMatrixIndexPointerOESBounds(GLint size, GLenum type,
+ GLsizei stride, const GLvoid *pointer, GLsizei count);
+GL_API void GL_APIENTRY glWeightPointerOESBounds(GLint size, GLenum type,
+ GLsizei stride, const GLvoid *pointer, GLsizei count);
}
void glColorPointerBounds(GLint size, GLenum type, GLsizei stride,
@@ -66,6 +72,21 @@ void glVertexPointerBounds(GLint size, GLenum type,
glVertexPointer(size, type, stride, pointer);
}
+void GL_APIENTRY glPointSizePointerOESBounds(GLenum type,
+ GLsizei stride, const GLvoid *pointer, GLsizei count) {
+ glPointSizePointerOES(type, stride, pointer);
+}
+
+GL_API void GL_APIENTRY glMatrixIndexPointerOESBounds(GLint size, GLenum type,
+ GLsizei stride, const GLvoid *pointer, GLsizei count) {
+ glMatrixIndexPointerOES(size, type, stride, pointer);
+}
+
+GL_API void GL_APIENTRY glWeightPointerOESBounds(GLint size, GLenum type,
+ GLsizei stride, const GLvoid *pointer, GLsizei count) {
+ glWeightPointerOES(size, type, stride, pointer);
+}
+
// ----------------------------------------------------------------------------
// Actual GL entry-points
// ----------------------------------------------------------------------------
diff --git a/opengl/tools/glgen/specs/gles11/checks.spec b/opengl/tools/glgen/specs/gles11/checks.spec
index 1468ab9..f917128 100644
--- a/opengl/tools/glgen/specs/gles11/checks.spec
+++ b/opengl/tools/glgen/specs/gles11/checks.spec
@@ -37,7 +37,6 @@ glBlendEquation unsupported
glBlendEquationSeparate unsupported
glBlendFuncSeparate unsupported
glCheckFramebufferStatusOES unsupported return 0
-glCurrentPaletteMatrixOES unsupported
glDeleteFramebuffersOES unsupported
glDeleteRenderbuffersOES unsupported
glFramebufferRenderbufferOES unsupported
@@ -52,11 +51,8 @@ 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/specs/jsr239/glspec-checks b/opengl/tools/glgen/specs/jsr239/glspec-checks
index 063cdc7..c28e403 100644
--- a/opengl/tools/glgen/specs/jsr239/glspec-checks
+++ b/opengl/tools/glgen/specs/jsr239/glspec-checks
@@ -35,7 +35,6 @@ glBlendEquation unsupported
glBlendEquationSeparate unsupported
glBlendFuncSeparate unsupported
glCheckFramebufferStatusOES unsupported return 0
-glCurrentPaletteMatrixOES unsupported
glDeleteFramebuffersOES unsupported
glDeleteRenderbuffersOES unsupported
glFramebufferRenderbufferOES unsupported
@@ -50,11 +49,8 @@ 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/src/JniCodeEmitter.java b/opengl/tools/glgen/src/JniCodeEmitter.java
index 4c1814a..e79170a 100644
--- a/opengl/tools/glgen/src/JniCodeEmitter.java
+++ b/opengl/tools/glgen/src/JniCodeEmitter.java
@@ -119,10 +119,15 @@ public class JniCodeEmitter {
emitFunction(jfunc, out, false, false);
}
+ boolean isPointerFunc(JFunc jfunc) {
+ String name = jfunc.getName();
+ return (name.endsWith("Pointer") || name.endsWith("PointerOES"))
+ && jfunc.getCFunc().hasPointerArg();
+ }
+
void emitFunctionCall(JFunc jfunc, PrintStream out, String iii, boolean grabArray) {
boolean isVoid = jfunc.getType().isVoid();
- boolean isPointerFunc = jfunc.getName().endsWith("Pointer") &&
- jfunc.getCFunc().hasPointerArg();
+ boolean isPointerFunc = isPointerFunc(jfunc);
if (!isVoid) {
out.println(iii +
@@ -406,9 +411,7 @@ public class JniCodeEmitter {
* if !interfaceDecl: public <returntype> func(args) { body }
*/
void emitFunction(JFunc jfunc, PrintStream out, boolean nativeDecl, boolean interfaceDecl) {
- boolean isPointerFunc =
- jfunc.getName().endsWith("Pointer") &&
- jfunc.getCFunc().hasPointerArg();
+ boolean isPointerFunc = isPointerFunc(jfunc);
if (!nativeDecl && !interfaceDecl && !isPointerFunc) {
// If it's not a pointer function, we've already emitted it
@@ -510,6 +513,34 @@ public class JniCodeEmitter {
out.println(iii + " (stride >= 0)) {");
out.println(iii + indent + "_vertexPointer = pointer;");
out.println(iii + "}");
+ } else if (fname.equals("glPointSizePointerOES")) {
+ out.println(iii + "if (((type == GL_FLOAT) ||");
+ out.println(iii + " (type == GL_FIXED)) &&");
+ out.println(iii + " (stride >= 0)) {");
+ out.println(iii + indent + "_pointSizePointerOES = pointer;");
+ out.println(iii + "}");
+ } else if (fname.equals("glMatrixIndexPointerOES")) {
+ out.println(iii + "if (((size == 2) ||");
+ out.println(iii + " (size == 3) ||");
+ out.println(iii + " (size == 4)) &&");
+ out.println(iii + " ((type == GL_FLOAT) ||");
+ out.println(iii + " (type == GL_BYTE) ||");
+ out.println(iii + " (type == GL_SHORT) ||");
+ out.println(iii + " (type == GL_FIXED)) &&");
+ out.println(iii + " (stride >= 0)) {");
+ out.println(iii + indent + "_matrixIndexPointerOES = pointer;");
+ out.println(iii + "}");
+ } else if (fname.equals("glWeightPointer")) {
+ out.println(iii + "if (((size == 2) ||");
+ out.println(iii + " (size == 3) ||");
+ out.println(iii + " (size == 4)) &&");
+ out.println(iii + " ((type == GL_FLOAT) ||");
+ out.println(iii + " (type == GL_BYTE) ||");
+ out.println(iii + " (type == GL_SHORT) ||");
+ out.println(iii + " (type == GL_FIXED)) &&");
+ out.println(iii + " (stride >= 0)) {");
+ out.println(iii + indent + "_weightPointerOES = pointer;");
+ out.println(iii + "}");
}
}
@@ -609,9 +640,9 @@ public class JniCodeEmitter {
//
String outName = "android_" + jfunc.getName();
- boolean isPointerFunc = outName.endsWith("Pointer") &&
- jfunc.getCFunc().hasPointerArg();
+ boolean isPointerFunc = isPointerFunc(jfunc);
boolean isVBOPointerFunc = (outName.endsWith("Pointer") ||
+ outName.endsWith("PointerOES") ||
outName.endsWith("DrawElements")) &&
!jfunc.getCFunc().hasPointerArg();
if (isPointerFunc) {
diff --git a/opengl/tools/glgen/stubs/gles11/GLES11ExtHeader.java-if b/opengl/tools/glgen/stubs/gles11/GLES11ExtHeader.java-if
index 428ccee..c5e34cd 100644
--- a/opengl/tools/glgen/stubs/gles11/GLES11ExtHeader.java-if
+++ b/opengl/tools/glgen/stubs/gles11/GLES11ExtHeader.java-if
@@ -18,6 +18,8 @@
package android.opengl;
+import java.nio.Buffer;
+
public class GLES11Ext {
public static final int GL_BLEND_EQUATION_RGB_OES = 0x8009;
public static final int GL_BLEND_EQUATION_ALPHA_OES = 0x883D;
@@ -127,4 +129,10 @@ public class GLES11Ext {
static {
_nativeClassInit();
}
- \ No newline at end of file
+
+ private static final int GL_BYTE = GLES10.GL_BYTE;
+ private static final int GL_FIXED = GLES10.GL_FIXED;
+ private static final int GL_FLOAT = GLES10.GL_FLOAT;
+ private static final int GL_SHORT = GLES10.GL_SHORT;
+
+ private static Buffer _matrixIndexPointerOES; \ No newline at end of file
diff --git a/opengl/tools/glgen/stubs/gles11/GLES11ExtcHeader.cpp b/opengl/tools/glgen/stubs/gles11/GLES11ExtcHeader.cpp
index 294d1ce..2548b32 100644
--- a/opengl/tools/glgen/stubs/gles11/GLES11ExtcHeader.cpp
+++ b/opengl/tools/glgen/stubs/gles11/GLES11ExtcHeader.cpp
@@ -23,6 +23,15 @@
#include <GLES/gl.h>
#include <GLES/glext.h>
+/* special calls implemented in Android's GLES wrapper used to more
+ * efficiently bound-check passed arrays */
+extern "C" {
+GL_API void GL_APIENTRY glMatrixIndexPointerOESBounds(GLint size, GLenum type, GLsizei stride,
+ const GLvoid *ptr, GLsizei count);
+GL_API void GL_APIENTRY glWeightPointerOESBounds(GLint size, GLenum type, GLsizei stride,
+ const GLvoid *ptr, GLsizei count);
+}
+
static int initialized = 0;
static jclass nioAccessClass;
@@ -121,5 +130,17 @@ releasePointer(JNIEnv *_env, jarray array, void *data, jboolean commit)
commit ? 0 : JNI_ABORT);
}
+static void *
+getDirectBufferPointer(JNIEnv *_env, jobject buffer) {
+ char* buf = (char*) _env->GetDirectBufferAddress(buffer);
+ if (buf) {
+ jint position = _env->GetIntField(buffer, positionID);
+ jint elementSizeShift = _env->GetIntField(buffer, elementSizeShiftID);
+ buf += position << elementSizeShift;
+ } else {
+ _env->ThrowNew(IAEClass, "Must use a native order direct Buffer");
+ }
+ return (void*) buf;
+}
// --------------------------------------------------------------------------
diff --git a/opengl/tools/glgen/stubs/gles11/GLES11Header.java-if b/opengl/tools/glgen/stubs/gles11/GLES11Header.java-if
index 26f466f..81572d2 100644
--- a/opengl/tools/glgen/stubs/gles11/GLES11Header.java-if
+++ b/opengl/tools/glgen/stubs/gles11/GLES11Header.java-if
@@ -149,3 +149,4 @@ public class GLES11 extends GLES10 {
_nativeClassInit();
}
+ private static Buffer _pointSizePointerOES;
diff --git a/opengl/tools/glgen/stubs/gles11/GLES11cHeader.cpp b/opengl/tools/glgen/stubs/gles11/GLES11cHeader.cpp
index 294d1ce..4c297f7 100644
--- a/opengl/tools/glgen/stubs/gles11/GLES11cHeader.cpp
+++ b/opengl/tools/glgen/stubs/gles11/GLES11cHeader.cpp
@@ -23,6 +23,13 @@
#include <GLES/gl.h>
#include <GLES/glext.h>
+/* special calls implemented in Android's GLES wrapper used to more
+ * efficiently bound-check passed arrays */
+extern "C" {
+GL_API void GL_APIENTRY glPointSizePointerOESBounds(GLenum type, GLsizei stride,
+ const GLvoid *ptr, GLsizei count);
+}
+
static int initialized = 0;
static jclass nioAccessClass;
@@ -121,5 +128,18 @@ releasePointer(JNIEnv *_env, jarray array, void *data, jboolean commit)
commit ? 0 : JNI_ABORT);
}
+static void *
+getDirectBufferPointer(JNIEnv *_env, jobject buffer) {
+ char* buf = (char*) _env->GetDirectBufferAddress(buffer);
+ if (buf) {
+ jint position = _env->GetIntField(buffer, positionID);
+ jint elementSizeShift = _env->GetIntField(buffer, elementSizeShiftID);
+ buf += position << elementSizeShift;
+ } else {
+ _env->ThrowNew(IAEClass, "Must use a native order direct Buffer");
+ }
+ return (void*) buf;
+}
+
// --------------------------------------------------------------------------
diff --git a/opengl/tools/glgen/stubs/gles11/GLES20Header.java-if b/opengl/tools/glgen/stubs/gles11/GLES20Header.java-if
index 7504509..b615e0a 100644
--- a/opengl/tools/glgen/stubs/gles11/GLES20Header.java-if
+++ b/opengl/tools/glgen/stubs/gles11/GLES20Header.java-if
@@ -19,7 +19,6 @@
package android.opengl;
/** OpenGL ES 2.0
- * @hide
*/
public class GLES20 {
public static final int GL_ACTIVE_TEXTURE = 0x84E0;
diff --git a/opengl/tools/glgen/stubs/jsr239/GLCHeader.cpp b/opengl/tools/glgen/stubs/jsr239/GLCHeader.cpp
index 4494643..b3d1c6c 100644
--- a/opengl/tools/glgen/stubs/jsr239/GLCHeader.cpp
+++ b/opengl/tools/glgen/stubs/jsr239/GLCHeader.cpp
@@ -34,6 +34,12 @@ GL_API void GL_APIENTRY glTexCoordPointerBounds(GLint size, GLenum type,
GLsizei stride, const GLvoid *pointer, GLsizei count);
GL_API void GL_APIENTRY glVertexPointerBounds(GLint size, GLenum type,
GLsizei stride, const GLvoid *pointer, GLsizei count);
+GL_API void GL_APIENTRY glPointSizePointerOESBounds(GLenum type,
+ GLsizei stride, const GLvoid *pointer, GLsizei count);
+GL_API void GL_APIENTRY glMatrixIndexPointerOESBounds(GLint size, GLenum type,
+ GLsizei stride, const GLvoid *pointer, GLsizei count);
+GL_API void GL_APIENTRY glWeightPointerOESBounds(GLint size, GLenum type,
+ GLsizei stride, const GLvoid *pointer, GLsizei count);
}
static int initialized = 0;
diff --git a/opengl/tools/glgen/stubs/jsr239/GLImplHeader.java-impl b/opengl/tools/glgen/stubs/jsr239/GLImplHeader.java-impl
index fe60c5d..76fea3f 100644
--- a/opengl/tools/glgen/stubs/jsr239/GLImplHeader.java-impl
+++ b/opengl/tools/glgen/stubs/jsr239/GLImplHeader.java-impl
@@ -44,6 +44,9 @@ public class GLImpl implements GL10, GL10Ext, GL11, GL11Ext, GL11ExtensionPack {
Buffer _normalPointer = null;
Buffer _texCoordPointer = null;
Buffer _vertexPointer = null;
+ Buffer _pointSizePointerOES = null;
+ Buffer _matrixIndexPointerOES = null;
+ Buffer _weightPointerOES = null;
public GLImpl() {
}
diff --git a/services/java/com/android/server/ConnectivityService.java b/services/java/com/android/server/ConnectivityService.java
index 509554b..9980be7 100644
--- a/services/java/com/android/server/ConnectivityService.java
+++ b/services/java/com/android/server/ConnectivityService.java
@@ -100,7 +100,7 @@ public class ConnectivityService extends IConnectivityManager.Stub {
private boolean mSystemReady;
private ArrayList<Intent> mDeferredBroadcasts;
- private class NetworkAttributes {
+ private static class NetworkAttributes {
/**
* Class for holding settings read from resources.
*/
@@ -108,12 +108,14 @@ public class ConnectivityService extends IConnectivityManager.Stub {
public int mType;
public int mRadio;
public int mPriority;
+ public NetworkInfo.State mLastState;
public NetworkAttributes(String init) {
String fragments[] = init.split(",");
mName = fragments[0].toLowerCase();
mType = Integer.parseInt(fragments[1]);
mRadio = Integer.parseInt(fragments[2]);
mPriority = Integer.parseInt(fragments[3]);
+ mLastState = NetworkInfo.State.UNKNOWN;
}
public boolean isDefault() {
return (mType == mRadio);
@@ -122,7 +124,7 @@ public class ConnectivityService extends IConnectivityManager.Stub {
NetworkAttributes[] mNetAttributes;
int mNetworksDefined;
- private class RadioAttributes {
+ private static class RadioAttributes {
public int mSimultaneity;
public int mType;
public RadioAttributes(String init) {
@@ -1218,9 +1220,22 @@ public class ConnectivityService extends IConnectivityManager.Stub {
switch (msg.what) {
case NetworkStateTracker.EVENT_STATE_CHANGED:
info = (NetworkInfo) msg.obj;
+ int type = info.getType();
+ NetworkInfo.State state = info.getState();
+ if(mNetAttributes[type].mLastState == state) {
+ if (DBG) {
+ // TODO - remove this after we validate the dropping doesn't break anything
+ Log.d(TAG, "Dropping ConnectivityChange for " +
+ info.getTypeName() +": " +
+ state + "/" + info.getDetailedState());
+ }
+ return;
+ }
+ mNetAttributes[type].mLastState = state;
+
if (DBG) Log.d(TAG, "ConnectivityChange for " +
info.getTypeName() + ": " +
- info.getState() + "/" + info.getDetailedState());
+ state + "/" + info.getDetailedState());
// Connectivity state changed:
// [31-13] Reserved for future use
@@ -1238,10 +1253,9 @@ public class ConnectivityService extends IConnectivityManager.Stub {
if (info.getDetailedState() ==
NetworkInfo.DetailedState.FAILED) {
handleConnectionFailure(info);
- } else if (info.getState() ==
- NetworkInfo.State.DISCONNECTED) {
+ } else if (state == NetworkInfo.State.DISCONNECTED) {
handleDisconnect(info);
- } else if (info.getState() == NetworkInfo.State.SUSPENDED) {
+ } else if (state == NetworkInfo.State.SUSPENDED) {
// TODO: need to think this over.
// the logic here is, handle SUSPENDED the same as
// DISCONNECTED. The only difference being we are
@@ -1250,7 +1264,7 @@ public class ConnectivityService extends IConnectivityManager.Stub {
// opportunity to handle DISCONNECTED and SUSPENDED
// differently, or not.
handleDisconnect(info);
- } else if (info.getState() == NetworkInfo.State.CONNECTED) {
+ } else if (state == NetworkInfo.State.CONNECTED) {
handleConnect(info);
}
break;
diff --git a/services/java/com/android/server/WifiService.java b/services/java/com/android/server/WifiService.java
index 0ea832b..987a24e 100644
--- a/services/java/com/android/server/WifiService.java
+++ b/services/java/com/android/server/WifiService.java
@@ -25,6 +25,7 @@ import static android.net.wifi.WifiManager.WIFI_STATE_UNKNOWN;
import android.app.AlarmManager;
import android.app.PendingIntent;
import android.bluetooth.BluetoothA2dp;
+import android.bluetooth.BluetoothDevice;
import android.content.BroadcastReceiver;
import android.content.ContentResolver;
import android.content.Context;
@@ -62,6 +63,7 @@ import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
+import java.util.Set;
import java.util.regex.Pattern;
import java.io.FileDescriptor;
import java.io.PrintWriter;
@@ -109,7 +111,7 @@ public class WifiService extends IWifiManager.Stub {
private int mMulticastDisabled;
private final IBatteryStats mBatteryStats;
-
+
/**
* See {@link Settings.Gservices#WIFI_IDLE_MS}. This is the default value if a
* Settings.Gservices value is not present. This timeout value is chosen as
@@ -162,7 +164,7 @@ public class WifiService extends IWifiManager.Stub {
* Last UID that asked to enable WIFI.
*/
private int mLastEnableUid = Process.myUid();
-
+
/**
* Number of allowed radio frequency channels in various regulatory domains.
* This list is sufficient for 802.11b/g networks (2.4GHz range).
@@ -177,7 +179,7 @@ public class WifiService extends IWifiManager.Stub {
mWifiStateTracker = tracker;
mWifiStateTracker.enableRssiPolling(true);
mBatteryStats = BatteryStatsService.getService();
-
+
mScanResultCache = new LinkedHashMap<String, ScanResult>(
SCAN_RESULT_CACHE_SIZE, 0.75f, true) {
/*
@@ -396,7 +398,7 @@ public class WifiService extends IWifiManager.Stub {
} finally {
Binder.restoreCallingIdentity(ident);
}
-
+
// Update state
mWifiState = wifiState;
@@ -1380,11 +1382,16 @@ public class WifiService extends IWifiManager.Stub {
}
mPluggedType = pluggedType;
} else if (action.equals(BluetoothA2dp.ACTION_SINK_STATE_CHANGED)) {
- boolean isBluetoothPlaying =
- intent.getIntExtra(
- BluetoothA2dp.EXTRA_SINK_STATE,
- BluetoothA2dp.STATE_DISCONNECTED) == BluetoothA2dp.STATE_PLAYING;
+ BluetoothA2dp a2dp = new BluetoothA2dp(mContext);
+ Set<BluetoothDevice> sinks = a2dp.getConnectedSinks();
+ boolean isBluetoothPlaying = false;
+ for (BluetoothDevice sink : sinks) {
+ if (a2dp.getSinkState(sink) == BluetoothA2dp.STATE_PLAYING) {
+ isBluetoothPlaying = true;
+ }
+ }
mWifiStateTracker.setBluetoothScanMode(isBluetoothPlaying);
+
} else {
return;
}
@@ -1396,7 +1403,7 @@ public class WifiService extends IWifiManager.Stub {
* Determines whether the Wi-Fi chipset should stay awake or be put to
* sleep. Looks at the setting for the sleep policy and the current
* conditions.
- *
+ *
* @see #shouldDeviceStayAwake(int, int)
*/
private boolean shouldWifiStayAwake(int stayAwakeConditions, int pluggedType) {
@@ -1415,7 +1422,7 @@ public class WifiService extends IWifiManager.Stub {
return shouldDeviceStayAwake(stayAwakeConditions, pluggedType);
}
}
-
+
/**
* Determine whether the bit value corresponding to {@code pluggedType} is set in
* the bit string {@code stayAwakeConditions}. Because a {@code pluggedType} value
@@ -1509,7 +1516,7 @@ public class WifiService extends IWifiManager.Stub {
intentFilter.addAction(BluetoothA2dp.ACTION_SINK_STATE_CHANGED);
mContext.registerReceiver(mReceiver, intentFilter);
}
-
+
private boolean isAirplaneSensitive() {
String airplaneModeRadios = Settings.System.getString(mContext.getContentResolver(),
Settings.System.AIRPLANE_MODE_RADIOS);
diff --git a/services/java/com/android/server/status/StatusBarPolicy.java b/services/java/com/android/server/status/StatusBarPolicy.java
index 2b9d18f..bee0930 100644
--- a/services/java/com/android/server/status/StatusBarPolicy.java
+++ b/services/java/com/android/server/status/StatusBarPolicy.java
@@ -283,7 +283,7 @@ public class StatusBarPolicy {
private IBinder mBluetoothIcon;
private IconData mBluetoothData;
private int mBluetoothHeadsetState;
- private int mBluetoothA2dpState;
+ private boolean mBluetoothA2dpConnected;
private int mBluetoothPbapState;
private boolean mBluetoothEnabled;
@@ -455,7 +455,7 @@ public class StatusBarPolicy {
} else {
mBluetoothEnabled = false;
}
- mBluetoothA2dpState = BluetoothA2dp.STATE_DISCONNECTED;
+ mBluetoothA2dpConnected = false;
mBluetoothHeadsetState = BluetoothHeadset.STATE_DISCONNECTED;
mBluetoothPbapState = BluetoothPbap.STATE_DISCONNECTED;
mService.setIconVisibility(mBluetoothIcon, mBluetoothEnabled);
@@ -636,12 +636,12 @@ public class StatusBarPolicy {
int flags = WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE
| WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE
| WindowManager.LayoutParams.FLAG_DIM_BEHIND;
-
+
if (!mContext.getResources().getBoolean(
com.android.internal.R.bool.config_sf_slowBlur)) {
flags |= WindowManager.LayoutParams.FLAG_BLUR_BEHIND;
}
-
+
WindowManager.LayoutParams lp = new WindowManager.LayoutParams(
ViewGroup.LayoutParams.WRAP_CONTENT,
ViewGroup.LayoutParams.WRAP_CONTENT,
@@ -1083,7 +1083,6 @@ public class StatusBarPolicy {
private final void updateBluetooth(Intent intent) {
int iconId = com.android.internal.R.drawable.stat_sys_data_bluetooth;
-
String action = intent.getAction();
if (action.equals(BluetoothAdapter.ACTION_STATE_CHANGED)) {
int state = intent.getIntExtra(BluetoothAdapter.EXTRA_STATE, BluetoothAdapter.ERROR);
@@ -1092,8 +1091,12 @@ public class StatusBarPolicy {
mBluetoothHeadsetState = intent.getIntExtra(BluetoothHeadset.EXTRA_STATE,
BluetoothHeadset.STATE_ERROR);
} else if (action.equals(BluetoothA2dp.ACTION_SINK_STATE_CHANGED)) {
- mBluetoothA2dpState = intent.getIntExtra(BluetoothA2dp.EXTRA_SINK_STATE,
- BluetoothA2dp.STATE_DISCONNECTED);
+ BluetoothA2dp a2dp = new BluetoothA2dp(mContext);
+ if (a2dp.getConnectedSinks().size() != 0) {
+ mBluetoothA2dpConnected = true;
+ } else {
+ mBluetoothA2dpConnected = false;
+ }
} else if (action.equals(BluetoothPbap.PBAP_STATE_CHANGED_ACTION)) {
mBluetoothPbapState = intent.getIntExtra(BluetoothPbap.PBAP_STATE,
BluetoothPbap.STATE_DISCONNECTED);
@@ -1101,9 +1104,7 @@ public class StatusBarPolicy {
return;
}
- if (mBluetoothHeadsetState == BluetoothHeadset.STATE_CONNECTED ||
- mBluetoothA2dpState == BluetoothA2dp.STATE_CONNECTED ||
- mBluetoothA2dpState == BluetoothA2dp.STATE_PLAYING ||
+ if (mBluetoothHeadsetState == BluetoothHeadset.STATE_CONNECTED || mBluetoothA2dpConnected ||
mBluetoothPbapState == BluetoothPbap.STATE_CONNECTED) {
iconId = com.android.internal.R.drawable.stat_sys_data_bluetooth_connected;
}