Merge change I5123e63a into eclair

* changes:
  Fix CTS dpi tests.
diff --git a/tests/Android.mk b/tests/Android.mk
index 1dcb569..64517af 100644
--- a/tests/Android.mk
+++ b/tests/Android.mk
@@ -24,8 +24,8 @@
 
 LOCAL_JAVA_LIBRARIES := android.test.runner
 
-# Resource unit tests use a private locale
-LOCAL_AAPT_FLAGS = -c xx_YY -c cs
+# Resource unit tests use a private locale and some densities
+LOCAL_AAPT_FLAGS = -c xx_YY -c cs -c 32dpi -c 240dpi -c 160dpi
 
 LOCAL_PACKAGE_NAME := CtsTestStubs
 
diff --git a/tests/res/values-v10/strings.xml b/tests/res/values-v10/strings.xml
new file mode 100644
index 0000000..6cd55fa
--- /dev/null
+++ b/tests/res/values-v10/strings.xml
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- 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.
+-->
+
+<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
+   <string name="version_cur">v10cur</string>
+</resources>
diff --git a/tests/res/values-v11/strings.xml b/tests/res/values-v11/strings.xml
new file mode 100644
index 0000000..d4d75ff
--- /dev/null
+++ b/tests/res/values-v11/strings.xml
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- 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.
+-->
+
+<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
+   <string name="version_cur">v11cur</string>
+</resources>
diff --git a/tests/res/values-v12/strings.xml b/tests/res/values-v12/strings.xml
new file mode 100644
index 0000000..ab421fa
--- /dev/null
+++ b/tests/res/values-v12/strings.xml
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- 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.
+-->
+
+<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
+   <string name="version_cur">v12cur</string>
+</resources>
diff --git a/tests/res/values-v13/strings.xml b/tests/res/values-v13/strings.xml
new file mode 100644
index 0000000..d71936a
--- /dev/null
+++ b/tests/res/values-v13/strings.xml
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- 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.
+-->
+
+<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
+   <string name="version_cur">v13cur</string>
+   <string name="version_old">v13old</string>
+</resources>
diff --git a/tests/res/values-v3/strings.xml b/tests/res/values-v3/strings.xml
new file mode 100644
index 0000000..a4d012a
--- /dev/null
+++ b/tests/res/values-v3/strings.xml
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- 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.
+-->
+
+<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
+   <string name="version_cur">v3cur</string>
+   <string name="version_v3">v3</string>
+</resources>
diff --git a/tests/res/values-v4/strings.xml b/tests/res/values-v4/strings.xml
new file mode 100644
index 0000000..e6d414a
--- /dev/null
+++ b/tests/res/values-v4/strings.xml
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- 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.
+-->
+
+<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
+   <string name="version_cur">v4cur</string>
+</resources>
diff --git a/tests/res/values-v5/strings.xml b/tests/res/values-v5/strings.xml
new file mode 100644
index 0000000..ef3a564
--- /dev/null
+++ b/tests/res/values-v5/strings.xml
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- 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.
+-->
+
+<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
+   <string name="version_cur">v5cur</string>
+</resources>
diff --git a/tests/res/values-v6/strings.xml b/tests/res/values-v6/strings.xml
new file mode 100644
index 0000000..fb1f15d
--- /dev/null
+++ b/tests/res/values-v6/strings.xml
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- 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.
+-->
+
+<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
+   <string name="version_cur">v6cur</string>
+</resources>
diff --git a/tests/res/values-v7/strings.xml b/tests/res/values-v7/strings.xml
new file mode 100644
index 0000000..4c3df45
--- /dev/null
+++ b/tests/res/values-v7/strings.xml
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- 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.
+-->
+
+<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
+   <string name="version_cur">v7cur</string>
+</resources>
diff --git a/tests/res/values-v8/strings.xml b/tests/res/values-v8/strings.xml
new file mode 100644
index 0000000..b4e1d88
--- /dev/null
+++ b/tests/res/values-v8/strings.xml
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- 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.
+-->
+
+<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
+   <string name="version_cur">v8cur</string>
+</resources>
diff --git a/tests/res/values-v9/strings.xml b/tests/res/values-v9/strings.xml
new file mode 100644
index 0000000..a03ea12
--- /dev/null
+++ b/tests/res/values-v9/strings.xml
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- 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.
+-->
+
+<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
+   <string name="version_cur">v9cur</string>
+</resources>
diff --git a/tests/res/values/strings.xml b/tests/res/values/strings.xml
index f365a0a..37b625c 100644
--- a/tests/res/values/strings.xml
+++ b/tests/res/values/strings.xml
@@ -164,4 +164,7 @@
    <string name="country">Country:</string>
    <string name="symbol">Symbol:</string>
    <string name="country_warning">No such country registered</string>
+   <string name="version_cur">base</string>
+   <string name="version_old">base</string>
+   <string name="version_v3">base</string>
 </resources>
diff --git a/tests/tests/app/src/android/app/cts/AlertDialogTest.java b/tests/tests/app/src/android/app/cts/AlertDialogTest.java
index 4d0d8fd..4ab57da 100644
--- a/tests/tests/app/src/android/app/cts/AlertDialogTest.java
+++ b/tests/tests/app/src/android/app/cts/AlertDialogTest.java
@@ -468,6 +468,7 @@
         assertTrue(mActivity.getDialog().isShowing());
         assertFalse(mActivity.onCancelCalled);
         mInstrumentation.sendKeyDownUpSync(KeyEvent.KEYCODE_BACK);
+        mInstrumentation.waitForIdleSync();
         assertTrue(mActivity.onCancelCalled);
     }
 
diff --git a/tests/tests/app/src/android/app/cts/InstrumentationTest.java b/tests/tests/app/src/android/app/cts/InstrumentationTest.java
index 3007d80..a2c8eb8 100644
--- a/tests/tests/app/src/android/app/cts/InstrumentationTest.java
+++ b/tests/tests/app/src/android/app/cts/InstrumentationTest.java
@@ -684,9 +684,8 @@
     )
     public void testWaitForIdle() throws Exception {
         MockRunnable mr = new MockRunnable();
-        mInstrumentation.waitForIdle(mr);
-
         assertFalse(mr.isRunCalled());
+        mInstrumentation.waitForIdle(mr);
         Thread.sleep(WAIT_TIME);
         assertTrue(mr.isRunCalled());
     }
diff --git a/tests/tests/app/src/android/app/cts/ProgressDialogTest.java b/tests/tests/app/src/android/app/cts/ProgressDialogTest.java
index 05e9aa8..85a714c 100644
--- a/tests/tests/app/src/android/app/cts/ProgressDialogTest.java
+++ b/tests/tests/app/src/android/app/cts/ProgressDialogTest.java
@@ -171,8 +171,7 @@
                 mProgressDialog = ProgressDialog.show(mContext, TITLE, MESSAGE, true, false);
 
                 mProgressDialog.setOnCancelListener(cL);
-                final KeyEvent event = new KeyEvent(KeyEvent.KEYCODE_BACK, KeyEvent.KEYCODE_BACK);
-                mProgressDialog.onKeyDown(KeyEvent.KEYCODE_BACK, event);
+                mProgressDialog.onBackPressed();
             }
         });
         mInstrumentation.waitForIdleSync();
@@ -186,8 +185,7 @@
 
                 assertFalse(mCanceled);
                 mProgressDialog.setOnCancelListener(cL);
-                final KeyEvent event = new KeyEvent(KeyEvent.KEYCODE_BACK, KeyEvent.KEYCODE_BACK);
-                mProgressDialog.onKeyDown(KeyEvent.KEYCODE_BACK, event);
+                mProgressDialog.onBackPressed();
             }
         });
         mInstrumentation.waitForIdleSync();
@@ -214,8 +212,7 @@
             public void run() {
                 mProgressDialog = ProgressDialog.show(mContext, TITLE, MESSAGE, true, false, cL);
 
-                final KeyEvent event = new KeyEvent(KeyEvent.KEYCODE_BACK, KeyEvent.KEYCODE_BACK);
-                mProgressDialog.onKeyDown(KeyEvent.KEYCODE_BACK, event);
+                mProgressDialog.onBackPressed();
             }
         });
         mInstrumentation.waitForIdleSync();
@@ -228,8 +225,7 @@
                 mProgressDialog = ProgressDialog.show(mContext, TITLE, MESSAGE, true, true, cL);
 
                 assertFalse(mCanceled);
-                final KeyEvent event = new KeyEvent(KeyEvent.KEYCODE_BACK, KeyEvent.KEYCODE_BACK);
-                mProgressDialog.onKeyDown(KeyEvent.KEYCODE_BACK, event);
+                mProgressDialog.onBackPressed();
             }
         });
         mInstrumentation.waitForIdleSync();
diff --git a/tests/tests/content/src/android/content/cts/ContentValuesTest.java b/tests/tests/content/src/android/content/cts/ContentValuesTest.java
index d228823..335b836 100644
--- a/tests/tests/content/src/android/content/cts/ContentValuesTest.java
+++ b/tests/tests/content/src/android/content/cts/ContentValuesTest.java
@@ -285,14 +285,11 @@
         args = {}
     )
     public void testToString() {
-        assertEquals("", mContentValues.toString());
+        assertNotNull(mContentValues.toString());
 
         mContentValues.put("Float", 1.1F);
-        mContentValues.put("Boolean", true);
-        assertEquals("Boolean=true Float=1.1", mContentValues.toString());
-
-        mContentValues.remove("Boolean");
-        assertEquals("Float=1.1", mContentValues.toString());
+        assertNotNull(mContentValues.toString());
+        assertTrue(mContentValues.toString().length() > 0);
     }
 
     @TestTargetNew(
diff --git a/tests/tests/content/src/android/content/res/cts/ConfigTest.java b/tests/tests/content/src/android/content/res/cts/ConfigTest.java
index ddf61b6..276cb35 100755
--- a/tests/tests/content/src/android/content/res/cts/ConfigTest.java
+++ b/tests/tests/content/src/android/content/res/cts/ConfigTest.java
@@ -534,4 +534,20 @@
         checkValue(res, R.configVarying.bag,
                 R.styleable.TestConfig, new String[]{"bag dpad"});
     }
+    
+    @MediumTest
+    public void testVersions() {
+        // Check that we get the most recent resources that are <= our
+        // current version.  Note the special version adjustment, so that
+        // during development the resource version is incremented to the
+        // next one.
+        int vers = android.os.Build.VERSION.SDK_INT;
+        if (!"REL".equals(android.os.Build.VERSION.CODENAME)) {
+            vers++;
+        }
+        String expected = "v" + vers + "cur";
+        assertEquals(expected, mContext.getResources().getString(R.string.version_cur));
+        assertEquals("base",  mContext.getResources().getString(R.string.version_old));
+        assertEquals("v3",  mContext.getResources().getString(R.string.version_v3));
+    }
 }
diff --git a/tests/tests/database/src/android/database/sqlite/cts/SQLiteQueryBuilderTest.java b/tests/tests/database/src/android/database/sqlite/cts/SQLiteQueryBuilderTest.java
index 74ef69f..15e3515 100644
--- a/tests/tests/database/src/android/database/sqlite/cts/SQLiteQueryBuilderTest.java
+++ b/tests/tests/database/src/android/database/sqlite/cts/SQLiteQueryBuilderTest.java
@@ -148,7 +148,8 @@
 
         sql = sqliteQueryBuilder.buildQuery(null, // projectionIn is null
                 null, null, null, null, null, null);
-        expected = "SELECT age, address, name FROM " + TEST_TABLE_NAME;
+        // TODO: implement an order-independent way of doing the projection columns comparison
+        expected = "SELECT age, name, address FROM " + TEST_TABLE_NAME;
         assertEquals(expected, sql);
 
         sqliteQueryBuilder.setProjectionMap(null);
diff --git a/tests/tests/graphics/src/android/graphics/cts/BitmapFactoryTest.java b/tests/tests/graphics/src/android/graphics/cts/BitmapFactoryTest.java
index 5e89e9f..4c6259c 100644
--- a/tests/tests/graphics/src/android/graphics/cts/BitmapFactoryTest.java
+++ b/tests/tests/graphics/src/android/graphics/cts/BitmapFactoryTest.java
@@ -101,8 +101,8 @@
         Bitmap b = BitmapFactory.decodeResource(mRes, R.drawable.start);
         assertNotNull(b);
         // Test the bitmap size
-        assertEquals(START_HEIGHT * mTargetDensity / mDefaultDensity, b.getHeight());
-        assertEquals(START_WIDTH * mTargetDensity / mDefaultDensity, b.getWidth());
+        assertEquals(START_HEIGHT * mTargetDensity / mDefaultDensity, b.getHeight(), 1.1);
+        assertEquals(START_WIDTH * mTargetDensity / mDefaultDensity, b.getWidth(), 1.1);
     }
 
     @TestTargetNew(
diff --git a/tests/tests/graphics/src/android/graphics/drawable/cts/BitmapDrawableTest.java b/tests/tests/graphics/src/android/graphics/drawable/cts/BitmapDrawableTest.java
index a209ca3..a27aa9d 100644
--- a/tests/tests/graphics/src/android/graphics/drawable/cts/BitmapDrawableTest.java
+++ b/tests/tests/graphics/src/android/graphics/drawable/cts/BitmapDrawableTest.java
@@ -92,16 +92,19 @@
     })
     @SuppressWarnings("deprecation")
     public void testConstructor() {
+        // TODO: should default paint flags be left as an untested implementation detail?
+        final int defaultPaintFlags = Paint.FILTER_BITMAP_FLAG | Paint.DITHER_FLAG |
+            Paint.DEV_KERN_TEXT_FLAG;
         BitmapDrawable bitmapDrawable = new BitmapDrawable();
         assertNotNull(bitmapDrawable.getPaint());
-        assertEquals(Paint.FILTER_BITMAP_FLAG | Paint.DEV_KERN_TEXT_FLAG,
+        assertEquals(defaultPaintFlags,
                 bitmapDrawable.getPaint().getFlags());
         assertNull(bitmapDrawable.getBitmap());
 
         Bitmap bitmap = Bitmap.createBitmap(200, 300, Config.ARGB_8888);
         bitmapDrawable = new BitmapDrawable(bitmap);
         assertNotNull(bitmapDrawable.getPaint());
-        assertEquals(Paint.FILTER_BITMAP_FLAG | Paint.DEV_KERN_TEXT_FLAG,
+        assertEquals(defaultPaintFlags,
                 bitmapDrawable.getPaint().getFlags());
         assertEquals(bitmap, bitmapDrawable.getBitmap());
 
@@ -190,13 +193,14 @@
         InputStream source = mContext.getResources().openRawResource(R.raw.testimage);
         BitmapDrawable bitmapDrawable = new BitmapDrawable(source);
 
+        assertTrue(bitmapDrawable.getPaint().isDither());
+
+        bitmapDrawable.setDither(false);
         assertFalse(bitmapDrawable.getPaint().isDither());
 
         bitmapDrawable.setDither(true);
         assertTrue(bitmapDrawable.getPaint().isDither());
 
-        bitmapDrawable.setDither(false);
-        assertFalse(bitmapDrawable.getPaint().isDither());
     }
 
     @TestTargets({
@@ -444,7 +448,7 @@
         assertEquals(TileMode.MIRROR, bitmapDrawable.getTileModeX());
         assertEquals(TileMode.MIRROR, bitmapDrawable.getTileModeY());
         // default value
-        assertFalse(bitmapDrawable.getPaint().isDither());
+        assertTrue(bitmapDrawable.getPaint().isDither());
         assertFalse(bitmapDrawable.getPaint().isAntiAlias());
         assertTrue(bitmapDrawable.getPaint().isFilterBitmap());
 
diff --git a/tests/tests/graphics/src/android/graphics/drawable/cts/NinePatchDrawableTest.java b/tests/tests/graphics/src/android/graphics/drawable/cts/NinePatchDrawableTest.java
index 185b564..a473cd9 100644
--- a/tests/tests/graphics/src/android/graphics/drawable/cts/NinePatchDrawableTest.java
+++ b/tests/tests/graphics/src/android/graphics/drawable/cts/NinePatchDrawableTest.java
@@ -103,9 +103,8 @@
         // } catch (Exception e) {
         // }
 
-        mNinePatchDrawable = new NinePatchDrawable(bmp, chunk, null, name);
         try {
-            mNinePatchDrawable.getPadding(new Rect());
+            mNinePatchDrawable = new NinePatchDrawable(bmp, chunk, null, name);
             fail("The constructor should not accept null padding.");
         } catch (NullPointerException e) {
         }
@@ -281,13 +280,13 @@
         args = {boolean.class}
     )
     public void testSetDither() {
-        assertFalse(mNinePatchDrawable.getPaint().isDither());
-
-        mNinePatchDrawable.setDither(true);
         assertTrue(mNinePatchDrawable.getPaint().isDither());
 
         mNinePatchDrawable.setDither(false);
         assertFalse(mNinePatchDrawable.getPaint().isDither());
+
+        mNinePatchDrawable.setDither(true);
+        assertTrue(mNinePatchDrawable.getPaint().isDither());
     }
 
     @TestTargetNew(
diff --git a/tests/tests/location/src/android/location/cts/LocationManagerTest.java b/tests/tests/location/src/android/location/cts/LocationManagerTest.java
index 335e12e..e034cdf 100755
--- a/tests/tests/location/src/android/location/cts/LocationManagerTest.java
+++ b/tests/tests/location/src/android/location/cts/LocationManagerTest.java
@@ -716,12 +716,7 @@
         assertFalse(mManager.sendExtraCommand(TEST_MOCK_PROVIDER_NAME, "unknown", new Bundle()));
 
         assertNull(mManager.getProvider(UNKNOWN_PROVIDER_NAME));
-        try {
-            mManager.sendExtraCommand(UNKNOWN_PROVIDER_NAME, "unknown", new Bundle());
-            fail("Should throw NullPointerException if the provider does not exist!");
-        } catch (NullPointerException e) {
-            // expected
-        }
+        assertFalse(mManager.sendExtraCommand(UNKNOWN_PROVIDER_NAME, "unknown", new Bundle()));
     }
 
     @TestTargets({
diff --git a/tests/tests/net/src/android/net/cts/MailToTest.java b/tests/tests/net/src/android/net/cts/MailToTest.java
index e64aaf4..01ede1a 100644
--- a/tests/tests/net/src/android/net/cts/MailToTest.java
+++ b/tests/tests/net/src/android/net/cts/MailToTest.java
@@ -28,7 +28,7 @@
 public class MailToTest extends AndroidTestCase {
     private static final String MAILTOURI_1 = "mailto:chris@example.com";
     private static final String MAILTOURI_2 = "mailto:infobot@example.com?subject=current-issue";
-    private static final String MAILTOURI_3 = 
+    private static final String MAILTOURI_3 =
             "mailto:infobot@example.com?body=send%20current-issue";
     private static final String MAILTOURI_4 = "mailto:infobot@example.com?body=send%20current-" +
                                               "issue%0D%0Asend%20index";
@@ -115,8 +115,10 @@
         assertEquals("current-issue", mailTo_2.getSubject());
         assertNull(mailTo_2.getBody());
         assertNull(mailTo_2.getCc());
-        assertEquals("mailto:?to=infobot%40example.com&subject=current-issue&",
-                mailTo_2.toString());
+        String stringUrl = mailTo_2.toString();
+        assertTrue(stringUrl.startsWith("mailto:?"));
+        assertTrue(stringUrl.contains("to=infobot%40example.com&"));
+        assertTrue(stringUrl.contains("subject=current-issue&"));
 
         assertTrue(MailTo.isMailTo(MAILTOURI_3));
         MailTo mailTo_3 = MailTo.parse(MAILTOURI_3);
@@ -126,8 +128,10 @@
         assertEquals("send current-issue", mailTo_3.getBody());
         assertNull(mailTo_3.getCc());
         assertNull(mailTo_3.getSubject());
-        assertEquals("mailto:?body=send%20current-issue&to=infobot%40example.com&",
-                mailTo_3.toString());
+        stringUrl = mailTo_3.toString();
+        assertTrue(stringUrl.startsWith("mailto:?"));
+        assertTrue(stringUrl.contains("to=infobot%40example.com&"));
+        assertTrue(stringUrl.contains("body=send%20current-issue&"));
 
         assertTrue(MailTo.isMailTo(MAILTOURI_4));
         MailTo mailTo_4 = MailTo.parse(MAILTOURI_4);
@@ -137,9 +141,11 @@
         assertEquals("send current-issue\r\nsend index", mailTo_4.getBody());
         assertNull(mailTo_4.getCc());
         assertNull(mailTo_4.getSubject());
-        assertEquals(
-                "mailto:?body=send%20current-issue%0D%0Asend%20index&to=infobot%40example.com&",
-                mailTo_4.toString());
+        stringUrl = mailTo_4.toString();
+        assertTrue(stringUrl.startsWith("mailto:?"));
+        assertTrue(stringUrl.contains("to=infobot%40example.com&"));
+        assertTrue(stringUrl.contains("body=send%20current-issue%0D%0Asend%20index&"));
+
 
         assertTrue(MailTo.isMailTo(MAILTOURI_5));
         MailTo mailTo_5 = MailTo.parse(MAILTOURI_5);
@@ -150,8 +156,11 @@
         assertEquals("bob@example.com", mailTo_5.getCc());
         assertEquals("hello", mailTo_5.getBody());
         assertNull(mailTo_5.getSubject());
-        assertEquals("mailto:?cc=bob%40example.com&body=hello&to=joe%40example.com&",
-                mailTo_5.toString());
+        stringUrl = mailTo_5.toString();
+        assertTrue(stringUrl.startsWith("mailto:?"));
+        assertTrue(stringUrl.contains("cc=bob%40example.com&"));
+        assertTrue(stringUrl.contains("body=hello&"));
+        assertTrue(stringUrl.contains("to=joe%40example.com&"));
 
         assertTrue(MailTo.isMailTo(MAILTOURI_6));
         MailTo mailTo_6 = MailTo.parse(MAILTOURI_6);
@@ -162,7 +171,10 @@
         assertEquals("bob@example.com", mailTo_6.getCc());
         assertEquals("hello", mailTo_6.getBody());
         assertNull(mailTo_6.getSubject());
-        assertEquals("mailto:?cc=bob%40example.com&body=hello&to=%2C%20joe%40example.com&",
-                mailTo_6.toString());
+        stringUrl = mailTo_6.toString();
+        assertTrue(stringUrl.startsWith("mailto:?"));
+        assertTrue(stringUrl.contains("cc=bob%40example.com&"));
+        assertTrue(stringUrl.contains("body=hello&"));
+        assertTrue(stringUrl.contains("to=%2C%20joe%40example.com&"));
     }
 }
diff --git a/tests/tests/os/src/android/os/cts/BuildVersionTest.java b/tests/tests/os/src/android/os/cts/BuildVersionTest.java
index fbde39e..6d247f0 100644
--- a/tests/tests/os/src/android/os/cts/BuildVersionTest.java
+++ b/tests/tests/os/src/android/os/cts/BuildVersionTest.java
@@ -27,8 +27,8 @@
 public class BuildVersionTest extends TestCase {
 
     private static final String LOG_TAG = "BuildVersionTest";
-    private static final String EXPECTED_RELEASE = "1.6";
-    private static final String EXPECTED_SDK = "4";
+    private static final String EXPECTED_RELEASE = "2.1";
+    private static final String EXPECTED_SDK = "6";
 
     public void testReleaseVersion() {
         // Applications may rely on the exact release version
diff --git a/tests/tests/os/src/android/os/cts/FileAcessPermissionTest.java b/tests/tests/os/src/android/os/cts/FileAccessPermissionTest.java
similarity index 85%
rename from tests/tests/os/src/android/os/cts/FileAcessPermissionTest.java
rename to tests/tests/os/src/android/os/cts/FileAccessPermissionTest.java
index 06a6de6..2922d21 100644
--- a/tests/tests/os/src/android/os/cts/FileAcessPermissionTest.java
+++ b/tests/tests/os/src/android/os/cts/FileAccessPermissionTest.java
@@ -35,12 +35,12 @@
  * read/write</B>
  * Pay attention that if run test test on emulator. You must using mksdcard to
  * create a sdcard image file then start emulator with command emulator -sdcard <filepath>
- * If run this on device, must insert a sdcard into device. 
+ * If run this on device, must insert a sdcard into device.
  *
  * mksdcard <size> <file>
  * emulator -sdcard <filepath>
  */
-public class FileAcessPermissionTest extends AndroidTestCase {
+public class FileAccessPermissionTest extends AndroidTestCase {
 
     /**
      * Test /system dir access.
@@ -80,11 +80,7 @@
         assertFalse(file.canRead());
         assertFalse(file.canWrite());
         File[] files = file.listFiles();
-        for (File f : files) {
-            assertTrue(f.canRead());
-            assertFalse(f.canWrite());
-            assertFalse(f.delete());
-        }
+        assertTrue(files == null || files.length == 0);
 
         // test app data dir.
         File dir = getContext().getFilesDir();
@@ -103,21 +99,14 @@
         File otherAppDataDir = new File(userAppDataDir, "com.test.test.dir");
         assertFalse(otherAppDataDir.mkdirs());
         files = userAppDataDir.listFiles();
-        for (int i = 0; i < files.length; i++) {
-            if (!files[i].getAbsolutePath().endsWith("com.android")) {
-                File f = new File(files[i], "files");
-                if (!f.exists()) {
-                    assertFalse(f.mkdirs());
-                } else {
-                    assertFalse(f.canWrite());
-                    File dataFile = new File(f, "test");
-                    try {
-                        dataFile.createNewFile();
-                        fail("should throw out exception");
-                    } catch (IOException e) {
-                    }
-                }
-            }
+        assertTrue(files == null || files.length == 0);
+        File newOtherAppFile = new File(userAppDataDir, "test.txt");
+        try {
+            assertFalse(newOtherAppFile.createNewFile());
+            writeFileCheck(newOtherAppFile);
+            fail("Created file in other app's directory");
+        } catch (IOException e) {
+            // expected
         }
 
         // test /sdcard dir.
diff --git a/tests/tests/provider/src/android/provider/cts/MediaStore_Images_ThumbnailsTest.java b/tests/tests/provider/src/android/provider/cts/MediaStore_Images_ThumbnailsTest.java
index 2e68695..a5c2c89 100644
--- a/tests/tests/provider/src/android/provider/cts/MediaStore_Images_ThumbnailsTest.java
+++ b/tests/tests/provider/src/android/provider/cts/MediaStore_Images_ThumbnailsTest.java
@@ -221,20 +221,10 @@
         values.put(Thumbnails.HEIGHT, 50);
         values.put(Thumbnails.WIDTH, 50);
         values.put(Thumbnails.DATA, "/sdcard/testimage1.jpg");
-        try {
-            assertEquals(1, mContentResolver.update(uri, values, null, null));
-            fail("Should throw UnsupportedOperationException when updating the thumbnail");
-        } catch (UnsupportedOperationException e) {
-            // expected
-        }
+        assertEquals(1, mContentResolver.update(uri, values, null, null));
 
         // delete
-        try {
-            assertEquals(1, mContentResolver.delete(uri, null, null));
-            fail("Should throw UnsupportedOperationException when deleting the thumbnail");
-        } catch (UnsupportedOperationException e) {
-            // expected
-        }
+        assertEquals(1, mContentResolver.delete(uri, null, null));
     }
 
     public void testStoreImagesMediaInternal() {
diff --git a/tools/host/src/com/android/cts/Version.java b/tools/host/src/com/android/cts/Version.java
index 8ea5cf0..d34649b 100644
--- a/tools/host/src/com/android/cts/Version.java
+++ b/tools/host/src/com/android/cts/Version.java
@@ -18,7 +18,7 @@
 
 public class Version {
     // The CTS version string
-    private static final String version = "1.6_r1";
+    private static final String version = "2.1_pre_r1";
     
     private Version() {
         // no instances allowed
diff --git a/tools/test-progress-new/etc/test-progress b/tools/test-progress-new/etc/test-progress
index 94a4289..af7eec4 100644
--- a/tools/test-progress-new/etc/test-progress
+++ b/tools/test-progress-new/etc/test-progress
@@ -274,6 +274,7 @@
 android.accounts.cts \
 android.app \
 android.app.cts \
+android.bluetooth \
 android.content \
 android.content.cts \
 android.content.pm \
@@ -321,6 +322,7 @@
 android.speech.tts \
 android.speech.tts.cts \
 android.telephony \
+android.telephony.cdma \
 android.telephony.cts \
 android.telephony.gsm \
 android.telephony.gsm.cts \