summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--api/current.xml237
-rw-r--r--core/java/android/app/ActivityThread.java12
-rw-r--r--core/java/android/app/SearchManager.java31
-rw-r--r--core/java/android/backup/BackupDataOutput.java44
-rw-r--r--core/java/android/backup/FileBackupHelper.java68
-rw-r--r--core/java/android/backup/SharedPreferencesBackupHelper.java40
-rwxr-xr-xcore/java/android/inputmethodservice/KeyboardView.java30
-rw-r--r--core/java/android/util/DisplayMetrics.java12
-rw-r--r--core/java/android/view/MotionEvent.java4
-rw-r--r--core/java/com/android/internal/backup/IBackupTransport.aidl48
-rw-r--r--core/jni/Android.mk3
-rw-r--r--core/jni/AndroidRuntime.cpp2
-rw-r--r--core/jni/android_backup_FileBackupHelper.cpp79
-rw-r--r--core/jni/android_opengl_GLES10.cpp99
-rw-r--r--core/jni/android_opengl_GLES10Ext.cpp6
-rw-r--r--core/jni/android_opengl_GLES11.cpp6
-rw-r--r--core/jni/android_opengl_GLES11Ext.cpp6
-rw-r--r--core/jni/android_os_ParcelFileDescriptor.cpp31
-rw-r--r--core/jni/android_server_BluetoothA2dpService.cpp22
-rw-r--r--core/jni/com_google_android_gles_jni_GLImpl.cpp99
-rw-r--r--docs/html/guide/topics/graphics/2d-graphics.jd15
-rw-r--r--docs/html/guide/topics/resources/resources-i18n.jd19
-rw-r--r--include/ui/Camera.h2
-rw-r--r--include/ui/ICameraClient.h19
-rw-r--r--libs/ui/Camera.cpp12
-rw-r--r--libs/ui/ICameraClient.cpp43
-rw-r--r--opengl/java/android/opengl/GLES10.java54
-rw-r--r--opengl/java/com/google/android/gles_jni/GLImpl.java54
-rw-r--r--opengl/tools/glgen/specs/gles11/checks.spec2
-rw-r--r--opengl/tools/glgen/specs/jsr239/glspec-checks2
-rw-r--r--opengl/tools/glgen/src/JniCodeEmitter.java67
-rw-r--r--opengl/tools/glgen/stubs/gles11/GLES10ExtcHeader.cpp6
-rw-r--r--opengl/tools/glgen/stubs/gles11/GLES10cHeader.cpp15
-rw-r--r--opengl/tools/glgen/stubs/gles11/GLES11ExtcHeader.cpp6
-rw-r--r--opengl/tools/glgen/stubs/gles11/GLES11cHeader.cpp6
-rw-r--r--opengl/tools/glgen/stubs/jsr239/GLCHeader.cpp15
-rw-r--r--services/java/com/android/server/BackupManagerService.java28
-rw-r--r--tests/backup/Android.mk4
-rw-r--r--tests/backup/AndroidManifest.xml2
-rw-r--r--tests/backup/src/com/android/backuptest/BackupTestActivity.java44
40 files changed, 1050 insertions, 244 deletions
diff --git a/api/current.xml b/api/current.xml
index 4086836..5325bf6 100644
--- a/api/current.xml
+++ b/api/current.xml
@@ -23815,6 +23815,219 @@
</field>
</class>
</package>
+<package name="android.backup"
+>
+<class name="BackupDataOutput"
+ extends="java.lang.Object"
+ abstract="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<constructor name="BackupDataOutput"
+ type="android.backup.BackupDataOutput"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="context" type="android.content.Context">
+</parameter>
+<parameter name="fd" type="java.io.FileDescriptor">
+</parameter>
+</constructor>
+<method name="close"
+ return="void"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
+<method name="flush"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
+<method name="write"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="buffer" type="byte[]">
+</parameter>
+</method>
+<method name="write"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="oneByte" type="int">
+</parameter>
+</method>
+<method name="write"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="buffer" type="byte[]">
+</parameter>
+<parameter name="offset" type="int">
+</parameter>
+<parameter name="count" type="int">
+</parameter>
+</method>
+<method name="writeKey"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="key" type="java.lang.String">
+</parameter>
+</method>
+<method name="writeOperation"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="op" type="int">
+</parameter>
+</method>
+<field name="OP_DELETE"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="2"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="OP_UPDATE"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="1"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+</class>
+<class name="FileBackupHelper"
+ extends="java.lang.Object"
+ abstract="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<constructor name="FileBackupHelper"
+ type="android.backup.FileBackupHelper"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</constructor>
+<method name="performBackup"
+ return="void"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="context" type="android.content.Context">
+</parameter>
+<parameter name="oldSnapshot" type="android.os.ParcelFileDescriptor">
+</parameter>
+<parameter name="newSnapshot" type="android.os.ParcelFileDescriptor">
+</parameter>
+<parameter name="data" type="android.backup.BackupDataOutput">
+</parameter>
+<parameter name="files" type="java.lang.String[]">
+</parameter>
+</method>
+</class>
+<class name="SharedPreferencesBackupHelper"
+ extends="java.lang.Object"
+ abstract="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<constructor name="SharedPreferencesBackupHelper"
+ type="android.backup.SharedPreferencesBackupHelper"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</constructor>
+<method name="performBackup"
+ return="void"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="context" type="android.content.Context">
+</parameter>
+<parameter name="oldSnapshot" type="android.os.ParcelFileDescriptor">
+</parameter>
+<parameter name="newSnapshot" type="android.os.ParcelFileDescriptor">
+</parameter>
+<parameter name="data" type="android.backup.BackupDataOutput">
+</parameter>
+<parameter name="prefGroups" type="java.lang.String[]">
+</parameter>
+</method>
+</class>
+</package>
<package name="android.content"
>
<class name="ActivityNotFoundException"
@@ -63082,6 +63295,30 @@
visibility="public"
>
</method>
+<method name="invalidateAllKeys"
+ return="void"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
+<method name="invalidateKey"
+ return="void"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="keyIndex" type="int">
+</parameter>
+</method>
<method name="isPreviewEnabled"
return="boolean"
abstract="false"
diff --git a/core/java/android/app/ActivityThread.java b/core/java/android/app/ActivityThread.java
index dfa3fa8..2fc476e 100644
--- a/core/java/android/app/ActivityThread.java
+++ b/core/java/android/app/ActivityThread.java
@@ -316,18 +316,16 @@ public final class ActivityThread {
float appScale = -1.0f;
if (ai.supportsDensities != null) {
- // TODO: precompute this in DisplayMetrics
- float systemDensityDpi = metrics.density * DisplayMetrics.DEFAULT_DENSITY;
int minDiff = Integer.MAX_VALUE;
for (int density : ai.supportsDensities) {
- int tmpDiff = (int) Math.abs(systemDensityDpi - density);
+ int tmpDiff = (int) Math.abs(DisplayMetrics.DEVICE_DENSITY - density);
if (tmpDiff == 0) {
appScale = 1.0f;
break;
}
// prefer higher density (appScale>1.0), unless that's only option.
if (tmpDiff < minDiff && appScale < 1.0f) {
- appScale = systemDensityDpi / density;
+ appScale = DisplayMetrics.DEVICE_DENSITY / density;
minDiff = tmpDiff;
}
}
@@ -3482,6 +3480,8 @@ public final class ActivityThread {
}
mConfiguration.updateFrom(config);
DisplayMetrics dm = getDisplayMetricsLocked(true);
+ DisplayMetrics appDm = new DisplayMetrics();
+ appDm.setTo(dm);
// set it for java, this also affects newly created Resources
if (config.locale != null) {
@@ -3501,7 +3501,9 @@ public final class ActivityThread {
WeakReference<Resources> v = it.next();
Resources r = v.get();
if (r != null) {
- r.updateConfiguration(config, dm);
+ // keep the original density based on application cale.
+ appDm.density = r.getDisplayMetrics().density;
+ r.updateConfiguration(config, appDm);
//Log.i(TAG, "Updated app resources " + v.getKey()
// + " " + r + ": " + r.getConfiguration());
} else {
diff --git a/core/java/android/app/SearchManager.java b/core/java/android/app/SearchManager.java
index 2d2f98a..90de40d 100644
--- a/core/java/android/app/SearchManager.java
+++ b/core/java/android/app/SearchManager.java
@@ -1182,6 +1182,17 @@ public class SearchManager
* Typically you'll use this with a URI matcher.
*/
public final static String SUGGEST_URI_PATH_QUERY = "search_suggest_query";
+
+ /**
+ * Uri path for shortcut validation. This is the path that the search manager will use when
+ * querying your content provider to refresh a shortcutted suggestion result and to check if it
+ * is still valid. When asked, a source may return an up to date result, or no result. No
+ * result indicates the shortcut refers to a no longer valid sugggestion.
+ *
+ * @see #SUGGEST_COLUMN_SHORTCUT_ID
+ * @hide
+ */
+ public final static String SUGGEST_URI_PATH_SHORTCUT = "search_suggest_shortcut";
/**
* MIME type for suggestions data. You'll use this in your suggestions content provider
@@ -1303,6 +1314,26 @@ public class SearchManager
public final static String SUGGEST_COLUMN_QUERY = "suggest_intent_query";
/**
+ * Column name for suggestions cursor. <i>Optional.</i> This column is used to indicate whether
+ * a search suggestion should be stored as a shortcut, and whether it should be validated. If
+ * missing, the result will be stored as a shortcut and never validated. If set to
+ * {@link #SUGGEST_NEVER_MAKE_SHORTCUT}, the result will not be stored as a shortcut.
+ * Otherwise, the shortcut id will be used to check back for validation via
+ * {@link #SUGGEST_URI_PATH_SHORTCUT}.
+ *
+ * @hide Pending API council approval.
+ */
+ public final static String SUGGEST_COLUMN_SHORTCUT_ID = "suggest_shortcut_id";
+
+ /**
+ * Column value for suggestion column {@link #SUGGEST_COLUMN_SHORTCUT_ID} when a suggestion
+ * should not be stored as a shortcut in global search.
+ *
+ * @hide Pending API council approval.
+ */
+ public final static String SUGGEST_NEVER_MAKE_SHORTCUT = "_-1";
+
+ /**
* If a suggestion has this value in {@link #SUGGEST_COLUMN_INTENT_ACTION},
* the search dialog will switch to a different suggestion source when the
* suggestion is clicked.
diff --git a/core/java/android/backup/BackupDataOutput.java b/core/java/android/backup/BackupDataOutput.java
new file mode 100644
index 0000000..6c47f7e
--- /dev/null
+++ b/core/java/android/backup/BackupDataOutput.java
@@ -0,0 +1,44 @@
+/*
+ * 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.backup;
+
+import android.content.Context;
+
+import java.io.FileDescriptor;
+
+public class BackupDataOutput {
+ /* package */ FileDescriptor fd;
+
+ public static final int OP_UPDATE = 1;
+ public static final int OP_DELETE = 2;
+
+ public BackupDataOutput(Context context, FileDescriptor fd) {
+ this.fd = fd;
+ }
+
+ public void close() {
+ // do we close the fd?
+ }
+ public native void flush();
+ public native void write(byte[] buffer);
+ public native void write(int oneByte);
+ public native void write(byte[] buffer, int offset, int count);
+
+ public native void writeOperation(int op);
+ public native void writeKey(String key);
+}
+
diff --git a/core/java/android/backup/FileBackupHelper.java b/core/java/android/backup/FileBackupHelper.java
new file mode 100644
index 0000000..3b2122c
--- /dev/null
+++ b/core/java/android/backup/FileBackupHelper.java
@@ -0,0 +1,68 @@
+/*
+ * 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.backup;
+
+import android.content.Context;
+import android.os.ParcelFileDescriptor;
+
+import java.io.FileDescriptor;
+
+public class FileBackupHelper {
+ /**
+ * Based on oldSnapshot, determine which of the files from the application's data directory
+ * need to be backed up, write them to the data stream, and fill in newSnapshot with the
+ * state as it exists now.
+ */
+ public static void performBackup(Context context,
+ ParcelFileDescriptor oldSnapshot, ParcelFileDescriptor newSnapshot,
+ BackupDataOutput data, String[] files) {
+ String basePath = context.getFilesDir().getAbsolutePath();
+ performBackup_checked(basePath, oldSnapshot, newSnapshot, data, files);
+ }
+
+ /**
+ * Check the parameters so the native code doens't have to throw all the exceptions
+ * since it's easier to do that from java.
+ */
+ static void performBackup_checked(String basePath,
+ ParcelFileDescriptor oldSnapshot, ParcelFileDescriptor newSnapshot,
+ BackupDataOutput data, String[] files) {
+ if (newSnapshot == null) {
+ throw new NullPointerException("newSnapshot==null");
+ }
+ if (data == null) {
+ throw new NullPointerException("data==null");
+ }
+ if (data.fd == null) {
+ throw new NullPointerException("data.fd==null");
+ }
+ if (files == null) {
+ throw new NullPointerException("files==null");
+ }
+
+ int err = performBackup_native(basePath, oldSnapshot.getFileDescriptor(),
+ newSnapshot.getFileDescriptor(), data.fd, files);
+
+ if (err != 0) {
+ throw new RuntimeException("Backup failed"); // TODO: more here
+ }
+ }
+
+ native private static int performBackup_native(String basePath,
+ FileDescriptor oldSnapshot, FileDescriptor newSnapshot,
+ FileDescriptor data, String[] files);
+}
diff --git a/core/java/android/backup/SharedPreferencesBackupHelper.java b/core/java/android/backup/SharedPreferencesBackupHelper.java
new file mode 100644
index 0000000..e839bb4
--- /dev/null
+++ b/core/java/android/backup/SharedPreferencesBackupHelper.java
@@ -0,0 +1,40 @@
+/*
+ * 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.backup;
+
+import android.content.Context;
+import android.os.ParcelFileDescriptor;
+
+import java.io.FileDescriptor;
+
+public class SharedPreferencesBackupHelper {
+ public static void performBackup(Context context,
+ ParcelFileDescriptor oldSnapshot, ParcelFileDescriptor newSnapshot,
+ BackupDataOutput data, String[] prefGroups) {
+ String basePath = "/xxx"; //context.getPreferencesDir();
+
+ // make filenames for the prefGroups
+ final int N = prefGroups.length;
+ String[] files = new String[N];
+ for (int i=0; i<N; i++) {
+ files[i] = prefGroups[i] + ".xml";
+ }
+
+ FileBackupHelper.performBackup_checked(basePath, oldSnapshot, newSnapshot, data, files);
+ }
+}
+
diff --git a/core/java/android/inputmethodservice/KeyboardView.java b/core/java/android/inputmethodservice/KeyboardView.java
index 65c9893..8b474d5 100755
--- a/core/java/android/inputmethodservice/KeyboardView.java
+++ b/core/java/android/inputmethodservice/KeyboardView.java
@@ -407,7 +407,7 @@ public class KeyboardView extends View implements View.OnClickListener {
// Release buffer, just in case the new keyboard has a different size.
// It will be reallocated on the next draw.
mBuffer = null;
- invalidateAll();
+ invalidateAllKeys();
computeProximityThreshold(keyboard);
mMiniKeyboardCache.clear(); // Not really necessary to do every time, but will free up views
}
@@ -431,7 +431,7 @@ public class KeyboardView extends View implements View.OnClickListener {
if (mKeyboard != null) {
if (mKeyboard.setShifted(shifted)) {
// The whole keyboard probably needs to be redrawn
- invalidateAll();
+ invalidateAllKeys();
return true;
}
}
@@ -573,7 +573,7 @@ public class KeyboardView extends View implements View.OnClickListener {
if (mBuffer == null) {
mBuffer = Bitmap.createBitmap(getWidth(), getHeight(), Bitmap.Config.ARGB_8888);
mCanvas = new Canvas(mBuffer);
- invalidateAll();
+ invalidateAllKeys();
}
final Canvas canvas = mCanvas;
canvas.clipRect(mDirtyRect, Op.REPLACE);
@@ -874,13 +874,27 @@ public class KeyboardView extends View implements View.OnClickListener {
mPreviewText.setVisibility(VISIBLE);
}
- private void invalidateAll() {
+ /**
+ * Requests a redraw of the entire keyboard. Calling {@link #invalidate} is not sufficient
+ * because the keyboard renders the keys to an off-screen buffer and an invalidate() only
+ * draws the cached buffer.
+ * @see #invalidateKey(int)
+ */
+ public void invalidateAllKeys() {
mDirtyRect.union(0, 0, getWidth(), getHeight());
mDrawPending = true;
invalidate();
}
-
- private void invalidateKey(int keyIndex) {
+
+ /**
+ * Invalidates a key so that it will be redrawn on the next repaint. Use this method if only
+ * one key is changing it's content. Any changes that affect the position or size of the key
+ * may not be honored.
+ * @param keyIndex the index of the key in the attached {@link Keyboard}.
+ * @see #invalidateAllKeys
+ */
+ public void invalidateKey(int keyIndex) {
+ if (mKeys == null) return;
if (keyIndex < 0 || keyIndex >= mKeys.length) {
return;
}
@@ -991,7 +1005,7 @@ public class KeyboardView extends View implements View.OnClickListener {
mPopupKeyboard.showAtLocation(this, Gravity.NO_GRAVITY, x, y);
mMiniKeyboardOnScreen = true;
//mMiniKeyboard.onTouchEvent(getTranslatedEvent(me));
- invalidateAll();
+ invalidateAllKeys();
return true;
}
return false;
@@ -1164,7 +1178,7 @@ public class KeyboardView extends View implements View.OnClickListener {
if (mPopupKeyboard.isShowing()) {
mPopupKeyboard.dismiss();
mMiniKeyboardOnScreen = false;
- invalidateAll();
+ invalidateAllKeys();
}
}
diff --git a/core/java/android/util/DisplayMetrics.java b/core/java/android/util/DisplayMetrics.java
index 9de4cbe..095f4f4 100644
--- a/core/java/android/util/DisplayMetrics.java
+++ b/core/java/android/util/DisplayMetrics.java
@@ -31,7 +31,11 @@ public class DisplayMetrics {
*/
public static final int DEFAULT_DENSITY = 160;
- private static final int sLcdDensity = SystemProperties.getInt("ro.sf.lcd_density",
+ /**
+ * The device's density.
+ * @hide
+ */
+ public static final int DEVICE_DENSITY = SystemProperties.getInt("ro.sf.lcd_density",
DEFAULT_DENSITY);
/**
@@ -90,9 +94,9 @@ public class DisplayMetrics {
public void setToDefaults() {
widthPixels = 0;
heightPixels = 0;
- density = sLcdDensity / (float) DEFAULT_DENSITY;
+ density = DEVICE_DENSITY / (float) DEFAULT_DENSITY;
scaledDensity = density;
- xdpi = sLcdDensity;
- ydpi = sLcdDensity;
+ xdpi = DEVICE_DENSITY;
+ ydpi = DEVICE_DENSITY;
}
}
diff --git a/core/java/android/view/MotionEvent.java b/core/java/android/view/MotionEvent.java
index 0d55679..86261c4 100644
--- a/core/java/android/view/MotionEvent.java
+++ b/core/java/android/view/MotionEvent.java
@@ -228,8 +228,10 @@ public final class MotionEvent implements Parcelable {
if (mHistory != null) {
float[] history = mHistory;
int length = history.length;
- for (int i = 0; i < length; i++) {
+ for (int i = 0; i < length; i += 4) {
history[i] *= scale;
+ history[i + 2] *= scale;
+ history[i + 3] *= scale;
}
}
}
diff --git a/core/java/com/android/internal/backup/IBackupTransport.aidl b/core/java/com/android/internal/backup/IBackupTransport.aidl
index d64a303..ce39768 100644
--- a/core/java/com/android/internal/backup/IBackupTransport.aidl
+++ b/core/java/com/android/internal/backup/IBackupTransport.aidl
@@ -16,6 +16,54 @@
package com.android.internal.backup;
+import android.os.ParcelFileDescriptor;
+
/** {@hide} */
interface IBackupTransport {
+/* STOPSHIP - don't ship with this comment in place
+ Things the transport interface has to do:
+ 1. set up the connection to the destination
+ - set up encryption
+ - for Google cloud, log in using the user's gaia credential or whatever
+ - for sd, spin off the backup transport and establish communication with it
+ 2. send each app's backup transaction
+ - parse the data file for key/value pointers etc
+ - send key/blobsize set to the Google cloud, get back quota ok/rejected response
+ - sd/adb doesn't preflight; no per-app quota
+ - app's entire change is essentially atomic
+ - cloud transaction encrypts then sends each key/value pair separately; we already
+ parsed the data when preflighting so we don't have to again here
+ - sd target streams raw data into encryption envelope then to sd?
+ 3. shut down connection to destination
+ - cloud: tear down connection etc
+ - sd: close the file and shut down the writer proxy
+*/
+ /**
+ * Establish a connection to the back-end data repository, if necessary. If the transport
+ * needs to initialize state that is not tied to individual applications' backup operations,
+ * this is where it should be done.
+ *
+ * @return Zero on success; a nonzero error code on failure.
+ */
+ int startSession();
+
+ /**
+ * Send one application's data to the backup destination.
+ *
+ * @param packageName The identity of the application whose data is being backed up.
+ * @param data The data stream that resulted from invoking the application's
+ * BackupService.doBackup() method. This may be a pipe rather than a
+ * file on persistent media, so it may not be seekable.
+ * @return Zero on success; a nonzero error code on failure.
+ */
+ int performBackup(String packageName, in ParcelFileDescriptor data);
+
+ /**
+ * Terminate the backup session, closing files, freeing memory, and cleaning up whatever
+ * other state the transport required.
+ *
+ * @return Zero on success; a nonzero error code on failure. Even on failure, the session
+ * is torn down and must be restarted if another backup is attempted.
+ */
+ int endSession();
}
diff --git a/core/jni/Android.mk b/core/jni/Android.mk
index 48675a1..702ea87 100644
--- a/core/jni/Android.mk
+++ b/core/jni/Android.mk
@@ -117,7 +117,8 @@ LOCAL_SRC_FILES:= \
android_ddm_DdmHandleNativeHeap.cpp \
android_location_GpsLocationProvider.cpp \
com_android_internal_os_ZygoteInit.cpp \
- com_android_internal_graphics_NativeUtils.cpp
+ com_android_internal_graphics_NativeUtils.cpp \
+ android_backup_FileBackupHelper.cpp
LOCAL_C_INCLUDES += \
$(JNI_H_INCLUDE) \
diff --git a/core/jni/AndroidRuntime.cpp b/core/jni/AndroidRuntime.cpp
index 422020e..d1e87f3 100644
--- a/core/jni/AndroidRuntime.cpp
+++ b/core/jni/AndroidRuntime.cpp
@@ -154,6 +154,7 @@ extern int register_android_ddm_DdmHandleNativeHeap(JNIEnv *env);
extern int register_com_android_internal_os_ZygoteInit(JNIEnv* env);
extern int register_android_util_Base64(JNIEnv* env);
extern int register_android_location_GpsLocationProvider(JNIEnv* env);
+extern int register_android_backup_FileBackupHelper(JNIEnv *env);
static AndroidRuntime* gCurRuntime = NULL;
@@ -1168,6 +1169,7 @@ static const RegJNIRec gRegJNI[] = {
REG_JNI(register_android_ddm_DdmHandleNativeHeap),
REG_JNI(register_android_util_Base64),
REG_JNI(register_android_location_GpsLocationProvider),
+ REG_JNI(register_android_backup_FileBackupHelper),
};
/*
diff --git a/core/jni/android_backup_FileBackupHelper.cpp b/core/jni/android_backup_FileBackupHelper.cpp
new file mode 100644
index 0000000..e8d60a0
--- /dev/null
+++ b/core/jni/android_backup_FileBackupHelper.cpp
@@ -0,0 +1,79 @@
+/*
+ * 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.
+ */
+
+#include "JNIHelp.h"
+#include <android_runtime/AndroidRuntime.h>
+
+#include <utils/backup_helpers.h>
+
+namespace android
+{
+
+static jfieldID s_descriptorField;
+
+static int
+performBackup_native(JNIEnv* env, jstring basePath,
+ jobject oldSnapshot, jobject newSnapshot,
+ jobject data, jobjectArray files)
+{
+ int err;
+
+ // all parameters have already been checked against null
+
+ int oldSnapshotFD = env->GetIntField(oldSnapshot, s_descriptorField);
+ int newSnapshotFD = env->GetIntField(newSnapshot, s_descriptorField);
+ int dataFD = env->GetIntField(data, s_descriptorField);
+
+ char const* basePathUTF = env->GetStringUTFChars(basePath, NULL);
+ const int fileCount = env->GetArrayLength(files);
+ char const** filesUTF = (char const**)malloc(sizeof(char*)*fileCount);
+ for (int i=0; i<fileCount; i++) {
+ filesUTF[i] = env->GetStringUTFChars((jstring)env->GetObjectArrayElement(files, i), NULL);
+ }
+
+ err = back_up_files(oldSnapshotFD, newSnapshotFD, dataFD, basePathUTF, filesUTF, fileCount);
+
+ for (int i=0; i<fileCount; i++) {
+ env->ReleaseStringUTFChars((jstring)env->GetObjectArrayElement(files, i), filesUTF[i]);
+ }
+ free(filesUTF);
+ env->ReleaseStringUTFChars(basePath, basePathUTF);
+
+ return err;
+}
+
+static const JNINativeMethod g_methods[] = {
+ { "performBackup_native",
+ "(Ljava/lang/String;Ljava/io/FileDescriptor;Ljava/io/FileDescriptor;"
+ "Ljava/io/FileDescriptor;[Ljava/lang/String;)I",
+ (void*)performBackup_native },
+};
+
+int register_android_backup_FileBackupHelper(JNIEnv* env)
+{
+ jclass clazz;
+
+ clazz = env->FindClass("java/io/FileDescriptor");
+ LOG_FATAL_IF(clazz == NULL, "Unable to find class java.io.FileDescriptor");
+ s_descriptorField = env->GetFieldID(clazz, "descriptor", "I");
+ LOG_FATAL_IF(s_descriptorField == NULL,
+ "Unable to find descriptor field in java.io.FileDescriptor");
+
+ return AndroidRuntime::registerNativeMethods(env, "android/backup/FileBackupHelper",
+ g_methods, NELEM(g_methods));
+}
+
+}
diff --git a/core/jni/android_opengl_GLES10.cpp b/core/jni/android_opengl_GLES10.cpp
index bc644d2..7e388ef 100644
--- a/core/jni/android_opengl_GLES10.cpp
+++ b/core/jni/android_opengl_GLES10.cpp
@@ -22,11 +22,7 @@
#include <assert.h>
#include <GLES/gl.h>
-
-#include <private/opengles/gl_context.h>
-
-#define _NUM_COMPRESSED_TEXTURE_FORMATS \
- (::android::OGLES_NUM_COMPRESSED_TEXTURE_FORMATS)
+#include <GLES/glext.h>
static int initialized = 0;
@@ -67,7 +63,6 @@ nativeClassInitBuffer(JNIEnv *_env)
_env->GetFieldID(bufferClass, "_elementSizeShift", "I");
}
-
static void
nativeClassInit(JNIEnv *_env, jclass glImplClass)
{
@@ -118,7 +113,6 @@ getPointer(JNIEnv *_env, jobject buffer, jarray *array, jint *remaining)
return (void *) ((char *) data + offset);
}
-
static void
releasePointer(JNIEnv *_env, jarray array, void *data, jboolean commit)
{
@@ -126,6 +120,13 @@ releasePointer(JNIEnv *_env, jarray array, void *data, jboolean commit)
commit ? 0 : JNI_ABORT);
}
+static int
+getNumCompressedTextureFormats() {
+ int numCompressedTextureFormats = 0;
+ glGetIntegerv(GL_NUM_COMPRESSED_TEXTURE_FORMATS, &numCompressedTextureFormats);
+ return numCompressedTextureFormats;
+}
+
// --------------------------------------------------------------------------
/* void glActiveTexture ( GLenum texture ) */
@@ -290,7 +291,13 @@ android_glColorPointerBounds__IIILjava_nio_Buffer_2I
jint _remaining;
GLvoid *pointer = (GLvoid *) 0;
- pointer = (GLvoid *)getPointer(_env, pointer_buf, &_array, &_remaining);
+ if (pointer_buf) {
+ pointer = (GLvoid *) _env->GetDirectBufferAddress(pointer_buf);
+ if ( ! pointer ) {
+ _env->ThrowNew(IAEClass, "Must use a native order direct Buffer");
+ return;
+ }
+ }
glColorPointerBounds(
(GLint)size,
(GLenum)type,
@@ -298,9 +305,6 @@ android_glColorPointerBounds__IIILjava_nio_Buffer_2I
(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 ) */
@@ -1022,6 +1026,12 @@ android_glGetIntegerv__I_3II
#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_COLOR_CONTROL)
+ case GL_LIGHT_MODEL_COLOR_CONTROL:
+#endif // defined(GL_LIGHT_MODEL_COLOR_CONTROL)
+#if defined(GL_LIGHT_MODEL_LOCAL_VIEWER)
+ case GL_LIGHT_MODEL_LOCAL_VIEWER:
+#endif // defined(GL_LIGHT_MODEL_LOCAL_VIEWER)
#if defined(GL_LIGHT_MODEL_TWO_SIDE)
case GL_LIGHT_MODEL_TWO_SIDE:
#endif // defined(GL_LIGHT_MODEL_TWO_SIDE)
@@ -1236,6 +1246,12 @@ android_glGetIntegerv__I_3II
#if defined(GL_COLOR_WRITEMASK)
case GL_COLOR_WRITEMASK:
#endif // defined(GL_COLOR_WRITEMASK)
+#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)
#if defined(GL_SCISSOR_BOX)
case GL_SCISSOR_BOX:
#endif // defined(GL_SCISSOR_BOX)
@@ -1267,13 +1283,7 @@ android_glGetIntegerv__I_3II
#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;
+ _needed = getNumCompressedTextureFormats();
break;
default:
_needed = 0;
@@ -1378,6 +1388,12 @@ android_glGetIntegerv__ILjava_nio_IntBuffer_2
#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_COLOR_CONTROL)
+ case GL_LIGHT_MODEL_COLOR_CONTROL:
+#endif // defined(GL_LIGHT_MODEL_COLOR_CONTROL)
+#if defined(GL_LIGHT_MODEL_LOCAL_VIEWER)
+ case GL_LIGHT_MODEL_LOCAL_VIEWER:
+#endif // defined(GL_LIGHT_MODEL_LOCAL_VIEWER)
#if defined(GL_LIGHT_MODEL_TWO_SIDE)
case GL_LIGHT_MODEL_TWO_SIDE:
#endif // defined(GL_LIGHT_MODEL_TWO_SIDE)
@@ -1592,6 +1608,12 @@ android_glGetIntegerv__ILjava_nio_IntBuffer_2
#if defined(GL_COLOR_WRITEMASK)
case GL_COLOR_WRITEMASK:
#endif // defined(GL_COLOR_WRITEMASK)
+#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)
#if defined(GL_SCISSOR_BOX)
case GL_SCISSOR_BOX:
#endif // defined(GL_SCISSOR_BOX)
@@ -1623,13 +1645,7 @@ android_glGetIntegerv__ILjava_nio_IntBuffer_2
#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;
+ _needed = getNumCompressedTextureFormats();
break;
default:
_needed = 0;
@@ -2749,16 +2765,19 @@ android_glNormalPointerBounds__IILjava_nio_Buffer_2I
jint _remaining;
GLvoid *pointer = (GLvoid *) 0;
- pointer = (GLvoid *)getPointer(_env, pointer_buf, &_array, &_remaining);
+ if (pointer_buf) {
+ pointer = (GLvoid *) _env->GetDirectBufferAddress(pointer_buf);
+ if ( ! pointer ) {
+ _env->ThrowNew(IAEClass, "Must use a native order direct Buffer");
+ return;
+ }
+ }
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 ) */
@@ -3001,7 +3020,13 @@ android_glTexCoordPointerBounds__IIILjava_nio_Buffer_2I
jint _remaining;
GLvoid *pointer = (GLvoid *) 0;
- pointer = (GLvoid *)getPointer(_env, pointer_buf, &_array, &_remaining);
+ if (pointer_buf) {
+ pointer = (GLvoid *) _env->GetDirectBufferAddress(pointer_buf);
+ if ( ! pointer ) {
+ _env->ThrowNew(IAEClass, "Must use a native order direct Buffer");
+ return;
+ }
+ }
glTexCoordPointerBounds(
(GLint)size,
(GLenum)type,
@@ -3009,9 +3034,6 @@ android_glTexCoordPointerBounds__IIILjava_nio_Buffer_2I
(GLvoid *)pointer,
(GLsizei)remaining
);
- if (_array) {
- releasePointer(_env, _array, pointer, JNI_FALSE);
- }
}
/* void glTexEnvf ( GLenum target, GLenum pname, GLfloat param ) */
@@ -3356,7 +3378,13 @@ android_glVertexPointerBounds__IIILjava_nio_Buffer_2I
jint _remaining;
GLvoid *pointer = (GLvoid *) 0;
- pointer = (GLvoid *)getPointer(_env, pointer_buf, &_array, &_remaining);
+ if (pointer_buf) {
+ pointer = (GLvoid *) _env->GetDirectBufferAddress(pointer_buf);
+ if ( ! pointer ) {
+ _env->ThrowNew(IAEClass, "Must use a native order direct Buffer");
+ return;
+ }
+ }
glVertexPointerBounds(
(GLint)size,
(GLenum)type,
@@ -3364,9 +3392,6 @@ android_glVertexPointerBounds__IIILjava_nio_Buffer_2I
(GLvoid *)pointer,
(GLsizei)remaining
);
- if (_array) {
- releasePointer(_env, _array, pointer, JNI_FALSE);
- }
}
/* void glViewport ( GLint x, GLint y, GLsizei width, GLsizei height ) */
diff --git a/core/jni/android_opengl_GLES10Ext.cpp b/core/jni/android_opengl_GLES10Ext.cpp
index 6114d6a..f17ef21 100644
--- a/core/jni/android_opengl_GLES10Ext.cpp
+++ b/core/jni/android_opengl_GLES10Ext.cpp
@@ -22,11 +22,7 @@
#include <assert.h>
#include <GLES/gl.h>
-
-#include <private/opengles/gl_context.h>
-
-#define _NUM_COMPRESSED_TEXTURE_FORMATS \
- (::android::OGLES_NUM_COMPRESSED_TEXTURE_FORMATS)
+#include <GLES/glext.h>
static int initialized = 0;
diff --git a/core/jni/android_opengl_GLES11.cpp b/core/jni/android_opengl_GLES11.cpp
index a7e59a8..ed8dfc8 100644
--- a/core/jni/android_opengl_GLES11.cpp
+++ b/core/jni/android_opengl_GLES11.cpp
@@ -22,11 +22,7 @@
#include <assert.h>
#include <GLES/gl.h>
-
-#include <private/opengles/gl_context.h>
-
-#define _NUM_COMPRESSED_TEXTURE_FORMATS \
- (::android::OGLES_NUM_COMPRESSED_TEXTURE_FORMATS)
+#include <GLES/glext.h>
static int initialized = 0;
diff --git a/core/jni/android_opengl_GLES11Ext.cpp b/core/jni/android_opengl_GLES11Ext.cpp
index 069cec1..6f3495c 100644
--- a/core/jni/android_opengl_GLES11Ext.cpp
+++ b/core/jni/android_opengl_GLES11Ext.cpp
@@ -22,11 +22,7 @@
#include <assert.h>
#include <GLES/gl.h>
-
-#include <private/opengles/gl_context.h>
-
-#define _NUM_COMPRESSED_TEXTURE_FORMATS \
- (::android::OGLES_NUM_COMPRESSED_TEXTURE_FORMATS)
+#include <GLES/glext.h>
static int initialized = 0;
diff --git a/core/jni/android_os_ParcelFileDescriptor.cpp b/core/jni/android_os_ParcelFileDescriptor.cpp
index 971f87c..848a57a 100644
--- a/core/jni/android_os_ParcelFileDescriptor.cpp
+++ b/core/jni/android_os_ParcelFileDescriptor.cpp
@@ -1,19 +1,18 @@
-/* //device/libs/android_runtime/android_os_ParcelFileDescriptor.cpp
-**
-** Copyright 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.
-*/
+/*
+ * 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.
+ */
//#define LOG_NDEBUG 0
diff --git a/core/jni/android_server_BluetoothA2dpService.cpp b/core/jni/android_server_BluetoothA2dpService.cpp
index b320c09..fe94642 100644
--- a/core/jni/android_server_BluetoothA2dpService.cpp
+++ b/core/jni/android_server_BluetoothA2dpService.cpp
@@ -45,7 +45,8 @@ static jmethodID method_onSinkPlaying;
static jmethodID method_onSinkStopped;
typedef struct {
- JNIEnv *env;
+ JavaVM *vm;
+ int envVer;
DBusConnection *conn;
jobject me; // for callbacks to java
} native_data_t;
@@ -70,7 +71,8 @@ static bool initNative(JNIEnv* env, jobject object) {
LOGE("%s: out of memory!", __FUNCTION__);
return false;
}
- nat->env = env;
+ env->GetJavaVM( &(nat->vm) );
+ nat->envVer = env->GetVersion();
nat->me = env->NewGlobalRef(object);
DBusError err;
@@ -239,8 +241,14 @@ static void onConnectSinkResult(DBusMessage *msg, void *user, void *natData) {
char *c_path = (char *)user;
DBusError err;
+ JNIEnv *env;
+
+ if (nat->vm->GetEnv((void**)&env, nat->envVer) < 0) {
+ LOGE("%s: error finding Env for our VM\n", __FUNCTION__);
+ return;
+ }
+
dbus_error_init(&err);
- JNIEnv *env = nat->env;
LOGV("... path = %s", c_path);
if (dbus_set_error_from_message(&err, msg)) {
@@ -264,8 +272,14 @@ static void onDisconnectSinkResult(DBusMessage *msg, void *user, void *natData)
char *c_path = (char *)user;
DBusError err;
+ JNIEnv *env;
+
+ if (nat->vm->GetEnv((void**)&env, nat->envVer) < 0) {
+ LOGE("%s: error finding Env for our VM\n", __FUNCTION__);
+ return;
+ }
+
dbus_error_init(&err);
- JNIEnv *env = nat->env;
LOGV("... path = %s", c_path);
if (dbus_set_error_from_message(&err, msg)) {
diff --git a/core/jni/com_google_android_gles_jni_GLImpl.cpp b/core/jni/com_google_android_gles_jni_GLImpl.cpp
index 4ca79b5..6f2a438 100644
--- a/core/jni/com_google_android_gles_jni_GLImpl.cpp
+++ b/core/jni/com_google_android_gles_jni_GLImpl.cpp
@@ -22,11 +22,7 @@
#include <assert.h>
#include <GLES/gl.h>
-
-#include <private/opengles/gl_context.h>
-
-#define _NUM_COMPRESSED_TEXTURE_FORMATS \
- (::android::OGLES_NUM_COMPRESSED_TEXTURE_FORMATS)
+#include <GLES/glext.h>
static int initialized = 0;
@@ -67,7 +63,6 @@ nativeClassInitBuffer(JNIEnv *_env)
_env->GetFieldID(bufferClass, "_elementSizeShift", "I");
}
-
static void
nativeClassInit(JNIEnv *_env, jclass glImplClass)
{
@@ -118,7 +113,6 @@ getPointer(JNIEnv *_env, jobject buffer, jarray *array, jint *remaining)
return (void *) ((char *) data + offset);
}
-
static void
releasePointer(JNIEnv *_env, jarray array, void *data, jboolean commit)
{
@@ -126,6 +120,13 @@ releasePointer(JNIEnv *_env, jarray array, void *data, jboolean commit)
commit ? 0 : JNI_ABORT);
}
+static int
+getNumCompressedTextureFormats() {
+ int numCompressedTextureFormats = 0;
+ glGetIntegerv(GL_NUM_COMPRESSED_TEXTURE_FORMATS, &numCompressedTextureFormats);
+ return numCompressedTextureFormats;
+}
+
// --------------------------------------------------------------------------
/* void glActiveTexture ( GLenum texture ) */
@@ -290,7 +291,13 @@ android_glColorPointerBounds__IIILjava_nio_Buffer_2I
jint _remaining;
GLvoid *pointer = (GLvoid *) 0;
- pointer = (GLvoid *)getPointer(_env, pointer_buf, &_array, &_remaining);
+ if (pointer_buf) {
+ pointer = (GLvoid *) _env->GetDirectBufferAddress(pointer_buf);
+ if ( ! pointer ) {
+ _env->ThrowNew(IAEClass, "Must use a native order direct Buffer");
+ return;
+ }
+ }
glColorPointerBounds(
(GLint)size,
(GLenum)type,
@@ -298,9 +305,6 @@ android_glColorPointerBounds__IIILjava_nio_Buffer_2I
(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 ) */
@@ -1022,6 +1026,12 @@ android_glGetIntegerv__I_3II
#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_COLOR_CONTROL)
+ case GL_LIGHT_MODEL_COLOR_CONTROL:
+#endif // defined(GL_LIGHT_MODEL_COLOR_CONTROL)
+#if defined(GL_LIGHT_MODEL_LOCAL_VIEWER)
+ case GL_LIGHT_MODEL_LOCAL_VIEWER:
+#endif // defined(GL_LIGHT_MODEL_LOCAL_VIEWER)
#if defined(GL_LIGHT_MODEL_TWO_SIDE)
case GL_LIGHT_MODEL_TWO_SIDE:
#endif // defined(GL_LIGHT_MODEL_TWO_SIDE)
@@ -1236,6 +1246,12 @@ android_glGetIntegerv__I_3II
#if defined(GL_COLOR_WRITEMASK)
case GL_COLOR_WRITEMASK:
#endif // defined(GL_COLOR_WRITEMASK)
+#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)
#if defined(GL_SCISSOR_BOX)
case GL_SCISSOR_BOX:
#endif // defined(GL_SCISSOR_BOX)
@@ -1267,13 +1283,7 @@ android_glGetIntegerv__I_3II
#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;
+ _needed = getNumCompressedTextureFormats();
break;
default:
_needed = 0;
@@ -1378,6 +1388,12 @@ android_glGetIntegerv__ILjava_nio_IntBuffer_2
#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_COLOR_CONTROL)
+ case GL_LIGHT_MODEL_COLOR_CONTROL:
+#endif // defined(GL_LIGHT_MODEL_COLOR_CONTROL)
+#if defined(GL_LIGHT_MODEL_LOCAL_VIEWER)
+ case GL_LIGHT_MODEL_LOCAL_VIEWER:
+#endif // defined(GL_LIGHT_MODEL_LOCAL_VIEWER)
#if defined(GL_LIGHT_MODEL_TWO_SIDE)
case GL_LIGHT_MODEL_TWO_SIDE:
#endif // defined(GL_LIGHT_MODEL_TWO_SIDE)
@@ -1592,6 +1608,12 @@ android_glGetIntegerv__ILjava_nio_IntBuffer_2
#if defined(GL_COLOR_WRITEMASK)
case GL_COLOR_WRITEMASK:
#endif // defined(GL_COLOR_WRITEMASK)
+#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)
#if defined(GL_SCISSOR_BOX)
case GL_SCISSOR_BOX:
#endif // defined(GL_SCISSOR_BOX)
@@ -1623,13 +1645,7 @@ android_glGetIntegerv__ILjava_nio_IntBuffer_2
#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;
+ _needed = getNumCompressedTextureFormats();
break;
default:
_needed = 0;
@@ -2749,16 +2765,19 @@ android_glNormalPointerBounds__IILjava_nio_Buffer_2I
jint _remaining;
GLvoid *pointer = (GLvoid *) 0;
- pointer = (GLvoid *)getPointer(_env, pointer_buf, &_array, &_remaining);
+ if (pointer_buf) {
+ pointer = (GLvoid *) _env->GetDirectBufferAddress(pointer_buf);
+ if ( ! pointer ) {
+ _env->ThrowNew(IAEClass, "Must use a native order direct Buffer");
+ return;
+ }
+ }
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 ) */
@@ -3001,7 +3020,13 @@ android_glTexCoordPointerBounds__IIILjava_nio_Buffer_2I
jint _remaining;
GLvoid *pointer = (GLvoid *) 0;
- pointer = (GLvoid *)getPointer(_env, pointer_buf, &_array, &_remaining);
+ if (pointer_buf) {
+ pointer = (GLvoid *) _env->GetDirectBufferAddress(pointer_buf);
+ if ( ! pointer ) {
+ _env->ThrowNew(IAEClass, "Must use a native order direct Buffer");
+ return;
+ }
+ }
glTexCoordPointerBounds(
(GLint)size,
(GLenum)type,
@@ -3009,9 +3034,6 @@ android_glTexCoordPointerBounds__IIILjava_nio_Buffer_2I
(GLvoid *)pointer,
(GLsizei)remaining
);
- if (_array) {
- releasePointer(_env, _array, pointer, JNI_FALSE);
- }
}
/* void glTexEnvf ( GLenum target, GLenum pname, GLfloat param ) */
@@ -3356,7 +3378,13 @@ android_glVertexPointerBounds__IIILjava_nio_Buffer_2I
jint _remaining;
GLvoid *pointer = (GLvoid *) 0;
- pointer = (GLvoid *)getPointer(_env, pointer_buf, &_array, &_remaining);
+ if (pointer_buf) {
+ pointer = (GLvoid *) _env->GetDirectBufferAddress(pointer_buf);
+ if ( ! pointer ) {
+ _env->ThrowNew(IAEClass, "Must use a native order direct Buffer");
+ return;
+ }
+ }
glVertexPointerBounds(
(GLint)size,
(GLenum)type,
@@ -3364,9 +3392,6 @@ android_glVertexPointerBounds__IIILjava_nio_Buffer_2I
(GLvoid *)pointer,
(GLsizei)remaining
);
- if (_array) {
- releasePointer(_env, _array, pointer, JNI_FALSE);
- }
}
/* void glViewport ( GLint x, GLint y, GLsizei width, GLsizei height ) */
diff --git a/docs/html/guide/topics/graphics/2d-graphics.jd b/docs/html/guide/topics/graphics/2d-graphics.jd
index 1f62f3d..af584a2 100644
--- a/docs/html/guide/topics/graphics/2d-graphics.jd
+++ b/docs/html/guide/topics/graphics/2d-graphics.jd
@@ -10,8 +10,8 @@ parent.link=index.html
<ol>
<li><a href="#drawables">Drawables</a>
<ol>
- <li><a href="#drawable-images">Creating from resource images</a></li>
- <li><a href="#drawable-xml">Creating from resource XML</a></li>
+ <li><a href="#drawables-from-images">Creating from resource images</a></li>
+ <li><a href="#drawables-from-xml">Creating from resource XML</a></li>
</ol>
</li>
<li><a href="#shape-drawable">ShapeDrawable</a></li>
@@ -59,6 +59,15 @@ From there, you can reference it from your code or your XML layout.
Either way, it is referred using a resource ID, which is the file name without the file type
extension (E.g., <code>my_image.png</code> is referenced as <var>my_image</var>).</p>
+<p class="note"><strong>Note:</strong> Image resources placed in <code>res/drawable/</code> may be
+automatically optimized with lossless image compression by the
+<a href="{@docRoot}guide/developing/tools/aapt.html">aapt</a> tool. For example, a true-color PNG that does
+not require more than 256 colors may be converted to an 8-bit PNG with a color palette. This
+will result in an image of equal quality but which requires less memory. So be aware that the
+image binaries placed in this directory can change during the build. If you plan on reading
+an image as a bit stream in order to convert it to a bitmap, put your images in the <code>res/raw/</code>
+folder instead, where they will not be optimized.</p>
+
<h4>Example code</h4>
<p>The following code snippet demonstrates how to build an {@link android.widget.ImageView} that uses an image
from drawable resources and add it to the layout.</p>
@@ -90,7 +99,7 @@ Resources res = mContext.getResources();
Drawable myImage = res.getDrawable(R.drawable.my_image);
</pre>
-<p class="caution"><strong>Caution:</strong> Each unique resource in your project can maintain only one
+<p class="warning"><strong>Note:</strong> Each unique resource in your project can maintain only one
state, no matter how many different objects you may instantiate for it. For example, if you instantiate two
Drawable objects from the same image resource, then change a property (such as the alpha) for one of the
Drawables, then it will also affect the other. So when dealing with multiple instances of an image resource,
diff --git a/docs/html/guide/topics/resources/resources-i18n.jd b/docs/html/guide/topics/resources/resources-i18n.jd
index b1da4cd..4bbb44a 100644
--- a/docs/html/guide/topics/resources/resources-i18n.jd
+++ b/docs/html/guide/topics/resources/resources-i18n.jd
@@ -111,21 +111,30 @@ the containing file.</p>
<td><code>res/drawable/</code></td>
<td><p>.png, .9.png, .jpg files that are compiled into the following
Drawable resource subtypes:</p>
- <p>To get a resource of this type, use <code>Resource.getDrawable(<em>id</em>)</code>
- <ul>
+ <ul class="nolist">
<li><a href="available-resources.html#imagefileresources">bitmap files</a></li>
<li><a href="available-resources.html#ninepatch">9-patches (resizable bitmaps)</a></li>
- </ul></td>
+ </ul>
+ <p>To get a resource of this type, use <code>mContext.getResources().getDrawable(R.drawable.<em>imageId</em>)</code></p>
+ <p class="note"><strong>Note:</strong> Image resources placed in here may
+ be automatically optimized with lossless image compression by the
+ <a href="{@docRoot}guide/developing/tools/aapt.html">aapt</a> tool. For example, a true-color PNG
+ that does not require more than 256 colors may be converted to an 8-bit PNG with a color palette.
+ This will result in an image of equal quality but which requires less memory. So be aware that the
+ image binaries placed in this directory can change during the build. If you plan on reading
+ an image as a bit stream in order to convert it to a bitmap, put your images in the
+ <code>res/raw/</code> folder instead, where they will not be optimized.</p>
+ </td>
</tr>
<tr>
<td><code>res/layout/</code></td>
<td>XML files that are compiled into screen layouts (or part of a screen).
- See <a href="{@docRoot}guide/topics/ui/declaring-layout.html">Declaring Layout</a></td>
+ See <a href="{@docRoot}guide/topics/ui/declaring-layout.html">Declaring Layout</a>.</td>
</tr>
<tr>
<td><code>res/values/</code></td>
<td><p>XML files that can be compiled into many kinds of resource.</p>
- <p class="note"><strong>Note:</strong> unlike the other res/ folders, this one
+ <p class="note"><strong>Note:</strong> Unlike the other res/ folders, this one
can hold any number of files that hold descriptions of resources to create
rather than the resources themselves. The XML element types control
where these resources are placed under the R class.</p>
diff --git a/include/ui/Camera.h b/include/ui/Camera.h
index fd851d9..901c7a9 100644
--- a/include/ui/Camera.h
+++ b/include/ui/Camera.h
@@ -143,6 +143,8 @@ public:
virtual void errorCallback(status_t error);
virtual void autoFocusCallback(bool focused);
virtual void recordingCallback(const sp<IMemory>& frame);
+ virtual void notifyCallback(int32_t msgType, int32_t ext, int32_t ext2);
+ virtual void dataCallback(int32_t msgType, const sp<IMemory>& frame);
sp<ICamera> remote();
diff --git a/include/ui/ICameraClient.h b/include/ui/ICameraClient.h
index 73b951c..1645ef8 100644
--- a/include/ui/ICameraClient.h
+++ b/include/ui/ICameraClient.h
@@ -29,6 +29,23 @@ class ICameraClient: public IInterface
public:
DECLARE_META_INTERFACE(CameraClient);
+ // msgType in notifyCallback function
+ enum {
+ ERROR,
+ SHUTTER,
+ FOCUSED,
+ ZOOM
+ } notify_callback_message_type;
+
+ // msgType in dataCallback function
+ enum {
+ PREVIEW,
+ RECORD,
+ POSTVIEW,
+ RAW,
+ COMPRESSED
+ } data_callback_message_type;
+
virtual void shutterCallback() = 0;
virtual void rawCallback(const sp<IMemory>& picture) = 0;
virtual void jpegCallback(const sp<IMemory>& picture) = 0;
@@ -36,6 +53,8 @@ public:
virtual void errorCallback(status_t error) = 0;
virtual void autoFocusCallback(bool focused) = 0;
virtual void recordingCallback(const sp<IMemory>& frame) = 0;
+ virtual void notifyCallback(int32_t msgType, int32_t ext1, int32_t ext2) = 0;
+ virtual void dataCallback(int32_t msgType, const sp<IMemory>& data) = 0;
};
diff --git a/libs/ui/Camera.cpp b/libs/ui/Camera.cpp
index 41577c4..ed4f3b8 100644
--- a/libs/ui/Camera.cpp
+++ b/libs/ui/Camera.cpp
@@ -397,6 +397,18 @@ void Camera::errorCallback(status_t error)
}
}
+// callback from camera service
+void Camera::notifyCallback(int32_t msgType, int32_t ext1, int32_t ext2)
+{
+ LOGV("notifyCallback");
+}
+
+// callback from camera service when image is ready
+void Camera::dataCallback(int32_t msgType, const sp<IMemory>& frame)
+{
+ LOGV("dataCallback");
+}
+
void Camera::binderDied(const wp<IBinder>& who) {
LOGW("ICamera died");
if (mErrorCallback) {
diff --git a/libs/ui/ICameraClient.cpp b/libs/ui/ICameraClient.cpp
index 4bec9d2..ae07b67 100644
--- a/libs/ui/ICameraClient.cpp
+++ b/libs/ui/ICameraClient.cpp
@@ -32,6 +32,8 @@ enum {
ERROR_CALLBACK,
AUTOFOCUS_CALLBACK,
RECORDING_CALLBACK,
+ NOTIFY_CALLBACK,
+ DATA_CALLBACK,
};
class BpCameraClient: public BpInterface<ICameraClient>
@@ -110,6 +112,30 @@ public:
data.writeInt32(focused);
remote()->transact(AUTOFOCUS_CALLBACK, data, &reply, IBinder::FLAG_ONEWAY);
}
+
+ // generic callback from camera service to app
+ void notifyCallback(int32_t msgType, int32_t ext1, int32_t ext2)
+ {
+ LOGV("notifyCallback");
+ Parcel data, reply;
+ data.writeInterfaceToken(ICameraClient::getInterfaceDescriptor());
+ data.writeInt32(msgType);
+ data.writeInt32(ext1);
+ data.writeInt32(ext2);
+ remote()->transact(NOTIFY_CALLBACK, data, &reply, IBinder::FLAG_ONEWAY);
+ }
+
+ // generic data callback from camera service to app with image data
+ void dataCallback(int32_t msgType, const sp<IMemory>& imageData)
+ {
+ LOGV("dataCallback");
+ Parcel data, reply;
+ data.writeInterfaceToken(ICameraClient::getInterfaceDescriptor());
+ data.writeInt32(msgType);
+ data.writeStrongBinder(imageData->asBinder());
+ remote()->transact(DATA_CALLBACK, data, &reply, IBinder::FLAG_ONEWAY);
+ }
+
};
IMPLEMENT_META_INTERFACE(CameraClient, "android.hardware.ICameraClient");
@@ -174,6 +200,23 @@ status_t BnCameraClient::onTransact(
autoFocusCallback(focused);
return NO_ERROR;
} break;
+ case NOTIFY_CALLBACK: {
+ LOGV("NOTIFY_CALLBACK");
+ CHECK_INTERFACE(ICameraClient, data, reply);
+ int32_t msgType = data.readInt32();
+ int32_t ext1 = data.readInt32();
+ int32_t ext2 = data.readInt32();
+ notifyCallback(msgType, ext1, ext2);
+ return NO_ERROR;
+ } break;
+ case DATA_CALLBACK: {
+ LOGV("RAW_CALLBACK");
+ CHECK_INTERFACE(ICameraClient, data, reply);
+ int32_t msgType = data.readInt32();
+ sp<IMemory> imageData = interface_cast<IMemory>(data.readStrongBinder());
+ dataCallback(msgType, imageData);
+ return NO_ERROR;
+ } break;
default:
return BBinder::onTransact(code, data, reply, flags);
}
diff --git a/opengl/java/android/opengl/GLES10.java b/opengl/java/android/opengl/GLES10.java
index 147b60f..db52b82 100644
--- a/opengl/java/android/opengl/GLES10.java
+++ b/opengl/java/android/opengl/GLES10.java
@@ -395,13 +395,6 @@ public class GLES10 {
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,
@@ -409,6 +402,13 @@ public class GLES10 {
pointer,
pointer.remaining()
);
+ if ((size == 4) &&
+ ((type == GL_FLOAT) ||
+ (type == GL_UNSIGNED_BYTE) ||
+ (type == GL_FIXED)) &&
+ (stride >= 0)) {
+ _colorPointer = pointer;
+ }
}
// C function void glCompressedTexImage2D ( GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data )
@@ -956,6 +956,12 @@ public class GLES10 {
int stride,
java.nio.Buffer pointer
) {
+ glNormalPointerBounds(
+ type,
+ stride,
+ pointer,
+ pointer.remaining()
+ );
if (((type == GL_FLOAT) ||
(type == GL_BYTE) ||
(type == GL_SHORT) ||
@@ -963,12 +969,6 @@ public class GLES10 {
(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 )
@@ -1149,6 +1149,13 @@ public class GLES10 {
int stride,
java.nio.Buffer pointer
) {
+ glTexCoordPointerBounds(
+ size,
+ type,
+ stride,
+ pointer,
+ pointer.remaining()
+ );
if (((size == 2) ||
(size == 3) ||
(size == 4)) &&
@@ -1159,13 +1166,6 @@ public class GLES10 {
(stride >= 0)) {
_texCoordPointer = pointer;
}
- glTexCoordPointerBounds(
- size,
- type,
- stride,
- pointer,
- pointer.remaining()
- );
}
// C function void glTexEnvf ( GLenum target, GLenum pname, GLfloat param )
@@ -1294,6 +1294,13 @@ public class GLES10 {
int stride,
java.nio.Buffer pointer
) {
+ glVertexPointerBounds(
+ size,
+ type,
+ stride,
+ pointer,
+ pointer.remaining()
+ );
if (((size == 2) ||
(size == 3) ||
(size == 4)) &&
@@ -1304,13 +1311,6 @@ public class GLES10 {
(stride >= 0)) {
_vertexPointer = pointer;
}
- glVertexPointerBounds(
- size,
- type,
- stride,
- pointer,
- pointer.remaining()
- );
}
// C function void glViewport ( GLint x, GLint y, GLsizei width, GLsizei height )
diff --git a/opengl/java/com/google/android/gles_jni/GLImpl.java b/opengl/java/com/google/android/gles_jni/GLImpl.java
index 47f07d0..4e365ef 100644
--- a/opengl/java/com/google/android/gles_jni/GLImpl.java
+++ b/opengl/java/com/google/android/gles_jni/GLImpl.java
@@ -172,13 +172,6 @@ public class GLImpl implements GL10, GL10Ext, GL11, GL11Ext, GL11ExtensionPack {
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,
@@ -186,6 +179,13 @@ public class GLImpl implements GL10, GL10Ext, GL11, GL11Ext, GL11ExtensionPack {
pointer,
pointer.remaining()
);
+ if ((size == 4) &&
+ ((type == GL_FLOAT) ||
+ (type == GL_UNSIGNED_BYTE) ||
+ (type == GL_FIXED)) &&
+ (stride >= 0)) {
+ _colorPointer = pointer;
+ }
}
// C function void glCompressedTexImage2D ( GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data )
@@ -744,6 +744,12 @@ public class GLImpl implements GL10, GL10Ext, GL11, GL11Ext, GL11ExtensionPack {
int stride,
java.nio.Buffer pointer
) {
+ glNormalPointerBounds(
+ type,
+ stride,
+ pointer,
+ pointer.remaining()
+ );
if (((type == GL_FLOAT) ||
(type == GL_BYTE) ||
(type == GL_SHORT) ||
@@ -751,12 +757,6 @@ public class GLImpl implements GL10, GL10Ext, GL11, GL11Ext, GL11ExtensionPack {
(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 )
@@ -937,6 +937,13 @@ public class GLImpl implements GL10, GL10Ext, GL11, GL11Ext, GL11ExtensionPack {
int stride,
java.nio.Buffer pointer
) {
+ glTexCoordPointerBounds(
+ size,
+ type,
+ stride,
+ pointer,
+ pointer.remaining()
+ );
if (((size == 2) ||
(size == 3) ||
(size == 4)) &&
@@ -947,13 +954,6 @@ public class GLImpl implements GL10, GL10Ext, GL11, GL11Ext, GL11ExtensionPack {
(stride >= 0)) {
_texCoordPointer = pointer;
}
- glTexCoordPointerBounds(
- size,
- type,
- stride,
- pointer,
- pointer.remaining()
- );
}
// C function void glTexEnvf ( GLenum target, GLenum pname, GLfloat param )
@@ -1082,6 +1082,13 @@ public class GLImpl implements GL10, GL10Ext, GL11, GL11Ext, GL11ExtensionPack {
int stride,
java.nio.Buffer pointer
) {
+ glVertexPointerBounds(
+ size,
+ type,
+ stride,
+ pointer,
+ pointer.remaining()
+ );
if (((size == 2) ||
(size == 3) ||
(size == 4)) &&
@@ -1092,13 +1099,6 @@ public class GLImpl implements GL10, GL10Ext, GL11, GL11Ext, GL11ExtensionPack {
(stride >= 0)) {
_vertexPointer = pointer;
}
- glVertexPointerBounds(
- size,
- type,
- stride,
- pointer,
- pointer.remaining()
- );
}
// C function void glViewport ( GLint x, GLint y, GLsizei width, GLsizei height )
diff --git a/opengl/tools/glgen/specs/gles11/checks.spec b/opengl/tools/glgen/specs/gles11/checks.spec
index 97dac2e..e31a2ce 100644
--- a/opengl/tools/glgen/specs/gles11/checks.spec
+++ b/opengl/tools/glgen/specs/gles11/checks.spec
@@ -9,7 +9,7 @@ glFog ifcheck params 1 pname GL_FOG_MODE,GL_FOG_DENSITY,GL_FOG_START,GL_FOG_END
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
+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_COLOR_CONTROL,GL_LIGHT_MODEL_LOCAL_VIEWER,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_FOG_COLOR,GL_LIGHT_MODEL_AMBIENT,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 getNumCompressedTextureFormats() pname GL_COMPRESSED_TEXTURE_FORMATS
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
diff --git a/opengl/tools/glgen/specs/jsr239/glspec-checks b/opengl/tools/glgen/specs/jsr239/glspec-checks
index a84ed653..55840fa 100644
--- a/opengl/tools/glgen/specs/jsr239/glspec-checks
+++ b/opengl/tools/glgen/specs/jsr239/glspec-checks
@@ -7,7 +7,7 @@ glFog ifcheck params 1 pname GL_FOG_MODE,GL_FOG_DENSITY,GL_FOG_START,GL_FOG_END
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
+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_COLOR_CONTROL,GL_LIGHT_MODEL_LOCAL_VIEWER,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_FOG_COLOR,GL_LIGHT_MODEL_AMBIENT,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 getNumCompressedTextureFormats() pname GL_COMPRESSED_TEXTURE_FORMATS
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
diff --git a/opengl/tools/glgen/src/JniCodeEmitter.java b/opengl/tools/glgen/src/JniCodeEmitter.java
index ef0dbd0..b0997b1 100644
--- a/opengl/tools/glgen/src/JniCodeEmitter.java
+++ b/opengl/tools/glgen/src/JniCodeEmitter.java
@@ -454,6 +454,15 @@ public class JniCodeEmitter {
String iii = indent + indent;
+ // emitBoundsChecks(jfunc, out, iii);
+ emitFunctionCall(jfunc, out, iii, false);
+
+ // Set the pointer after we call the native code, so that if
+ // the native code throws an exception we don't modify the
+ // pointer. We assume that the native code is written so that
+ // if an exception is thrown, then the underlying glXXXPointer
+ // function will not have been called.
+
String fname = jfunc.getName();
if (isPointerFunc) {
// TODO - deal with VBO variants
@@ -498,9 +507,6 @@ public class JniCodeEmitter {
}
}
- // emitBoundsChecks(jfunc, out, iii);
- emitFunctionCall(jfunc, out, iii, false);
-
boolean isVoid = jfunc.getType().isVoid();
if (!isVoid) {
@@ -873,19 +879,39 @@ public class JniCodeEmitter {
String array = numBufferArgs <= 1 ? "_array" :
"_" + bufferArgNames.get(bufArgIdx++) + "Array";
- boolean nullAllowed = isNullAllowed(cfunc);
+ boolean nullAllowed = isNullAllowed(cfunc) || isPointerFunc;
if (nullAllowed) {
out.println(indent + "if (" + cname + "_buf) {");
out.print(indent);
}
- out.println(indent +
+ if (isPointerFunc) {
+ out.println(indent +
cname +
" = (" +
cfunc.getArgType(cIndex).getDeclaration() +
- ")getPointer(_env, " +
- cname +
- "_buf, &" + array + ", &" + remaining + ");");
+ ") _env->GetDirectBufferAddress(" +
+ (mUseCPlusPlus ? "" : "_env, ") +
+ cname + "_buf);");
+ String iii = " ";
+ out.println(iii + indent + "if ( ! " + cname + " ) {");
+ out.println(iii + iii + indent +
+ (mUseCPlusPlus ? "_env" : "(*_env)") +
+ "->ThrowNew(" +
+ (mUseCPlusPlus ? "" : "_env, ") +
+ "IAEClass, \"Must use a native order direct Buffer\");");
+ out.println(iii + iii + indent + "return;");
+ out.println(iii + indent + "}");
+ } else {
+ out.println(indent +
+ cname +
+ " = (" +
+ cfunc.getArgType(cIndex).getDeclaration() +
+ ")getPointer(_env, " +
+ cname +
+ "_buf, &" + array + ", &" + remaining +
+ ");");
+ }
if (nullAllowed) {
out.println(indent + "}");
@@ -987,17 +1013,20 @@ public class JniCodeEmitter {
");");
out.println(indent + "}");
} else if (jfunc.getArgType(idx).isBuffer()) {
- String array = numBufferArgs <= 1 ? "_array" :
- "_" + bufferArgNames.get(bufArgIdx++) + "Array";
- out.println(indent + "if (" + array + ") {");
- out.println(indent + indent +
- "releasePointer(_env, " + array + ", " +
- cfunc.getArgName(cIndex) +
- ", " +
- (cfunc.getArgType(cIndex).isConst() ?
- "JNI_FALSE" : "_exception ? JNI_FALSE : JNI_TRUE") +
- ");");
- out.println(indent + "}");
+ if (! isPointerFunc) {
+ String array = numBufferArgs <= 1 ? "_array" :
+ "_" + bufferArgNames.get(bufArgIdx++) + "Array";
+ out.println(indent + "if (" + array + ") {");
+ out.println(indent + indent +
+ "releasePointer(_env, " + array + ", " +
+ cfunc.getArgName(cIndex) +
+ ", " +
+ (cfunc.getArgType(cIndex).isConst() ?
+ "JNI_FALSE" : "_exception ? JNI_FALSE :" +
+ " JNI_TRUE") +
+ ");");
+ out.println(indent + "}");
+ }
}
}
}
diff --git a/opengl/tools/glgen/stubs/gles11/GLES10ExtcHeader.cpp b/opengl/tools/glgen/stubs/gles11/GLES10ExtcHeader.cpp
index 3e5c19c..294d1ce 100644
--- a/opengl/tools/glgen/stubs/gles11/GLES10ExtcHeader.cpp
+++ b/opengl/tools/glgen/stubs/gles11/GLES10ExtcHeader.cpp
@@ -21,11 +21,7 @@
#include <assert.h>
#include <GLES/gl.h>
-
-#include <private/opengles/gl_context.h>
-
-#define _NUM_COMPRESSED_TEXTURE_FORMATS \
- (::android::OGLES_NUM_COMPRESSED_TEXTURE_FORMATS)
+#include <GLES/glext.h>
static int initialized = 0;
diff --git a/opengl/tools/glgen/stubs/gles11/GLES10cHeader.cpp b/opengl/tools/glgen/stubs/gles11/GLES10cHeader.cpp
index 3e5c19c..7aa18b6 100644
--- a/opengl/tools/glgen/stubs/gles11/GLES10cHeader.cpp
+++ b/opengl/tools/glgen/stubs/gles11/GLES10cHeader.cpp
@@ -21,11 +21,7 @@
#include <assert.h>
#include <GLES/gl.h>
-
-#include <private/opengles/gl_context.h>
-
-#define _NUM_COMPRESSED_TEXTURE_FORMATS \
- (::android::OGLES_NUM_COMPRESSED_TEXTURE_FORMATS)
+#include <GLES/glext.h>
static int initialized = 0;
@@ -66,7 +62,6 @@ nativeClassInitBuffer(JNIEnv *_env)
_env->GetFieldID(bufferClass, "_elementSizeShift", "I");
}
-
static void
nativeClassInit(JNIEnv *_env, jclass glImplClass)
{
@@ -117,7 +112,6 @@ getPointer(JNIEnv *_env, jobject buffer, jarray *array, jint *remaining)
return (void *) ((char *) data + offset);
}
-
static void
releasePointer(JNIEnv *_env, jarray array, void *data, jboolean commit)
{
@@ -125,5 +119,12 @@ releasePointer(JNIEnv *_env, jarray array, void *data, jboolean commit)
commit ? 0 : JNI_ABORT);
}
+static int
+getNumCompressedTextureFormats() {
+ int numCompressedTextureFormats = 0;
+ glGetIntegerv(GL_NUM_COMPRESSED_TEXTURE_FORMATS, &numCompressedTextureFormats);
+ return numCompressedTextureFormats;
+}
+
// --------------------------------------------------------------------------
diff --git a/opengl/tools/glgen/stubs/gles11/GLES11ExtcHeader.cpp b/opengl/tools/glgen/stubs/gles11/GLES11ExtcHeader.cpp
index 3e5c19c..294d1ce 100644
--- a/opengl/tools/glgen/stubs/gles11/GLES11ExtcHeader.cpp
+++ b/opengl/tools/glgen/stubs/gles11/GLES11ExtcHeader.cpp
@@ -21,11 +21,7 @@
#include <assert.h>
#include <GLES/gl.h>
-
-#include <private/opengles/gl_context.h>
-
-#define _NUM_COMPRESSED_TEXTURE_FORMATS \
- (::android::OGLES_NUM_COMPRESSED_TEXTURE_FORMATS)
+#include <GLES/glext.h>
static int initialized = 0;
diff --git a/opengl/tools/glgen/stubs/gles11/GLES11cHeader.cpp b/opengl/tools/glgen/stubs/gles11/GLES11cHeader.cpp
index 3e5c19c..294d1ce 100644
--- a/opengl/tools/glgen/stubs/gles11/GLES11cHeader.cpp
+++ b/opengl/tools/glgen/stubs/gles11/GLES11cHeader.cpp
@@ -21,11 +21,7 @@
#include <assert.h>
#include <GLES/gl.h>
-
-#include <private/opengles/gl_context.h>
-
-#define _NUM_COMPRESSED_TEXTURE_FORMATS \
- (::android::OGLES_NUM_COMPRESSED_TEXTURE_FORMATS)
+#include <GLES/glext.h>
static int initialized = 0;
diff --git a/opengl/tools/glgen/stubs/jsr239/GLCHeader.cpp b/opengl/tools/glgen/stubs/jsr239/GLCHeader.cpp
index 4636081..8f174c7 100644
--- a/opengl/tools/glgen/stubs/jsr239/GLCHeader.cpp
+++ b/opengl/tools/glgen/stubs/jsr239/GLCHeader.cpp
@@ -21,11 +21,7 @@
#include <assert.h>
#include <GLES/gl.h>
-
-#include <private/opengles/gl_context.h>
-
-#define _NUM_COMPRESSED_TEXTURE_FORMATS \
- (::android::OGLES_NUM_COMPRESSED_TEXTURE_FORMATS)
+#include <GLES/glext.h>
static int initialized = 0;
@@ -66,7 +62,6 @@ nativeClassInitBuffer(JNIEnv *_env)
_env->GetFieldID(bufferClass, "_elementSizeShift", "I");
}
-
static void
nativeClassInit(JNIEnv *_env, jclass glImplClass)
{
@@ -117,7 +112,6 @@ getPointer(JNIEnv *_env, jobject buffer, jarray *array, jint *remaining)
return (void *) ((char *) data + offset);
}
-
static void
releasePointer(JNIEnv *_env, jarray array, void *data, jboolean commit)
{
@@ -125,5 +119,12 @@ releasePointer(JNIEnv *_env, jarray array, void *data, jboolean commit)
commit ? 0 : JNI_ABORT);
}
+static int
+getNumCompressedTextureFormats() {
+ int numCompressedTextureFormats = 0;
+ glGetIntegerv(GL_NUM_COMPRESSED_TEXTURE_FORMATS, &numCompressedTextureFormats);
+ return numCompressedTextureFormats;
+}
+
// --------------------------------------------------------------------------
diff --git a/services/java/com/android/server/BackupManagerService.java b/services/java/com/android/server/BackupManagerService.java
index 63fc871..e582fb1 100644
--- a/services/java/com/android/server/BackupManagerService.java
+++ b/services/java/com/android/server/BackupManagerService.java
@@ -42,7 +42,9 @@ import android.util.SparseArray;
import android.backup.IBackupManager;
import java.io.File;
+import java.io.FileDescriptor;
import java.io.FileNotFoundException;
+import java.io.PrintWriter;
import java.lang.String;
import java.util.HashSet;
import java.util.List;
@@ -51,7 +53,8 @@ class BackupManagerService extends IBackupManager.Stub {
private static final String TAG = "BackupManagerService";
private static final boolean DEBUG = true;
- private static final long COLLECTION_INTERVAL = 3 * 60 * 1000;
+ private static final long COLLECTION_INTERVAL = 1000;
+ //private static final long COLLECTION_INTERVAL = 3 * 60 * 1000;
private static final int MSG_RUN_BACKUP = 1;
@@ -338,8 +341,11 @@ class BackupManagerService extends IBackupManager.Stub {
// Record that we need a backup pass for the caller. Since multiple callers
// may share a uid, we need to note all candidates within that uid and schedule
// a backup pass for each of them.
+
+ Log.d(TAG, "dataChanged packageName=" + packageName);
HashSet<ServiceInfo> targets = mBackupParticipants.get(Binder.getCallingUid());
+ Log.d(TAG, "targets=" + targets);
if (targets != null) {
synchronized (mQueueLock) {
// Note that this client has made data changes that need to be backed up
@@ -354,6 +360,7 @@ class BackupManagerService extends IBackupManager.Stub {
}
}
+ Log.d(TAG, "Scheduling backup for " + mPendingBackups.size() + " participants");
// Schedule a backup pass in a few minutes. As backup-eligible data
// keeps changing, continue to defer the backup pass until things
// settle down, to avoid extra overhead.
@@ -380,4 +387,23 @@ class BackupManagerService extends IBackupManager.Stub {
}
}
}
+
+
+ @Override
+ public void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
+ synchronized (mQueueLock) {
+ int N = mBackupParticipants.size();
+ pw.println("Participants:");
+ for (int i=0; i<N; i++) {
+ int uid = mBackupParticipants.keyAt(i);
+ pw.print(" uid: ");
+ pw.println(uid);
+ HashSet<ServiceInfo> services = mBackupParticipants.valueAt(i);
+ for (ServiceInfo s: services) {
+ pw.print(" ");
+ pw.println(s.toString());
+ }
+ }
+ }
+ }
}
diff --git a/tests/backup/Android.mk b/tests/backup/Android.mk
index 35c05df..2e3385f 100644
--- a/tests/backup/Android.mk
+++ b/tests/backup/Android.mk
@@ -21,7 +21,7 @@ include $(CLEAR_VARS)
LOCAL_SRC_FILES := \
backup_helper_test.cpp
-LOCAL_MODULE_TAGS := optional
+LOCAL_MODULE_TAGS := user
LOCAL_MODULE := backup_helper_test
LOCAL_SHARED_LIBRARIES := libutils
@@ -31,7 +31,7 @@ include $(BUILD_EXECUTABLE)
# ========================================
include $(CLEAR_VARS)
-LOCAL_MODULE_TAGS := tests
+LOCAL_MODULE_TAGS := user
LOCAL_SRC_FILES := $(call all-subdir-java-files)
diff --git a/tests/backup/AndroidManifest.xml b/tests/backup/AndroidManifest.xml
index c26078b..eaeb5b7 100644
--- a/tests/backup/AndroidManifest.xml
+++ b/tests/backup/AndroidManifest.xml
@@ -10,7 +10,7 @@
</activity>
<service android:name="BackupTestService">
<intent-filter>
- <action android:name="android.backup.BackupService" />
+ <action android:name="android.backup.BackupService.SERVICE" />
</intent-filter>
</service>
</application>
diff --git a/tests/backup/src/com/android/backuptest/BackupTestActivity.java b/tests/backup/src/com/android/backuptest/BackupTestActivity.java
index 31aec39..de68cb7 100644
--- a/tests/backup/src/com/android/backuptest/BackupTestActivity.java
+++ b/tests/backup/src/com/android/backuptest/BackupTestActivity.java
@@ -31,14 +31,58 @@ import android.widget.ArrayAdapter;
import android.widget.ListView;
import android.widget.Toast;
+import java.io.BufferedReader;
+import java.io.InputStreamReader;
+import java.io.IOException;
+import java.io.PrintStream;
+import java.text.DateFormat;
+import java.util.Date;
+
public class BackupTestActivity extends ListActivity
{
static final String TAG = "BackupTestActivity";
static final String PREF_GROUP_SETTINGS = "settings";
static final String PREF_KEY = "pref";
+ static final String FILE_NAME = "file.txt";
Test[] mTests = new Test[] {
+ new Test("Show File") {
+ void run() {
+ StringBuffer str = new StringBuffer();
+ str.append("Text is:");
+ BufferedReader reader = null;
+ try {
+ reader = new BufferedReader(new InputStreamReader(openFileInput(FILE_NAME)));
+ while (reader.ready()) {
+ str.append("\n");
+ str.append(reader.readLine());
+ }
+ } catch (IOException ex) {
+ str.append("ERROR: ");
+ str.append(ex.toString());
+ }
+ Log.d(TAG, str.toString());
+ Toast.makeText(BackupTestActivity.this, str, Toast.LENGTH_SHORT).show();
+ }
+ },
+ new Test("Append to File") {
+ void run() {
+ PrintStream output = null;
+ try {
+ output = new PrintStream(openFileOutput(FILE_NAME, MODE_APPEND));
+ DateFormat formatter = DateFormat.getDateTimeInstance();
+ output.println(formatter.format(new Date()));
+ output.close();
+ } catch (IOException ex) {
+ if (output != null) {
+ output.close();
+ }
+ }
+ BackupManager bm = new BackupManager(BackupTestActivity.this);
+ bm.dataChanged();
+ }
+ },
new Test("Show Shared Pref") {
void run() {
SharedPreferences prefs = getSharedPreferences(PREF_GROUP_SETTINGS, MODE_PRIVATE);