diff options
41 files changed, 813 insertions, 216 deletions
diff --git a/api/current.xml b/api/current.xml index c222d42d58e8..39e9b4d9ad60 100644 --- a/api/current.xml +++ b/api/current.xml @@ -21795,6 +21795,184 @@ </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="false" + synchronized="false" + static="false" + final="false" + deprecated="not deprecated" + visibility="public" +> +</method> +<method name="write" + return="void" + abstract="false" + native="false" + 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="false" + 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="false" + 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="false" + synchronized="false" + static="false" + final="false" + deprecated="not deprecated" + visibility="public" +> +<parameter name="key" type="java.lang.String"> +</parameter> +</method> +</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" diff --git a/core/java/android/app/ActivityThread.java b/core/java/android/app/ActivityThread.java index dfa3fa8f1471..2fc476ec603d 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/backup/BackupDataOutput.java b/core/java/android/backup/BackupDataOutput.java new file mode 100644 index 000000000000..6c47f7eb9f80 --- /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 000000000000..3b2122cb94b9 --- /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 000000000000..e839bb4a93c8 --- /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/speech/IRecognitionService.aidl b/core/java/android/speech/IRecognitionService.aidl index 8f069769cf83..36d12e9aae64 100644 --- a/core/java/android/speech/IRecognitionService.aidl +++ b/core/java/android/speech/IRecognitionService.aidl @@ -16,7 +16,7 @@ package android.speech; -import android.os.Bundle; +import android.content.Intent; import android.speech.IRecognitionListener; // A Service interface to speech recognition. Call startListening when @@ -26,7 +26,8 @@ import android.speech.IRecognitionListener; /** {@hide} */ interface IRecognitionService { // Start listening for speech. Can only call this from one thread at once. - void startListening(in Bundle recognitionParams, + // see RecognizerIntent.java for constants used to specify the intent. + void startListening(in Intent recognizerIntent, in IRecognitionListener listener); void cancel(); diff --git a/core/java/android/util/DisplayMetrics.java b/core/java/android/util/DisplayMetrics.java index 9de4cbe80665..095f4f476417 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 0d5567908af8..86261c4a7edb 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/jni/Android.mk b/core/jni/Android.mk index ac35459b4df6..4839b6f1d991 100644 --- a/core/jni/Android.mk +++ b/core/jni/Android.mk @@ -116,7 +116,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 7c9f457c042a..aa6450d153c2 100644 --- a/core/jni/AndroidRuntime.cpp +++ b/core/jni/AndroidRuntime.cpp @@ -155,6 +155,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; @@ -1125,6 +1126,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 000000000000..e8d60a029749 --- /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 bc644d2e962b..675658023cf6 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 ) */ @@ -1022,6 +1023,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 +1243,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 +1280,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 +1385,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 +1605,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 +1642,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; diff --git a/core/jni/android_opengl_GLES10Ext.cpp b/core/jni/android_opengl_GLES10Ext.cpp index 6114d6ad76a9..f17ef21a521e 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 a7e59a8ea348..ed8dfc8b955d 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 069cec1418ef..6f3495c5062c 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 971f87c2969c..848a57adea4d 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/com_google_android_gles_jni_GLImpl.cpp b/core/jni/com_google_android_gles_jni_GLImpl.cpp index 4ca79b59bb15..7ad0b9ea854e 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 ) */ @@ -1022,6 +1023,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 +1243,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 +1280,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 +1385,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 +1605,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 +1642,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; diff --git a/docs/html/community/index.jd b/docs/html/community/index.jd index 5512d9cdb03f..ab1599a665f4 100644 --- a/docs/html/community/index.jd +++ b/docs/html/community/index.jd @@ -90,7 +90,7 @@ phrasing your questions, read <a href="http://www.catb.org/%7Eesr/faqs/smart-que </ul> </li> -<li><b>Android Market Help Center</b> - A web-based discussion forum where you can ask questions or report issues relating to Android Market. +<li><b>Android Market Help Forum</b> - A web-based discussion forum where you can ask questions or report issues relating to Android Market. <ul> <li>URL: <a href="http://www.google.com/support/forum/p/Android+Market?hl=en">http://www.google.com/support/forum/p/Android+Market?hl=en</a></li> </ul> diff --git a/docs/html/guide/practices/ui_guidelines/widget_design.jd b/docs/html/guide/practices/ui_guidelines/widget_design.jd index 58727af727ee..514b315c0a98 100644 --- a/docs/html/guide/practices/ui_guidelines/widget_design.jd +++ b/docs/html/guide/practices/ui_guidelines/widget_design.jd @@ -21,44 +21,62 @@ page.title=Widget Design Guidelines <li><a href="#frames">Standard widget frames</a></li> <li><a href="#shadows">Standard widget shadows</a></li> <li><a href="#tricks">Widget graphics tips and tricks</a></li> -<li><a href="#file">Windows graphics file format</a></li> +<li><a href="#file">Widget graphics file format</a></li> </ol> <h2>See also</h2> <ol> -<li>The <a href="{@docRoot}guide/topics/appwidgets/index.html">AppWidgets</a> section of the <em>Developer's Guide</em></li> -<li>Jeff Sharkey's <a href="http://android-developers.blogspot.com/2009/04/introducing-home-screen-widgets-and.html">AddWidgets</a> blog post</li> +<li><a href="{@docRoot}guide/topics/appwidgets/index.html">AppWidgets</a> topic in the <em>Dev Guide</em></li> +<li><a href="http://android-developers.blogspot.com/2009/04/introducing-home-screen-widgets-and.html">AppWidgets blog post</a></li> </ol> </div> </div> -<p>Widgets are a new feature introduced in Android™ mobile technology platform 1.5 ("Cupcake"). A widget displays an application's most important or timely information at a glance, on a user's Home screen. The Android open source code includes several examples of widgets, including widgets for Calendar, Music, and other applications.</p> +<p>Widgets are a feature introduced in Android 1.5. A widget displays an +application's most important or timely information at a glance, on a user's Home +screen. The standard Android system image includes several examples of widgets, +including widgets for Analog Clock, Music, and other applications.</p> -<!-- could we include a link to that open source code? --> +<p>Users pick the widgets they want to display on their Home screens by touching +& holding an empty area of the Home screen, selecting Widgets from the menu, +and then selecting the widget they want.</p> -<p>Users pick the widgets they want to display on their Home screens by touching & holding an empty area of the Home screen, selecting Widgets from the menu, and then selecting the widget they want.</p> +<p><img src="{@docRoot}images/widget_design/widget_examples.png" alt="Example +Widgets"></p> -<p><img src="{@docRoot}images/widget_design/widget_examples.png" alt="Example Widgets"></p> +<p>This document describes how to design a widget so it fits graphically with +other widgets and with the other elements of the Android Home screen. It also +describes some standards for widget artwork and some widget graphics tips and +tricks from the Android team.<p> -<p>This document describes how to design a widget so it fits graphically with other widgets and with the other elements of the Android Home screen. It also describes some standards for widget artwork and some widget graphics tips and tricks from the Android team.<p> - -<p>For information about developing widgets, see the <a href="{@docRoot}guide/topics/appwidgets/index.html">AppWidgets</a> section of the <em>Developer's Guide</em> and the <a href="http://android-developers.blogspot.com/2009/04/introducing-home-screen-widgets-and.html">AddWidgets</a> blog post.</p> +<p>For information about developing widgets, see the <a +href="{@docRoot}guide/topics/appwidgets/index.html">AppWidgets</a> section of +the <em>Developer's Guide</em> and the <a +href="http://android-developers.blogspot.com/2009/04/introducing-home-screen-widgets-and.html">AppWidgets</a> blog post.</p> <h2 id="anatomy">Standard widget anatomy</h2> -<p>Typical Android widgets have three main components: A bounding box, a frame, and the widget's graphical controls and other elements. Well-designed widgets leave some padding between the edges of the bounding box and the frame, and between the inner edges of the frame and the widget's controls. Widgets designed to fit visually with other widgets on the Home screen take cues from the other elements on the Home screen for alignment; they also use standard shading effects. All of these details are described in this document. +<p>Typical Android widgets have three main components: A bounding box, a frame, +and the widget's graphical controls and other elements. Well-designed widgets +leave some padding between the edges of the bounding box and the frame, and +between the inner edges of the frame and the widget's controls. Widgets designed +to fit visually with other widgets on the Home screen take cues from the other +elements on the Home screen for alignment; they also use standard shading +effects. All of these details are described in this document. <p><strong>Standard Widget Sizes in Portrait Orientation</strong><br/> -<img src="{@docRoot}images/widget_design/widget_sizes_portrait.png" alt="Standard Widget Sizes in Portrait Orientation"></p> +<img src="{@docRoot}images/widget_design/widget_sizes_portrait.png" +alt="Standard Widget Sizes in Portrait Orientation"></p> <p> </p> <p><strong>Standard Widget Sizes in Landscape Orientation</strong><br/> -<img src="{@docRoot}images/widget_design/widget_sizes_landscape.png" alt="Standard Widget Sizes in Landscape Orientation"></p> +<img src="{@docRoot}images/widget_design/widget_sizes_landscape.png" +alt="Standard Widget Sizes in Landscape Orientation"></p> <h2 id="design">Designing a widget</h2> @@ -66,43 +84,72 @@ page.title=Widget Design Guidelines <ol> <li><strong>Select a bounding box size for your widget.</strong></li> -<p>The most effective widgets display your application's most useful or timely data in the smallest widget size. Users will weigh the usefulness or your widget against the portion of the Home screen it covers, so the smaller the better.</p> +<p>The most effective widgets display your application's most useful or timely +data in the smallest widget size. Users will weigh the usefulness or your widget +against the portion of the Home screen it covers, so the smaller the better.</p> -<p>All widgets must fit within the bounding box of one of the six supported widget sizes, or better yet, within a pair of portrait and landscape orientation sizes, so your widget looks good when the user switches screen orientations.</p> +<p>All widgets must fit within the bounding box of one of the six supported +widget sizes, or better yet, within a pair of portrait and landscape orientation +sizes, so your widget looks good when the user switches screen +orientations.</p> -<p><a href="#sizes">Standard widget sizes</a> illustrates the bounding dimensions of the six widget sizes (three in portrait and three in landscape orientation).</p> +<p><a href="#sizes">Standard widget sizes</a> illustrates the bounding +dimensions of the six widget sizes (three in portrait and three in landscape +orientation).</p> <li><strong>Select a matching frame.</strong></li> -<p><a href="#frames">Standard widget frames</a> illustrates the standard frames for the six widget sizes, with links so you can download copies for your own use. You don't have to use these frames for your widget, but if you do, your widgets are more likely to fit visually with other widgets.</p> +<p><a href="#frames">Standard widget frames</a> illustrates the standard frames +for the six widget sizes, with links so you can download copies for your own +use. You don't have to use these frames for your widget, but if you do, your +widgets are more likely to fit visually with other widgets.</p> <li><strong>Apply standard shadow effect to your graphics.</strong></li> -<p>Again, you don't have to use this effect, but <a href="#shadows">Standard widget shadows</a> shows the Photoshop settings used for standard widgets.</p> +<p>Again, you don't have to use this effect, but <a href="#shadows">Standard +widget shadows</a> shows the Photoshop settings used for standard widgets.</p> -<li><strong>If your widget includes buttons, draw them in three states (default, pressed, and selected).</strong></li> +<li><strong>If your widget includes buttons, draw them in three states +(default, pressed, and selected).</strong></li> -<p>You can <a href="{@docRoot}images/widget_design/Music_widget_button_states.psd">download a Photoshop file that contains the three states of the Play button</a>, taken from the Music widget, to analyze the Photoshop settings used for the three standard button effects.</p> +<p>You can <a +href="{@docRoot}images/widget_design/Music_widget_button_states.psd">download a +Photoshop file that contains the three states of the Play button</a>, taken from +the Music widget, to analyze the Photoshop settings used for the three standard +button effects.</p> -<p><a href="{@docRoot}images/widget_design/Music_widget_button_states.psd"> <img src="{@docRoot}images/widget_design/buttons.png" alt="Click to download Photoshop template"></a></p> +<p><a href="{@docRoot}images/widget_design/Music_widget_button_states.psd"> <img +src="{@docRoot}images/widget_design/buttons.png" alt="Click to download +Photoshop template"></a></p> -<li><strong>Finish drawing your artwork and then scale and align it to fit.</strong></li> +<li><strong>Finish drawing your artwork and then scale and align it to +fit.</strong></li> -<p><a href="#tricks">Widget alignment tips and tricks</a> describes some techniques for aligning your widget's graphics inside the standard frames, along with a few other widget graphics tricks.</p> +<p><a href="#tricks">Widget alignment tips and tricks</a> describes some +techniques for aligning your widget's graphics inside the standard frames, along +with a few other widget graphics tricks.</p> -<li><strong>Save your widget with the correct graphics file settings.</strong></li> +<li><strong>Save your widget with the correct graphics file +settings.</strong></li> -<p><a href="#file">Windows graphics file format</a> describes the correct settings for your widget graphics files.</p> +<p><a href="#file">Windows graphics file format</a> describes the correct +settings for your widget graphics files.</p> </ol> <h2 id="sizes">Standard widget sizes</h2> -<p>There are six standard widget sizes, based on a Home screen grid of 4 x 4 (portrait) or 4 x 4 (landscape) cells. These dimensions are the bounding boxes for the six standard widget sizes. The contents of typical widgets don't draw to the edge of these dimensions, but fit inside a frame withing the bounding box, as described in <a href="#design">Designing a widget</a>.</p> +<p>There are six standard widget sizes, based on a Home screen grid of 4 x 4 +(portrait) or 4 x 4 (landscape) cells. These dimensions are the bounding boxes +for the six standard widget sizes. The contents of typical widgets don't draw to +the edge of these dimensions, but fit inside a frame withing the bounding box, +as described in <a href="#design">Designing a widget</a>.</p> -<p>In portrait orientation, each cell is 80 pixels wide by 100 pixels tall (the diagram shows a cell in portrait orientation). The three supported widget sizes in portrait orientation are:<p> +<p>In portrait orientation, each cell is 80 pixels wide by 100 pixels tall (the +diagram shows a cell in portrait orientation). The three supported widget sizes +in portrait orientation are:<p> <table> <tr><th>Cells</th><th>Pixels</th></tr> @@ -111,9 +158,11 @@ page.title=Widget Design Guidelines <tr><td>2 x 2</td><td>160 x 200</td></tr> </table> -<p><img src="{@docRoot}images/widget_design/portrait_sizes.png" alt="Widget dimensions in portrait orientation"></p> +<p><img src="{@docRoot}images/widget_design/portrait_sizes.png" alt="Widget +dimensions in portrait orientation"></p> -<p>In landscape orientation, each cell is 106 pixels wide by 74 pixels tall. The three supported widget sizes in landscape orientation are:</p> +<p>In landscape orientation, each cell is 106 pixels wide by 74 pixels tall. The +three supported widget sizes in landscape orientation are:</p> <table> <tr><th>Cells</th><th>Pixels</th></tr> @@ -122,60 +171,100 @@ page.title=Widget Design Guidelines <tr><td>2 x 2</td><td>212 x 148</td></tr> </table> -<p><img src="{@docRoot}images/widget_design/landscape_sizes.png" alt="Widget dimensions in landscape orientation"></p> +<p><img src="{@docRoot}images/widget_design/landscape_sizes.png" alt="Widget +dimensions in landscape orientation"></p> <h2 id="frames">Standard widget frames</h2> -<p>For each of the six standard widget sizes there is a standard frame. You can click the images of the frames in this section to download a Photoshop file for that frame, which you can use for your own widgets.<p> +<p>For each of the six standard widget sizes there is a standard frame. You can +click the images of the frames in this section to download a Photoshop file for +that frame, which you can use for your own widgets.<p> -<p><a href="{@docRoot}images/widget_design/4x1_Widget_Frame_Portrait.psd"> <img src="{@docRoot}images/widget_design/4x1_Widget_Frame_Portrait.png" alt="Click to download"></a><br>4x1_Widget_Frame_Portrait.psd</p> +<p><a href="{@docRoot}images/widget_design/4x1_Widget_Frame_Portrait.psd"> <img +src="{@docRoot}images/widget_design/4x1_Widget_Frame_Portrait.png" alt="Click to +download"></a><br>4x1_Widget_Frame_Portrait.psd</p> -<p><a href="{@docRoot}images/widget_design/3x3_Widget_Frame_Portrait.psd"> <img src="{@docRoot}images/widget_design/3x3_Widget_Frame_Portrait.png" alt="Click to download"></a><br>3x3_Widget_Frame_Portrait.psd</p> +<p><a href="{@docRoot}images/widget_design/3x3_Widget_Frame_Portrait.psd"> <img +src="{@docRoot}images/widget_design/3x3_Widget_Frame_Portrait.png" alt="Click to +download"></a><br>3x3_Widget_Frame_Portrait.psd</p> -<p><a href="{@docRoot}images/widget_design/2x2_Widget_Frame_Portrait.psd"> <img src="{@docRoot}images/widget_design/2x2_Widget_Frame_Portrait.png" alt="Click to download"></a><br>2x2_Widget_Frame_Portrait.psd</p> +<p><a href="{@docRoot}images/widget_design/2x2_Widget_Frame_Portrait.psd"> <img +src="{@docRoot}images/widget_design/2x2_Widget_Frame_Portrait.png" alt="Click to +download"></a><br>2x2_Widget_Frame_Portrait.psd</p> -<p><a href="{@docRoot}images/widget_design/4x1_Widget_Frame_Landscape.psd"> <img src="{@docRoot}images/widget_design/4x1_Widget_Frame_Landscape.png" alt="Click to download"></a><br>4x1_Widget_Frame_Landscape.psd</p> +<p><a href="{@docRoot}images/widget_design/4x1_Widget_Frame_Landscape.psd"> <img +src="{@docRoot}images/widget_design/4x1_Widget_Frame_Landscape.png" alt="Click +to download"></a><br>4x1_Widget_Frame_Landscape.psd</p> -<p><a href="{@docRoot}images/widget_design/3x3_Widget_Frame_Landscape.psd"> <img src="{@docRoot}images/widget_design/3x3_Widget_Frame_Landscape.png" alt="Click to download"></a><br>3x3_Widget_Frame_Landscape.psd</p> +<p><a href="{@docRoot}images/widget_design/3x3_Widget_Frame_Landscape.psd"> <img +src="{@docRoot}images/widget_design/3x3_Widget_Frame_Landscape.png" alt="Click +to download"></a><br>3x3_Widget_Frame_Landscape.psd</p> -<p><a href="{@docRoot}images/widget_design/2x2_Widget_Frame_Landscape.psd"> <img src="{@docRoot}images/widget_design/2x2_Widget_Frame_Landscape.png" alt="Click to download"></a><br>2x2_Widget_Frame_Landscape.psd</p> +<p><a href="{@docRoot}images/widget_design/2x2_Widget_Frame_Landscape.psd"> <img +src="{@docRoot}images/widget_design/2x2_Widget_Frame_Landscape.png" alt="Click +to download"></a><br>2x2_Widget_Frame_Landscape.psd</p> <h2 id="shadows">Standard widget shadows</h2> -<p>You can apply a shadow effect to your widget's artwork, so it matches other standard Android widgets, using the following settings in the Photoshop Layer Style dialog box.</p> +<p>You can apply a shadow effect to your widget's artwork, so it matches other +standard Android widgets, using the following settings in the Photoshop Layer +Style dialog box.</p> -<p><img src="{@docRoot}images/widget_design/Layer_Style.png" alt="Layer Style settings for standard shadows"></p> +<p><img src="{@docRoot}images/widget_design/Layer_Style.png" alt="Layer Style +settings for standard shadows"></p> <h2 id="tricks">Widget graphics tips and tricks</h2> -<p>The Android team has developed a few tricks for aligning widget artwork within standard widget bounding boxes and frames, so the widget aligns visually with other widgets and the other elements of the Home screen, as well as other techniques for creating widgets. +<p>The Android team has developed a few tricks for aligning widget artwork +within standard widget bounding boxes and frames, so the widget aligns visually +with other widgets and the other elements of the Home screen, as well as other +techniques for creating widgets. <ul> -<li>Use a screen shot from the Android SDK emulator to align both the shapes and shadows of your widget controls with the Search widget and with other elements on the Home screen.</li> +<li>Use a screen shot from the Android SDK emulator to align both the shapes and +shadows of your widget controls with the Search widget and with other elements +on the Home screen.</li> -<p>Cut the widget artwork asset" based on the full size of a cell, including any padding you want. (That is, for a 4 x 1 widget, cut the asset at 320 by 100 pixels.)</p> +<p>Cut the widget artwork asset" based on the full size of a cell, including any +padding you want. (That is, for a 4 x 1 widget, cut the asset at 320 by 100 +pixels.)</p> -<p><img src="{@docRoot}images/widget_design/alignment.png" alt="Aligning widget graphics" ></p> +<p><img src="{@docRoot}images/widget_design/alignment.png" alt="Aligning widget +graphics" ></p> -<li>To reduce banding when exporting a widget, apply the following Photoshop Add Noise setting to your graphic.</li> +<li>To reduce banding when exporting a widget, apply the following Photoshop Add +Noise setting to your graphic.</li> -<p><img src="{@docRoot}images/widget_design/Add_Noise.png" alt="Add Noise settings for widget graphics" ></p> +<p><img src="{@docRoot}images/widget_design/Add_Noise.png" alt="Add Noise +settings for widget graphics" ></p> -<li>Apply 9-patch techniques to shrink the graphic and set the padding of the content area. (<a href="{@docRoot}guide/developing/tools/draw9patch.html">See the detailed guide here.</a>)</li> +<li>Apply 9-patch techniques to shrink the graphic and set the padding of the +content area. (<a href="{@docRoot}guide/developing/tools/draw9patch.html">See +the detailed guide here.</a>)</li> -<p><strong>Note:</strong> The current Android widget templates were designed using a custom gradient angle, which means the 9-patch techniques can't be used to optimize the size of the asset. However, 9-patch techniques were used to set the content area padding.</p> +<p><strong>Note:</strong> The current Android widget templates were designed +using a custom gradient angle, which means the 9-patch techniques can't be used +to optimize the size of the asset. However, 9-patch techniques were used to set +the content area padding.</p> -<li>In some cases, devices have low pixel depths that can cause visual banding and dithering issues. To solve this, application developers should pass assets through a "proxy" drawable defined as <code>XML:<nine-patch android:src="@drawable/background" android:dither="true" /></code>. This technique references the original artwork, in this case <code>"background.9.png"</code>, and instructs the device to dither it as needed.</li> +<li>In some cases, devices have low pixel depths that can cause visual banding +and dithering issues. To solve this, application developers should pass assets +through a "proxy" drawable defined as <code>XML:<nine-patch +android:src="@drawable/background" android:dither="true" /></code>. This +technique references the original artwork, in this case +<code>"background.9.png"</code>, and instructs the device to dither it as +needed.</li> </ul> <h2 id="file">Widget graphics file format</h2> -<p>Save your widget artwork using the appropriate bounding box size in PNG-24 format on a transparent background and in 8-bit color.</p> +<p>Save your widget artwork using the appropriate bounding box size in PNG-24 +format on a transparent background and in 8-bit color.</p> <p><img src="{@docRoot}images/widget_design/file_format.png" alt="Widget graphics file format" ></p> diff --git a/docs/html/guide/topics/fundamentals.jd b/docs/html/guide/topics/fundamentals.jd index 3c7f419713f8..71705d354f62 100644 --- a/docs/html/guide/topics/fundamentals.jd +++ b/docs/html/guide/topics/fundamentals.jd @@ -464,7 +464,7 @@ two intent filters to the activity: </intent-filter> <intent-filter . . . > <action android:name="com.example.project.BOUNCE" /> - <data android:type="image/jpeg" /> + <data android:mimeType="image/jpeg" /> <category android:name="android.intent.category.DEFAULT" /> </intent-filter> </activity> diff --git a/docs/html/guide/topics/resources/index.jd b/docs/html/guide/topics/resources/index.jd index 7e3bce42eef9..1425cfaa1af2 100644 --- a/docs/html/guide/topics/resources/index.jd +++ b/docs/html/guide/topics/resources/index.jd @@ -18,8 +18,8 @@ In general, these are external elements that you want to include and reference w like images, audio, video, text strings, layouts, themes, etc. Every Android application contains a directory for resources (<code>res/</code>) and a directory for assets (<code>assets/</code>). Assets are used less often, because their applications are far fewer. You only need to save data -as an asset when you need to read the raw bites. -The directories for resources and assets both reside at the top of your project directory, alongside your source code directory +as an asset when you need to read the raw bytes. The directories for resources and assets both +reside at the top of an Android project tree, at the same level as your source code directory (<code>src/</code>).</p> <p>The difference between "resources" and "assets" isn't much on the surface, but in general, diff --git a/docs/html/sdk/1.5_r1/index.jd b/docs/html/sdk/1.5_r1/index.jd index 89892e95a179..438ee4bb80ce 100644 --- a/docs/html/sdk/1.5_r1/index.jd +++ b/docs/html/sdk/1.5_r1/index.jd @@ -50,8 +50,7 @@ page.title=Android 1.5 SDK, Release 1 <td width="5%"><nobr>Android 1.1</nobr></td> <td width="5%">2</td> <td width="5%"><nobr><a href="{@docRoot}sdk/android-1.1.html">Version Notes</a></nobr></td> -<td>Includes a compliant Android 1.1 library and system image with a set of development applications. Also includes the Maps external library (due to legacy build system issues).</a> -external library. </td> +<td>Includes a compliant Android 1.1 library and system image with a set of development applications. Also includes the Maps external library (due to legacy build system issues).</td> </tr> </table> diff --git a/docs/html/sdk/1.5_r1/requirements.jd b/docs/html/sdk/1.5_r1/requirements.jd index c3ee8f7eac44..4ed38a741261 100644 --- a/docs/html/sdk/1.5_r1/requirements.jd +++ b/docs/html/sdk/1.5_r1/requirements.jd @@ -16,8 +16,9 @@ page.title=System Requirements <ul> <li><a href="http://www.eclipse.org/downloads/">Eclipse</a> 3.3 (Europa), 3.4 (Ganymede) <ul> + <li>Recommended Eclipse IDE packages: Eclipse IDE for Java EE Developers, Eclipse IDE for Java Developers, Eclipse for RCP/Plug-in Developers</li> <li>Eclipse <a href="http://www.eclipse.org/jdt">JDT</a> plugin (included in most Eclipse IDE packages) </li> - <li><a href="http://www.eclipse.org/webtools">WST</a> (optional, but needed for the Android Editors feature; included in <a href="http://www.eclipse.org/downloads/moreinfo/compare.php">most Eclipse IDE packages</a>)</li> + <li>Eclipse Classic IDE package is not supported.</li> </ul> </li> <li><a href="http://java.sun.com/javase/downloads/index.jsp">JDK 5 or JDK 6</a> (JRE alone is not sufficient)</li> diff --git a/docs/html/sdk/RELEASENOTES.jd b/docs/html/sdk/RELEASENOTES.jd index db932158cd0d..c44cef3a55fb 100644 --- a/docs/html/sdk/RELEASENOTES.jd +++ b/docs/html/sdk/RELEASENOTES.jd @@ -29,7 +29,7 @@ that are running concurrently.</li> <li>Support for SDK add-ons, which extend the Android SDK to give you access to one or more external Android libraries and/or a customized (but compliant) system image that can run in the emulator. </li> - <li>The new Eclipse ADT plugin (version 0.9.0) offers new Wizards to let you + <li>The new Eclipse ADT plugin (version 0.9.x) offers new Wizards to let you create projects targetted for specific Android configurations, generate XML resources (such as layouts, animations, and menus), generate alternate layouts, and export and sign your application for publishing.</li> diff --git a/docs/html/sdk/adt_download.jd b/docs/html/sdk/adt_download.jd index 69969061fd77..8b22e2c15ebb 100644 --- a/docs/html/sdk/adt_download.jd +++ b/docs/html/sdk/adt_download.jd @@ -8,7 +8,7 @@ update site</a> in Eclipse, you can download the ADT zip file and install it from your computer (archived site) instead. </p> <p> -If you go with this method, in order to update the plugin, you will need to +If you use this approach, in order to update the plugin, you will need to download the latest version from this page, uninstall the old version from Eclipse, then install the new version. For more details on the procedure, see Troubleshooting ADT Installation in the @@ -16,7 +16,7 @@ see Troubleshooting ADT Installation in the page</a>. </p> <p> -<table> +<table class="download"> <tr> <th><nobr>ADT Version</nobr></th> <th>Package</th> @@ -26,41 +26,49 @@ page</a>. </tr> <tr> - <td style="background-color:#ffcccc;">0.9.0</td> - <td style="background-color:#ffcccc;"><a href="http://dl-ssl.google.com/android/ADT-0.9.0.zip">ADT-0.9.0.zip</a></td> - <td style="background-color:#ffcccc;"><nobr>2889330 bytes</nobr></td> - <td style="background-color:#ffcccc;"><nobr>4f4c4ece3071cf65bbd4e5da7bbde8af</nobr></td> - <td style="background-color:#ffcccc;"><nobr>Required for users of Android 1.5 SDK (and later releases). <em><nobr>27 Apr 2009</nobr></em></td> + <td>0.9.1</td> + <td><a href="http://dl-ssl.google.com/android/ADT-0.9.1.zip">ADT-0.9.1.zip</a></td> + <td><nobr>2916093 bytes</nobr></td> + <td><nobr>e7b2ab40414ac98</nobr></td> + <td><nobr>Required for users of Android 1.5 SDK (and later releases). Updated from 0.9.0. <em><nobr>6 May 2009</nobr></em></td> </tr> - <tr> + <tr class="alt-color"> <td>0.8.0</td> <td><a href="http://dl-ssl.google.com/android/ADT-0.8.0.zip">ADT-0.8.0.zip</a></td> <td colspan="2"><nobr> </nobr></td> <td><nobr>Required for users of Android 1.1 SDK and Android 1.0 SDK. <em><nobr>23 Sep 2008</nobr></em></td> </tr> +</table> + + +<h4>Older Versions of ADT</h4> + +<p>The table below lists older versions of the ADT Plugin that are no longer supported. If you are developing applications that are intended to be deployable to Android-powered devices, make sure that you upgrade to the most current SDK release available and use the most current version of the ADT Plugin, as listed in the section above.</p> + +<p>If you are not sure what version of ADT is installed in your Eclipse environment, open Eclipse and from the main menu select <strong>Help</strong> > <strong>About Eclipse</strong> > <strong>Features Details</strong>. Locate "com.android.ide.eclipse.adt" in the +Feature ID column and look at its version number.</p> + +<table> + <tr> + <th><nobr>ADT Version</nobr></th> + <th>Notes</th> + </tr> + <tr> <td>0.7.1</td> - <td><a href="http://dl-ssl.google.com/android/ADT-0.7.1.zip">ADT-0.7.1.zip</a></td> - <td colspan="2"><nobr> </nobr></td> <td>Required for users of Android 0.9 SDK beta. As of this version, <b>Eclipse 3.2 is no longer supported.</b> Please upgrade to Eclipse Ganymede (3.4) or Europa (3.3) if you are still using 3.2. <em><nobr>18 Aug 2008</nobr></em></td> </tr> <tr> <td>0.4.0</td> - <td><a href="http://dl-ssl.google.com/android/ADT-0.4.0.zip">ADT-0.4.0.zip</a></td> - <td colspan="2"><nobr> </nobr></td> <td>Required if you are using the M5 SDK. See the SDK Release Notes for details on changes and enhancements in this version. <em><nobr>12 Feb 2008</nobr></em></td> </tr> <tr> <td>0.3.3</td> - <td><a href="http://dl-ssl.google.com/android/ADT-0.3.3.zip">ADT-0.3.3.zip</a></td> - <td colspan="2"><nobr> </nobr></td> <td>Some significant enhancements (see m3-rc37 SDK Release Notes). <em><nobr>14 Dec 2007</nobr></em></td> </tr> <tr> <td>0.3.1</td> - <td><a href="http://dl-ssl.google.com/android/ADT-0.3.1.zip">ADT-0.3.1.zip</a></td> - <td colspan="2"><nobr> </nobr></td> <td>Initial Release. Required for Android m3-rc20 SDK and Android m3-rc22 SDK.<em><nobr>21 Nov 2007</nobr></em></td> </tr> </table> diff --git a/media/libmedia/ToneGenerator.cpp b/media/libmedia/ToneGenerator.cpp index d1789addb922..81ee92c5a121 100644 --- a/media/libmedia/ToneGenerator.cpp +++ b/media/libmedia/ToneGenerator.cpp @@ -357,7 +357,7 @@ ToneGenerator::~ToneGenerator() { bool ToneGenerator::startTone(int toneType) { bool lResult = false; - if (toneType >= NUM_TONES) + if ((toneType < 0) || (toneType >= NUM_TONES)) return lResult; if (mState == TONE_IDLE) { diff --git a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/MediaMetadataTest.java b/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/MediaMetadataTest.java index 364e1af3b8f9..3715913877e4 100644 --- a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/MediaMetadataTest.java +++ b/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/MediaMetadataTest.java @@ -170,21 +170,25 @@ public class MediaMetadataTest extends AndroidTestCase { validateMetatData(non_mp3_test_file.WAV.ordinal(), MediaNames.META_DATA_OTHERS); } + @Suppress @MediumTest public static void testWma9_Metadata() throws Exception { validateMetatData(non_mp3_test_file.WMA9.ordinal(), MediaNames.META_DATA_OTHERS); } + @Suppress @MediumTest public static void testWma10_Metadata() throws Exception { validateMetatData(non_mp3_test_file.WMA10.ordinal(), MediaNames.META_DATA_OTHERS); } + @Suppress @MediumTest public static void testWmv9_Metadata() throws Exception { validateMetatData(non_mp3_test_file.WMV9.ordinal(), MediaNames.META_DATA_OTHERS); } + @Suppress @MediumTest public static void testWmv10_Metadata() throws Exception { validateMetatData(non_mp3_test_file.WMV7.ordinal(), MediaNames.META_DATA_OTHERS); diff --git a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/MediaPlayerApiTest.java b/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/MediaPlayerApiTest.java index cfcc521e803d..8be7058babf7 100644 --- a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/MediaPlayerApiTest.java +++ b/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/MediaPlayerApiTest.java @@ -78,6 +78,7 @@ public class MediaPlayerApiTest extends ActivityInstrumentationTestCase<MediaFra assertTrue("MIDI getDuration", duratoinWithinTolerence); } + @Suppress @MediumTest public void testWMA9GetDuration() throws Exception { int duration = CodecTest.getDuration(MediaNames.WMA9); @@ -118,7 +119,8 @@ public class MediaPlayerApiTest extends ActivityInstrumentationTestCase<MediaFra boolean currentPosition = CodecTest.getCurrentPosition(MediaNames.MIDI); assertTrue("MIDI GetCurrentPosition", currentPosition); } - + + @Suppress @LargeTest public void testWMA9GetCurrentPosition() throws Exception { boolean currentPosition = CodecTest.getCurrentPosition(MediaNames.WMA9); @@ -156,6 +158,7 @@ public class MediaPlayerApiTest extends ActivityInstrumentationTestCase<MediaFra assertTrue("MIDI Pause", isPaused); } + @Suppress @LargeTest public void testWMA9Pause() throws Exception { boolean isPaused = CodecTest.pause(MediaNames.WMA9); @@ -227,6 +230,7 @@ public class MediaPlayerApiTest extends ActivityInstrumentationTestCase<MediaFra assertTrue("MIDI setLooping", isLoop); } + @Suppress @LargeTest public void testWMA9SetLooping() throws Exception { boolean isLoop = CodecTest.setLooping(MediaNames.WMA9); @@ -265,6 +269,7 @@ public class MediaPlayerApiTest extends ActivityInstrumentationTestCase<MediaFra assertTrue("MIDI seekTo", isLoop); } + @Suppress @LargeTest public void testWMA9SeekTo() throws Exception { boolean isLoop = CodecTest.seekTo(MediaNames.WMA9); @@ -304,6 +309,7 @@ public class MediaPlayerApiTest extends ActivityInstrumentationTestCase<MediaFra assertTrue("MIDI seekToEnd", isEnd); } + @Suppress @LargeTest public void testWMA9SeekToEnd() throws Exception { boolean isEnd = CodecTest.seekToEnd(MediaNames.WMA9); @@ -379,7 +385,8 @@ public class MediaPlayerApiTest extends ActivityInstrumentationTestCase<MediaFra boolean isSeek = CodecTest.videoSeekTo(MediaNames.VIDEO_H264_AMR); assertTrue("H264AMR SeekTo", isSeek); } - + + @Suppress @LargeTest public void testVideoWMVSeekTo() throws Exception { boolean isSeek = CodecTest.videoSeekTo(MediaNames.VIDEO_WMV); @@ -450,4 +457,3 @@ public class MediaPlayerApiTest extends ActivityInstrumentationTestCase<MediaFra assertTrue("StreamH264PrepareAsyncCallback", onPrepareSuccess); } } - diff --git a/opengl/tools/glgen/specs/gles11/checks.spec b/opengl/tools/glgen/specs/gles11/checks.spec index 97dac2efccfe..e31a2ce50e03 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 a84ed65332a3..55840fa10143 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/stubs/gles11/GLES10ExtcHeader.cpp b/opengl/tools/glgen/stubs/gles11/GLES10ExtcHeader.cpp index 3e5c19cdde42..294d1ce82e72 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 3e5c19cdde42..7aa18b63e00c 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 3e5c19cdde42..294d1ce82e72 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 3e5c19cdde42..294d1ce82e72 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 4636081cf0f3..8f174c7f9e98 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 63fc871e8ec9..e582fb15c603 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/services/java/com/android/server/LocationManagerService.java b/services/java/com/android/server/LocationManagerService.java index c924d8dfead7..14c834b722da 100644 --- a/services/java/com/android/server/LocationManagerService.java +++ b/services/java/com/android/server/LocationManagerService.java @@ -918,12 +918,9 @@ public class LocationManagerService extends ILocationManager.Stub implements Run } } } - if (LocationManager.GPS_PROVIDER.equals(provider) || - LocationManager.NETWORK_PROVIDER.equals(provider)) { - for (ProximityAlert alert : mProximityAlerts.values()) { - if (alert.mUid == uid) { - return true; - } + for (ProximityAlert alert : mProximityAlerts.values()) { + if (alert.mUid == uid) { + return true; } } return false; @@ -1359,13 +1356,8 @@ public class LocationManagerService extends ILocationManager.Stub implements Run mProximityListener = new ProximityListener(); mProximityReceiver = new Receiver(mProximityListener); - LocationProviderProxy provider = mProvidersByName.get(LocationManager.GPS_PROVIDER); - if (provider != null) { - requestLocationUpdatesLocked(provider.getName(), 1000L, 1.0f, mProximityReceiver); - } - - provider = mProvidersByName.get(LocationManager.NETWORK_PROVIDER); - if (provider != null) { + for (int i = mProviders.size() - 1; i >= 0; i--) { + LocationProviderProxy provider = mProviders.get(i); requestLocationUpdatesLocked(provider.getName(), 1000L, 1.0f, mProximityReceiver); } } @@ -1809,9 +1801,13 @@ public class LocationManagerService extends ILocationManager.Stub implements Run if (mProvidersByName.get(name) != null) { throw new IllegalArgumentException("Provider \"" + name + "\" already exists"); } + + // clear calling identity so INSTALL_LOCATION_PROVIDER permission is not required + long identity = Binder.clearCallingIdentity(); addProvider(new LocationProviderProxy(name, provider)); mMockProviders.put(name, provider); updateProvidersLocked(); + Binder.restoreCallingIdentity(identity); } } @@ -1835,7 +1831,10 @@ public class LocationManagerService extends ILocationManager.Stub implements Run if (mockProvider == null) { throw new IllegalArgumentException("Provider \"" + provider + "\" unknown"); } + // clear calling identity so INSTALL_LOCATION_PROVIDER permission is not required + long identity = Binder.clearCallingIdentity(); mockProvider.setLocation(loc); + Binder.restoreCallingIdentity(identity); } } diff --git a/tests/CoreTests/android/location/LocationManagerProximityTest.java b/tests/CoreTests/android/location/LocationManagerProximityTest.java index e1501e34e528..3f43bcf08148 100644 --- a/tests/CoreTests/android/location/LocationManagerProximityTest.java +++ b/tests/CoreTests/android/location/LocationManagerProximityTest.java @@ -52,11 +52,7 @@ public class LocationManagerProximityTest extends AndroidTestCase { private static final String LOG_TAG = "LocationProximityTest"; - // use network provider as mock location provider, because: - // - proximity alert is hardcoded to listen to only network or gps - // - 'network' provider is not installed in emulator, so can mock it - // using test provider APIs - private static final String PROVIDER_NAME = LocationManager.NETWORK_PROVIDER; + private static final String PROVIDER_NAME = "test"; @Override protected void setUp() throws Exception { @@ -84,6 +80,7 @@ public class LocationManagerProximityTest extends AndroidTestCase { false, // upportsBearing, Criteria.POWER_MEDIUM, // powerRequirement Criteria.ACCURACY_FINE); // accuracy + mLocationManager.setTestProviderEnabled(PROVIDER_NAME, true); } @Override diff --git a/tests/backup/Android.mk b/tests/backup/Android.mk index 35c05df59fb8..2e3385f8b569 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 c26078bb60e8..eaeb5b72da94 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 31aec3997909..de68cb7356ca 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); |