Merge remote branch 'goog/honeycomb-mr1' into honeycomb-mr2

Conflicts:
	tests/tests/dpi/src/android/dpi/cts/ConfigurationTest.java

Change-Id: I7c1af2c95488db0e14e2973b6d0dc6ad33059dfe
diff --git a/apps/CtsVerifier/AndroidManifest.xml b/apps/CtsVerifier/AndroidManifest.xml
index 969c2a7..157116a 100644
--- a/apps/CtsVerifier/AndroidManifest.xml
+++ b/apps/CtsVerifier/AndroidManifest.xml
@@ -18,7 +18,7 @@
 <manifest xmlns:android="http://schemas.android.com/apk/res/android"
       package="com.android.cts.verifier"
       android:versionCode="1"
-      android:versionName="3.1_r1">
+      android:versionName="3.2_r1">
 
     <uses-sdk android:minSdkVersion="5"></uses-sdk>
 
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/features/FeatureSummaryActivity.java b/apps/CtsVerifier/src/com/android/cts/verifier/features/FeatureSummaryActivity.java
index 6ed4773..3736711 100644
--- a/apps/CtsVerifier/src/com/android/cts/verifier/features/FeatureSummaryActivity.java
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/features/FeatureSummaryActivity.java
@@ -157,6 +157,13 @@
             new Feature("android.hardware.usb.accessory", true),
     };
 
+    public static final Feature[] ALL_HONEYCOMB_MR2_FEATURES = {
+            new Feature("android.hardware.faketouch.multitouch.distinct", false),
+            new Feature("android.hardware.faketouch.multitouch.jazzhand", false),
+            new Feature("android.hardware.screen.landscape", false),
+            new Feature("android.hardware.screen.portrait", false),
+    };
+
     @Override
     public void onCreate(Bundle savedInstanceState) {
         super.onCreate(savedInstanceState);
@@ -187,6 +194,9 @@
 
         // add features from latest to last so that the latest requirements are put in the set first
         int apiVersion = Build.VERSION.SDK_INT;
+        if (apiVersion >= Build.VERSION_CODES.HONEYCOMB_MR2) {
+            Collections.addAll(features, ALL_HONEYCOMB_MR2_FEATURES);
+        }
         if (apiVersion >= Build.VERSION_CODES.HONEYCOMB_MR1) {
             Collections.addAll(features, ALL_HONEYCOMB_MR1_FEATURES);
         }
diff --git a/tests/expectations/knownfailures.txt b/tests/expectations/knownfailures.txt
index addf048..bfa478b 100644
--- a/tests/expectations/knownfailures.txt
+++ b/tests/expectations/knownfailures.txt
@@ -1,4 +1,5 @@
 [
+/* Framework problems. */
 {
   name: "android.admin.cts.DevicePolicyManagerTest",
   bug: 4993068
@@ -31,28 +32,22 @@
   name: "android.webkit.cts.WebViewTest#testRequestFocusNodeHref",
   bug: 3241968
 },
-{
-  name: "android.webkit.cts.CookieSyncManagerTest#testCookieSyncManager",
-  bug: 4442572
-},
-{
-  name: "android.graphics.cts.PaintTest#testBreakText",
-  bug: 4355524
-},
-{
-  name: "android.graphics.cts.PaintTest#testMeasureText",
-  bug: 4361123
-},
+
 {
   description: "Need investigation.",
   names: [
-    "android.content.cts.ContextWrapperTest#testAccessTheme",
     "android.provider.cts.Contacts_PeopleTest#testAddToGroup",
     "android.provider.cts.MediaStore_Audio_Playlists_MembersTest",
     "android.webkit.cts.WebViewTest#testRequestImageRef",
     "tests.api.java.util.CalendarTest#test_getInstance"
   ]
 },
+
+{
+  description: "Test should be made independent from theme.",
+  name: "android.content.cts.ContextWrapperTest#testAccessTheme"
+},
+  
 {
   description: "Flakey",
   names: [
@@ -63,4 +58,5 @@
     "android.widget.cts.AbsListViewTest#testGetContextMenuInfo"
   ]
 }
+
 ]
diff --git a/tests/res/values-h550dp/configVarying.xml b/tests/res/values-h550dp/configVarying.xml
new file mode 100755
index 0000000..2faab0e
--- /dev/null
+++ b/tests/res/values-h550dp/configVarying.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- 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.
+-->
+
+<resources>
+    <item type="configVarying" name="simple">simple h550</item>
+    <bag type="configVarying" name="bag">
+        <item name="testString">bag h550</item>
+    </bag>
+    <item type="configVarying" name="h">550</item>
+    <item type="configVarying" name="wh">550</item>
+</resources>
diff --git a/tests/res/values-h670dp/configVarying.xml b/tests/res/values-h670dp/configVarying.xml
new file mode 100755
index 0000000..21ade5b
--- /dev/null
+++ b/tests/res/values-h670dp/configVarying.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- 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.
+-->
+
+<resources>
+    <item type="configVarying" name="simple">simple h670</item>
+    <bag type="configVarying" name="bag">
+        <item name="testString">bag h670</item>
+    </bag>
+    <item type="configVarying" name="h">670</item>
+    <item type="configVarying" name="wh">670</item>
+</resources>
diff --git a/tests/res/values-sw600dp-land/configVarying.xml b/tests/res/values-sw600dp-land/configVarying.xml
new file mode 100755
index 0000000..c18dda6
--- /dev/null
+++ b/tests/res/values-sw600dp-land/configVarying.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- 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.
+-->
+
+<resources>
+    <item type="configVarying" name="simple">simple sw600 land</item>
+    <bag type="configVarying" name="bag">
+        <item name="testString">bag sw600 land</item>
+    </bag>
+    <item type="configVarying" name="sw">600 land</item>
+</resources>
diff --git a/tests/res/values-sw600dp/configVarying.xml b/tests/res/values-sw600dp/configVarying.xml
new file mode 100755
index 0000000..5ecea45
--- /dev/null
+++ b/tests/res/values-sw600dp/configVarying.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- 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.
+-->
+
+<resources>
+    <item type="configVarying" name="simple">simple sw600</item>
+    <bag type="configVarying" name="bag">
+        <item name="testString">bag sw600</item>
+    </bag>
+    <item type="configVarying" name="sw">600</item>
+</resources>
diff --git a/tests/res/values-sw720dp/configVarying.xml b/tests/res/values-sw720dp/configVarying.xml
new file mode 100755
index 0000000..99af476
--- /dev/null
+++ b/tests/res/values-sw720dp/configVarying.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- 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.
+-->
+
+<resources>
+    <item type="configVarying" name="simple">simple sw720</item>
+    <bag type="configVarying" name="bag">
+        <item name="testString">bag sw720</item>
+    </bag>
+    <item type="configVarying" name="sw">720</item>
+</resources>
diff --git a/tests/res/values-v13/strings.xml b/tests/res/values-v13/strings.xml
index d71936a..c3f723c 100644
--- a/tests/res/values-v13/strings.xml
+++ b/tests/res/values-v13/strings.xml
@@ -16,5 +16,4 @@
 
 <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-v14/strings.xml b/tests/res/values-v14/strings.xml
new file mode 100644
index 0000000..45f5fbe
--- /dev/null
+++ b/tests/res/values-v14/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">v14cur</string>
+</resources>
diff --git a/tests/res/values-v15/strings.xml b/tests/res/values-v15/strings.xml
new file mode 100644
index 0000000..c1d5e48
--- /dev/null
+++ b/tests/res/values-v15/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">v15cur</string>
+</resources>
diff --git a/tests/res/values-v16/strings.xml b/tests/res/values-v16/strings.xml
new file mode 100644
index 0000000..e7a3e8e
--- /dev/null
+++ b/tests/res/values-v16/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">v16cur</string>
+</resources>
diff --git a/tests/res/values-v17/strings.xml b/tests/res/values-v17/strings.xml
new file mode 100644
index 0000000..fcf9d91
--- /dev/null
+++ b/tests/res/values-v17/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">v17cur</string>
+</resources>
diff --git a/tests/res/values-v18/strings.xml b/tests/res/values-v18/strings.xml
new file mode 100644
index 0000000..0b84d5e
--- /dev/null
+++ b/tests/res/values-v18/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">v18cur</string>
+   <string name="version_old">v18old</string>
+</resources>
diff --git a/tests/res/values-w600dp-h550dp/configVarying.xml b/tests/res/values-w600dp-h550dp/configVarying.xml
new file mode 100755
index 0000000..d4361a8
--- /dev/null
+++ b/tests/res/values-w600dp-h550dp/configVarying.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- 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.
+-->
+
+<resources>
+    <item type="configVarying" name="simple">simple sw600</item>
+    <bag type="configVarying" name="bag">
+        <item name="testString">bag sw600</item>
+    </bag>
+    <item type="configVarying" name="wh">600-550</item>
+</resources>
diff --git a/tests/res/values-w600dp/configVarying.xml b/tests/res/values-w600dp/configVarying.xml
new file mode 100755
index 0000000..b8248a6
--- /dev/null
+++ b/tests/res/values-w600dp/configVarying.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- 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.
+-->
+
+<resources>
+    <item type="configVarying" name="simple">simple w600</item>
+    <bag type="configVarying" name="bag">
+        <item name="testString">bag w600</item>
+    </bag>
+    <item type="configVarying" name="w">600</item>
+    <item type="configVarying" name="wh">600</item>
+</resources>
diff --git a/tests/res/values-w720dp-h670dp/configVarying.xml b/tests/res/values-w720dp-h670dp/configVarying.xml
new file mode 100755
index 0000000..c205786
--- /dev/null
+++ b/tests/res/values-w720dp-h670dp/configVarying.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- 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.
+-->
+
+<resources>
+    <item type="configVarying" name="simple">simple 720-670</item>
+    <bag type="configVarying" name="bag">
+        <item name="testString">bag 720-670</item>
+    </bag>
+    <item type="configVarying" name="wh">720-670</item>
+</resources>
diff --git a/tests/res/values-w720dp/configVarying.xml b/tests/res/values-w720dp/configVarying.xml
new file mode 100755
index 0000000..3211ad4
--- /dev/null
+++ b/tests/res/values-w720dp/configVarying.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- 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.
+-->
+
+<resources>
+    <item type="configVarying" name="simple">simple w720</item>
+    <bag type="configVarying" name="bag">
+        <item name="testString">bag w720</item>
+    </bag>
+    <item type="configVarying" name="w">720</item>
+</resources>
diff --git a/tests/res/values/configVarying.xml b/tests/res/values/configVarying.xml
index de1b09e..7b7d576 100755
--- a/tests/res/values/configVarying.xml
+++ b/tests/res/values/configVarying.xml
@@ -23,4 +23,8 @@
     <item type="configVarying" name="normal">default</item>
     <item type="configVarying" name="large">default</item>
     <item type="configVarying" name="xlarge">default</item>
+    <item type="configVarying" name="sw">default</item>
+    <item type="configVarying" name="w">default</item>
+    <item type="configVarying" name="h">default</item>
+    <item type="configVarying" name="wh">default</item>
 </resources>
diff --git a/tests/tests/app/src/android/app/cts/ActivityManagerMemoryClassTest.java b/tests/tests/app/src/android/app/cts/ActivityManagerMemoryClassTest.java
index 5ff5e67..f5cfa10 100644
--- a/tests/tests/app/src/android/app/cts/ActivityManagerMemoryClassTest.java
+++ b/tests/tests/app/src/android/app/cts/ActivityManagerMemoryClassTest.java
@@ -33,11 +33,6 @@
 public class ActivityManagerMemoryClassTest
         extends ActivityInstrumentationTestCase2<ActivityManagerMemoryClassLaunchActivity> {
 
-    /**
-     * A density value used by some TV devices, but not yet in {link DisplayMetrics}.
-     */
-    private static final int DENSITY_TV = 213;
-
     public ActivityManagerMemoryClassTest() {
         super(ActivityManagerMemoryClassLaunchActivity.class);
     }
@@ -88,7 +83,7 @@
 
             case DisplayMetrics.DENSITY_HIGH:
             case DisplayMetrics.DENSITY_XHIGH:
-            case DENSITY_TV:
+            case DisplayMetrics.DENSITY_TV:
                 expectedMinimumMemory = isXLarge ? 48 : 32;
                 break;
 
diff --git a/tests/tests/app/src/android/app/cts/SystemFeaturesTest.java b/tests/tests/app/src/android/app/cts/SystemFeaturesTest.java
index e4d306c..bb7cc4b 100644
--- a/tests/tests/app/src/android/app/cts/SystemFeaturesTest.java
+++ b/tests/tests/app/src/android/app/cts/SystemFeaturesTest.java
@@ -203,6 +203,11 @@
         }
     }
 
+    public void testScreenFeatures() {
+        assertTrue(mPackageManager.hasSystemFeature(PackageManager.FEATURE_SCREEN_LANDSCAPE)
+                || mPackageManager.hasSystemFeature(PackageManager.FEATURE_SCREEN_PORTRAIT));
+    }
+
     /**
      * Check that the sensor features reported by the PackageManager correspond to the sensors
      * returned by {@link SensorManager#getSensorList(int)}.
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 d68fd19..144c2f2 100755
--- a/tests/tests/content/src/android/content/res/cts/ConfigTest.java
+++ b/tests/tests/content/src/android/content/res/cts/ConfigTest.java
@@ -27,6 +27,7 @@
 import android.test.suitebuilder.annotation.MediumTest;
 import android.test.suitebuilder.annotation.SmallTest;
 import android.util.DisplayMetrics;
+import android.util.Log;
 
 import com.android.cts.stub.R;
 
@@ -44,7 +45,10 @@
         WIDTH,
         HEIGHT,
         DENSITY,
-        SCREENLAYOUT
+        SCREENLAYOUT,
+        SWIDTH_DP,
+        WIDTH_DP,
+        HEIGHT_DP
     }
 
     private static void checkValue(final Resources res, final int resId,
@@ -78,25 +82,13 @@
     }
 
     private class TotalConfig {
-        private Configuration mConfig;
-        private DisplayMetrics mMetrics;
+        final Configuration mConfig;
+        final DisplayMetrics mMetrics;
 
         public TotalConfig() {
             mConfig = new Configuration();
-            // don't rely on build settings - they may change
-            mConfig.locale = new Locale("en", "US");
-            mConfig.mcc = 310;
-            mConfig.mnc = 001; // unused
-            mConfig.touchscreen = Configuration.TOUCHSCREEN_FINGER;
-            mConfig.keyboard = Configuration.KEYBOARD_QWERTY;
-            mConfig.keyboardHidden = Configuration.KEYBOARDHIDDEN_YES;
-            mConfig.navigation = Configuration.NAVIGATION_TRACKBALL;
-            mConfig.orientation = Configuration.ORIENTATION_PORTRAIT;
-
             mMetrics = new DisplayMetrics();
-            mMetrics.widthPixels = 200;
-            mMetrics.heightPixels = 320;
-            mMetrics.density = 1;
+            mConfig.locale = new Locale("++", "++");
         }
 
         public void setProperty(final Properties p, final int value) {
@@ -135,6 +127,15 @@
                 case SCREENLAYOUT:
                     mConfig.screenLayout = value;
                     break;
+                case SWIDTH_DP:
+                    mConfig.smallestScreenWidthDp = value;
+                    break;
+                case WIDTH_DP:
+                    mConfig.screenWidthDp = value;
+                    break;
+                case HEIGHT_DP:
+                    mConfig.screenHeightDp = value;
+                    break;
                 default:
                     assert(false);
                     break;
@@ -164,6 +165,29 @@
         }
     }
 
+    public TotalConfig makeEmptyConfig() {
+        return new TotalConfig();
+    }
+
+    public TotalConfig makeClassicConfig() {
+        TotalConfig config = new TotalConfig();
+        config.mConfig.locale = new Locale("en", "US");
+        config.mConfig.mcc = 310;
+        config.mConfig.mnc = 001; // unused
+        config.mConfig.touchscreen = Configuration.TOUCHSCREEN_FINGER;
+        config.mConfig.keyboard = Configuration.KEYBOARD_QWERTY;
+        config.mConfig.keyboardHidden = Configuration.KEYBOARDHIDDEN_YES;
+        config.mConfig.navigation = Configuration.NAVIGATION_TRACKBALL;
+        config.mConfig.orientation = Configuration.ORIENTATION_PORTRAIT;
+        config.mConfig.smallestScreenWidthDp = 320;
+        config.mConfig.screenWidthDp = 320;
+        config.mConfig.screenHeightDp = 480;
+        config.mMetrics.widthPixels = 200;
+        config.mMetrics.heightPixels = 320;
+        config.mMetrics.density = 1;
+        return config;
+    }
+
     private static void checkPair(Resources res, int[] notResIds,
             int simpleRes, String simpleString,
             int bagRes, String bagString) {
@@ -182,25 +206,25 @@
     }
 
     @SmallTest
-    public void testAllConfigs() {
+    public void testAllEmptyConfigs() {
         /**
          * Test a resource that contains a value for each possible single
          * configuration value.
          */
-        TotalConfig config = new TotalConfig();
+        TotalConfig config = makeEmptyConfig();
         Resources res = config.getResources();
         checkValue(res, R.configVarying.simple, "simple default");
         checkValue(res, R.configVarying.bag,
                 R.styleable.TestConfig, new String[]{"bag default"});
 
-        config = new TotalConfig();
+        config = makeEmptyConfig();
         config.setProperty(Properties.LANGUAGE, "xx");
         res = config.getResources();
         checkValue(res, R.configVarying.simple, "simple xx");
         checkValue(res, R.configVarying.bag,
                 R.styleable.TestConfig, new String[]{"bag xx"});
 
-        config = new TotalConfig();
+        config = makeEmptyConfig();
         config.setProperty(Properties.LANGUAGE, "xx");
         config.setProperty(Properties.COUNTRY, "YY");
         res = config.getResources();
@@ -208,77 +232,77 @@
         checkValue(res, R.configVarying.bag,
                 R.styleable.TestConfig, new String[]{"bag xx-rYY"});
 
-        config = new TotalConfig();
+        config = makeEmptyConfig();
         config.setProperty(Properties.MCC, 111);
         res = config.getResources();
         checkValue(res, R.configVarying.simple, "simple mcc111");
         checkValue(res, R.configVarying.bag,
                 R.styleable.TestConfig, new String[]{"bag mcc111"});
 
-        config = new TotalConfig();
+        config = makeEmptyConfig();
         config.setProperty(Properties.MNC, 222);
         res = config.getResources();
         checkValue(res, R.configVarying.simple, "simple mnc222");
         checkValue(res, R.configVarying.bag,
                 R.styleable.TestConfig, new String[]{"bag mnc222"});
 
-        config = new TotalConfig();
+        config = makeEmptyConfig();
         config.setProperty(Properties.TOUCHSCREEN, Configuration.TOUCHSCREEN_NOTOUCH);
         res = config.getResources();
         checkValue(res, R.configVarying.simple, "simple notouch");
         checkValue(res, R.configVarying.bag,
                 R.styleable.TestConfig, new String[]{"bag notouch"});
 
-        config = new TotalConfig();
+        config = makeEmptyConfig();
         config.setProperty(Properties.TOUCHSCREEN, Configuration.TOUCHSCREEN_STYLUS);
         res = config.getResources();
         checkValue(res, R.configVarying.simple, "simple stylus");
         checkValue(res, R.configVarying.bag,
                 R.styleable.TestConfig, new String[]{"bag stylus"});
 
-        config = new TotalConfig();
+        config = makeEmptyConfig();
         config.setProperty(Properties.KEYBOARD, Configuration.KEYBOARD_NOKEYS);
         res = config.getResources();
         checkValue(res, R.configVarying.simple, "simple nokeys");
         checkValue(res, R.configVarying.bag,
                 R.styleable.TestConfig, new String[]{"bag nokeys"});
 
-        config = new TotalConfig();
+        config = makeEmptyConfig();
         config.setProperty(Properties.KEYBOARD, Configuration.KEYBOARD_12KEY);
         res = config.getResources();
         checkValue(res, R.configVarying.simple, "simple 12key");
         checkValue(res, R.configVarying.bag,
                 R.styleable.TestConfig, new String[]{"bag 12key"});
 
-        config = new TotalConfig();
+        config = makeEmptyConfig();
         config.setProperty(Properties.KEYBOARDHIDDEN, Configuration.KEYBOARDHIDDEN_NO);
         res = config.getResources();
         checkValue(res, R.configVarying.simple, "simple keysexposed");
         checkValue(res, R.configVarying.bag,
                 R.styleable.TestConfig, new String[]{"bag keysexposed"});
 
-        config = new TotalConfig();
+        config = makeEmptyConfig();
         config.setProperty(Properties.NAVIGATION, Configuration.NAVIGATION_NONAV);
         res = config.getResources();
         checkValue(res, R.configVarying.simple, "simple nonav");
         checkValue(res, R.configVarying.bag,
                 R.styleable.TestConfig, new String[]{"bag nonav"});
 
-        config = new TotalConfig();
+        config = makeEmptyConfig();
         config.setProperty(Properties.NAVIGATION, Configuration.NAVIGATION_DPAD);
         res = config.getResources();
         checkValue(res, R.configVarying.simple, "simple dpad");
         checkValue(res, R.configVarying.bag,
                 R.styleable.TestConfig, new String[]{"bag dpad"});
 
-        config = new TotalConfig();
+        config = makeEmptyConfig();
         config.setProperty(Properties.NAVIGATION, Configuration.NAVIGATION_WHEEL);
         res = config.getResources();
         checkValue(res, R.configVarying.simple, "simple wheel");
         checkValue(res, R.configVarying.bag,
                 R.styleable.TestConfig, new String[]{"bag wheel"});
 
-        config = new TotalConfig();
+        config = makeEmptyConfig();
         config.setProperty(Properties.HEIGHT, 480);
         config.setProperty(Properties.WIDTH, 320);
         res = config.getResources();
@@ -286,54 +310,308 @@
         checkValue(res, R.configVarying.bag,
                 R.styleable.TestConfig, new String[]{"bag 480x320"});
 
-        config = new TotalConfig();
+        config = makeEmptyConfig();
         config.setProperty(Properties.DENSITY, 240);
         res = config.getResources();
         checkValue(res, R.configVarying.simple, "simple 240dpi");
         checkValue(res, R.configVarying.bag,
                 R.styleable.TestConfig, new String[]{"bag 240dpi"});
 
-        config = new TotalConfig();
+        config = makeEmptyConfig();
         config.setProperty(Properties.ORIENTATION, Configuration.ORIENTATION_LANDSCAPE);
         res = config.getResources();
         checkValue(res, R.configVarying.simple, "simple landscape");
         checkValue(res, R.configVarying.bag,
                 R.styleable.TestConfig, new String[]{"bag landscape"});
 
-        config = new TotalConfig();
+        config = makeEmptyConfig();
         config.setProperty(Properties.ORIENTATION, Configuration.ORIENTATION_SQUARE);
         res = config.getResources();
         checkValue(res, R.configVarying.simple, "simple square");
         checkValue(res, R.configVarying.bag,
                 R.styleable.TestConfig, new String[]{"bag square"});
 
-        config = new TotalConfig();
+        config = makeEmptyConfig();
         config.setProperty(Properties.SCREENLAYOUT, Configuration.SCREENLAYOUT_SIZE_SMALL);
         res = config.getResources();
         checkValue(res, R.configVarying.simple, "simple small");
         checkValue(res, R.configVarying.bag,
                 R.styleable.TestConfig, new String[]{"bag small"});
 
-        config = new TotalConfig();
+        config = makeEmptyConfig();
         config.setProperty(Properties.SCREENLAYOUT, Configuration.SCREENLAYOUT_SIZE_NORMAL);
         res = config.getResources();
         checkValue(res, R.configVarying.simple, "simple normal");
         checkValue(res, R.configVarying.bag,
                 R.styleable.TestConfig, new String[]{"bag normal"});
 
-        config = new TotalConfig();
+        config = makeEmptyConfig();
         config.setProperty(Properties.SCREENLAYOUT, Configuration.SCREENLAYOUT_SIZE_LARGE);
         res = config.getResources();
         checkValue(res, R.configVarying.simple, "simple large");
         checkValue(res, R.configVarying.bag,
                 R.styleable.TestConfig, new String[]{"bag large"});
 
-        config = new TotalConfig();
+        config = makeEmptyConfig();
         config.setProperty(Properties.SCREENLAYOUT, Configuration.SCREENLAYOUT_SIZE_XLARGE);
         res = config.getResources();
         checkValue(res, R.configVarying.simple, "simple xlarge");
         checkValue(res, R.configVarying.bag,
                 R.styleable.TestConfig, new String[]{"bag xlarge"});
+
+        config = makeEmptyConfig();
+        config.setProperty(Properties.SWIDTH_DP, 600);
+        res = config.getResources();
+        checkValue(res, R.configVarying.simple, "simple sw600");
+        checkValue(res, R.configVarying.bag,
+                R.styleable.TestConfig, new String[]{"bag sw600"});
+
+        config = makeEmptyConfig();
+        config.setProperty(Properties.SWIDTH_DP, 600);
+        res = config.getResources();
+        checkValue(res, R.configVarying.simple, "simple sw600");
+        checkValue(res, R.configVarying.bag,
+                R.styleable.TestConfig, new String[]{"bag sw600"});
+
+        config = makeEmptyConfig();
+        config.setProperty(Properties.SWIDTH_DP, 720);
+        res = config.getResources();
+        checkValue(res, R.configVarying.simple, "simple sw720");
+        checkValue(res, R.configVarying.bag,
+                R.styleable.TestConfig, new String[]{"bag sw720"});
+
+        config = makeEmptyConfig();
+        config.setProperty(Properties.WIDTH_DP, 600);
+        res = config.getResources();
+        checkValue(res, R.configVarying.simple, "simple w600");
+        checkValue(res, R.configVarying.bag,
+                R.styleable.TestConfig, new String[]{"bag w600"});
+
+        config = makeEmptyConfig();
+        config.setProperty(Properties.WIDTH_DP, 720);
+        res = config.getResources();
+        checkValue(res, R.configVarying.simple, "simple w720");
+        checkValue(res, R.configVarying.bag,
+                R.styleable.TestConfig, new String[]{"bag w720"});
+
+        config = makeEmptyConfig();
+        config.setProperty(Properties.HEIGHT_DP, 550);
+        res = config.getResources();
+        checkValue(res, R.configVarying.simple, "simple h550");
+        checkValue(res, R.configVarying.bag,
+                R.styleable.TestConfig, new String[]{"bag h550"});
+
+        config = makeEmptyConfig();
+        config.setProperty(Properties.HEIGHT_DP, 670);
+        res = config.getResources();
+        checkValue(res, R.configVarying.simple, "simple h670");
+        checkValue(res, R.configVarying.bag,
+                R.styleable.TestConfig, new String[]{"bag h670"});
+    }
+
+    @SmallTest
+    public void testAllClassicConfigs() {
+        /**
+         * Test a resource that contains a value for each possible single
+         * configuration value.
+         */
+        TotalConfig config = makeClassicConfig();
+        Resources res = config.getResources();
+        checkValue(res, R.configVarying.simple, "simple default");
+        checkValue(res, R.configVarying.bag,
+                R.styleable.TestConfig, new String[]{"bag default"});
+
+        config = makeClassicConfig();
+        config.setProperty(Properties.LANGUAGE, "xx");
+        res = config.getResources();
+        checkValue(res, R.configVarying.simple, "simple xx");
+        checkValue(res, R.configVarying.bag,
+                R.styleable.TestConfig, new String[]{"bag xx"});
+
+        config = makeClassicConfig();
+        config.setProperty(Properties.LANGUAGE, "xx");
+        config.setProperty(Properties.COUNTRY, "YY");
+        res = config.getResources();
+        checkValue(res, R.configVarying.simple, "simple xx-rYY");
+        checkValue(res, R.configVarying.bag,
+                R.styleable.TestConfig, new String[]{"bag xx-rYY"});
+
+        config = makeClassicConfig();
+        config.setProperty(Properties.MCC, 111);
+        res = config.getResources();
+        checkValue(res, R.configVarying.simple, "simple mcc111");
+        checkValue(res, R.configVarying.bag,
+                R.styleable.TestConfig, new String[]{"bag mcc111"});
+
+        config = makeClassicConfig();
+        config.setProperty(Properties.MNC, 222);
+        res = config.getResources();
+        checkValue(res, R.configVarying.simple, "simple mnc222");
+        checkValue(res, R.configVarying.bag,
+                R.styleable.TestConfig, new String[]{"bag mnc222"});
+
+        config = makeClassicConfig();
+        config.setProperty(Properties.TOUCHSCREEN, Configuration.TOUCHSCREEN_NOTOUCH);
+        res = config.getResources();
+        checkValue(res, R.configVarying.simple, "simple notouch");
+        checkValue(res, R.configVarying.bag,
+                R.styleable.TestConfig, new String[]{"bag notouch"});
+
+        config = makeClassicConfig();
+        config.setProperty(Properties.TOUCHSCREEN, Configuration.TOUCHSCREEN_STYLUS);
+        res = config.getResources();
+        checkValue(res, R.configVarying.simple, "simple stylus");
+        checkValue(res, R.configVarying.bag,
+                R.styleable.TestConfig, new String[]{"bag stylus"});
+
+        config = makeClassicConfig();
+        config.setProperty(Properties.KEYBOARD, Configuration.KEYBOARD_NOKEYS);
+        res = config.getResources();
+        checkValue(res, R.configVarying.simple, "simple nokeys");
+        checkValue(res, R.configVarying.bag,
+                R.styleable.TestConfig, new String[]{"bag nokeys"});
+
+        config = makeClassicConfig();
+        config.setProperty(Properties.KEYBOARD, Configuration.KEYBOARD_12KEY);
+        res = config.getResources();
+        checkValue(res, R.configVarying.simple, "simple 12key 63x57");
+        checkValue(res, R.configVarying.bag,
+                R.styleable.TestConfig, new String[]{"bag 12key 63x57"});
+
+        config = makeClassicConfig();
+        config.setProperty(Properties.KEYBOARDHIDDEN, Configuration.KEYBOARDHIDDEN_NO);
+        res = config.getResources();
+        checkValue(res, R.configVarying.simple, "simple keysexposed");
+        checkValue(res, R.configVarying.bag,
+                R.styleable.TestConfig, new String[]{"bag keysexposed"});
+
+        config = makeClassicConfig();
+        config.setProperty(Properties.NAVIGATION, Configuration.NAVIGATION_NONAV);
+        res = config.getResources();
+        checkValue(res, R.configVarying.simple, "simple nonav");
+        checkValue(res, R.configVarying.bag,
+                R.styleable.TestConfig, new String[]{"bag nonav"});
+
+        config = makeClassicConfig();
+        config.setProperty(Properties.NAVIGATION, Configuration.NAVIGATION_DPAD);
+        res = config.getResources();
+        checkValue(res, R.configVarying.simple, "simple dpad 63x57");
+        checkValue(res, R.configVarying.bag,
+                R.styleable.TestConfig, new String[]{"bag dpad 63x57"});
+
+        config = makeClassicConfig();
+        config.setProperty(Properties.NAVIGATION, Configuration.NAVIGATION_WHEEL);
+        res = config.getResources();
+        checkValue(res, R.configVarying.simple, "simple wheel");
+        checkValue(res, R.configVarying.bag,
+                R.styleable.TestConfig, new String[]{"bag wheel"});
+
+        config = makeClassicConfig();
+        config.setProperty(Properties.HEIGHT, 480);
+        config.setProperty(Properties.WIDTH, 320);
+        res = config.getResources();
+        checkValue(res, R.configVarying.simple, "simple 480x320");
+        checkValue(res, R.configVarying.bag,
+                R.styleable.TestConfig, new String[]{"bag 480x320"});
+
+        config = makeClassicConfig();
+        config.setProperty(Properties.DENSITY, 240);
+        res = config.getResources();
+        checkValue(res, R.configVarying.simple, "simple 240dpi");
+        checkValue(res, R.configVarying.bag,
+                R.styleable.TestConfig, new String[]{"bag 240dpi"});
+
+        config = makeClassicConfig();
+        config.setProperty(Properties.ORIENTATION, Configuration.ORIENTATION_LANDSCAPE);
+        res = config.getResources();
+        checkValue(res, R.configVarying.simple, "simple landscape");
+        checkValue(res, R.configVarying.bag,
+                R.styleable.TestConfig, new String[]{"bag landscape"});
+
+        config = makeClassicConfig();
+        config.setProperty(Properties.ORIENTATION, Configuration.ORIENTATION_SQUARE);
+        res = config.getResources();
+        checkValue(res, R.configVarying.simple, "simple square");
+        checkValue(res, R.configVarying.bag,
+                R.styleable.TestConfig, new String[]{"bag square"});
+
+        config = makeClassicConfig();
+        config.setProperty(Properties.SCREENLAYOUT, Configuration.SCREENLAYOUT_SIZE_SMALL);
+        res = config.getResources();
+        checkValue(res, R.configVarying.simple, "simple small");
+        checkValue(res, R.configVarying.bag,
+                R.styleable.TestConfig, new String[]{"bag small"});
+
+        config = makeClassicConfig();
+        config.setProperty(Properties.SCREENLAYOUT, Configuration.SCREENLAYOUT_SIZE_NORMAL);
+        res = config.getResources();
+        checkValue(res, R.configVarying.simple, "simple normal");
+        checkValue(res, R.configVarying.bag,
+                R.styleable.TestConfig, new String[]{"bag normal"});
+
+        config = makeClassicConfig();
+        config.setProperty(Properties.SCREENLAYOUT, Configuration.SCREENLAYOUT_SIZE_LARGE);
+        res = config.getResources();
+        checkValue(res, R.configVarying.simple, "simple large");
+        checkValue(res, R.configVarying.bag,
+                R.styleable.TestConfig, new String[]{"bag large"});
+
+        config = makeClassicConfig();
+        config.setProperty(Properties.SCREENLAYOUT, Configuration.SCREENLAYOUT_SIZE_XLARGE);
+        res = config.getResources();
+        checkValue(res, R.configVarying.simple, "simple xlarge");
+        checkValue(res, R.configVarying.bag,
+                R.styleable.TestConfig, new String[]{"bag xlarge"});
+
+        config = makeClassicConfig();
+        config.setProperty(Properties.SWIDTH_DP, 600);
+        res = config.getResources();
+        checkValue(res, R.configVarying.simple, "simple sw600");
+        checkValue(res, R.configVarying.bag,
+                R.styleable.TestConfig, new String[]{"bag sw600"});
+
+        config = makeClassicConfig();
+        config.setProperty(Properties.SWIDTH_DP, 600);
+        config.setProperty(Properties.ORIENTATION, Configuration.ORIENTATION_LANDSCAPE);
+        res = config.getResources();
+        checkValue(res, R.configVarying.simple, "simple sw600 land");
+        checkValue(res, R.configVarying.bag,
+                R.styleable.TestConfig, new String[]{"bag sw600 land"});
+
+        config = makeClassicConfig();
+        config.setProperty(Properties.SWIDTH_DP, 720);
+        res = config.getResources();
+        checkValue(res, R.configVarying.simple, "simple sw720");
+        checkValue(res, R.configVarying.bag,
+                R.styleable.TestConfig, new String[]{"bag sw720"});
+
+        config = makeClassicConfig();
+        config.setProperty(Properties.WIDTH_DP, 600);
+        res = config.getResources();
+        checkValue(res, R.configVarying.simple, "simple w600");
+        checkValue(res, R.configVarying.bag,
+                R.styleable.TestConfig, new String[]{"bag w600"});
+
+        config = makeClassicConfig();
+        config.setProperty(Properties.WIDTH_DP, 720);
+        res = config.getResources();
+        checkValue(res, R.configVarying.simple, "simple w720");
+        checkValue(res, R.configVarying.bag,
+                R.styleable.TestConfig, new String[]{"bag w720"});
+
+        config = makeClassicConfig();
+        config.setProperty(Properties.HEIGHT_DP, 550);
+        res = config.getResources();
+        checkValue(res, R.configVarying.simple, "simple h550");
+        checkValue(res, R.configVarying.bag,
+                R.styleable.TestConfig, new String[]{"bag h550"});
+
+        config = makeClassicConfig();
+        config.setProperty(Properties.HEIGHT_DP, 670);
+        res = config.getResources();
+        checkValue(res, R.configVarying.simple, "simple h670");
+        checkValue(res, R.configVarying.bag,
+                R.styleable.TestConfig, new String[]{"bag h670"});
     }
     
     @MediumTest
@@ -345,63 +623,63 @@
         // SO, X < 49 goes to 32
         // 49 >= X < 182 goes to 160
         // X >= 182 goes to 240
-        TotalConfig config = new TotalConfig();
+        TotalConfig config = makeClassicConfig();
         config.setProperty(Properties.DENSITY, 2);
         Resources res = config.getResources();
         checkValue(res, R.configVarying.simple, "simple 32dpi");
         checkValue(res, R.configVarying.bag,
                 R.styleable.TestConfig, new String[]{"bag 32dpi"});
 
-        config = new TotalConfig();
+        config = makeClassicConfig();
         config.setProperty(Properties.DENSITY, 32);
         res = config.getResources();
         checkValue(res, R.configVarying.simple, "simple 32dpi");
         checkValue(res, R.configVarying.bag,
                 R.styleable.TestConfig, new String[]{"bag 32dpi"});
 
-        config = new TotalConfig();
+        config = makeClassicConfig();
         config.setProperty(Properties.DENSITY, 48);
         res = config.getResources();
         checkValue(res, R.configVarying.simple, "simple 32dpi");
         checkValue(res, R.configVarying.bag,
                 R.styleable.TestConfig, new String[]{"bag 32dpi"});
 
-        config = new TotalConfig();
+        config = makeClassicConfig();
         config.setProperty(Properties.DENSITY, 49);
         res = config.getResources();
         checkValue(res, R.configVarying.simple, "simple default");
         checkValue(res, R.configVarying.bag,
                 R.styleable.TestConfig, new String[]{"bag default"});
 
-        config = new TotalConfig();
+        config = makeClassicConfig();
         config.setProperty(Properties.DENSITY, 150);
         res = config.getResources();
         checkValue(res, R.configVarying.simple, "simple default");
         checkValue(res, R.configVarying.bag,
                 R.styleable.TestConfig, new String[]{"bag default"});
 
-        config = new TotalConfig();
+        config = makeClassicConfig();
         config.setProperty(Properties.DENSITY, 181);
         res = config.getResources();
         checkValue(res, R.configVarying.simple, "simple default");
         checkValue(res, R.configVarying.bag,
                 R.styleable.TestConfig, new String[]{"bag default"});
 
-        config = new TotalConfig();
+        config = makeClassicConfig();
         config.setProperty(Properties.DENSITY, 182);
         res = config.getResources();
         checkValue(res, R.configVarying.simple, "simple 240dpi");
         checkValue(res, R.configVarying.bag,
                 R.styleable.TestConfig, new String[]{"bag 240dpi"});
 
-        config = new TotalConfig();
+        config = makeClassicConfig();
         config.setProperty(Properties.DENSITY, 239);
         res = config.getResources();
         checkValue(res, R.configVarying.simple, "simple 240dpi");
         checkValue(res, R.configVarying.bag,
                 R.styleable.TestConfig, new String[]{"bag 240dpi"});
 
-        config = new TotalConfig();
+        config = makeClassicConfig();
         config.setProperty(Properties.DENSITY, 490);
         res = config.getResources();
         checkValue(res, R.configVarying.simple, "simple 240dpi");
@@ -413,7 +691,7 @@
     public void testScreenSize() throws Exception {
         // ensure that we fall back to the best available screen size
         // for a given configuration.
-        TotalConfig config = new TotalConfig();
+        TotalConfig config = makeClassicConfig();
         config.setProperty(Properties.SCREENLAYOUT, Configuration.SCREENLAYOUT_SIZE_SMALL);
         Resources res = config.getResources();
         checkValue(res, R.configVarying.simple, "simple small");
@@ -422,7 +700,7 @@
         checkValue(res, R.configVarying.large, "default");
         checkValue(res, R.configVarying.xlarge, "default");
         
-        config = new TotalConfig();
+        config = makeClassicConfig();
         config.setProperty(Properties.SCREENLAYOUT, Configuration.SCREENLAYOUT_SIZE_NORMAL);
         res = config.getResources();
         checkValue(res, R.configVarying.simple, "simple normal");
@@ -431,7 +709,7 @@
         checkValue(res, R.configVarying.large, "default");
         checkValue(res, R.configVarying.xlarge, "default");
         
-        config = new TotalConfig();
+        config = makeClassicConfig();
         config.setProperty(Properties.SCREENLAYOUT, Configuration.SCREENLAYOUT_SIZE_LARGE);
         res = config.getResources();
         checkValue(res, R.configVarying.simple, "simple large");
@@ -440,7 +718,7 @@
         checkValue(res, R.configVarying.large, "large");
         checkValue(res, R.configVarying.xlarge, "default");
         
-        config = new TotalConfig();
+        config = makeClassicConfig();
         config.setProperty(Properties.SCREENLAYOUT, Configuration.SCREENLAYOUT_SIZE_XLARGE);
         res = config.getResources();
         checkValue(res, R.configVarying.simple, "simple xlarge");
@@ -450,59 +728,216 @@
         checkValue(res, R.configVarying.xlarge, "xlarge");
     }
 
+    @MediumTest
+    public void testNewScreenSize() throws Exception {
+        // ensure that swNNNdp, wNNNdp, and hNNNdp are working correctly
+        // for various common screen configurations.
+        TotalConfig config = makeClassicConfig();
+        config.setProperty(Properties.SWIDTH_DP, 599);
+        config.setProperty(Properties.WIDTH_DP, 599);
+        config.setProperty(Properties.HEIGHT_DP, 549);
+        config.setProperty(Properties.ORIENTATION, Configuration.ORIENTATION_LANDSCAPE);
+        config.setProperty(Properties.SCREENLAYOUT, Configuration.SCREENLAYOUT_SIZE_LARGE);
+        Resources res = config.getResources();
+        checkValue(res, R.configVarying.simple, "simple large");
+        checkValue(res, R.configVarying.sw, "default");
+        checkValue(res, R.configVarying.w, "default");
+        checkValue(res, R.configVarying.h, "default");
+        checkValue(res, R.configVarying.wh, "default");
+
+        config = makeClassicConfig();
+        config.setProperty(Properties.SWIDTH_DP, 480);
+        config.setProperty(Properties.WIDTH_DP, 800);
+        config.setProperty(Properties.HEIGHT_DP, 480);
+        config.setProperty(Properties.ORIENTATION, Configuration.ORIENTATION_LANDSCAPE);
+        config.setProperty(Properties.SCREENLAYOUT, Configuration.SCREENLAYOUT_SIZE_LARGE);
+        res = config.getResources();
+        checkValue(res, R.configVarying.simple, "simple w720");
+        checkValue(res, R.configVarying.sw, "default");
+        checkValue(res, R.configVarying.w, "720");
+        checkValue(res, R.configVarying.h, "default");
+        checkValue(res, R.configVarying.wh, "600");
+
+        config = makeClassicConfig();
+        config.setProperty(Properties.SWIDTH_DP, 600);
+        config.setProperty(Properties.WIDTH_DP, 1024);
+        config.setProperty(Properties.HEIGHT_DP, 552);
+        config.setProperty(Properties.ORIENTATION, Configuration.ORIENTATION_LANDSCAPE);
+        config.setProperty(Properties.SCREENLAYOUT, Configuration.SCREENLAYOUT_SIZE_LARGE);
+        res = config.getResources();
+        checkValue(res, R.configVarying.simple, "simple sw600 land");
+        checkValue(res, R.configVarying.sw, "600 land");
+        checkValue(res, R.configVarying.w, "720");
+        checkValue(res, R.configVarying.h, "550");
+        checkValue(res, R.configVarying.wh, "600-550");
+
+        config = makeClassicConfig();
+        config.setProperty(Properties.SWIDTH_DP, 600);
+        config.setProperty(Properties.WIDTH_DP, 600);
+        config.setProperty(Properties.HEIGHT_DP, 974);
+        config.setProperty(Properties.ORIENTATION, Configuration.ORIENTATION_PORTRAIT);
+        config.setProperty(Properties.SCREENLAYOUT, Configuration.SCREENLAYOUT_SIZE_LARGE);
+        res = config.getResources();
+        checkValue(res, R.configVarying.simple, "simple sw600");
+        checkValue(res, R.configVarying.sw, "600");
+        checkValue(res, R.configVarying.w, "600");
+        checkValue(res, R.configVarying.h, "670");
+        checkValue(res, R.configVarying.wh, "600-550");
+
+        config = makeClassicConfig();
+        config.setProperty(Properties.SWIDTH_DP, 719);
+        config.setProperty(Properties.WIDTH_DP, 1279);
+        config.setProperty(Properties.HEIGHT_DP, 669);
+        config.setProperty(Properties.ORIENTATION, Configuration.ORIENTATION_LANDSCAPE);
+        config.setProperty(Properties.SCREENLAYOUT, Configuration.SCREENLAYOUT_SIZE_LARGE);
+        res = config.getResources();
+        checkValue(res, R.configVarying.simple, "simple sw600 land");
+        checkValue(res, R.configVarying.sw, "600 land");
+        checkValue(res, R.configVarying.w, "720");
+        checkValue(res, R.configVarying.h, "550");
+        checkValue(res, R.configVarying.wh, "600-550");
+
+        config = makeClassicConfig();
+        config.setProperty(Properties.SWIDTH_DP, 800);
+        config.setProperty(Properties.WIDTH_DP, 1280);
+        config.setProperty(Properties.HEIGHT_DP, 672);
+        config.setProperty(Properties.ORIENTATION, Configuration.ORIENTATION_LANDSCAPE);
+        config.setProperty(Properties.SCREENLAYOUT, Configuration.SCREENLAYOUT_SIZE_XLARGE);
+        res = config.getResources();
+        checkValue(res, R.configVarying.simple, "simple sw720");
+        checkValue(res, R.configVarying.sw, "720");
+        checkValue(res, R.configVarying.w, "720");
+        checkValue(res, R.configVarying.h, "670");
+        checkValue(res, R.configVarying.wh, "720-670");
+
+        config = makeClassicConfig();
+        config.setProperty(Properties.SWIDTH_DP, 800);
+        config.setProperty(Properties.WIDTH_DP, 720);
+        config.setProperty(Properties.HEIGHT_DP, 1230);
+        config.setProperty(Properties.ORIENTATION, Configuration.ORIENTATION_PORTRAIT);
+        config.setProperty(Properties.SCREENLAYOUT, Configuration.SCREENLAYOUT_SIZE_XLARGE);
+        res = config.getResources();
+        checkValue(res, R.configVarying.simple, "simple sw720");
+        checkValue(res, R.configVarying.sw, "720");
+        checkValue(res, R.configVarying.w, "720");
+        checkValue(res, R.configVarying.h, "670");
+        checkValue(res, R.configVarying.wh, "720-670");
+    }
+
 // TODO - add tests for special cases - ie, other key params seem ignored if 
 // nokeys is set
 
     @MediumTest
-    public void testCombinations() {
+    public void testPrecidence() {
         /**
-         * Verify that proper strings are found for multiple-selectivity case
-         * (ie, a string set for locale and mcc is found only when both are
-         * true).
+         * Check for precidence of resources selected when there are multiple
+         * options matching the current config.
          */
-        TotalConfig config = new TotalConfig();
-        config.setProperty(Properties.LANGUAGE, "xx");
-        config.setProperty(Properties.COUNTRY, "YY");
-        config.setProperty(Properties.MCC, 111);
+        TotalConfig config = makeEmptyConfig();
+        config.setProperty(Properties.HEIGHT, 640);
+        config.setProperty(Properties.WIDTH, 400);
         Resources res = config.getResources();
-        checkValue(res, R.configVarying.simple, "simple mcc111 xx-rYY");
-        checkValue(res, R.configVarying.bag, R.styleable.TestConfig,
-                new String[] { "bag mcc111 xx-rYY" });
+        checkValue(res, R.configVarying.simple, "simple 640x400");
+        checkValue(res, R.configVarying.bag,
+                R.styleable.TestConfig, new String[]{"bag 640x400"});
 
-        config = new TotalConfig();
+        config.setProperty(Properties.NAVIGATION, Configuration.NAVIGATION_NONAV);
+        res = config.getResources();
+        checkValue(res, R.configVarying.simple, "simple nonav");
+        checkValue(res, R.configVarying.bag,
+                R.styleable.TestConfig, new String[]{"bag nonav"});
+
+        config.setProperty(Properties.KEYBOARD, Configuration.KEYBOARD_NOKEYS);
+        res = config.getResources();
+        checkValue(res, R.configVarying.simple, "simple nokeys");
+        checkValue(res, R.configVarying.bag,
+                R.styleable.TestConfig, new String[]{"bag nokeys"});
+
+        config.setProperty(Properties.KEYBOARDHIDDEN, Configuration.KEYBOARDHIDDEN_NO);
+        res = config.getResources();
+        checkValue(res, R.configVarying.simple, "simple keysexposed");
+        checkValue(res, R.configVarying.bag,
+                R.styleable.TestConfig, new String[]{"bag keysexposed"});
+
+        config.setProperty(Properties.TOUCHSCREEN, Configuration.TOUCHSCREEN_NOTOUCH);
+        res = config.getResources();
+        checkValue(res, R.configVarying.simple, "simple notouch");
+        checkValue(res, R.configVarying.bag,
+                R.styleable.TestConfig, new String[]{"bag notouch"});
+
+        config.setProperty(Properties.DENSITY, 240);
+        res = config.getResources();
+        checkValue(res, R.configVarying.simple, "simple 240dpi");
+        checkValue(res, R.configVarying.bag,
+                R.styleable.TestConfig, new String[]{"bag 240dpi"});
+
+        config.setProperty(Properties.ORIENTATION, Configuration.ORIENTATION_LANDSCAPE);
+        res = config.getResources();
+        checkValue(res, R.configVarying.simple, "simple landscape");
+        checkValue(res, R.configVarying.bag,
+                R.styleable.TestConfig, new String[]{"bag landscape"});
+
+        config.setProperty(Properties.SCREENLAYOUT, Configuration.SCREENLAYOUT_SIZE_XLARGE);
+        res = config.getResources();
+        checkValue(res, R.configVarying.simple, "simple xlarge");
+        checkValue(res, R.configVarying.bag,
+                R.styleable.TestConfig, new String[]{"bag xlarge"});
+
+        config.setProperty(Properties.HEIGHT_DP, 670);
+        res = config.getResources();
+        checkValue(res, R.configVarying.simple, "simple h670");
+        checkValue(res, R.configVarying.bag,
+                R.styleable.TestConfig, new String[]{"bag h670"});
+
+        config.setProperty(Properties.WIDTH_DP, 720);
+        res = config.getResources();
+        checkValue(res, R.configVarying.simple, "simple 720-670");
+        checkValue(res, R.configVarying.bag,
+                R.styleable.TestConfig, new String[]{"bag 720-670"});
+
+        config.setProperty(Properties.SWIDTH_DP, 720);
+        res = config.getResources();
+        checkValue(res, R.configVarying.simple, "simple sw720");
+        checkValue(res, R.configVarying.bag,
+                R.styleable.TestConfig, new String[]{"bag sw720"});
+
         config.setProperty(Properties.LANGUAGE, "xx");
         config.setProperty(Properties.COUNTRY, "YY");
-        config.setProperty(Properties.MCC, 333);
         res = config.getResources();
         checkValue(res, R.configVarying.simple, "simple xx-rYY");
         checkValue(res, R.configVarying.bag,
-                R.styleable.TestConfig, new String[] { "bag xx-rYY" });
+                R.styleable.TestConfig, new String[]{"bag xx-rYY"});
 
-        config = new TotalConfig();
-        config.setProperty(Properties.MNC, 333);
+        config.setProperty(Properties.MCC, 111);
         res = config.getResources();
-        checkValue(res, R.configVarying.simple, "simple default");
+        checkValue(res, R.configVarying.simple, "simple mcc111 xx-rYY");
         checkValue(res, R.configVarying.bag,
-                R.styleable.TestConfig, new String[]{"bag default"});
+                R.styleable.TestConfig, new String[]{"bag mcc111 xx-rYY"});
+
+        config.setProperty(Properties.MNC, 222);
+        res = config.getResources();
+        checkValue(res, R.configVarying.simple, "simple mcc111 mnc222");
+        checkValue(res, R.configVarying.bag,
+                R.styleable.TestConfig, new String[]{"bag mcc111 mnc222"});
     }
 
     @MediumTest
-    public void testPrecidence() {
+    public void testCombinations() {
         /**
          * Verify that in cases of ties, the specific ordering is followed
          */
 
         /**
-         * Precidence order: mcc, mnc, locale, screenlayout-size,
+         * Precidence order: mcc, mnc, locale, swdp, wdp, hdp, screenlayout-size,
          * screenlayout-long, orientation, density,
          * touchscreen, hidden, keyboard, navigation, width-height
          */
 
         /**
          * verify mcc trumps mnc.  Have 110-xx, 220-xx but no 110-220
-         * so with is selected?  Should be mcc110-xx. 
+         * so which is selected?  Should be mcc110-xx.
          */
-        TotalConfig config = new TotalConfig();
+        TotalConfig config = makeClassicConfig();
         config.setProperty(Properties.MCC, 110);
         config.setProperty(Properties.MNC, 220);
         config.setProperty(Properties.LANGUAGE, "xx");
@@ -513,7 +948,7 @@
 
         /* full A + B + C doesn't exist.  Do we get A + C or B + C? 
          */
-        config = new TotalConfig();
+        config = makeClassicConfig();
         config.setProperty(Properties.MCC, 111);
         config.setProperty(Properties.MNC, 222);
         config.setProperty(Properties.LANGUAGE, "xx");
@@ -522,7 +957,7 @@
         checkValue(res, R.configVarying.bag,
                 R.styleable.TestConfig, new String[]{"bag mcc111 mnc222"});
 
-        config = new TotalConfig();
+        config = makeClassicConfig();
         config.setProperty(Properties.MNC, 222);
         config.setProperty(Properties.LANGUAGE, "xx");
         config.setProperty(Properties.ORIENTATION, 
@@ -532,7 +967,7 @@
         checkValue(res, R.configVarying.bag,
                 R.styleable.TestConfig, new String[]{"bag mnc222 xx"});
 
-        config = new TotalConfig();
+        config = makeClassicConfig();
         config.setProperty(Properties.LANGUAGE, "xx");
         config.setProperty(Properties.ORIENTATION, 
                 Configuration.ORIENTATION_SQUARE);
@@ -542,7 +977,37 @@
         checkValue(res, R.configVarying.bag,
                 R.styleable.TestConfig, new String[]{"bag xx square"});
 
-        config = new TotalConfig();
+        /**
+         * Verify that proper strings are found for multiple-selectivity case
+         * (ie, a string set for locale and mcc is found only when both are
+         * true).
+         */
+        config = makeClassicConfig();
+        config.setProperty(Properties.LANGUAGE, "xx");
+        config.setProperty(Properties.COUNTRY, "YY");
+        config.setProperty(Properties.MCC, 111);
+        res = config.getResources();
+        checkValue(res, R.configVarying.simple, "simple mcc111 xx-rYY");
+        checkValue(res, R.configVarying.bag, R.styleable.TestConfig,
+                new String[] { "bag mcc111 xx-rYY" });
+
+        config = makeClassicConfig();
+        config.setProperty(Properties.LANGUAGE, "xx");
+        config.setProperty(Properties.COUNTRY, "YY");
+        config.setProperty(Properties.MCC, 333);
+        res = config.getResources();
+        checkValue(res, R.configVarying.simple, "simple xx-rYY");
+        checkValue(res, R.configVarying.bag,
+                R.styleable.TestConfig, new String[] { "bag xx-rYY" });
+
+        config = makeClassicConfig();
+        config.setProperty(Properties.MNC, 333);
+        res = config.getResources();
+        checkValue(res, R.configVarying.simple, "simple default");
+        checkValue(res, R.configVarying.bag,
+                R.styleable.TestConfig, new String[]{"bag default"});
+
+        config = makeClassicConfig();
         config.setProperty(Properties.ORIENTATION, 
                 Configuration.ORIENTATION_SQUARE);
         config.setProperty(Properties.DENSITY, 32);
@@ -553,7 +1018,7 @@
         checkValue(res, R.configVarying.bag,
                 R.styleable.TestConfig, new String[]{"bag square 32dpi"});
 
-        config = new TotalConfig();
+        config = makeClassicConfig();
         config.setProperty(Properties.DENSITY, 32);
         config.setProperty(Properties.TOUCHSCREEN, 
                 Configuration.TOUCHSCREEN_STYLUS);
@@ -564,7 +1029,7 @@
         checkValue(res, R.configVarying.bag,
                 R.styleable.TestConfig, new String[]{"bag 32dpi stylus"});
 
-        config = new TotalConfig();
+        config = makeClassicConfig();
         config.setProperty(Properties.TOUCHSCREEN, 
                 Configuration.TOUCHSCREEN_STYLUS);
         config.setProperty(Properties.KEYBOARDHIDDEN, 
@@ -575,7 +1040,7 @@
         checkValue(res, R.configVarying.bag,
                 R.styleable.TestConfig, new String[]{"bag stylus keysexposed"});
 
-        config = new TotalConfig();
+        config = makeClassicConfig();
         config.setProperty(Properties.KEYBOARDHIDDEN, 
                 Configuration.KEYBOARDHIDDEN_NO);
         config.setProperty(Properties.KEYBOARD, Configuration.KEYBOARD_12KEY);
@@ -586,7 +1051,7 @@
         checkValue(res, R.configVarying.bag,
                 R.styleable.TestConfig, new String[]{"bag keysexposed 12key"});
 
-        config = new TotalConfig();
+        config = makeClassicConfig();
         config.setProperty(Properties.KEYBOARD, Configuration.KEYBOARD_12KEY);
         config.setProperty(Properties.NAVIGATION, 
                 Configuration.NAVIGATION_DPAD);
@@ -597,15 +1062,15 @@
         checkValue(res, R.configVarying.bag,
                 R.styleable.TestConfig, new String[]{"bag 12key dpad"});
 
-        config = new TotalConfig();
+        config = makeClassicConfig();
         config.setProperty(Properties.NAVIGATION, 
                 Configuration.NAVIGATION_DPAD);
         config.setProperty(Properties.HEIGHT, 640);
         config.setProperty(Properties.WIDTH, 400);
         res = config.getResources();
-        checkValue(res, R.configVarying.simple, "simple dpad");
+        checkValue(res, R.configVarying.simple, "simple dpad 63x57");
         checkValue(res, R.configVarying.bag,
-                R.styleable.TestConfig, new String[]{"bag dpad"});
+                R.styleable.TestConfig, new String[]{"bag dpad 63x57"});
     }
     
     @MediumTest
diff --git a/tests/tests/content/src/android/content/res/cts/ResourcesTest.java b/tests/tests/content/src/android/content/res/cts/ResourcesTest.java
index 1ea5edb..b8f2cb1 100644
--- a/tests/tests/content/src/android/content/res/cts/ResourcesTest.java
+++ b/tests/tests/content/src/android/content/res/cts/ResourcesTest.java
@@ -315,30 +315,6 @@
         assertEquals(5.0f, cfgNew.fontScale, 0.001f);
     }
 
-    @TestTargets({
-        @TestTargetNew(
-            level = TestLevel.COMPLETE,
-            method = "getDisplayMetrics",
-            args = {}
-        ),
-        @TestTargetNew(
-            level = TestLevel.COMPLETE,
-            method = "updateSystemConfiguration",
-            args = {Configuration.class, DisplayMetrics.class}
-        )
-    })
-    public void testGetDisplayMetrics() {
-        final DisplayMetrics dM1 = mResources.getDisplayMetrics();
-        dM1.widthPixels = 11;
-        dM1.heightPixels = 27;
-
-        Resources.updateSystemConfiguration(new Configuration(), dM1);
-
-        final DisplayMetrics dM2 = mResources.getDisplayMetrics();
-        assertEquals(11, dM2.widthPixels);
-        assertEquals(27, dM2.heightPixels);
-    }
-
     @TestTargetNew(
         level = TestLevel.COMPLETE,
         method = "getDimensionPixelSize",
diff --git a/tests/tests/dpi/src/android/dpi/cts/ConfigurationTest.java b/tests/tests/dpi/src/android/dpi/cts/ConfigurationTest.java
index b4b4d40..f478de7 100644
--- a/tests/tests/dpi/src/android/dpi/cts/ConfigurationTest.java
+++ b/tests/tests/dpi/src/android/dpi/cts/ConfigurationTest.java
@@ -38,7 +38,7 @@
 
     public void testScreenConfiguration() {
         WindowManager windowManager =
-            (WindowManager) getContext().getSystemService(Context.WINDOW_SERVICE);
+                (WindowManager) getContext().getSystemService(Context.WINDOW_SERVICE);
         Display display = windowManager.getDefaultDisplay();
         DisplayMetrics metrics = new DisplayMetrics();
         display.getMetrics(metrics);
@@ -54,14 +54,14 @@
 
         int max = Math.max(metrics.widthPixels, metrics.heightPixels);
         int min = Math.min(metrics.widthPixels, metrics.heightPixels);
-        boolean format16x9 = Math.floor(max * 9.0d / 16.0d) <= min;
-        boolean format4x3 = Math.ceil(max * 3.0d / 4.0d) >= min;
-        assertTrue("Aspect ratio must be between 4:3 and 16:9. It was " + max + ":" + min,
-                format4x3 && format16x9);
+        double aspectRatio = (double) max / min;
+        assertTrue("Aspect ratio must be between 1.333 and 1.86. It was " + aspectRatio,
+                aspectRatio >= 1.333 && aspectRatio <= 1.86);
 
         Set<Integer> allowedDensities = new HashSet<Integer>();
         allowedDensities.add(DisplayMetrics.DENSITY_LOW);
         allowedDensities.add(DisplayMetrics.DENSITY_MEDIUM);
+        allowedDensities.add(DisplayMetrics.DENSITY_TV);
         allowedDensities.add(DisplayMetrics.DENSITY_HIGH);
         allowedDensities.add(DENSITY_TV);
         allowedDensities.add(DisplayMetrics.DENSITY_XHIGH);
diff --git a/tests/tests/graphics/src/android/graphics/cts/PaintTest.java b/tests/tests/graphics/src/android/graphics/cts/PaintTest.java
index 20701cb..9f8cee9 100644
--- a/tests/tests/graphics/src/android/graphics/cts/PaintTest.java
+++ b/tests/tests/graphics/src/android/graphics/cts/PaintTest.java
@@ -72,6 +72,10 @@
         SpannedString textSpan = new SpannedString(text);
 
         Paint p = new Paint();
+
+        // We need to turn off kerning in order to get accurate comparisons
+        p.setFlags(p.getFlags() & ~Paint.DEV_KERN_TEXT_FLAG);
+
         float[] widths = new float[text.length()];
         assertEquals(text.length(), p.getTextWidths(text, widths));
 
@@ -126,6 +130,9 @@
             float expectedWidth) {
         Paint p = new Paint();
 
+        // We need to turn off kerning in order to get accurate comparisons
+        p.setFlags(p.getFlags() & ~Paint.DEV_KERN_TEXT_FLAG);
+
         int count = end - start;
         if (!measureForwards) {
             count = -count;
@@ -1272,6 +1279,10 @@
         SpannedString textSpan = new SpannedString(text);
 
         Paint p = new Paint();
+
+        // We need to turn off kerning in order to get accurate comparisons
+        p.setFlags(p.getFlags() & ~Paint.DEV_KERN_TEXT_FLAG);
+
         float[] widths = new float[text.length()];
         for (int i = 0; i < widths.length; i++) {
             widths[i] = p.measureText(text, i, i + 1);
@@ -1300,6 +1311,10 @@
     private void assertMeasureText(String text, char[] textChars, SpannedString textSpan,
             int start, int end, float expectedWidth) {
         Paint p = new Paint();
+
+        // We need to turn off kerning in order to get accurate comparisons
+        p.setFlags(p.getFlags() & ~Paint.DEV_KERN_TEXT_FLAG);
+
         int count = end - start;
         float[] widths = new float[] {-1, -1, -1, -1};
 
diff --git a/tests/tests/graphics/src/android/graphics/drawable/cts/ScaleDrawableTest.java b/tests/tests/graphics/src/android/graphics/drawable/cts/ScaleDrawableTest.java
index 23e8745..ff50d26 100644
--- a/tests/tests/graphics/src/android/graphics/drawable/cts/ScaleDrawableTest.java
+++ b/tests/tests/graphics/src/android/graphics/drawable/cts/ScaleDrawableTest.java
@@ -515,7 +515,8 @@
         XmlResourceParser parser = res.getXml(R.xml.scaledrawable);
         AttributeSet attrs = DrawableTestUtils.getAttributeSet(parser, "scale_allattrs");
         scaleDrawable.inflate(res, parser, attrs);
-        int bitmapSize = 48 * res.getDisplayMetrics().densityDpi / DisplayMetrics.DENSITY_DEFAULT;
+        int bitmapSize = (int) Math.ceil(48.0 *
+                res.getDisplayMetrics().densityDpi / DisplayMetrics.DENSITY_DEFAULT);
         assertEquals(bitmapSize, scaleDrawable.getIntrinsicWidth());
         assertEquals(bitmapSize, scaleDrawable.getIntrinsicHeight());
 
diff --git a/tests/tests/net/src/android/net/cts/ConnectivityManagerTest.java b/tests/tests/net/src/android/net/cts/ConnectivityManagerTest.java
index 3751b3c..2db0acb 100644
--- a/tests/tests/net/src/android/net/cts/ConnectivityManagerTest.java
+++ b/tests/tests/net/src/android/net/cts/ConnectivityManagerTest.java
@@ -35,6 +35,8 @@
 import android.test.AndroidTestCase;
 import android.util.Log;
 
+import java.util.HashSet;
+import java.util.Set;
 import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.TimeUnit;
 
@@ -170,12 +172,20 @@
         args = {int.class, int.class}
     )
     public void testRequestRouteToHost() {
+        Set<Integer> exceptionFreeTypes = new HashSet<Integer>();
+        exceptionFreeTypes.add(ConnectivityManager.TYPE_BLUETOOTH);
+        exceptionFreeTypes.add(ConnectivityManager.TYPE_ETHERNET);
+        exceptionFreeTypes.add(ConnectivityManager.TYPE_MOBILE);
+        exceptionFreeTypes.add(ConnectivityManager.TYPE_MOBILE_DUN);
+        exceptionFreeTypes.add(ConnectivityManager.TYPE_MOBILE_HIPRI);
+        exceptionFreeTypes.add(ConnectivityManager.TYPE_MOBILE_MMS);
+        exceptionFreeTypes.add(ConnectivityManager.TYPE_MOBILE_SUPL);
 
         NetworkInfo[] ni = mCm.getAllNetworkInfo();
         for (NetworkInfo n : ni) {
-            // make sure network is up (except WIFI due to always fail)
-            if (n.isConnected() && (n.getType() != TYPE_WIFI)) {
-                assertTrue(mCm.requestRouteToHost(n.getType(), HOST_ADDRESS));
+            if (n.isConnected() && exceptionFreeTypes.contains(n.getType())) {
+                assertTrue("Network type: " + n.getType(), mCm.requestRouteToHost(n.getType(),
+                        HOST_ADDRESS));
             }
         }
 
diff --git a/tests/tests/os/src/android/os/cts/BuildVersionTest.java b/tests/tests/os/src/android/os/cts/BuildVersionTest.java
index 954507b..9bf21ae 100644
--- a/tests/tests/os/src/android/os/cts/BuildVersionTest.java
+++ b/tests/tests/os/src/android/os/cts/BuildVersionTest.java
@@ -32,8 +32,8 @@
 
     private static final String LOG_TAG = "BuildVersionTest";
     private static final Set<String> EXPECTED_RELEASES =
-        new HashSet<String>(Arrays.asList("3.1"));
-    private static final int EXPECTED_SDK = 12;
+        new HashSet<String>(Arrays.asList("3.2", "3.2.1", "3.2.2"));
+    private static final int EXPECTED_SDK = 13;
 
     public void testReleaseVersion() {
         // Applications may rely on the exact release version
diff --git a/tests/tests/os/src/android/os/cts/MessengerTest.java b/tests/tests/os/src/android/os/cts/MessengerTest.java
index efe022d..6b2debc 100644
--- a/tests/tests/os/src/android/os/cts/MessengerTest.java
+++ b/tests/tests/os/src/android/os/cts/MessengerTest.java
@@ -90,6 +90,9 @@
         public void dump(FileDescriptor fd, String[] args) throws RemoteException {
         }
 
+        public void dumpAsync(FileDescriptor fd, String[] args) throws RemoteException {
+        }
+
     };
 
     // Create another messenger to send msg.
diff --git a/tests/tests/view/src/android/view/cts/MotionEventTest.java b/tests/tests/view/src/android/view/cts/MotionEventTest.java
index f8a14e6..909ec92 100644
--- a/tests/tests/view/src/android/view/cts/MotionEventTest.java
+++ b/tests/tests/view/src/android/view/cts/MotionEventTest.java
@@ -599,4 +599,71 @@
             android.util.Log.i("TEST", msg.toString());
         }
     }
+
+    public void testPointerCoordsDefaultConstructor() {
+        PointerCoords coords = new PointerCoords();
+
+        assertEquals(0f, coords.x);
+        assertEquals(0f, coords.y);
+        assertEquals(0f, coords.pressure);
+        assertEquals(0f, coords.size);
+        assertEquals(0f, coords.touchMajor);
+        assertEquals(0f, coords.touchMinor);
+        assertEquals(0f, coords.toolMajor);
+        assertEquals(0f, coords.toolMinor);
+        assertEquals(0f, coords.orientation);
+    }
+
+    public void testPointerCoordsCopyConstructor() {
+        PointerCoords coords = new PointerCoords();
+        coords.x = 1;
+        coords.y = 2;
+        coords.pressure = 3;
+        coords.size = 4;
+        coords.touchMajor = 5;
+        coords.touchMinor = 6;
+        coords.toolMajor = 7;
+        coords.toolMinor = 8;
+        coords.orientation = 9;
+        coords.setAxisValue(MotionEvent.AXIS_GENERIC_1, 10);
+
+        PointerCoords copy = new PointerCoords(coords);
+        assertEquals(1f, copy.x);
+        assertEquals(2f, copy.y);
+        assertEquals(3f, copy.pressure);
+        assertEquals(4f, copy.size);
+        assertEquals(5f, copy.touchMajor);
+        assertEquals(6f, copy.touchMinor);
+        assertEquals(7f, copy.toolMajor);
+        assertEquals(8f, copy.toolMinor);
+        assertEquals(9f, copy.orientation);
+        assertEquals(10f, coords.getAxisValue(MotionEvent.AXIS_GENERIC_1));
+    }
+
+    public void testPointerCoordsCopyFrom() {
+        PointerCoords coords = new PointerCoords();
+        coords.x = 1;
+        coords.y = 2;
+        coords.pressure = 3;
+        coords.size = 4;
+        coords.touchMajor = 5;
+        coords.touchMinor = 6;
+        coords.toolMajor = 7;
+        coords.toolMinor = 8;
+        coords.orientation = 9;
+        coords.setAxisValue(MotionEvent.AXIS_GENERIC_1, 10);
+
+        PointerCoords copy = new PointerCoords();
+        copy.copyFrom(coords);
+        assertEquals(1f, copy.x);
+        assertEquals(2f, copy.y);
+        assertEquals(3f, copy.pressure);
+        assertEquals(4f, copy.size);
+        assertEquals(5f, copy.touchMajor);
+        assertEquals(6f, copy.touchMinor);
+        assertEquals(7f, copy.toolMajor);
+        assertEquals(8f, copy.toolMinor);
+        assertEquals(9f, copy.orientation);
+        assertEquals(10f, coords.getAxisValue(MotionEvent.AXIS_GENERIC_1));
+    }
 }
diff --git a/tests/tests/view/src/android/view/cts/VelocityTrackerTest.java b/tests/tests/view/src/android/view/cts/VelocityTrackerTest.java
index 35254b6..25b94d9 100644
--- a/tests/tests/view/src/android/view/cts/VelocityTrackerTest.java
+++ b/tests/tests/view/src/android/view/cts/VelocityTrackerTest.java
@@ -96,7 +96,7 @@
         VelocityTracker vt = VelocityTracker.obtain();
         assertNotNull(vt);
 
-        MotionEvent me = MotionEvent.obtain(0L, 10, 1, .0f, .0f, 0);
+        MotionEvent me = MotionEvent.obtain(0L, 10L, MotionEvent.ACTION_MOVE, .0f, .0f, 0);
 
         vt.clear();
         me.addBatch(20L, 20, 20, .0f, .0f, 0);
@@ -112,14 +112,14 @@
         assertEquals(XVelocity, vt.getXVelocity(), ERROR_TOLERANCE);
         assertEquals(YVelocity, vt.getYVelocity(), ERROR_TOLERANCE);
 
-        for (int i = 30; i < 100; i += 10) {
-            me.addBatch((long)i, (float)i, (float)i, .0f, .0f, 0);
+        for (int i = 3; i < 10; i++) {
+            me.addBatch((long)i * 10, (float)i * 10, (float)i * 10, .0f, .0f, 0);
         }
         vt.clear();
         vt.addMovement(me);
         vt.computeCurrentVelocity(1);
-        XVelocity = 1.1875744f;
-        YVelocity = 1.1875744f;
+        XVelocity = 1.1479408f;
+        YVelocity = 1.1479408f;
         assertEquals(XVelocity, vt.getXVelocity(), ERROR_TOLERANCE);
         assertEquals(YVelocity, vt.getYVelocity(), ERROR_TOLERANCE);
 
@@ -127,11 +127,21 @@
         me.addBatch(100L, 100, 100, .0f, .0f, 0);
         vt.addMovement(me);
         vt.computeCurrentVelocity(1);
-        XVelocity = 1.1562872f;
-        YVelocity = 1.1562872f;
+        XVelocity = 1.1284428f;
+        YVelocity = 1.1284428f;
         assertEquals(XVelocity, vt.getXVelocity(), ERROR_TOLERANCE);
         assertEquals(YVelocity, vt.getYVelocity(), ERROR_TOLERANCE);
 
+        me.recycle();
+        me = MotionEvent.obtain(0L, 110L, MotionEvent.ACTION_UP, 100f, 100f, 0);
+        vt.addMovement(me);
+        vt.computeCurrentVelocity(1);
+        XVelocity = 1.1284428f;
+        YVelocity = 1.1284428f;
+        assertEquals(XVelocity, vt.getXVelocity(), ERROR_TOLERANCE);
+        assertEquals(YVelocity, vt.getYVelocity(), ERROR_TOLERANCE);
+
+        me.recycle();
         vt.recycle();
     }
 }
diff --git a/tests/tests/view/src/android/view/cts/WindowTest.java b/tests/tests/view/src/android/view/cts/WindowTest.java
index a3e0237..5727ff0 100755
--- a/tests/tests/view/src/android/view/cts/WindowTest.java
+++ b/tests/tests/view/src/android/view/cts/WindowTest.java
@@ -381,8 +381,7 @@
         int screenWidth = dm.widthPixels;
         int screenHeight = dm.heightPixels;
         assertEquals(screenWidth, decor.getWidth());
-        assertTrue("Screen height: " + screenHeight + " Decor view height: " + decor.getHeight(),
-                screenHeight >= decor.getHeight());
+        assertEquals(screenHeight, decor.getHeight());
         assertSame(mWindow.getContext(), decor.getContext());
     }
 
diff --git a/tests/tests/webkit/src/android/webkit/cts/CookieSyncManagerTest.java b/tests/tests/webkit/src/android/webkit/cts/CookieSyncManagerTest.java
index 3b7d340..9450c70 100644
--- a/tests/tests/webkit/src/android/webkit/cts/CookieSyncManagerTest.java
+++ b/tests/tests/webkit/src/android/webkit/cts/CookieSyncManagerTest.java
@@ -52,7 +52,7 @@
             args = {}
         )
     })
-    public void testCookieSyncManager() {
+    public void testCookieSyncManager() throws Exception {
         CookieSyncManager csm1 = CookieSyncManager.createInstance(getActivity());
         assertNotNull(csm1);
 
@@ -62,7 +62,6 @@
         assertSame(csm1, csm2);
 
         final CookieManager cookieManager = CookieManager.getInstance();
-        cookieManager.setAcceptFileSchemeCookies(true);
 
         // Remove all cookies from the database.
         cookieManager.removeAllCookie();
@@ -76,7 +75,8 @@
         cookieManager.setAcceptCookie(true);
         assertTrue(cookieManager.acceptCookie());
 
-        String url = TestHtmlConstants.getFileUrl(TestHtmlConstants.HELLO_WORLD_URL);
+        CtsTestServer server = new CtsTestServer(getActivity(), false);
+        String url = server.getCookieUrl("conquest.html");
         String cookieValue = "a=b";
         cookieManager.setCookie(url, cookieValue);
         assertEquals(cookieValue, cookieManager.getCookie(url));
diff --git a/tests/tests/widget/src/android/widget/cts/LinearLayoutTest.java b/tests/tests/widget/src/android/widget/cts/LinearLayoutTest.java
index 7abd6d2..9da5607 100644
--- a/tests/tests/widget/src/android/widget/cts/LinearLayoutTest.java
+++ b/tests/tests/widget/src/android/widget/cts/LinearLayoutTest.java
@@ -230,9 +230,9 @@
         assertEquals(1.0f, parent.getWeightSum());
 
         int parentWidth = parent.getWidth();
-        assertEquals(parentWidth * 0.2, (float) weight02.getWidth(), 1.0);
-        assertEquals(parentWidth * 0.5, (float) weight05.getWidth(), 1.0);
-        assertEquals(parentWidth * 0.3, (float) weight03.getWidth(), 1.0);
+        assertEquals(Math.ceil(parentWidth * 0.2), weight02.getWidth(), 1.0);
+        assertEquals(Math.ceil(parentWidth * 0.5), weight05.getWidth(), 1.0);
+        assertEquals(Math.ceil(parentWidth * 0.3), weight03.getWidth(), 1.0);
     }
 
     @TestTargets({
diff --git a/tools/host/src/com/android/cts/Version.java b/tools/host/src/com/android/cts/Version.java
index 3a27f0f..aafa328 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 = "3.1_r4";
+    private static final String version = "3.2_r4";
 
     private Version() {
         // no instances allowed