Reconcile with jb-release

Change-Id: I134f15079de06dce8d9e8ac424a63b6afae77150
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/AndroidManifest.xml b/tests/AndroidManifest.xml
index e96acda..31ad973 100644
--- a/tests/AndroidManifest.xml
+++ b/tests/AndroidManifest.xml
@@ -137,7 +137,8 @@
 
         <activity android:name="android.media.cts.MediaStubActivity"
             android:label="MediaStubActivity"
-            android:screenOrientation="nosensor">
+            android:screenOrientation="nosensor"
+            android:configChanges="keyboard|keyboardHidden|orientation|screenSize">
             <intent-filter>
                 <action android:name="android.intent.action.MAIN" />
                 <category android:name="android.intent.category.FRAMEWORK_INSTRUMENTATION_TEST" />
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/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/graphics2/src/android/graphics2/cts/TextureViewTest.java b/tests/tests/graphics2/src/android/graphics2/cts/TextureViewTest.java
index 932a5d5..c84919a 100644
--- a/tests/tests/graphics2/src/android/graphics2/cts/TextureViewTest.java
+++ b/tests/tests/graphics2/src/android/graphics2/cts/TextureViewTest.java
@@ -17,6 +17,7 @@
 package android.graphics2.cts;
 
 import android.graphics2.cts.TextureViewCameraActivity;
+import android.hardware.Camera;
 import android.test.ActivityInstrumentationTestCase2;
 
 
@@ -30,10 +31,16 @@
     @Override
     protected void setUp() throws Exception {
         super.setUp();
+        if (Camera.getNumberOfCameras() < 1) {
+            return;
+        }
         mActivity = getActivity();
     }
 
     public void testTextureViewActivity() throws InterruptedException {
+        if (Camera.getNumberOfCameras() < 1) {
+            return;
+        }
         assertTrue(mActivity.waitForCompletion(WAIT_TIMEOUT_IN_SECS));
     }
 
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/media/src/android/media/cts/MediaPlayerTest.java b/tests/tests/media/src/android/media/cts/MediaPlayerTest.java
index 02b18de..3274d13 100644
--- a/tests/tests/media/src/android/media/cts/MediaPlayerTest.java
+++ b/tests/tests/media/src/android/media/cts/MediaPlayerTest.java
@@ -314,7 +314,7 @@
      * from the time setDisplay() was called
      */
     public void testVideoSurfaceResetting() throws Exception {
-        final int tolerance = 66 * 3 / 2; /* Test video is 15fps... 66 ms per frame */
+        final int tolerance = 150;
         final int audioLatencyTolerance = 1000;  /* covers audio path latency variability */
         final int seekPos = 5000;
 
diff --git a/tests/tests/permission/src/android/permission/cts/FileSystemPermissionTest.java b/tests/tests/permission/src/android/permission/cts/FileSystemPermissionTest.java
index cf99273..629f61d 100644
--- a/tests/tests/permission/src/android/permission/cts/FileSystemPermissionTest.java
+++ b/tests/tests/permission/src/android/permission/cts/FileSystemPermissionTest.java
@@ -291,6 +291,7 @@
                     "/data/local/tmp",
                     "/data/local/tmp/com.nuance.android.vsuite.vsuiteapp",
                     "/data/log",
+                    "/data/logger",
                     "/data/lost+found",
                     "/data/misc",
                     "/data/misc/bluetooth",
@@ -373,9 +374,15 @@
                 writableDirs.isEmpty());
     }
 
+    private static final Set<File> SYS_EXCEPTIONS = new HashSet<File>(
+            Arrays.asList(
+                new File("/sys/kernel/debug/tracing/trace_marker")
+            ));
+
     @LargeTest
     public void testAllFilesInSysAreNotWritable() throws Exception {
         Set<File> writable = getAllWritableFilesInDirAndSubDir(new File("/sys"));
+        writable.removeAll(SYS_EXCEPTIONS);
         assertTrue("Found writable: " + writable.toString(),
                 writable.isEmpty());
     }
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..b7bc40a1 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