am ec10c4f2: am e66798b1: DO NOT MERGE ICS MR1 Backport of Some Tests

* commit 'ec10c4f2d726c76d64d77f89731bcdb91f12bfa0':
diff --git a/CtsTestCaseList.mk b/CtsTestCaseList.mk
index b4dc4dd..f87d3a3 100644
--- a/CtsTestCaseList.mk
+++ b/CtsTestCaseList.mk
@@ -38,8 +38,6 @@
 	CtsBluetoothTestCases \
 	CtsContentTestCases \
 	CtsDatabaseTestCases \
-	CtsDelegatingAccessibilityService \
-	CtsDeviceAdmin \
 	CtsDpiTestCases \
 	CtsDpiTestCases2 \
 	CtsDrmTestCases \
@@ -72,16 +70,18 @@
 	CtsUtilTestCases \
 	CtsViewTestCases \
 	CtsWebkitTestCases \
-	CtsWidgetTestCases \
-	SignatureTest \
-	TestDeviceSetup \
-	$(CTS_SECURITY_APPS_LIST)
+	CtsWidgetTestCases
 
 CTS_TEST_CASE_LIST := \
+	TestDeviceSetup \
+	CtsDelegatingAccessibilityService \
+	CtsDeviceAdmin \
 	com.replica.replicaisland \
+	SignatureTest \
 	ApiDemos \
 	ApiDemosReferenceTest \
 	$(CTS_COVERAGE_TEST_CASE_LIST) \
+	$(CTS_SECURITY_APPS_LIST)
 
 CTS_NATIVE_EXES := \
 	CtsNativeMediaTestCases
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/PassFailButtons.java b/apps/CtsVerifier/src/com/android/cts/verifier/PassFailButtons.java
index 9991b9d..e7bf70d 100644
--- a/apps/CtsVerifier/src/com/android/cts/verifier/PassFailButtons.java
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/PassFailButtons.java
@@ -76,9 +76,6 @@
 
         Button getPassButton();
 
-        /* Added to the interface just to make sure it isn't forgotten in the implementations. */
-        Dialog onCreateDialog(int id, Bundle args);
-
         /**
          * Returns a unique identifier for the test.  Usually, this is just the class name.
          */
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/audioquality/Experiment.java b/apps/CtsVerifier/src/com/android/cts/verifier/audioquality/Experiment.java
index 6f2aa83..bd5f186 100644
--- a/apps/CtsVerifier/src/com/android/cts/verifier/audioquality/Experiment.java
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/audioquality/Experiment.java
@@ -27,7 +27,7 @@
  * The base class for all audio experiments.
  */
 public class Experiment implements Runnable {
-    protected static final String TAG = "AudioQualityVerifier";
+    private static final String TAG = "AudioQualityVerifier";
 
     private static final int DEFAULT_TIMEOUT = 5; // In seconds
 
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/audioquality/experiments/LoopbackExperiment.java b/apps/CtsVerifier/src/com/android/cts/verifier/audioquality/experiments/LoopbackExperiment.java
index 109fdfe..0817860 100644
--- a/apps/CtsVerifier/src/com/android/cts/verifier/audioquality/experiments/LoopbackExperiment.java
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/audioquality/experiments/LoopbackExperiment.java
@@ -35,6 +35,8 @@
  * the test results (score and report).
  */
 public class LoopbackExperiment extends Experiment {
+    private static final String TAG = "LoopbackExperiment";
+
     protected static final int TIMEOUT = 10;
 
     // Amount of silence in ms before and after playback
diff --git a/tests/core/libcore/src/Dummy.java b/tests/core/libcore/src/Dummy.java
index cfe0c81..64b67de 100644
--- a/tests/core/libcore/src/Dummy.java
+++ b/tests/core/libcore/src/Dummy.java
@@ -17,7 +17,7 @@
 /**
  * We really just want the core-tests classes from the static java
  * library, but the build system currently needs at least one input
- * file, not just becuase its a sanity check, but because the static
+ * file, not just because its a sanity check, but because the static
  * class files and resources are included in the output of the local
  * java compilation.
  */
diff --git a/tests/tests/graphics/src/android/graphics/drawable/cts/GradientDrawableTest.java b/tests/tests/graphics/src/android/graphics/drawable/cts/GradientDrawableTest.java
index 6849c69..d2599e4 100644
--- a/tests/tests/graphics/src/android/graphics/drawable/cts/GradientDrawableTest.java
+++ b/tests/tests/graphics/src/android/graphics/drawable/cts/GradientDrawableTest.java
@@ -449,7 +449,7 @@
         method = "getConstantState",
         args = {}
     )
-    @ToBeFixed(bug = "", explanation = "can not assert the inner fields, becuase the class" +
+    @ToBeFixed(bug = "", explanation = "can not assert the inner fields, because the class" +
             " GradientState is package protected.")
     public void testGetConstantState() {
         GradientDrawable gradientDrawable = new GradientDrawable();
diff --git a/tests/tests/graphics/src/android/graphics/drawable/cts/InsetDrawableTest.java b/tests/tests/graphics/src/android/graphics/drawable/cts/InsetDrawableTest.java
index 32dc5ca..c3a0b45 100644
--- a/tests/tests/graphics/src/android/graphics/drawable/cts/InsetDrawableTest.java
+++ b/tests/tests/graphics/src/android/graphics/drawable/cts/InsetDrawableTest.java
@@ -431,7 +431,7 @@
         method = "getConstantState",
         args = {}
     )
-    @ToBeFixed(bug = "", explanation = "can not assert the inner fields, becuase the class" +
+    @ToBeFixed(bug = "", explanation = "can not assert the inner fields, because the class" +
             " InsetState is package protected.")
     public void testGetConstantState() {
         Drawable d = mContext.getResources().getDrawable(R.drawable.pass);
diff --git a/tests/tests/hardware/src/android/hardware/cts/CameraTest.java b/tests/tests/hardware/src/android/hardware/cts/CameraTest.java
old mode 100644
new mode 100755
diff --git a/tests/tests/text/src/android/text/format/cts/TimeTest.java b/tests/tests/text/src/android/text/format/cts/TimeTest.java
index 0fb3f2a..50c51da 100644
--- a/tests/tests/text/src/android/text/format/cts/TimeTest.java
+++ b/tests/tests/text/src/android/text/format/cts/TimeTest.java
@@ -627,10 +627,10 @@
     )
     public void testSetToNow0() throws Exception {
         Time t = new Time(Time.TIMEZONE_UTC);
-        t.setToNow();
         long currentTime = System.currentTimeMillis();
+        t.setToNow();
         long time = t.toMillis(false);
-        assertEquals(currentTime, time, 500);
+        assertEquals(currentTime, time, 999);
     }
 
     @TestTargetNew(
diff --git a/tests/tests/view/src/android/view/cts/OrientationEventListenerTest.java b/tests/tests/view/src/android/view/cts/OrientationEventListenerTest.java
index 570ef88..130f01b 100644
--- a/tests/tests/view/src/android/view/cts/OrientationEventListenerTest.java
+++ b/tests/tests/view/src/android/view/cts/OrientationEventListenerTest.java
@@ -56,7 +56,7 @@
             level = TestLevel.SUFFICIENT,
             notes = "Test {@link OrientationEventListener#enable()}. "
                     + "This method is simply called to make sure that no exception is thrown. "
-                    + "The registeration of the listener can not be tested becuase there is "
+                    + "The registration of the listener can not be tested because there is "
                     + "no way to simulate sensor events",
             method = "enable",
             args = {}
@@ -65,7 +65,7 @@
             level = TestLevel.SUFFICIENT,
             notes = "Test {@link OrientationEventListener#disable()}. "
                     + "This method is simply called to make sure that no exception is thrown. "
-                    + "The registeration of the listener can not be tested becuase there is "
+                    + "The registration of the listener can not be tested because there is "
                     + "no way to simulate sensor events",
             method = "disable",
             args = {}
diff --git a/tests/tests/view/src/android/view/cts/OrientationListenerTest.java b/tests/tests/view/src/android/view/cts/OrientationListenerTest.java
index f21519c..b3437cd 100644
--- a/tests/tests/view/src/android/view/cts/OrientationListenerTest.java
+++ b/tests/tests/view/src/android/view/cts/OrientationListenerTest.java
@@ -65,7 +65,7 @@
             level = TestLevel.COMPLETE,
             notes = "Test {@link OrientationListener#enable()}. "
                     + "This method is simply called to make sure that no exception is thrown. "
-                    + "The registeration of the listener can not be tested becuase there is no way "
+                    + "The registration of the listener can not be tested because there is no way "
                     + "to simulate sensor events on the emulator",
             method = "enable",
             args = {}
@@ -74,14 +74,14 @@
             level = TestLevel.COMPLETE,
             notes = "Test {@link OrientationListener#disable()}. "
                     + "This method is simply called to make sure that no exception is thrown. "
-                    + "The registeration of the listener can not be tested becuase there is no way "
+                    + "The registration of the listener can not be tested because there is no way "
                     + "to simulate sensor events on the emulator",
             method = "disable",
             args = {}
         )
     })
     @ToBeFixed(explanation = "Can not simulate sensor events on the emulator.")
-    public void testRegisterationOfOrientationListener() {
+    public void testRegistrationOfOrientationListener() {
         // these methods are called to assure that no exception is thrown
         MockOrientationListener listener = new MockOrientationListener(mContext);
         listener.disable();
diff --git a/tests/tests/widget/src/android/widget/cts/GridViewTest.java b/tests/tests/widget/src/android/widget/cts/GridViewTest.java
index 84c07f7..50a7bae 100755
--- a/tests/tests/widget/src/android/widget/cts/GridViewTest.java
+++ b/tests/tests/widget/src/android/widget/cts/GridViewTest.java
@@ -312,7 +312,8 @@
         mGridView.setStretchMode(GridView.NO_STRETCH);
         // Number of columns should be big enough, otherwise the
         // horizontal spacing cannot be correctly verified.
-        mGridView.setNumColumns(22);
+        mGridView.setNumColumns(28);
+
 
         // this test case can not be ran in UI thread.
         mActivity.runOnUiThread(new Runnable() {
diff --git a/tools/cts-native-xml-generator/src/Android.mk b/tools/cts-native-xml-generator/src/Android.mk
index 70b9f49..ed93457 100644
--- a/tools/cts-native-xml-generator/src/Android.mk
+++ b/tools/cts-native-xml-generator/src/Android.mk
@@ -20,7 +20,7 @@
 include $(CLEAR_VARS)
 
 LOCAL_SRC_FILES := $(call all-subdir-java-files)
-LOCAL_JAVA_RESOURCE_DIRS := res
+LOCAL_JAVA_RESOURCE_DIRS := 
 LOCAL_JAR_MANIFEST := MANIFEST.mf
 
 LOCAL_MODULE := cts-native-xml-generator
diff --git a/tools/tradefed-host/src/com/android/cts/tradefed/build/CtsBuildProvider.java b/tools/tradefed-host/src/com/android/cts/tradefed/build/CtsBuildProvider.java
index b536102..c28631b 100644
--- a/tools/tradefed-host/src/com/android/cts/tradefed/build/CtsBuildProvider.java
+++ b/tools/tradefed-host/src/com/android/cts/tradefed/build/CtsBuildProvider.java
@@ -31,7 +31,7 @@
     @Option(name="cts-install-path", description="the path to the cts installation to use")
     private String mCtsRootDirPath = System.getProperty("CTS_ROOT");
 
-    public static final String CTS_BUILD_VERSION = "4.0.3_r2";
+    public static final String CTS_BUILD_VERSION = "4.0.3_r1";
 
     /**
      * {@inheritDoc}
diff --git a/tools/vm-tests-tf/src/util/build/BuildDalvikSuite.java b/tools/vm-tests-tf/src/util/build/BuildDalvikSuite.java
index bd3f4fd..bd688fe 100644
--- a/tools/vm-tests-tf/src/util/build/BuildDalvikSuite.java
+++ b/tools/vm-tests-tf/src/util/build/BuildDalvikSuite.java
@@ -631,7 +631,7 @@
             scanner.close();
         }
         if (scanner2 != null) {
-            scanner.close();
+            scanner2.close();
         }
         return md;
     }
@@ -650,6 +650,7 @@
                 FileReader reader = new FileReader(file);
                 char[] charContents = new char[(int) file.length()];
                 reader.read(charContents);
+                reader.close();
                 String contents = new String(charContents);
                 if (contents.equals(content)) {
                     // System.out.println("skipping identical: "
diff --git a/tools/vm-tests/src/util/build/BuildDalvikSuite.java b/tools/vm-tests/src/util/build/BuildDalvikSuite.java
index eda6382..f08b651 100644
--- a/tools/vm-tests/src/util/build/BuildDalvikSuite.java
+++ b/tools/vm-tests/src/util/build/BuildDalvikSuite.java
@@ -794,7 +794,7 @@
 	    scanner.close();
 	}
 	if (scanner2 != null) {
-	    scanner.close();
+	    scanner2.close();
 	}
         return md;
     }