Merge change 1108 into donut
* changes:
* update density correctly when the configuration is changed. * Turns private sLcdDensity to public DEVICE_DENSITY to use it in ActivityThread
diff --git a/api/current.xml b/api/current.xml
index 509abe1..39e9b4d 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"
@@ -135944,6 +136122,19 @@
visibility="public"
>
</method>
+<method name="getTag"
+ return="java.lang.Object"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="key" type="int">
+</parameter>
+</method>
<method name="getTop"
return="int"
abstract="false"
@@ -137843,6 +138034,21 @@
<parameter name="tag" type="java.lang.Object">
</parameter>
</method>
+<method name="setTag"
+ return="void"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="key" type="int">
+</parameter>
+<parameter name="tag" type="java.lang.Object">
+</parameter>
+</method>
<method name="setTouchDelegate"
return="void"
abstract="false"
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/BackupService.java b/core/java/android/backup/BackupService.java
index 5a6886d..6ac703a 100644
--- a/core/java/android/backup/BackupService.java
+++ b/core/java/android/backup/BackupService.java
@@ -33,7 +33,7 @@
* In order to use the backup service, your application must implement a
* subclass of BackupService, and declare an intent filter
* in the application manifest specifying that your BackupService subclass
- * handles the {link #SERVICE_ACTION} intent action. For example:
+ * handles the {@link BackupService#SERVICE_ACTION} intent action. For example:
*
* <pre class="prettyprint">
* <!-- Use the class "MyBackupService" to perform backups for my app -->
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/speech/IRecognitionService.aidl b/core/java/android/speech/IRecognitionService.aidl
index 8f06976..36d12e9a 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 @@
/** {@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/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 @@
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/android/view/View.java b/core/java/android/view/View.java
index 07c56ee..d042f28d 100644
--- a/core/java/android/view/View.java
+++ b/core/java/android/view/View.java
@@ -61,6 +61,7 @@
import java.util.ArrayList;
import java.util.Arrays;
+import java.util.WeakHashMap;
import java.lang.ref.SoftReference;
import java.lang.reflect.Method;
import java.lang.reflect.InvocationTargetException;
@@ -1287,7 +1288,17 @@
* a Rect. :)
*/
static final ThreadLocal<Rect> sThreadLocal = new ThreadLocal<Rect>();
-
+
+ /**
+ * Map used to store views' tags.
+ */
+ private static WeakHashMap<View, SparseArray<Object>> sTags;
+
+ /**
+ * Lock used to access sTags.
+ */
+ private static final Object sTagsLock = new Object();
+
/**
* The animation currently associated with this view.
* @hide
@@ -7000,6 +7011,9 @@
* Returns this view's tag.
*
* @return the Object stored in this view as a tag
+ *
+ * @see #setTag(Object)
+ * @see #getTag(int)
*/
@ViewDebug.ExportedProperty
public Object getTag() {
@@ -7013,12 +7027,102 @@
* resorting to another data structure.
*
* @param tag an Object to tag the view with
+ *
+ * @see #getTag()
+ * @see #setTag(int, Object)
*/
public void setTag(final Object tag) {
mTag = tag;
}
/**
+ * Returns the tag associated with this view and the specified key.
+ *
+ * @param key The key identifying the tag
+ *
+ * @return the Object stored in this view as a tag
+ *
+ * @see #setTag(int, Object)
+ * @see #getTag()
+ */
+ public Object getTag(int key) {
+ SparseArray<Object> tags = null;
+ synchronized (sTagsLock) {
+ if (sTags != null) {
+ tags = sTags.get(this);
+ }
+ }
+
+ if (tags != null) return tags.get(key);
+ return null;
+ }
+
+ /**
+ * Sets a tag associated with this view and a key. A tag can be used
+ * to mark a view in its hierarchy and does not have to be unique within
+ * the hierarchy. Tags can also be used to store data within a view
+ * without resorting to another data structure.
+ *
+ * The specified key should be an id declared in the resources of the
+ * application to ensure it is unique. Keys identified as belonging to
+ * the Android framework or not associated with any package will cause
+ * an {@link IllegalArgumentException} to be thrown.
+ *
+ * @param key The key identifying the tag
+ * @param tag An Object to tag the view with
+ *
+ * @throws IllegalArgumentException If they specified key is not valid
+ *
+ * @see #setTag(Object)
+ * @see #getTag(int)
+ */
+ public void setTag(int key, final Object tag) {
+ // If the package id is 0x00 or 0x01, it's either an undefined package
+ // or a framework id
+ if ((key >>> 24) < 2) {
+ throw new IllegalArgumentException("The key must be an application-specific "
+ + "resource id.");
+ }
+
+ setTagInternal(this, key, tag);
+ }
+
+ /**
+ * Variation of {@link #setTag(int, Object)} that enforces the key to be a
+ * framework id.
+ *
+ * @hide
+ */
+ public void setTagInternal(int key, Object tag) {
+ if ((key >>> 24) != 0x1) {
+ throw new IllegalArgumentException("The key must be a framework-specific "
+ + "resource id.");
+ }
+
+ setTagInternal(this, key, tag);
+ }
+
+ private static void setTagInternal(View view, int key, Object tag) {
+ SparseArray<Object> tags = null;
+ synchronized (sTagsLock) {
+ if (sTags == null) {
+ sTags = new WeakHashMap<View, SparseArray<Object>>();
+ } else {
+ tags = sTags.get(view);
+ }
+ }
+
+ if (tags == null) {
+ tags = new SparseArray<Object>(2);
+ synchronized (sTagsLock) {
+ sTags.put(view, tags);
+ }
+ }
+
+ tags.put(key, tag);
+ }
+
+ /**
* Prints information about this view in the log output, with the tag
* {@link #VIEW_LOG_TAG}.
*
diff --git a/core/jni/Android.mk b/core/jni/Android.mk
index ac35459..4839b6f 100644
--- a/core/jni/Android.mk
+++ b/core/jni/Android.mk
@@ -116,7 +116,8 @@
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 7c9f457..aa6450d 100644
--- a/core/jni/AndroidRuntime.cpp
+++ b/core/jni/AndroidRuntime.cpp
@@ -155,6 +155,7 @@
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 @@
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..6756580 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 @@
_env->GetFieldID(bufferClass, "_elementSizeShift", "I");
}
-
static void
nativeClassInit(JNIEnv *_env, jclass glImplClass)
{
@@ -118,7 +113,6 @@
return (void *) ((char *) data + offset);
}
-
static void
releasePointer(JNIEnv *_env, jarray array, void *data, jboolean commit)
{
@@ -126,6 +120,13 @@
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 @@
#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 @@
#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 @@
#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 @@
#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 @@
#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 @@
#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 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/com_google_android_gles_jni_GLImpl.cpp b/core/jni/com_google_android_gles_jni_GLImpl.cpp
index 4ca79b5..7ad0b9e 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 @@
_env->GetFieldID(bufferClass, "_elementSizeShift", "I");
}
-
static void
nativeClassInit(JNIEnv *_env, jclass glImplClass)
{
@@ -118,7 +113,6 @@
return (void *) ((char *) data + offset);
}
-
static void
releasePointer(JNIEnv *_env, jarray array, void *data, jboolean commit)
{
@@ -126,6 +120,13 @@
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 @@
#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 @@
#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 @@
#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 @@
#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 @@
#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 @@
#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/res/res/drawable/ic_contact_picture.png b/core/res/res/drawable/ic_contact_picture.png
new file mode 100644
index 0000000..3a338e8
--- /dev/null
+++ b/core/res/res/drawable/ic_contact_picture.png
Binary files differ
diff --git a/docs/html/community/index.jd b/docs/html/community/index.jd
index 5512d9c..ab1599a 100644
--- a/docs/html/community/index.jd
+++ b/docs/html/community/index.jd
@@ -90,7 +90,7 @@
</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 58727af..514b315 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 @@
<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 @@
<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 @@
<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 @@
<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 3c7f419..71705d3 100644
--- a/docs/html/guide/topics/fundamentals.jd
+++ b/docs/html/guide/topics/fundamentals.jd
@@ -464,7 +464,7 @@
</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 7e3bce42..1425cfa 100644
--- a/docs/html/guide/topics/resources/index.jd
+++ b/docs/html/guide/topics/resources/index.jd
@@ -18,8 +18,8 @@
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 89892e9..438ee4b 100644
--- a/docs/html/sdk/1.5_r1/index.jd
+++ b/docs/html/sdk/1.5_r1/index.jd
@@ -50,8 +50,7 @@
<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 c3ee8f7..4ed38a7 100644
--- a/docs/html/sdk/1.5_r1/requirements.jd
+++ b/docs/html/sdk/1.5_r1/requirements.jd
@@ -16,8 +16,9 @@
<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 db93215..c44cef3 100644
--- a/docs/html/sdk/RELEASENOTES.jd
+++ b/docs/html/sdk/RELEASENOTES.jd
@@ -29,7 +29,7 @@
<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 6996906..8b22e2c 100644
--- a/docs/html/sdk/adt_download.jd
+++ b/docs/html/sdk/adt_download.jd
@@ -8,7 +8,7 @@
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 @@
page</a>.
</p>
<p>
-<table>
+<table class="download">
<tr>
<th><nobr>ADT Version</nobr></th>
<th>Package</th>
@@ -26,41 +26,49 @@
</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/location/java/android/location/ILocationProvider.aidl b/location/java/android/location/ILocationProvider.aidl
index e3e374d..6c23f83 100644
--- a/location/java/android/location/ILocationProvider.aidl
+++ b/location/java/android/location/ILocationProvider.aidl
@@ -44,6 +44,4 @@
boolean sendExtraCommand(String command, inout Bundle extras);
void addListener(int uid);
void removeListener(int uid);
- void wakeLockAcquired();
- void wakeLockReleased();
}
diff --git a/location/java/com/android/internal/location/GpsLocationProvider.java b/location/java/com/android/internal/location/GpsLocationProvider.java
index 97b6a62..21c7adb 100644
--- a/location/java/com/android/internal/location/GpsLocationProvider.java
+++ b/location/java/com/android/internal/location/GpsLocationProvider.java
@@ -34,6 +34,7 @@
import android.net.SntpClient;
import android.os.Bundle;
import android.os.IBinder;
+import android.os.PowerManager;
import android.os.RemoteException;
import android.os.ServiceManager;
import android.os.SystemClock;
@@ -207,6 +208,10 @@
private int mSuplDataConnectionState;
private final ConnectivityManager mConnMgr;
+ // Wakelocks
+ private final static String WAKELOCK_KEY = "GpsLocationProvider";
+ private final PowerManager.WakeLock mWakeLock;
+
// Alarms
private final static String ALARM_WAKEUP = "com.android.internal.location.ALARM_WAKEUP";
private final AlarmManager mAlarmManager;
@@ -307,6 +312,10 @@
mContext = context;
mLocationManager = locationManager;
+ // Create a wake lock
+ PowerManager powerManager = (PowerManager) mContext.getSystemService(Context.POWER_SERVICE);
+ mWakeLock = powerManager.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, WAKELOCK_KEY);
+
mAlarmManager = (AlarmManager)mContext.getSystemService(Context.ALARM_SERVICE);
mWakeupIntent = PendingIntent.getBroadcast(mContext, 0, new Intent(ALARM_WAKEUP), 0);
@@ -574,12 +583,6 @@
}
}
- public void wakeLockAcquired() {
- }
-
- public void wakeLockReleased() {
- }
-
public void addListener(int uid) {
mClientUids.put(uid, 0);
if (mNavigating) {
@@ -767,6 +770,10 @@
mNavigating = (status == GPS_STATUS_SESSION_BEGIN);
if (wasNavigating != mNavigating) {
+ if (mNavigating) {
+ if (DEBUG) Log.d(TAG, "Acquiring wakelock");
+ mWakeLock.acquire();
+ }
synchronized(mListeners) {
int size = mListeners.size();
for (int i = 0; i < size; i++) {
@@ -804,6 +811,11 @@
Intent intent = new Intent(GPS_ENABLED_CHANGE_ACTION);
intent.putExtra(EXTRA_ENABLED, mNavigating);
mContext.sendBroadcast(intent);
+
+ if (!mNavigating) {
+ if (DEBUG) Log.d(TAG, "Releasing wakelock");
+ mWakeLock.release();
+ }
}
}
diff --git a/location/java/com/android/internal/location/LocationProviderProxy.java b/location/java/com/android/internal/location/LocationProviderProxy.java
index abca28f..80303f4 100644
--- a/location/java/com/android/internal/location/LocationProviderProxy.java
+++ b/location/java/com/android/internal/location/LocationProviderProxy.java
@@ -231,20 +231,4 @@
Log.e(TAG, "removeListener failed", e);
}
}
-
- public void wakeLockAcquired() {
- try {
- mProvider.wakeLockAcquired();
- } catch (RemoteException e) {
- Log.e(TAG, "wakeLockAcquired failed", e);
- }
- }
-
- public void wakeLockReleased() {
- try {
- mProvider.wakeLockReleased();
- } catch (RemoteException e) {
- Log.e(TAG, "wakeLockReleased failed", e);
- }
- }
}
diff --git a/location/java/com/android/internal/location/MockProvider.java b/location/java/com/android/internal/location/MockProvider.java
index d81d0ab..f167a44 100644
--- a/location/java/com/android/internal/location/MockProvider.java
+++ b/location/java/com/android/internal/location/MockProvider.java
@@ -182,12 +182,6 @@
public void removeListener(int uid) {
}
- public void wakeLockAcquired() {
- }
-
- public void wakeLockReleased() {
- }
-
public void dump(PrintWriter pw, String prefix) {
pw.println(prefix + mName);
pw.println(prefix + "mHasLocation=" + mHasLocation);
diff --git a/media/jni/soundpool/SoundPool.cpp b/media/jni/soundpool/SoundPool.cpp
index 02731825..0812650 100644
--- a/media/jni/soundpool/SoundPool.cpp
+++ b/media/jni/soundpool/SoundPool.cpp
@@ -18,7 +18,8 @@
#define LOG_TAG "SoundPool"
#include <utils/Log.h>
-//#define USE_SHARED_MEM_BUFFER
+//
+#define USE_SHARED_MEM_BUFFER
// XXX needed for timing latency
#include <utils/Timers.h>
@@ -507,10 +508,12 @@
frameCount = sample->size()/numChannels/((sample->format() == AudioSystem::PCM_16_BIT) ? sizeof(int16_t) : sizeof(uint8_t));
}
+#ifndef USE_SHARED_MEM_BUFFER
// Ensure minimum audio buffer size in case of short looped sample
if(frameCount < kDefaultBufferCount * bufferFrames) {
frameCount = kDefaultBufferCount * bufferFrames;
}
+#endif
AudioTrack* newTrack;
diff --git a/media/libmedia/ToneGenerator.cpp b/media/libmedia/ToneGenerator.cpp
index d1789ad..81ee92c 100644
--- a/media/libmedia/ToneGenerator.cpp
+++ b/media/libmedia/ToneGenerator.cpp
@@ -357,7 +357,7 @@
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 364e1af..3715913 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 @@
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 cfcc521..8be7058 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 @@
assertTrue("MIDI getDuration", duratoinWithinTolerence);
}
+ @Suppress
@MediumTest
public void testWMA9GetDuration() throws Exception {
int duration = CodecTest.getDuration(MediaNames.WMA9);
@@ -118,7 +119,8 @@
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 @@
assertTrue("MIDI Pause", isPaused);
}
+ @Suppress
@LargeTest
public void testWMA9Pause() throws Exception {
boolean isPaused = CodecTest.pause(MediaNames.WMA9);
@@ -227,6 +230,7 @@
assertTrue("MIDI setLooping", isLoop);
}
+ @Suppress
@LargeTest
public void testWMA9SetLooping() throws Exception {
boolean isLoop = CodecTest.setLooping(MediaNames.WMA9);
@@ -265,6 +269,7 @@
assertTrue("MIDI seekTo", isLoop);
}
+ @Suppress
@LargeTest
public void testWMA9SeekTo() throws Exception {
boolean isLoop = CodecTest.seekTo(MediaNames.WMA9);
@@ -304,6 +309,7 @@
assertTrue("MIDI seekToEnd", isEnd);
}
+ @Suppress
@LargeTest
public void testWMA9SeekToEnd() throws Exception {
boolean isEnd = CodecTest.seekToEnd(MediaNames.WMA9);
@@ -379,7 +385,8 @@
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 @@
assertTrue("StreamH264PrepareAsyncCallback", onPrepareSuccess);
}
}
-
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 @@
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 @@
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 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 @@
_env->GetFieldID(bufferClass, "_elementSizeShift", "I");
}
-
static void
nativeClassInit(JNIEnv *_env, jclass glImplClass)
{
@@ -117,7 +112,6 @@
return (void *) ((char *) data + offset);
}
-
static void
releasePointer(JNIEnv *_env, jarray array, void *data, jboolean commit)
{
@@ -125,5 +119,12 @@
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 @@
_env->GetFieldID(bufferClass, "_elementSizeShift", "I");
}
-
static void
nativeClassInit(JNIEnv *_env, jclass glImplClass)
{
@@ -117,7 +112,6 @@
return (void *) ((char *) data + offset);
}
-
static void
releasePointer(JNIEnv *_env, jarray array, void *data, jboolean commit)
{
@@ -125,5 +119,12 @@
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 56caeea..e582fb15 100644
--- a/services/java/com/android/server/BackupManagerService.java
+++ b/services/java/com/android/server/BackupManagerService.java
@@ -18,14 +18,18 @@
import android.backup.BackupService;
import android.backup.IBackupService;
+import android.content.BroadcastReceiver;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
+import android.content.IntentFilter;
import android.content.ServiceConnection;
import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
import android.content.pm.ServiceInfo;
+import android.net.Uri;
import android.os.Binder;
+import android.os.Bundle;
import android.os.Environment;
import android.os.Handler;
import android.os.IBinder;
@@ -38,7 +42,9 @@
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;
@@ -47,7 +53,8 @@
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;
@@ -207,38 +214,138 @@
mStateDir.mkdirs();
mDataDir = Environment.getDownloadCacheDirectory();
- // Identify the backup participants
- // !!! TODO: also watch package-install to keep this up to date
- List<ResolveInfo> services = mPackageManager.queryIntentServices(
- new Intent(BackupService.SERVICE_ACTION), 0);
- if (DEBUG) {
- Log.v(TAG, "Backup participants: " + services.size());
- for (ResolveInfo ri : services) {
- Log.v(TAG, " " + ri + " : " + ri.filter);
- }
+ // Build our mapping of uid to backup client services
+ synchronized (mBackupParticipants) {
+ addPackageParticipantsLocked(null);
}
- // Build our mapping of uid to backup client services
- for (ResolveInfo ri : services) {
- int uid = ri.serviceInfo.applicationInfo.uid;
- HashSet<ServiceInfo> set = mBackupParticipants.get(uid);
- if (set == null) {
- set = new HashSet<ServiceInfo>();
- mBackupParticipants.put(uid, set);
+ // Register for broadcasts about package install, etc., so we can
+ // update the provider list.
+ IntentFilter filter = new IntentFilter();
+ filter.addAction(Intent.ACTION_PACKAGE_ADDED);
+ filter.addAction(Intent.ACTION_PACKAGE_REMOVED);
+ filter.addDataScheme("package");
+ mContext.registerReceiver(mBroadcastReceiver, filter);
+ }
+
+ // ----- Track installation/removal of packages -----
+ BroadcastReceiver mBroadcastReceiver = new BroadcastReceiver() {
+ public void onReceive(Context context, Intent intent) {
+ if (DEBUG) Log.d(TAG, "Received broadcast " + intent);
+
+ Uri uri = intent.getData();
+ if (uri == null) {
+ return;
}
- set.add(ri.serviceInfo);
+ String pkgName = uri.getSchemeSpecificPart();
+ if (pkgName == null) {
+ return;
+ }
+
+ String action = intent.getAction();
+ if (Intent.ACTION_PACKAGE_ADDED.equals(action)) {
+ synchronized (mBackupParticipants) {
+ Bundle extras = intent.getExtras();
+ if (extras != null && extras.getBoolean(Intent.EXTRA_REPLACING, false)) {
+ // The package was just upgraded
+ updatePackageParticipantsLocked(pkgName);
+ } else {
+ // The package was just added
+ addPackageParticipantsLocked(pkgName);
+ }
+ }
+ }
+ else if (Intent.ACTION_PACKAGE_REMOVED.equals(action)) {
+ Bundle extras = intent.getExtras();
+ if (extras != null && extras.getBoolean(Intent.EXTRA_REPLACING, false)) {
+ // The package is being updated. We'll receive a PACKAGE_ADDED shortly.
+ } else {
+ synchronized (mBackupParticipants) {
+ removePackageParticipantsLocked(pkgName);
+ }
+ }
+ }
+ }
+ };
+
+ // Add the backup services in the given package to our set of known backup participants.
+ // If 'packageName' is null, adds all backup services in the system.
+ void addPackageParticipantsLocked(String packageName) {
+ List<ResolveInfo> services = mPackageManager.queryIntentServices(
+ new Intent(BackupService.SERVICE_ACTION), 0);
+ addPackageParticipantsLockedInner(packageName, services);
+ }
+
+ private void addPackageParticipantsLockedInner(String packageName, List<ResolveInfo> services) {
+ for (ResolveInfo ri : services) {
+ if (packageName == null || ri.serviceInfo.packageName.equals(packageName)) {
+ int uid = ri.serviceInfo.applicationInfo.uid;
+ HashSet<ServiceInfo> set = mBackupParticipants.get(uid);
+ if (set == null) {
+ set = new HashSet<ServiceInfo>();
+ mBackupParticipants.put(uid, set);
+ }
+ if (DEBUG) {
+ Log.v(TAG, "Adding " + services.size() + " backup participants:");
+ for (ResolveInfo svc : services) {
+ Log.v(TAG, " " + svc + " : " + svc.filter);
+ }
+ }
+
+ set.add(ri.serviceInfo);
+ }
}
}
-
+ // Remove the given package's backup services from our known active set. If
+ // 'packageName' is null, *all* backup services will be removed.
+ void removePackageParticipantsLocked(String packageName) {
+ List<ResolveInfo> services = mPackageManager.queryIntentServices(
+ new Intent(BackupService.SERVICE_ACTION), 0);
+ removePackageParticipantsLockedInner(packageName, services);
+ }
+
+ private void removePackageParticipantsLockedInner(String packageName, List<ResolveInfo> services) {
+ for (ResolveInfo ri : services) {
+ if (packageName == null || ri.serviceInfo.packageName.equals(packageName)) {
+ int uid = ri.serviceInfo.applicationInfo.uid;
+ HashSet<ServiceInfo> set = mBackupParticipants.get(uid);
+ if (set != null) {
+ set.remove(ri.serviceInfo);
+ if (set.size() == 0) {
+ mBackupParticipants.put(uid, null);
+ }
+ }
+ }
+ }
+ }
+
+ // Reset the given package's known backup participants. Unlike add/remove, the update
+ // action cannot be passed a null package name.
+ void updatePackageParticipantsLocked(String packageName) {
+ if (packageName == null) {
+ Log.e(TAG, "updatePackageParticipants called with null package name");
+ return;
+ }
+
+ // brute force but small code size
+ List<ResolveInfo> services = mPackageManager.queryIntentServices(
+ new Intent(BackupService.SERVICE_ACTION), 0);
+ removePackageParticipantsLockedInner(packageName, services);
+ addPackageParticipantsLockedInner(packageName, services);
+ }
+
// ----- IBackupManager binder interface -----
public void dataChanged(String packageName) throws RemoteException {
// 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
@@ -253,6 +360,7 @@
}
}
+ 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.
@@ -279,4 +387,23 @@
}
}
}
+
+
+ @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 9af729e..14c834b 100644
--- a/services/java/com/android/server/LocationManagerService.java
+++ b/services/java/com/android/server/LocationManagerService.java
@@ -33,7 +33,6 @@
import java.util.Set;
import java.util.regex.Pattern;
-import android.app.AlarmManager;
import android.app.PendingIntent;
import android.content.BroadcastReceiver;
import android.content.ContentQueryMap;
@@ -123,8 +122,6 @@
private static boolean sProvidersLoaded = false;
private final Context mContext;
- private LocationProviderProxy mGpsLocationProvider;
- private LocationProviderProxy mNetworkLocationProvider;
private IGeocodeProvider mGeocodeProvider;
private IGpsStatusProvider mGpsStatusProvider;
private LocationWorkerHandler mLocationHandler;
@@ -132,16 +129,10 @@
// Handler messages
private static final int MESSAGE_LOCATION_CHANGED = 1;
- // Alarm manager and wakelock variables
- private final static String ALARM_INTENT = "com.android.location.ALARM_INTENT";
+ // wakelock variables
private final static String WAKELOCK_KEY = "LocationManagerService";
- private AlarmManager mAlarmManager;
- private long mAlarmInterval = 0;
private PowerManager.WakeLock mWakeLock = null;
private int mPendingBroadcasts;
- private long mWakeLockAcquireTime = 0;
- private boolean mWakeLockGpsReceived = true;
- private boolean mWakeLockNetworkReceived = true;
/**
* List of all receivers.
@@ -388,24 +379,22 @@
public void onSendFinished(PendingIntent pendingIntent, Intent intent,
int resultCode, String resultData, Bundle resultExtras) {
- decrementPendingBroadcasts();
- }
-
- // this must be called while synchronized by callerin a synchronized block
- // containing the sending of the broadcaset
- private void incrementPendingBroadcastsLocked() {
- if (mPendingBroadcasts++ == 0) {
- synchronized (mLock) {
- LocationManagerService.this.incrementPendingBroadcastsLocked();
- }
+ synchronized (this) {
+ decrementPendingBroadcastsLocked();
}
}
- private void decrementPendingBroadcasts() {
- synchronized (this) {
- if (--mPendingBroadcasts == 0) {
- LocationManagerService.this.decrementPendingBroadcasts();
- }
+ // this must be called while synchronized by caller in a synchronized block
+ // containing the sending of the broadcaset
+ private void incrementPendingBroadcastsLocked() {
+ if (mPendingBroadcasts++ == 0) {
+ LocationManagerService.this.incrementPendingBroadcasts();
+ }
+ }
+
+ private void decrementPendingBroadcastsLocked() {
+ if (--mPendingBroadcasts == 0) {
+ LocationManagerService.this.decrementPendingBroadcasts();
}
}
}
@@ -413,7 +402,12 @@
public void locationCallbackFinished(ILocationListener listener) {
Receiver receiver = getReceiver(listener);
if (receiver != null) {
- receiver.decrementPendingBroadcasts();
+ synchronized (receiver) {
+ // so wakelock calls will succeed
+ long identity = Binder.clearCallingIdentity();
+ receiver.decrementPendingBroadcastsLocked();
+ Binder.restoreCallingIdentity(identity);
+ }
}
}
@@ -526,15 +520,6 @@
mProvidersByName.remove(provider.getName());
}
- /**
- * Load providers from /data/location/<provider_name>/
- * class
- * kml
- * nmea
- * track
- * location
- * properties
- */
private void loadProviders() {
synchronized (mLock) {
if (sProvidersLoaded) {
@@ -561,9 +546,8 @@
// Create a gps location provider
GpsLocationProvider provider = new GpsLocationProvider(mContext, this);
mGpsStatusProvider = provider.getGpsStatusProvider();
- mGpsLocationProvider =
- new LocationProviderProxy(LocationManager.GPS_PROVIDER, provider);
- addProvider(mGpsLocationProvider);
+ LocationProviderProxy proxy = new LocationProviderProxy(LocationManager.GPS_PROVIDER, provider);
+ addProvider(proxy);
}
updateProvidersLocked();
@@ -585,30 +569,20 @@
}
private void initialize() {
- // Alarm manager, needs to be done before calling loadProviders() below
- mAlarmManager = (AlarmManager) mContext.getSystemService(Context.ALARM_SERVICE);
-
// Create a wake lock, needs to be done before calling loadProviders() below
PowerManager powerManager = (PowerManager) mContext.getSystemService(Context.POWER_SERVICE);
mWakeLock = powerManager.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, WAKELOCK_KEY);
-
+
// Load providers
loadProviders();
// Register for Network (Wifi or Mobile) updates
- NetworkStateBroadcastReceiver networkReceiver = new NetworkStateBroadcastReceiver();
- IntentFilter networkIntentFilter = new IntentFilter();
- networkIntentFilter.addAction(ConnectivityManager.CONNECTIVITY_ACTION);
- networkIntentFilter.addAction(GpsLocationProvider.GPS_ENABLED_CHANGE_ACTION);
- mContext.registerReceiver(networkReceiver, networkIntentFilter);
-
- // Register for power updates
- PowerStateBroadcastReceiver powerStateReceiver = new PowerStateBroadcastReceiver();
IntentFilter intentFilter = new IntentFilter();
- intentFilter.addAction(ALARM_INTENT);
+ intentFilter.addAction(ConnectivityManager.CONNECTIVITY_ACTION);
+ // Register for Package Manager updates
intentFilter.addAction(Intent.ACTION_PACKAGE_REMOVED);
intentFilter.addAction(Intent.ACTION_PACKAGE_RESTARTED);
- mContext.registerReceiver(powerStateReceiver, intentFilter);
+ mContext.registerReceiver(mBroadcastReceiver, intentFilter);
// listen for settings changes
ContentResolver resolver = mContext.getContentResolver();
@@ -637,15 +611,12 @@
}
synchronized (mLock) {
- // FIXME - only network location provider supported for now
- if (LocationManager.NETWORK_PROVIDER.equals(name)) {
- mNetworkLocationProvider = new LocationProviderProxy(name, provider);
- addProvider(mNetworkLocationProvider);
- updateProvidersLocked();
+ LocationProviderProxy proxy = new LocationProviderProxy(name, provider);
+ addProvider(proxy);
+ updateProvidersLocked();
- // notify NetworkLocationProvider of any events it might have missed
- mNetworkLocationProvider.updateNetworkState(mNetworkState);
- }
+ // notify provider of current network state
+ proxy.updateNetworkState(mNetworkState);
}
}
@@ -825,12 +796,10 @@
if (listeners > 0) {
p.setMinTime(getMinTimeLocked(provider));
p.enableLocationTracking(true);
- updateWakelockStatusLocked();
}
} else {
p.enableLocationTracking(false);
p.disable();
- updateWakelockStatusLocked();
}
}
@@ -949,12 +918,9 @@
}
}
}
- 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;
@@ -1020,7 +986,6 @@
long minTimeForProvider = getMinTimeLocked(provider);
proxy.setMinTime(minTimeForProvider);
proxy.enableLocationTracking(true);
- updateWakelockStatusLocked();
} else {
// Notify the listener that updates are currently disabled
receiver.callProviderEnabledLocked(provider, false);
@@ -1109,8 +1074,6 @@
}
}
}
-
- updateWakelockStatusLocked();
} finally {
Binder.restoreCallingIdentity(identity);
}
@@ -1258,13 +1221,13 @@
Intent enteredIntent = new Intent();
enteredIntent.putExtra(LocationManager.KEY_PROXIMITY_ENTERING, true);
try {
- synchronized (mLock) {
- // synchronize to ensure incrementPendingBroadcastsLocked()
+ synchronized (this) {
+ // synchronize to ensure incrementPendingBroadcasts()
// is called before decrementPendingBroadcasts()
intent.send(mContext, 0, enteredIntent, this, mLocationHandler);
// call this after broadcasting so we do not increment
// if we throw an exeption.
- incrementPendingBroadcastsLocked();
+ incrementPendingBroadcasts();
}
} catch (PendingIntent.CanceledException e) {
if (LOCAL_LOGV) {
@@ -1283,13 +1246,13 @@
Intent exitedIntent = new Intent();
exitedIntent.putExtra(LocationManager.KEY_PROXIMITY_ENTERING, false);
try {
- synchronized (mLock) {
- // synchronize to ensure incrementPendingBroadcastsLocked()
+ synchronized (this) {
+ // synchronize to ensure incrementPendingBroadcasts()
// is called before decrementPendingBroadcasts()
intent.send(mContext, 0, exitedIntent, this, mLocationHandler);
// call this after broadcasting so we do not increment
// if we throw an exeption.
- incrementPendingBroadcastsLocked();
+ incrementPendingBroadcasts();
}
} catch (PendingIntent.CanceledException e) {
if (LOCAL_LOGV) {
@@ -1346,7 +1309,11 @@
public void onSendFinished(PendingIntent pendingIntent, Intent intent,
int resultCode, String resultData, Bundle resultExtras) {
- decrementPendingBroadcasts();
+ // synchronize to ensure incrementPendingBroadcasts()
+ // is called before decrementPendingBroadcasts()
+ synchronized (this) {
+ decrementPendingBroadcasts();
+ }
}
}
@@ -1389,13 +1356,8 @@
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);
}
}
@@ -1581,11 +1543,6 @@
}
writeLastKnownLocationLocked(provider, location);
- if (LocationManager.NETWORK_PROVIDER.equals(p.getName())) {
- mWakeLockNetworkReceived = true;
- }
- // Gps location received signal is in NetworkStateBroadcastReceiver
-
// Fetch latest status update time
long newStatusUpdateTime = p.getStatusUpdateTime();
@@ -1668,7 +1625,6 @@
}
handleLocationChangedLocked(location);
- updateWakelockStatusLocked();
}
}
} catch (Exception e) {
@@ -1678,20 +1634,12 @@
}
}
- private class PowerStateBroadcastReceiver extends BroadcastReceiver {
- @Override public void onReceive(Context context, Intent intent) {
+ private final BroadcastReceiver mBroadcastReceiver = new BroadcastReceiver() {
+ @Override
+ public void onReceive(Context context, Intent intent) {
String action = intent.getAction();
- if (action.equals(ALARM_INTENT)) {
- synchronized (mLock) {
- log("PowerStateBroadcastReceiver: Alarm received");
- // Have to do this immediately, rather than posting a
- // message, so we execute our code while the system
- // is holding a wake lock until the alarm broadcast
- // is finished.
- acquireWakeLockLocked();
- }
- } else if (action.equals(Intent.ACTION_PACKAGE_REMOVED)
+ if (action.equals(Intent.ACTION_PACKAGE_REMOVED)
|| action.equals(Intent.ACTION_PACKAGE_RESTARTED)) {
synchronized (mLock) {
int uid = intent.getIntExtra(Intent.EXTRA_UID, -1);
@@ -1733,15 +1681,7 @@
}
}
}
- }
- }
- }
-
- private class NetworkStateBroadcastReceiver extends BroadcastReceiver {
- @Override public void onReceive(Context context, Intent intent) {
- String action = intent.getAction();
-
- if (action.equals(ConnectivityManager.CONNECTIVITY_ACTION)) {
+ } else if (action.equals(ConnectivityManager.CONNECTIVITY_ACTION)) {
boolean noConnectivity =
intent.getBooleanExtra(ConnectivityManager.EXTRA_NO_CONNECTIVITY, false);
if (!noConnectivity) {
@@ -1759,146 +1699,43 @@
}
}
}
- } else if (action.equals(GpsLocationProvider.GPS_ENABLED_CHANGE_ACTION)) {
-
- final boolean enabled = intent.getBooleanExtra(GpsLocationProvider.EXTRA_ENABLED,
- false);
-
- synchronized (mLock) {
- if (!enabled) {
- // When GPS is disabled, we are OK to release wake-lock
- mWakeLockGpsReceived = true;
- }
- }
}
-
}
- }
+ };
// Wake locks
- private void updateWakelockStatusLocked() {
- log("updateWakelockStatus()");
-
- long callerId = Binder.clearCallingIdentity();
-
- boolean needsLock = (mPendingBroadcasts > 0);
- long minTime = Integer.MAX_VALUE;
-
- if (mNetworkLocationProvider != null && mNetworkLocationProvider.isLocationTracking()) {
- needsLock = true;
- minTime = Math.min(mNetworkLocationProvider.getMinTime(), minTime);
- }
-
- if (mGpsLocationProvider != null && mGpsLocationProvider.isLocationTracking()) {
- needsLock = true;
- minTime = Math.min(mGpsLocationProvider.getMinTime(), minTime);
- }
-
- PendingIntent sender =
- PendingIntent.getBroadcast(mContext, 0, new Intent(ALARM_INTENT), 0);
-
- // Cancel existing alarm
- log("Cancelling existing alarm");
- mAlarmManager.cancel(sender);
-
- if (needsLock) {
- long now = SystemClock.elapsedRealtime();
- mAlarmManager.set(
- AlarmManager.ELAPSED_REALTIME_WAKEUP, now + minTime, sender);
- mAlarmInterval = minTime;
- log("Creating a new wakelock alarm with minTime = " + minTime);
- } else {
- log("No need for alarm");
- mAlarmInterval = -1;
-
- releaseWakeLockLocked();
- }
- Binder.restoreCallingIdentity(callerId);
- }
-
- private void acquireWakeLockLocked() {
- try {
- acquireWakeLockXLocked();
- } catch (Exception e) {
- // This is to catch a runtime exception thrown when we try to release an
- // already released lock.
- Log.e(TAG, "exception in acquireWakeLock()", e);
- }
- }
-
- private void acquireWakeLockXLocked() {
- if (mWakeLock.isHeld()) {
- log("Must release wakelock before acquiring");
- mWakeLockAcquireTime = 0;
- mWakeLock.release();
- }
-
- boolean networkActive = (mNetworkLocationProvider != null)
- && mNetworkLocationProvider.isLocationTracking();
- boolean gpsActive = (mGpsLocationProvider != null)
- && mGpsLocationProvider.isLocationTracking();
-
- boolean needsLock = networkActive || gpsActive;
- if (!needsLock) {
- log("No need for Lock!");
- return;
- }
-
- mWakeLockGpsReceived = !gpsActive;
- mWakeLockNetworkReceived = !networkActive;
-
- // Acquire wake lock
- mWakeLock.acquire();
- mWakeLockAcquireTime = SystemClock.elapsedRealtime();
- log("Acquired wakelock");
-
- if (mNetworkLocationProvider != null) {
- mNetworkLocationProvider.wakeLockAcquired();
- }
- if (mGpsLocationProvider != null) {
- mGpsLocationProvider.wakeLockAcquired();
- }
- }
-
- private void releaseWakeLockLocked() {
- try {
- releaseWakeLockXLocked();
- } catch (Exception e) {
- // This is to catch a runtime exception thrown when we try to release an
- // already released lock.
- Log.e(TAG, "exception in releaseWakeLock()", e);
- }
- }
-
- private void releaseWakeLockXLocked() {
- if (mNetworkLocationProvider != null) {
- mNetworkLocationProvider.wakeLockReleased();
- }
- if (mGpsLocationProvider != null) {
- mGpsLocationProvider.wakeLockReleased();
- }
-
- // Release wake lock
- mWakeLockAcquireTime = 0;
- if (mWakeLock.isHeld()) {
- log("Released wakelock");
- mWakeLock.release();
- } else {
- log("Can't release wakelock again!");
- }
- }
-
- private void incrementPendingBroadcastsLocked() {
- if (mPendingBroadcasts++ == 0) {
- updateWakelockStatusLocked();
+ private void incrementPendingBroadcasts() {
+ synchronized (mWakeLock) {
+ if (mPendingBroadcasts++ == 0) {
+ try {
+ mWakeLock.acquire();
+ log("Acquired wakelock");
+ } catch (Exception e) {
+ // This is to catch a runtime exception thrown when we try to release an
+ // already released lock.
+ Log.e(TAG, "exception in acquireWakeLock()", e);
+ }
+ }
}
}
private void decrementPendingBroadcasts() {
- synchronized (mLock) {
+ synchronized (mWakeLock) {
if (--mPendingBroadcasts == 0) {
- updateWakelockStatusLocked();
+ try {
+ // Release wake lock
+ if (mWakeLock.isHeld()) {
+ mWakeLock.release();
+ log("Released wakelock");
+ } else {
+ log("Can't release wakelock again!");
+ }
+ } catch (Exception e) {
+ // This is to catch a runtime exception thrown when we try to release an
+ // already released lock.
+ Log.e(TAG, "exception in releaseWakeLock()", e);
+ }
}
}
}
@@ -1964,9 +1801,13 @@
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);
}
}
@@ -1990,7 +1831,10 @@
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);
}
}
@@ -2069,7 +1913,7 @@
protected void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
if (mContext.checkCallingOrSelfPermission(android.Manifest.permission.DUMP)
!= PackageManager.PERMISSION_GRANTED) {
- pw.println("Permission Denial: can't dump AlarmManager from from pid="
+ pw.println("Permission Denial: can't dump LocationManagerService from from pid="
+ Binder.getCallingPid()
+ ", uid=" + Binder.getCallingUid());
return;
@@ -2078,13 +1922,7 @@
synchronized (mLock) {
pw.println("Current Location Manager state:");
pw.println(" sProvidersLoaded=" + sProvidersLoaded);
- pw.println(" mGpsLocationProvider=" + mGpsLocationProvider);
- pw.println(" mNetworkLocationProvider=" + mNetworkLocationProvider);
pw.println(" mCollector=" + mCollector);
- pw.println(" mAlarmInterval=" + mAlarmInterval
- + " mWakeLockAcquireTime=" + mWakeLockAcquireTime);
- pw.println(" mWakeLockGpsReceived=" + mWakeLockGpsReceived
- + " mWakeLockNetworkReceived=" + mWakeLockNetworkReceived);
pw.println(" Listeners:");
int N = mReceivers.size();
for (int i=0; i<N; i++) {
diff --git a/services/java/com/android/server/PowerManagerService.java b/services/java/com/android/server/PowerManagerService.java
index 9c6e9dc..c5ea5fa9 100644
--- a/services/java/com/android/server/PowerManagerService.java
+++ b/services/java/com/android/server/PowerManagerService.java
@@ -496,8 +496,10 @@
}
public void acquireWakeLock(int flags, IBinder lock, String tag) {
- mContext.enforceCallingOrSelfPermission(android.Manifest.permission.WAKE_LOCK, null);
int uid = Binder.getCallingUid();
+ if (uid != Process.myUid()) {
+ mContext.enforceCallingOrSelfPermission(android.Manifest.permission.WAKE_LOCK, null);
+ }
long ident = Binder.clearCallingIdentity();
try {
synchronized (mLocks) {
@@ -554,14 +556,14 @@
// by the current state so we never turn it more on than
// it already is.
if ((wl.flags & PowerManager.ACQUIRE_CAUSES_WAKEUP) != 0) {
- reactivateWakeLocksLocked();
+ int oldWakeLockState = mWakeLockState;
+ mWakeLockState = mLocks.reactivateScreenLocksLocked();
if (mSpew) {
Log.d(TAG, "wakeup here mUserState=0x" + Integer.toHexString(mUserState)
- + " mLocks.gatherState()=0x"
- + Integer.toHexString(mLocks.gatherState())
- + " mWakeLockState=0x" + Integer.toHexString(mWakeLockState));
+ + " mWakeLockState=0x"
+ + Integer.toHexString(mWakeLockState)
+ + " previous wakeLockState=0x" + Integer.toHexString(oldWakeLockState));
}
- mWakeLockState = mLocks.gatherState();
} else {
if (mSpew) {
Log.d(TAG, "here mUserState=0x" + Integer.toHexString(mUserState)
@@ -598,7 +600,10 @@
}
public void releaseWakeLock(IBinder lock) {
- mContext.enforceCallingOrSelfPermission(android.Manifest.permission.WAKE_LOCK, null);
+ int uid = Binder.getCallingUid();
+ if (uid != Process.myUid()) {
+ mContext.enforceCallingOrSelfPermission(android.Manifest.permission.WAKE_LOCK, null);
+ }
synchronized (mLocks) {
releaseWakeLockLocked(lock, false);
@@ -653,17 +658,6 @@
}
}
- private void reactivateWakeLocksLocked()
- {
- int N = mLocks.size();
- for (int i=0; i<N; i++) {
- WakeLock wl = mLocks.get(i);
- if (isScreenLock(wl.flags)) {
- mLocks.get(i).activated = true;
- }
- }
- }
-
private class PokeLock implements IBinder.DeathRecipient
{
PokeLock(int p, IBinder b, String t) {
@@ -1752,8 +1746,7 @@
Binder.restoreCallingIdentity(ident);
}
- reactivateWakeLocksLocked();
- mWakeLockState = mLocks.gatherState();
+ mWakeLockState = mLocks.reactivateScreenLocksLocked();
setPowerState(mUserState | mWakeLockState, noChangeLights, true);
setTimeoutLocked(time, SCREEN_BRIGHT);
}
@@ -1944,6 +1937,20 @@
}
return result;
}
+
+ int reactivateScreenLocksLocked()
+ {
+ int result = 0;
+ int N = this.size();
+ for (int i=0; i<N; i++) {
+ WakeLock wl = this.get(i);
+ if (isScreenLock(wl.flags)) {
+ wl.activated = true;
+ result |= wl.minState;
+ }
+ }
+ return result;
+ }
}
void setPolicy(WindowManagerPolicy p) {
diff --git a/services/java/com/android/server/WindowManagerService.java b/services/java/com/android/server/WindowManagerService.java
index 3e75db1..3fa5baf 100644
--- a/services/java/com/android/server/WindowManagerService.java
+++ b/services/java/com/android/server/WindowManagerService.java
@@ -179,6 +179,25 @@
static final int UPDATE_FOCUS_PLACING_SURFACES = 2;
static final int UPDATE_FOCUS_WILL_PLACE_SURFACES = 3;
+ /** The minimum time between dispatching touch events. */
+ int mMinWaitTimeBetweenTouchEvents = 1000 / 35;
+
+ // Last touch event time
+ long mLastTouchEventTime = 0;
+
+ // Last touch event type
+ int mLastTouchEventType = OTHER_EVENT;
+
+ // Time to wait before calling useractivity again. This saves CPU usage
+ // when we get a flood of touch events.
+ static final int MIN_TIME_BETWEEN_USERACTIVITIES = 1000;
+
+ // Last time we call user activity
+ long mLastUserActivityCallTime = 0;
+
+ // Last time we updated battery stats
+ long mLastBatteryStatsCallTime = 0;
+
private static final String SYSTEM_SECURE = "ro.secure";
/**
@@ -3694,9 +3713,20 @@
// -------------------------------------------------------------
private final void wakeupIfNeeded(WindowState targetWin, int eventType) {
- if (targetWin == null ||
- targetWin.mAttrs.type != WindowManager.LayoutParams.TYPE_KEYGUARD) {
- mPowerManager.userActivity(SystemClock.uptimeMillis(), false, eventType);
+ long curTime = SystemClock.uptimeMillis();
+
+ if (eventType == LONG_TOUCH_EVENT || eventType == CHEEK_EVENT) {
+ if (mLastTouchEventType == eventType &&
+ (curTime - mLastUserActivityCallTime) < MIN_TIME_BETWEEN_USERACTIVITIES) {
+ return;
+ }
+ mLastUserActivityCallTime = curTime;
+ mLastTouchEventType = eventType;
+ }
+
+ if (targetWin == null
+ || targetWin.mAttrs.type != WindowManager.LayoutParams.TYPE_KEYGUARD) {
+ mPowerManager.userActivity(curTime, false, eventType, false);
}
}
@@ -3764,7 +3794,7 @@
// events in such a way, since this means the user is moving the
// pointer without actually pressing down. All other cases should
// be atypical, so let's log them.
- if (ev.getAction() != MotionEvent.ACTION_MOVE) {
+ if (action != MotionEvent.ACTION_MOVE) {
Log.w(TAG, "No window to dispatch pointer action " + ev.getAction());
}
if (qev != null) {
@@ -3851,7 +3881,39 @@
return false;
}
} //end if target
-
+
+ // TODO remove once we settle on a value or make it app specific
+ if (action == MotionEvent.ACTION_DOWN) {
+ int max_events_per_sec = 35;
+ try {
+ max_events_per_sec = Integer.parseInt(SystemProperties
+ .get("windowsmgr.max_events_per_sec"));
+ if (max_events_per_sec < 1) {
+ max_events_per_sec = 35;
+ }
+ } catch (NumberFormatException e) {
+ }
+ mMinWaitTimeBetweenTouchEvents = 1000 / max_events_per_sec;
+ }
+
+ /*
+ * Throttle events to minimize CPU usage when there's a flood of events
+ * e.g. constant contact with the screen
+ */
+ if (action == MotionEvent.ACTION_MOVE) {
+ long nextEventTime = mLastTouchEventTime + mMinWaitTimeBetweenTouchEvents;
+ long now = SystemClock.uptimeMillis();
+ if (now < nextEventTime) {
+ try {
+ Thread.sleep(nextEventTime - now);
+ } catch (InterruptedException e) {
+ }
+ mLastTouchEventTime = nextEventTime;
+ } else {
+ mLastTouchEventTime = now;
+ }
+ }
+
synchronized(mWindowMap) {
if (qev != null && action == MotionEvent.ACTION_MOVE) {
mKeyWaiter.bindTargetWindowLocked(target,
@@ -4928,7 +4990,7 @@
}
if ((actions & WindowManagerPolicy.ACTION_POKE_USER_ACTIVITY) != 0) {
mPowerManager.userActivity(event.when, false,
- LocalPowerManager.BUTTON_EVENT);
+ LocalPowerManager.BUTTON_EVENT, false);
}
if ((actions & WindowManagerPolicy.ACTION_PASS_TO_USER) != 0) {
@@ -5088,11 +5150,17 @@
eventType = LocalPowerManager.OTHER_EVENT;
}
try {
- mBatteryStats.noteInputEvent();
+ long now = SystemClock.uptimeMillis();
+
+ if ((now - mLastBatteryStatsCallTime)
+ >= MIN_TIME_BETWEEN_USERACTIVITIES) {
+ mLastBatteryStatsCallTime = now;
+ mBatteryStats.noteInputEvent();
+ }
} catch (RemoteException e) {
// Ignore
}
- mPowerManager.userActivity(curTime, false, eventType);
+ mPowerManager.userActivity(curTime, false, eventType, false);
switch (ev.classType) {
case RawInputEvent.CLASS_KEYBOARD:
KeyEvent ke = (KeyEvent)ev.event;
diff --git a/test-runner/android/test/TestLocationProvider.java b/test-runner/android/test/TestLocationProvider.java
index 08603e3..dded745 100644
--- a/test-runner/android/test/TestLocationProvider.java
+++ b/test-runner/android/test/TestLocationProvider.java
@@ -169,12 +169,6 @@
public void removeListener(int uid) {
}
- public void wakeLockAcquired() {
- }
-
- public void wakeLockReleased() {
- }
-
private void updateLocation() {
long time = SystemClock.uptimeMillis();
long multiplier = (time/5000)%500000;
diff --git a/tests/CoreTests/android/location/LocationManagerProximityTest.java b/tests/CoreTests/android/location/LocationManagerProximityTest.java
index e1501e3..3f43bcf 100644
--- a/tests/CoreTests/android/location/LocationManagerProximityTest.java
+++ b/tests/CoreTests/android/location/LocationManagerProximityTest.java
@@ -52,11 +52,7 @@
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 @@
false, // upportsBearing,
Criteria.POWER_MEDIUM, // powerRequirement
Criteria.ACCURACY_FINE); // accuracy
+ mLocationManager.setTestProviderEnabled(PROVIDER_NAME, true);
}
@Override
diff --git a/tests/FrameworkTest/tests/src/com/android/frameworktest/view/SetTagsTest.java b/tests/FrameworkTest/tests/src/com/android/frameworktest/view/SetTagsTest.java
new file mode 100644
index 0000000..523eeaf
--- /dev/null
+++ b/tests/FrameworkTest/tests/src/com/android/frameworktest/view/SetTagsTest.java
@@ -0,0 +1,114 @@
+/*
+ * Copyright (C) 2007 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.frameworktest.view;
+
+import com.android.frameworktest.R;
+import android.test.suitebuilder.annotation.MediumTest;
+
+import android.test.ActivityInstrumentationTestCase2;
+import android.widget.Button;
+
+/**
+ * Exercises {@link android.view.View}'s tags property.
+ */
+public class SetTagsTest extends ActivityInstrumentationTestCase2<Disabled> {
+ private Button mView;
+
+ public SetTagsTest() {
+ super("com.android.frameworktest", Disabled.class);
+ }
+
+ @Override
+ public void setUp() throws Exception {
+ super.setUp();
+
+ mView = (Button) getActivity().findViewById(R.id.disabledButton);
+ }
+
+ @MediumTest
+ public void testSetUpConditions() throws Exception {
+ assertNotNull(mView);
+ }
+
+ @MediumTest
+ public void testSetTag() throws Exception {
+ mView.setTag("1");
+ }
+
+ @MediumTest
+ public void testGetTag() throws Exception {
+ Object o = new Object();
+ mView.setTag(o);
+
+ final Object stored = mView.getTag();
+ assertNotNull(stored);
+ assertSame("The stored tag is inccorect", o, stored);
+ }
+
+ @MediumTest
+ public void testSetTagWithKey() throws Exception {
+ mView.setTag(R.id.a, "2");
+ }
+
+ @MediumTest
+ public void testGetTagWithKey() throws Exception {
+ Object o = new Object();
+ mView.setTag(R.id.a, o);
+
+ final Object stored = mView.getTag(R.id.a);
+ assertNotNull(stored);
+ assertSame("The stored tag is inccorect", o, stored);
+ }
+
+ @MediumTest
+ public void testSetTagWithFrameworkId() throws Exception {
+ boolean result = false;
+ try {
+ mView.setTag(android.R.id.list, "2");
+ } catch (IllegalArgumentException e) {
+ result = true;
+ }
+ assertTrue("Setting a tag with a framework id did not throw an exception", result);
+ }
+
+ @MediumTest
+ public void testSetTagWithNoPackageId() throws Exception {
+ boolean result = false;
+ try {
+ mView.setTag(0x000000AA, "2");
+ } catch (IllegalArgumentException e) {
+ result = true;
+ }
+ assertTrue("Setting a tag with an id with no package did not throw an exception", result);
+ }
+
+ @MediumTest
+ public void testSetTagInternalWithFrameworkId() throws Exception {
+ mView.setTagInternal(android.R.id.list, "2");
+ }
+
+ @MediumTest
+ public void testSetTagInternalWithApplicationId() throws Exception {
+ boolean result = false;
+ try {
+ mView.setTagInternal(R.id.a, "2");
+ } catch (IllegalArgumentException e) {
+ result = true;
+ }
+ assertTrue("Setting a tag with an id with app package did not throw an exception", result);
+ }
+}
diff --git a/tests/backup/Android.mk b/tests/backup/Android.mk
index 35c05df..2e3385f8 100644
--- a/tests/backup/Android.mk
+++ b/tests/backup/Android.mk
@@ -21,7 +21,7 @@
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 $(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.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);