summaryrefslogtreecommitdiffstats
path: root/opengl/java/com
diff options
context:
space:
mode:
authorJack Palevich <jackpal@google.com>2009-06-15 21:03:24 -0700
committerJack Palevich <jackpal@google.com>2009-06-15 21:03:24 -0700
commit91a27ae2fec23b420244258636d2370117e86f5e (patch)
tree5b2b1b47724a16dfb5b0b3f1850ff8e6c5606808 /opengl/java/com
parent7d143b89b714e077f8fd7dbac80945c76bfd9814 (diff)
downloadframeworks_base-91a27ae2fec23b420244258636d2370117e86f5e.zip
frameworks_base-91a27ae2fec23b420244258636d2370117e86f5e.tar.gz
frameworks_base-91a27ae2fec23b420244258636d2370117e86f5e.tar.bz2
Allow pre-Donut apps to use indirect Buffers in GL11 Pointer methods.
Apps targeting Donut and newer will throw an exception. We use a heuristic to determine whether an app is pre-Donut or not: We take the address space's __progname, and use that as the application's package name. For simple applications this is correct.
Diffstat (limited to 'opengl/java/com')
-rw-r--r--opengl/java/com/google/android/gles_jni/GLImpl.java33
1 files changed, 30 insertions, 3 deletions
diff --git a/opengl/java/com/google/android/gles_jni/GLImpl.java b/opengl/java/com/google/android/gles_jni/GLImpl.java
index 4e365ef..36b6ea0 100644
--- a/opengl/java/com/google/android/gles_jni/GLImpl.java
+++ b/opengl/java/com/google/android/gles_jni/GLImpl.java
@@ -19,6 +19,12 @@
package com.google.android.gles_jni;
+import android.app.ActivityThread;
+import android.content.pm.ApplicationInfo;
+import android.content.pm.IPackageManager;
+import android.os.Build;
+import android.util.Log;
+
import java.nio.Buffer;
import javax.microedition.khronos.opengles.GL10;
import javax.microedition.khronos.opengles.GL10Ext;
@@ -43,9 +49,30 @@ public class GLImpl implements GL10, GL10Ext, GL11, GL11Ext, GL11ExtensionPack {
public GLImpl() {
}
- public void glGetPointerv(int pname, java.nio.Buffer[] params) {
- throw new UnsupportedOperationException("glGetPointerv");
- }
+ public void glGetPointerv(int pname, java.nio.Buffer[] params) {
+ throw new UnsupportedOperationException("glGetPointerv");
+ }
+
+ private static boolean allowIndirectBuffers(String appName) {
+ boolean result = false;
+ int version = 0;
+ IPackageManager pm = ActivityThread.getPackageManager();
+ try {
+ ApplicationInfo applicationInfo = pm.getApplicationInfo(appName, 0);
+ if (applicationInfo != null) {
+ version = applicationInfo.targetSdkVersion;
+ }
+ } catch (android.os.RemoteException e) {
+ // ignore
+ }
+ Log.e("OpenGLES", String.format(
+ "Application %s (SDK target %d) called a GL11 Pointer method with an indirect Buffer.",
+ appName, version));
+ if (version <= Build.VERSION_CODES.CUPCAKE) {
+ result = true;
+ }
+ return result;
+ }
// C function void glActiveTexture ( GLenum texture )