am f01ed0d2: Merge "add more PollingCheck" into jb-dev

* commit 'f01ed0d23ca0457078f2ae645e09d40d0c3e4f6c':
  add more PollingCheck
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/nfc/NfcTestActivity.java b/apps/CtsVerifier/src/com/android/cts/verifier/nfc/NfcTestActivity.java
old mode 100644
new mode 100755
index 3a85860..b158ad3
--- a/apps/CtsVerifier/src/com/android/cts/verifier/nfc/NfcTestActivity.java
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/nfc/NfcTestActivity.java
@@ -22,6 +22,7 @@
 import com.android.cts.verifier.TestListAdapter.TestListItem;
 
 import android.content.Intent;
+import android.content.pm.PackageManager;
 import android.nfc.tech.MifareUltralight;
 import android.nfc.tech.Ndef;
 import android.nfc.tech.TagTechnology;
@@ -36,6 +37,8 @@
     private static final String MIFARE_ULTRALIGHT_ID =
             TagVerifierActivity.getTagTestId(MifareUltralight.class);
 
+    private static final String FEATURE_NFC_MIFARE = "com.nxp.mifare";
+
     @Override
     protected void onCreate(Bundle savedInstanceState) {
         super.onCreate(savedInstanceState);
@@ -56,8 +59,10 @@
         adapter.add(TestListItem.newCategory(this, R.string.nfc_tag_verification));
         adapter.add(TestListItem.newTest(this, R.string.nfc_ndef,
                 NDEF_ID, getTagIntent(Ndef.class), null));
-        adapter.add(TestListItem.newTest(this, R.string.nfc_mifare_ultralight,
-                MIFARE_ULTRALIGHT_ID, getTagIntent(MifareUltralight.class), null));
+        if (getPackageManager().hasSystemFeature(FEATURE_NFC_MIFARE)) {
+            adapter.add(TestListItem.newTest(this, R.string.nfc_mifare_ultralight,
+                    MIFARE_ULTRALIGHT_ID, getTagIntent(MifareUltralight.class), null));
+        }
 
         setTestListAdapter(adapter);
     }
diff --git a/tests/res/layout/textview_layout.xml b/tests/res/layout/textview_layout.xml
index 1437be9..512184f 100644
--- a/tests/res/layout/textview_layout.xml
+++ b/tests/res/layout/textview_layout.xml
@@ -33,6 +33,7 @@
                     android:textColorHint="@drawable/red"
                     android:textColorLink="@drawable/blue"
                     android:textScaleX="1.2"
+                    android:typeface="normal"
                     android:textSize="20px"
                     android:textStyle="normal"
                     android:layout_width="wrap_content"
diff --git a/tests/res/values/strings.xml b/tests/res/values/strings.xml
index 753602e..0ab3dd6 100644
--- a/tests/res/values/strings.xml
+++ b/tests/res/values/strings.xml
@@ -166,5 +166,5 @@
     <string name="long_text">This is a really long string which exceeds the width of the view.
 New devices have a much larger screen which actually enables long strings to be displayed
 with no fading. I have made this string longer to fix this case. If you are correcting this
-text, I would love to see the kind of devices you guys now use!</string>
+text, I would love to see the kind of devices you guys now use! Guys, maybe some devices need longer string! </string>
 </resources>
diff --git a/tests/tests/app/Android.mk b/tests/tests/app/Android.mk
index d61b87a..8d5877d 100644
--- a/tests/tests/app/Android.mk
+++ b/tests/tests/app/Android.mk
@@ -21,7 +21,7 @@
 # and when built explicitly put it in the data partition
 LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
 
-LOCAL_JAVA_LIBRARIES := android.test.runner
+LOCAL_JAVA_LIBRARIES := android.test.runner telephony-common
 
 LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner
 
diff --git a/tests/tests/content/src/android/content/cts/AvailableIntentsTest.java b/tests/tests/content/src/android/content/cts/AvailableIntentsTest.java
index 5df3739..a06b603 100755
--- a/tests/tests/content/src/android/content/cts/AvailableIntentsTest.java
+++ b/tests/tests/content/src/android/content/cts/AvailableIntentsTest.java
@@ -102,9 +102,12 @@
      * Test ACTION_CALL when uri is a phone number, it will call the entered phone number.
      */
     public void testCallPhoneNumber() {
-        Uri uri = Uri.parse("tel:2125551212");
-        Intent intent = new Intent(Intent.ACTION_CALL, uri);
-        assertCanBeHandled(intent);
+        PackageManager packageManager = mContext.getPackageManager();
+        if (packageManager.hasSystemFeature(PackageManager.FEATURE_TELEPHONY)) {
+            Uri uri = Uri.parse("tel:2125551212");
+            Intent intent = new Intent(Intent.ACTION_CALL, uri);
+            assertCanBeHandled(intent);
+        }
     }
 
     /**
diff --git a/tests/tests/dpi/src/android/dpi/cts/ConfigurationScreenLayoutTest.java b/tests/tests/dpi/src/android/dpi/cts/ConfigurationScreenLayoutTest.java
index d4c3611..f0372e9 100644
--- a/tests/tests/dpi/src/android/dpi/cts/ConfigurationScreenLayoutTest.java
+++ b/tests/tests/dpi/src/android/dpi/cts/ConfigurationScreenLayoutTest.java
@@ -24,6 +24,7 @@
 import android.test.ActivityInstrumentationTestCase2;
 import android.util.DisplayMetrics;
 import android.view.Display;
+import android.view.ViewConfiguration;
 import android.view.WindowManager;
 
 public class ConfigurationScreenLayoutTest
@@ -45,6 +46,9 @@
         int expectedSize = expectedScreenLayout & Configuration.SCREENLAYOUT_SIZE_MASK;
         int expectedLong = expectedScreenLayout & Configuration.SCREENLAYOUT_LONG_MASK;
 
+        // Check if the device has the navigation bar.
+        boolean navigationBar = hasNavigationBar();
+
         // Check that all four orientations report the same configuration value.
         for (int i = 0; i < ORIENTATIONS.length; i++) {
             Activity activity = startOrientationActivity(ORIENTATIONS[i]);
@@ -52,6 +56,15 @@
             int actualSize = mConfig.screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK;
             int actualLong = mConfig.screenLayout & Configuration.SCREENLAYOUT_LONG_MASK;
 
+            if (navigationBar) {
+                // Update screenLayout value if the device has the navigation bar.
+                expectedScreenLayout = reduceScreenLayout(activity,
+                        Configuration.SCREENLAYOUT_SIZE_XLARGE
+                        | Configuration.SCREENLAYOUT_LONG_YES);
+                expectedSize = expectedScreenLayout & Configuration.SCREENLAYOUT_SIZE_MASK;
+                expectedLong = expectedScreenLayout & Configuration.SCREENLAYOUT_LONG_MASK;
+            }
+
             assertEquals("Expected screen size value of " + expectedSize + " but got " + actualSize
                     + " for orientation " + ORIENTATIONS[i], expectedSize, actualSize);
             assertEquals("Expected screen long value of " + expectedLong + " but got " + actualLong
@@ -80,6 +93,11 @@
         return screenLayout;
     }
 
+    private boolean hasNavigationBar() {
+        // Check if the device has a permanent menu key available.
+        return !ViewConfiguration.get(getActivity()).hasPermanentMenuKey();
+    }
+
     private Activity startOrientationActivity(int orientation) {
         Intent intent = new Intent();
         intent.putExtra(OrientationActivity.EXTRA_ORIENTATION, orientation);
diff --git a/tests/tests/holo/src/android/holo/cts/LayoutTestActivity.java b/tests/tests/holo/src/android/holo/cts/LayoutTestActivity.java
index 052ddea..e88f5e1 100644
--- a/tests/tests/holo/src/android/holo/cts/LayoutTestActivity.java
+++ b/tests/tests/holo/src/android/holo/cts/LayoutTestActivity.java
@@ -163,7 +163,7 @@
         protected void onPreExecute() {
             mBitmap = getBitmap();
             mReferenceBitmap = BitmapAssets.getBitmap(getApplicationContext(), mBitmapName);
-            final int threshold = 1;
+            final int threshold = 2;
             mSame = compareTo(mBitmap, mReferenceBitmap, threshold);
         }
 
diff --git a/tests/tests/permission/Android.mk b/tests/tests/permission/Android.mk
index db67bf4..07f20d8 100644
--- a/tests/tests/permission/Android.mk
+++ b/tests/tests/permission/Android.mk
@@ -19,7 +19,7 @@
 
 LOCAL_MODULE_TAGS := tests
 
-LOCAL_JAVA_LIBRARIES := android.test.runner
+LOCAL_JAVA_LIBRARIES := android.test.runner telephony-common
 
 LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner
 
diff --git a/tests/tests/permission/src/android/permission/cts/FileSystemPermissionTest.java b/tests/tests/permission/src/android/permission/cts/FileSystemPermissionTest.java
index 73fb9b9..7cd3d3b 100644
--- a/tests/tests/permission/src/android/permission/cts/FileSystemPermissionTest.java
+++ b/tests/tests/permission/src/android/permission/cts/FileSystemPermissionTest.java
@@ -292,6 +292,7 @@
                     "/data/local/tmp",
                     "/data/local/tmp/com.nuance.android.vsuite.vsuiteapp",
                     "/data/log",
+                    "/data/logger",
                     "/data/lost+found",
                     "/data/misc",
                     "/data/misc/bluetooth",
diff --git a/tests/tests/permission2/Android.mk b/tests/tests/permission2/Android.mk
index 8e3d8a1..86a8bc7 100755
--- a/tests/tests/permission2/Android.mk
+++ b/tests/tests/permission2/Android.mk
@@ -19,7 +19,7 @@
 
 LOCAL_MODULE_TAGS := tests
 
-LOCAL_JAVA_LIBRARIES := android.test.runner
+LOCAL_JAVA_LIBRARIES := android.test.runner telephony-common mms-common
 
 LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner
 
diff --git a/tests/tests/telephony/Android.mk b/tests/tests/telephony/Android.mk
index 519f44a..e7a3336 100644
--- a/tests/tests/telephony/Android.mk
+++ b/tests/tests/telephony/Android.mk
@@ -22,7 +22,7 @@
 # and when built explicitly put it in the data partition
 LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
 
-LOCAL_JAVA_LIBRARIES := android.test.runner
+LOCAL_JAVA_LIBRARIES := android.test.runner telephony-common mms-common
 
 LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner
 
diff --git a/tests/tests/view/src/android/view/cts/KeyEventTest.java b/tests/tests/view/src/android/view/cts/KeyEventTest.java
old mode 100644
new mode 100755
index 7c1f1c7..61d7d92
--- a/tests/tests/view/src/android/view/cts/KeyEventTest.java
+++ b/tests/tests/view/src/android/view/cts/KeyEventTest.java
@@ -105,7 +105,6 @@
         assertEquals(0, keyData.number);
         assertEquals('z', keyData.meta[0]);
         assertEquals('Z', keyData.meta[1]);
-        assertEquals(0, keyData.meta[2]);
         assertEquals(0, keyData.meta[3]);
     }
 
diff --git a/tests/tests/widget/src/android/widget/cts/TextViewTest.java b/tests/tests/widget/src/android/widget/cts/TextViewTest.java
index aba2293..e295c40 100755
--- a/tests/tests/widget/src/android/widget/cts/TextViewTest.java
+++ b/tests/tests/widget/src/android/widget/cts/TextViewTest.java
@@ -1797,7 +1797,7 @@
         assertEquals(20f, mTextView.getTextSize(), 0.01f);
 
         // getTypeface
-        // getTypeface will be null if android:typeface is not set or is set to normal,
+        // getTypeface will be null if android:typeface is set to normal,
         // and android:style is not set or is set to normal
         assertNull(mTextView.getTypeface());
 
diff --git a/tools/vm-tests-tf/src/dot/junit/opcodes/xor_int_lit8/Test_xor_int_lit8.java b/tools/vm-tests-tf/src/dot/junit/opcodes/xor_int_lit8/Test_xor_int_lit8.java
index b2a3f69..a87103b 100644
--- a/tools/vm-tests-tf/src/dot/junit/opcodes/xor_int_lit8/Test_xor_int_lit8.java
+++ b/tools/vm-tests-tf/src/dot/junit/opcodes/xor_int_lit8/Test_xor_int_lit8.java
@@ -34,7 +34,7 @@
      }
 
     /**
-     * @title Arguments = 0xfffffff8, 0xf1
+     * @title Arguments = 0xfffffff8, 0xf1 (will be sign extended)
      */
     public void testN2() {
          T_xor_int_lit8_2 t = new T_xor_int_lit8_2();
diff --git a/tools/vm-tests-tf/src/dot/junit/opcodes/xor_int_lit8/d/T_xor_int_lit8_1.d b/tools/vm-tests-tf/src/dot/junit/opcodes/xor_int_lit8/d/T_xor_int_lit8_1.d
index cb4d830..70c51f1 100644
--- a/tools/vm-tests-tf/src/dot/junit/opcodes/xor_int_lit8/d/T_xor_int_lit8_1.d
+++ b/tools/vm-tests-tf/src/dot/junit/opcodes/xor_int_lit8/d/T_xor_int_lit8_1.d
@@ -28,7 +28,7 @@
 .limit regs 3
 
        const v1, 15
-       xor-int/lit16 v1, v1, 8
+       xor-int/lit8 v1, v1, 8
        return v1
 .end method
 
diff --git a/tools/vm-tests-tf/src/dot/junit/opcodes/xor_int_lit8/d/T_xor_int_lit8_2.d b/tools/vm-tests-tf/src/dot/junit/opcodes/xor_int_lit8/d/T_xor_int_lit8_2.d
index 8d23bf6..d471d75 100644
--- a/tools/vm-tests-tf/src/dot/junit/opcodes/xor_int_lit8/d/T_xor_int_lit8_2.d
+++ b/tools/vm-tests-tf/src/dot/junit/opcodes/xor_int_lit8/d/T_xor_int_lit8_2.d
@@ -28,7 +28,7 @@
 .limit regs 3
 
        const v2, -8
-       xor-int/lit16 v1, v2, -15
+       xor-int/lit8 v1, v2, -15
        return v1
 .end method
 
diff --git a/tools/vm-tests-tf/src/dot/junit/opcodes/xor_int_lit8/d/T_xor_int_lit8_3.d b/tools/vm-tests-tf/src/dot/junit/opcodes/xor_int_lit8/d/T_xor_int_lit8_3.d
index 5953574..f73909d 100644
--- a/tools/vm-tests-tf/src/dot/junit/opcodes/xor_int_lit8/d/T_xor_int_lit8_3.d
+++ b/tools/vm-tests-tf/src/dot/junit/opcodes/xor_int_lit8/d/T_xor_int_lit8_3.d
@@ -28,7 +28,7 @@
 .limit regs 3
 
        const v1, 0
-       xor-int/lit16 v1, v1, -1
+       xor-int/lit8 v1, v1, -1
        return v1
 .end method
 
diff --git a/tools/vm-tests-tf/src/dot/junit/opcodes/xor_int_lit8/d/T_xor_int_lit8_4.d b/tools/vm-tests-tf/src/dot/junit/opcodes/xor_int_lit8/d/T_xor_int_lit8_4.d
index c2270c4..6832299 100644
--- a/tools/vm-tests-tf/src/dot/junit/opcodes/xor_int_lit8/d/T_xor_int_lit8_4.d
+++ b/tools/vm-tests-tf/src/dot/junit/opcodes/xor_int_lit8/d/T_xor_int_lit8_4.d
@@ -28,7 +28,7 @@
 .limit regs 3
 
        const v1, 2147483647
-       xor-int/lit16 v1, v1, -128
+       xor-int/lit8 v1, v1, -128
        return v1
 .end method
 
diff --git a/tools/vm-tests-tf/src/dot/junit/opcodes/xor_int_lit8/d/T_xor_int_lit8_6.d b/tools/vm-tests-tf/src/dot/junit/opcodes/xor_int_lit8/d/T_xor_int_lit8_6.d
index b3ab7e4..b7bc40a 100644
--- a/tools/vm-tests-tf/src/dot/junit/opcodes/xor_int_lit8/d/T_xor_int_lit8_6.d
+++ b/tools/vm-tests-tf/src/dot/junit/opcodes/xor_int_lit8/d/T_xor_int_lit8_6.d
@@ -27,7 +27,7 @@
 .method public run()I
 .limit regs 3
 
-       xor-int/lit16 v1, v2, 1
+       xor-int/lit8 v1, v2, 1
        return v1    
 .end method
 
diff --git a/tools/vm-tests-tf/src/dot/junit/opcodes/xor_int_lit8/d/T_xor_int_lit8_7.d b/tools/vm-tests-tf/src/dot/junit/opcodes/xor_int_lit8/d/T_xor_int_lit8_7.d
index 74bf7e5..23e9337 100644
--- a/tools/vm-tests-tf/src/dot/junit/opcodes/xor_int_lit8/d/T_xor_int_lit8_7.d
+++ b/tools/vm-tests-tf/src/dot/junit/opcodes/xor_int_lit8/d/T_xor_int_lit8_7.d
@@ -27,7 +27,7 @@
 .method public run(F)I
 .limit regs 3
 
-       xor-int/lit16 v1, v2, 8
+       xor-int/lit8 v1, v2, 8
        return v1
 .end method
 
diff --git a/tools/vm-tests-tf/src/dot/junit/opcodes/xor_int_lit8/d/T_xor_int_lit8_8.d b/tools/vm-tests-tf/src/dot/junit/opcodes/xor_int_lit8/d/T_xor_int_lit8_8.d
index 0857ea6..0fc33fc 100644
--- a/tools/vm-tests-tf/src/dot/junit/opcodes/xor_int_lit8/d/T_xor_int_lit8_8.d
+++ b/tools/vm-tests-tf/src/dot/junit/opcodes/xor_int_lit8/d/T_xor_int_lit8_8.d
@@ -27,7 +27,7 @@
 .method public run(I)I
 .limit regs 3
 
-       xor-int/lit16 v1, v3, 8
+       xor-int/lit8 v1, v3, 8
        return v1
 .end method