Merge change I62fac03c into eclair

* changes:
  Comment needs to be moved from LOCAL_PACKAGE_NAME, otherwise files created have bad filenames "CtsExampleTestCases #Replace Example with your name.xml" and android.example is not created as expected.
diff --git a/tests/tests/content/src/android/content/pm/cts/PackageManagerTest.java b/tests/tests/content/src/android/content/pm/cts/PackageManagerTest.java
index 813e6601..f258997 100644
--- a/tests/tests/content/src/android/content/pm/cts/PackageManagerTest.java
+++ b/tests/tests/content/src/android/content/pm/cts/PackageManagerTest.java
@@ -655,25 +655,8 @@
         int pkgInfoSize = pkgInfo.size();
         mPackageManager.addPackageToPreferred(CONTENT_PKG_NAME);
         pkgInfo = mPackageManager.getPreferredPackages(0);
-        assertTrue(pkgInfo.size() == 1 + pkgInfoSize);
-        checkPreferredPackagesName(CONTENT_PKG_NAME, pkgInfo);
-        // Test removePackageFromPreferred
-        mPackageManager.removePackageFromPreferred(CONTENT_PKG_NAME);
-        assertTrue(mPackageManager.getPreferredPackages(0).size() == 0);
-    }
-
-    private void checkPreferredPackagesName(String expectedName, List<PackageInfo> pkgs) {
-        boolean isContained = false;
-        Iterator<PackageInfo> infoIterator = pkgs.iterator();
-        String current;
-        while (infoIterator.hasNext()) {
-            current = infoIterator.next().packageName;
-            if (current.equals(expectedName)) {
-                isContained = true;
-                break;
-            }
-        }
-        assertTrue(isContained);
+        // addPackageToPreferred should have no effect
+        assertEquals(pkgInfo.size(), pkgInfoSize);
     }
 
     @TestTargets({
diff --git a/tests/tests/hardware/src/android/hardware/cts/CameraTest.java b/tests/tests/hardware/src/android/hardware/cts/CameraTest.java
index 97d365e..3b4c5ed 100644
--- a/tests/tests/hardware/src/android/hardware/cts/CameraTest.java
+++ b/tests/tests/hardware/src/android/hardware/cts/CameraTest.java
@@ -428,13 +428,18 @@
         String flashMode = parameters.getFlashMode();
         assertTrue(flashMode == null || flashMode.equals(parameters.FLASH_MODE_OFF));
 
-        // Camera must provide focus mode, supported preview sizes, and
-        // supported picture sizes for applications.
+        // Some parameters must be supported.
         List<Size> previewSizes = parameters.getSupportedPreviewSizes();
         List<Size> pictureSizes = parameters.getSupportedPictureSizes();
+        List<Integer> previewFormats = parameters.getSupportedPreviewFormats();
+        List<Integer> pictureFormats = parameters.getSupportedPictureFormats();
+        List<String> focusModes = parameters.getSupportedFocusModes();
         String focusMode = parameters.getFocusMode();
         assertTrue(previewSizes != null && previewSizes.size() != 0);
         assertTrue(pictureSizes != null && pictureSizes.size() != 0);
+        assertTrue(previewFormats != null && previewFormats.size() != 0);
+        assertTrue(pictureFormats != null && pictureFormats.size() != 0);
+        assertTrue(focusModes != null && focusModes.size() != 0);
         assertTrue(focusMode != null);
         Size previewSize = previewSizes.get(0);
         Size pictureSize = pictureSizes.get(0);
diff --git a/tests/tests/jni/libjnitest/android_jni_cts_InstanceNonce.c b/tests/tests/jni/libjnitest/android_jni_cts_InstanceNonce.c
index 5adb2cb..e844f21 100644
--- a/tests/tests/jni/libjnitest/android_jni_cts_InstanceNonce.c
+++ b/tests/tests/jni/libjnitest/android_jni_cts_InstanceNonce.c
@@ -214,6 +214,105 @@
     return (*env)->IsSameObject(env, this, v);
 }
 
+// public native boolean takeIntLong(int v1, long v2);
+static jboolean InstanceNonce_takeIntLong(JNIEnv *env, jobject this,
+        jint v1, jlong v2) {
+    return (v1 == 914) && (v2 == 9140914091409140914LL);
+}
+
+// public native boolean takeLongInt(long v1, int v2);
+static jboolean InstanceNonce_takeLongInt(JNIEnv *env, jobject this,
+        jlong v1, jint v2) {
+    return (v1 == -4321LL) && (v2 == 12341234);
+}
+
+// public native boolean takeOneOfEach(boolean v0, byte v1, short v2,
+//         char v3, int v4, long v5, String v6, float v7, double v8,
+//         int[] v9);
+static jboolean InstanceNonce_takeOneOfEach(JNIEnv *env, jobject this,
+        jboolean v0, jbyte v1, jshort v2, jchar v3, jint v4, jlong v5,
+        jstring v6, jfloat v7, jdouble v8, jintArray v9) {
+    jsize length;
+    jboolean result;
+    
+    if ((v0 != false) || (v1 != 1) || (v2 != 2) || (v3 != 3) ||
+            (v4 != 4) || (v5 != 5) || (v7 != 7.0f) || (v8 != 8.0)) {
+        return false;
+    }
+
+    length = (*env)->GetStringUTFLength(env, v6);
+
+    if (length != 3) {
+        jniThrowException(env, "java/lang/AssertionError",
+                "bad string length");
+        return false;
+    }
+
+    const char *utf = (*env)->GetStringUTFChars(env, v6, NULL);
+    result = (strncmp("six", utf, 3) == 0);
+
+    (*env)->ReleaseStringUTFChars(env, v6, utf);
+
+    if (! result) {
+        return false;
+    }
+
+    length = (*env)->GetArrayLength(env, v9);
+    if (length != 2) {
+        jniThrowException(env, "java/lang/AssertionError",
+                "bad array length");
+        return false;
+    }
+
+    jint *elements = (*env)->GetIntArrayElements(env, v9, NULL);
+    result = (elements[0] == 9) && (elements[1] == 10);
+    (*env)->ReleaseIntArrayElements(env, v9, elements, JNI_ABORT);
+
+    return result;
+}
+
+// public native boolean takeCoolHandLuke(
+//         int v1, int v2, int v3, int v4,
+//         int v5, int v6, int v7, int v8, int v9,
+//         int v10, int v11, int v12, int v13, int v14,
+//         int v15, int v16, int v17, int v18, int v19,
+//         int v20, int v21, int v22, int v23, int v24,
+//         int v25, int v26, int v27, int v28, int v29,
+//         int v30, int v31, int v32, int v33, int v34,
+//         int v35, int v36, int v37, int v38, int v39,
+//         int v40, int v41, int v42, int v43, int v44,
+//         int v45, int v46, int v47, int v48, int v49,
+//         int v50);
+static jboolean InstanceNonce_takeCoolHandLuke(JNIEnv *env, jobject this,
+        jint v1, jint v2, jint v3, jint v4,
+        jint v5, jint v6, jint v7, jint v8, jint v9,
+        jint v10, jint v11, jint v12, jint v13, jint v14,
+        jint v15, jint v16, jint v17, jint v18, jint v19,
+        jint v20, jint v21, jint v22, jint v23, jint v24,
+        jint v25, jint v26, jint v27, jint v28, jint v29,
+        jint v30, jint v31, jint v32, jint v33, jint v34,
+        jint v35, jint v36, jint v37, jint v38, jint v39,
+        jint v40, jint v41, jint v42, jint v43, jint v44,
+        jint v45, jint v46, jint v47, jint v48, jint v49,
+        jint v50) {
+    return (v1 == 1) && (v2 == 2) && (v3 == 3) &&
+        (v4 == 4) && (v5 == 5) && (v6 == 6) && (v7 == 7) &&
+        (v8 == 8) && (v9 == 9) &&
+        (v10 == 10) && (v11 == 11) && (v12 == 12) && (v13 == 13) &&
+        (v14 == 14) && (v15 == 15) && (v16 == 16) && (v17 == 17) &&
+        (v18 == 18) && (v19 == 19) &&
+        (v20 == 20) && (v21 == 21) && (v22 == 22) && (v23 == 23) &&
+        (v24 == 24) && (v25 == 25) && (v26 == 26) && (v27 == 27) &&
+        (v28 == 28) && (v29 == 29) &&
+        (v30 == 30) && (v31 == 31) && (v32 == 32) && (v33 == 33) &&
+        (v34 == 34) && (v35 == 35) && (v36 == 36) && (v37 == 37) &&
+        (v38 == 38) && (v39 == 39) &&
+        (v40 == 40) && (v41 == 41) && (v42 == 42) && (v43 == 43) &&
+        (v44 == 44) && (v45 == 45) && (v46 == 46) && (v47 == 47) &&
+        (v48 == 48) && (v49 == 49) &&
+        (v50 == 50);
+}
+
 static JNINativeMethod methods[] = {
     // name, signature, function
     { "nop",               "()V", InstanceNonce_nop },
@@ -245,6 +344,13 @@
     { "takeString",        "(Ljava/lang/String;)Z", InstanceNonce_takeString },
     { "takeThis",          "(Landroid/jni/cts/InstanceNonce;)Z",
       InstanceNonce_takeThis },
+    { "takeIntLong",       "(IJ)Z", InstanceNonce_takeIntLong },
+    { "takeLongInt",       "(JI)Z", InstanceNonce_takeLongInt },
+    { "takeOneOfEach",     "(ZBSCIJLjava/lang/String;FD[I)Z",
+      InstanceNonce_takeOneOfEach },
+    { "takeCoolHandLuke",
+      "(IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII)Z",
+      InstanceNonce_takeCoolHandLuke },
 };
 
 int register_InstanceNonce(JNIEnv *env) {
diff --git a/tests/tests/jni/libjnitest/android_jni_cts_StaticNonce.c b/tests/tests/jni/libjnitest/android_jni_cts_StaticNonce.c
index 64055b0..a5b73f1 100644
--- a/tests/tests/jni/libjnitest/android_jni_cts_StaticNonce.c
+++ b/tests/tests/jni/libjnitest/android_jni_cts_StaticNonce.c
@@ -229,6 +229,105 @@
     return (*env)->IsSameObject(env, clazz, v);
 }
 
+// public static native boolean takeIntLong(int v1, long v2);
+static jboolean StaticNonce_takeIntLong(JNIEnv *env, jclass clazz,
+        jint v1, jlong v2) {
+    return (v1 == 914) && (v2 == 9140914091409140914LL);
+}
+
+// public static native boolean takeLongInt(long v1, int v2);
+static jboolean StaticNonce_takeLongInt(JNIEnv *env, jclass clazz,
+        jlong v1, jint v2) {
+    return (v1 == -4321LL) && (v2 == 12341234);
+}
+
+// public static native boolean takeOneOfEach(boolean v0, byte v1, short v2,
+//         char v3, int v4, long v5, String v6, float v7, double v8,
+//         int[] v9);
+static jboolean StaticNonce_takeOneOfEach(JNIEnv *env, jclass clazz,
+        jboolean v0, jbyte v1, jshort v2, jchar v3, jint v4, jlong v5,
+        jstring v6, jfloat v7, jdouble v8, jintArray v9) {
+    jsize length;
+    jboolean result;
+    
+    if ((v0 != false) || (v1 != 1) || (v2 != 2) || (v3 != 3) ||
+            (v4 != 4) || (v5 != 5) || (v7 != 7.0f) || (v8 != 8.0)) {
+        return false;
+    }
+
+    length = (*env)->GetStringUTFLength(env, v6);
+
+    if (length != 3) {
+        jniThrowException(env, "java/lang/AssertionError",
+                "bad string length");
+        return false;
+    }
+
+    const char *utf = (*env)->GetStringUTFChars(env, v6, NULL);
+    result = (strncmp("six", utf, 3) == 0);
+
+    (*env)->ReleaseStringUTFChars(env, v6, utf);
+
+    if (! result) {
+        return false;
+    }
+
+    length = (*env)->GetArrayLength(env, v9);
+    if (length != 2) {
+        jniThrowException(env, "java/lang/AssertionError",
+                "bad array length");
+        return false;
+    }
+
+    jint *elements = (*env)->GetIntArrayElements(env, v9, NULL);
+    result = (elements[0] == 9) && (elements[1] == 10);
+    (*env)->ReleaseIntArrayElements(env, v9, elements, JNI_ABORT);
+
+    return result;
+}
+
+// public static native boolean takeCoolHandLuke(
+//         int v1, int v2, int v3, int v4,
+//         int v5, int v6, int v7, int v8, int v9,
+//         int v10, int v11, int v12, int v13, int v14,
+//         int v15, int v16, int v17, int v18, int v19,
+//         int v20, int v21, int v22, int v23, int v24,
+//         int v25, int v26, int v27, int v28, int v29,
+//         int v30, int v31, int v32, int v33, int v34,
+//         int v35, int v36, int v37, int v38, int v39,
+//         int v40, int v41, int v42, int v43, int v44,
+//         int v45, int v46, int v47, int v48, int v49,
+//         int v50);
+static jboolean StaticNonce_takeCoolHandLuke(JNIEnv *env, jclass clazz,
+        jint v1, jint v2, jint v3, jint v4,
+        jint v5, jint v6, jint v7, jint v8, jint v9,
+        jint v10, jint v11, jint v12, jint v13, jint v14,
+        jint v15, jint v16, jint v17, jint v18, jint v19,
+        jint v20, jint v21, jint v22, jint v23, jint v24,
+        jint v25, jint v26, jint v27, jint v28, jint v29,
+        jint v30, jint v31, jint v32, jint v33, jint v34,
+        jint v35, jint v36, jint v37, jint v38, jint v39,
+        jint v40, jint v41, jint v42, jint v43, jint v44,
+        jint v45, jint v46, jint v47, jint v48, jint v49,
+        jint v50) {
+    return (v1 == 1) && (v2 == 2) && (v3 == 3) &&
+        (v4 == 4) && (v5 == 5) && (v6 == 6) && (v7 == 7) &&
+        (v8 == 8) && (v9 == 9) &&
+        (v10 == 10) && (v11 == 11) && (v12 == 12) && (v13 == 13) &&
+        (v14 == 14) && (v15 == 15) && (v16 == 16) && (v17 == 17) &&
+        (v18 == 18) && (v19 == 19) &&
+        (v20 == 20) && (v21 == 21) && (v22 == 22) && (v23 == 23) &&
+        (v24 == 24) && (v25 == 25) && (v26 == 26) && (v27 == 27) &&
+        (v28 == 28) && (v29 == 29) &&
+        (v30 == 30) && (v31 == 31) && (v32 == 32) && (v33 == 33) &&
+        (v34 == 34) && (v35 == 35) && (v36 == 36) && (v37 == 37) &&
+        (v38 == 38) && (v39 == 39) &&
+        (v40 == 40) && (v41 == 41) && (v42 == 42) && (v43 == 43) &&
+        (v44 == 44) && (v45 == 45) && (v46 == 46) && (v47 == 47) &&
+        (v48 == 48) && (v49 == 49) &&
+        (v50 == 50);
+}
+
 static JNINativeMethod methods[] = {
     // name, signature, function
     { "nop",               "()V", StaticNonce_nop },
@@ -260,6 +359,13 @@
     { "takeNull",          "(Ljava/lang/Object;)Z", StaticNonce_takeNull },
     { "takeString",        "(Ljava/lang/String;)Z", StaticNonce_takeString },
     { "takeThisClass",     "(Ljava/lang/Class;)Z", StaticNonce_takeThisClass },
+    { "takeIntLong",       "(IJ)Z", StaticNonce_takeIntLong },
+    { "takeLongInt",       "(JI)Z", StaticNonce_takeLongInt },
+    { "takeOneOfEach",     "(ZBSCIJLjava/lang/String;FD[I)Z",
+      StaticNonce_takeOneOfEach },
+    { "takeCoolHandLuke",
+      "(IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII)Z",
+      StaticNonce_takeCoolHandLuke },
 };
 
 int register_StaticNonce(JNIEnv *env) {
diff --git a/tests/tests/jni/src/android/jni/cts/InstanceNonce.java b/tests/tests/jni/src/android/jni/cts/InstanceNonce.java
index 7546c42..a5bb01d 100644
--- a/tests/tests/jni/src/android/jni/cts/InstanceNonce.java
+++ b/tests/tests/jni/src/android/jni/cts/InstanceNonce.java
@@ -61,4 +61,21 @@
     public native boolean takeNull(Object v);
     public native boolean takeString(String v);
     public native boolean takeThis(InstanceNonce v);
+    public native boolean takeIntLong(int v1, long v2);
+    public native boolean takeLongInt(long v1, int v2);
+    public native boolean takeOneOfEach(boolean v0, byte v1, short v2,
+            char v3, int v4, long v5, String v6, float v7, double v8,
+            int[] v9);
+    public native boolean takeCoolHandLuke(
+            int v1, int v2, int v3, int v4,
+            int v5, int v6, int v7, int v8, int v9,
+            int v10, int v11, int v12, int v13, int v14,
+            int v15, int v16, int v17, int v18, int v19,
+            int v20, int v21, int v22, int v23, int v24,
+            int v25, int v26, int v27, int v28, int v29,
+            int v30, int v31, int v32, int v33, int v34,
+            int v35, int v36, int v37, int v38, int v39,
+            int v40, int v41, int v42, int v43, int v44,
+            int v45, int v46, int v47, int v48, int v49,
+            int v50);
 }
diff --git a/tests/tests/jni/src/android/jni/cts/JniInstanceTest.java b/tests/tests/jni/src/android/jni/cts/JniInstanceTest.java
index 1c8a016..a66e072 100644
--- a/tests/tests/jni/src/android/jni/cts/JniInstanceTest.java
+++ b/tests/tests/jni/src/android/jni/cts/JniInstanceTest.java
@@ -231,10 +231,42 @@
         assertTrue(target.takeThis(target));
     }
 
-    // TODO: Add more tests here. E.g:
-    //    call to method taking (int, long), returning a "got expected" flag
-    //    call to method taking (long, int), returning a "got expected" flag
-    //    call to method taking one of each primitive type, an object, and
-    //      an array
-    //    call to method taking 50 arguments
+    /**
+     * Test a simple multiple value-taking method call, that returns whether it
+     * got the expected values.
+     */
+    public void test_takeIntLong() {
+        assertTrue(target.takeIntLong(914, 9140914091409140914L));
+    }
+
+    /**
+     * Test a simple multiple value-taking method call, that returns whether it
+     * got the expected values.
+     */
+    public void test_takeLongInt() {
+        assertTrue(target.takeLongInt(-4321L, 12341234));
+    }
+
+    /**
+     * Test a simple multiple value-taking method call, that returns whether it
+     * got the expected values.
+     */
+    public void test_takeOneOfEach() {
+        assertTrue(target.takeOneOfEach((boolean) false, (byte) 1,
+                        (short) 2, (char) 3, (int) 4, 5L, "six", 7.0f, 8.0,
+                        new int[] { 9, 10 }));
+    }
+
+    /**
+     * Test a simple multiple value-taking method call, that returns whether it
+     * got the expected values.
+     */
+    public void test_takeCoolHandLuke() {
+        assertTrue(target.takeCoolHandLuke(1, 2, 3, 4, 5, 6, 7, 8, 9,
+                        10, 11, 12, 13, 14, 15, 16, 17, 18, 19,
+                        20, 21, 22, 23, 24, 25, 26, 27, 28, 29,
+                        30, 31, 32, 33, 34, 35, 36, 37, 38, 39,
+                        40, 41, 42, 43, 44, 45, 46, 47, 48, 49,
+                        50));
+    }
 }
diff --git a/tests/tests/jni/src/android/jni/cts/JniStaticTest.java b/tests/tests/jni/src/android/jni/cts/JniStaticTest.java
index b9df0e7..ff4411d 100644
--- a/tests/tests/jni/src/android/jni/cts/JniStaticTest.java
+++ b/tests/tests/jni/src/android/jni/cts/JniStaticTest.java
@@ -232,10 +232,42 @@
         assertTrue(StaticNonce.takeThisClass(StaticNonce.class));
     }
 
-    // TODO: Add more tests here. E.g:
-    //    call to method taking (int, long), returning a "got expected" flag
-    //    call to method taking (long, int), returning a "got expected" flag
-    //    call to method taking one of each primitive type, an object, and
-    //      an array
-    //    call to method taking 50 arguments
+    /**
+     * Test a simple multiple value-taking method call, that returns whether it
+     * got the expected values.
+     */
+    public void test_takeIntLong() {
+        assertTrue(StaticNonce.takeIntLong(914, 9140914091409140914L));
+    }
+
+    /**
+     * Test a simple multiple value-taking method call, that returns whether it
+     * got the expected values.
+     */
+    public void test_takeLongInt() {
+        assertTrue(StaticNonce.takeLongInt(-4321L, 12341234));
+    }
+
+    /**
+     * Test a simple multiple value-taking method call, that returns whether it
+     * got the expected values.
+     */
+    public void test_takeOneOfEach() {
+        assertTrue(StaticNonce.takeOneOfEach((boolean) false, (byte) 1,
+                        (short) 2, (char) 3, (int) 4, 5L, "six", 7.0f, 8.0,
+                        new int[] { 9, 10 }));
+    }
+
+    /**
+     * Test a simple multiple value-taking method call, that returns whether it
+     * got the expected values.
+     */
+    public void test_takeCoolHandLuke() {
+        assertTrue(StaticNonce.takeCoolHandLuke(1, 2, 3, 4, 5, 6, 7, 8, 9,
+                        10, 11, 12, 13, 14, 15, 16, 17, 18, 19,
+                        20, 21, 22, 23, 24, 25, 26, 27, 28, 29,
+                        30, 31, 32, 33, 34, 35, 36, 37, 38, 39,
+                        40, 41, 42, 43, 44, 45, 46, 47, 48, 49,
+                        50));
+    }
 }
diff --git a/tests/tests/jni/src/android/jni/cts/StaticNonce.java b/tests/tests/jni/src/android/jni/cts/StaticNonce.java
index f3015c6..f9b3310 100644
--- a/tests/tests/jni/src/android/jni/cts/StaticNonce.java
+++ b/tests/tests/jni/src/android/jni/cts/StaticNonce.java
@@ -62,4 +62,21 @@
     public static native boolean takeNull(Object v);
     public static native boolean takeString(String v);
     public static native boolean takeThisClass(Class v);
+    public static native boolean takeIntLong(int v1, long v2);
+    public static native boolean takeLongInt(long v1, int v2);
+    public static native boolean takeOneOfEach(boolean v0, byte v1, short v2,
+            char v3, int v4, long v5, String v6, float v7, double v8,
+            int[] v9);
+    public static native boolean takeCoolHandLuke(
+            int v1, int v2, int v3, int v4,
+            int v5, int v6, int v7, int v8, int v9,
+            int v10, int v11, int v12, int v13, int v14,
+            int v15, int v16, int v17, int v18, int v19,
+            int v20, int v21, int v22, int v23, int v24,
+            int v25, int v26, int v27, int v28, int v29,
+            int v30, int v31, int v32, int v33, int v34,
+            int v35, int v36, int v37, int v38, int v39,
+            int v40, int v41, int v42, int v43, int v44,
+            int v45, int v46, int v47, int v48, int v49,
+            int v50);
 }