Merge "Modify cts-tradefed xml generator to match current schema." into honeycomb
diff --git a/tests/src/android/provider/cts/FileCopyHelper.java b/tests/src/android/provider/cts/FileCopyHelper.java
index a9c53e5..011f551 100644
--- a/tests/src/android/provider/cts/FileCopyHelper.java
+++ b/tests/src/android/provider/cts/FileCopyHelper.java
@@ -18,6 +18,8 @@
 
 import android.content.Context;
 
+import java.io.File;
+import java.io.FileOutputStream;
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.OutputStream;
@@ -95,4 +97,14 @@
             mContext.deleteFile(path);
         }
     }
+
+    public static void createFile(File file, int numBytes) throws IOException {
+        byte[] buffer = new byte[numBytes];
+        FileOutputStream output = new FileOutputStream(file);
+        try {
+            output.write(buffer);
+        } finally {
+            output.close();
+        }
+    }
 }
diff --git a/tests/tests/app/src/android/app/cts/InstrumentationTest.java b/tests/tests/app/src/android/app/cts/InstrumentationTest.java
index 00d4dac..6ab9ac6 100644
--- a/tests/tests/app/src/android/app/cts/InstrumentationTest.java
+++ b/tests/tests/app/src/android/app/cts/InstrumentationTest.java
@@ -88,6 +88,7 @@
         mIntent = null;
         if (mActivity != null) {
             mActivity.finish();
+            mActivity = null;
         }
         super.tearDown();
     }
@@ -608,18 +609,6 @@
 
     @TestTargetNew(
         level = TestLevel.COMPLETE,
-        method = "callActivityOnDestroy",
-        args = {Activity.class}
-    )
-    public void testCallActivityOnDestroy() throws Exception {
-        mActivity.setOnDestroyCalled(false);
-        mInstrumentation.callActivityOnDestroy(mActivity);
-        mInstrumentation.waitForIdleSync();
-        assertTrue(mActivity.isOnDestroyCalled());
-    }
-
-    @TestTargetNew(
-        level = TestLevel.COMPLETE,
         method = "sendKeyDownUpSync",
         args = {int.class}
     )
diff --git a/tests/tests/app/src/android/app/cts/ServiceTest.java b/tests/tests/app/src/android/app/cts/ServiceTest.java
index 7f6fe94..0b2b767 100644
--- a/tests/tests/app/src/android/app/cts/ServiceTest.java
+++ b/tests/tests/app/src/android/app/cts/ServiceTest.java
@@ -16,6 +16,11 @@
 
 package android.app.cts;
 
+import dalvik.annotation.TestLevel;
+import dalvik.annotation.TestTargetClass;
+import dalvik.annotation.TestTargetNew;
+import dalvik.annotation.TestTargets;
+
 import android.app.Service;
 import android.content.ComponentName;
 import android.content.Context;
@@ -27,10 +32,6 @@
 import android.os.Parcel;
 import android.os.RemoteException;
 import android.test.suitebuilder.annotation.MediumTest;
-import dalvik.annotation.TestLevel;
-import dalvik.annotation.TestTargetClass;
-import dalvik.annotation.TestTargetNew;
-import dalvik.annotation.TestTargets;
 
 @TestTargetClass(Service.class)
 public class ServiceTest extends ActivityTestsBase {
@@ -49,8 +50,8 @@
     private Intent mLocalService;
     private Intent mLocalDeniedService;
     private Intent mLocalGrantedService;
-    private Intent mLocalServiceGranted;
-    private Intent mLocalServiceDenied;
+    private Intent mLocalService_ApplicationHasPermission;
+    private Intent mLocalService_ApplicationDoesNotHavePermission;
 
     private IBinder mStateReceiver;
 
@@ -317,8 +318,8 @@
         mLocalService = new Intent(mContext, LocalService.class);
         mLocalDeniedService = new Intent(mContext, LocalDeniedService.class);
         mLocalGrantedService = new Intent(mContext, LocalGrantedService.class);
-        mLocalServiceGranted = new Intent(LocalService.SERVICE_LOCAL_GRANTED);
-        mLocalServiceDenied = new Intent(LocalService.SERVICE_LOCAL_DENIED);
+        mLocalService_ApplicationHasPermission = new Intent(LocalService.SERVICE_LOCAL_GRANTED);
+        mLocalService_ApplicationDoesNotHavePermission = new Intent(LocalService.SERVICE_LOCAL_DENIED);
         mStateReceiver = new MockBinder();
     }
 
@@ -388,7 +389,7 @@
         super.tearDown();
         mContext.stopService(mLocalService);
         mContext.stopService(mLocalGrantedService);
-        mContext.stopService(mLocalServiceGranted);
+        mContext.stopService(mLocalService_ApplicationHasPermission);
     }
 
     @TestTargets({
@@ -634,8 +635,9 @@
         )
     })
     @MediumTest
-    public void testLocalStartClassPermissionGranted() throws Exception {
+    public void testLocalStartClassPermissions() throws Exception {
         startExpectResult(mLocalGrantedService);
+        startExpectResult(mLocalDeniedService);
     }
 
     @TestTargets({
@@ -666,8 +668,9 @@
         )
     })
     @MediumTest
-    public void testLocalStartActionPermissionGranted() throws Exception {
-        startExpectResult(mLocalServiceGranted);
+    public void testLocalStartActionPermissions() throws Exception {
+        startExpectResult(mLocalService_ApplicationHasPermission);
+        startExpectResult(mLocalService_ApplicationDoesNotHavePermission);
     }
 
     @TestTargets({
@@ -698,8 +701,9 @@
         )
     })
     @MediumTest
-    public void testLocalBindClassPermissionGranted() throws Exception {
+    public void testLocalBindClassPermissions() throws Exception {
         bindExpectResult(mLocalGrantedService);
+        bindExpectResult(mLocalDeniedService);
     }
 
     @TestTargets({
@@ -730,8 +734,9 @@
         )
     })
     @MediumTest
-    public void testLocalBindActionPermissionGranted() throws Exception {
-        bindExpectResult(mLocalServiceGranted);
+    public void testLocalBindActionPermissions() throws Exception {
+        bindExpectResult(mLocalService_ApplicationHasPermission);
+        bindExpectResult(mLocalService_ApplicationDoesNotHavePermission);
     }
 
     @TestTargets({
@@ -795,135 +800,7 @@
     })
     @MediumTest
     public void testLocalBindAutoActionPermissionGranted() throws Exception {
-        bindAutoExpectResult(mLocalServiceGranted);
-    }
-
-    @TestTargets({
-        @TestTargetNew(
-            level = TestLevel.COMPLETE,
-            method = "onStart",
-            args = {android.content.Intent.class, int.class}
-        ),
-        @TestTargetNew(
-            level = TestLevel.COMPLETE,
-            method = "onDestroy",
-            args = {}
-        ),
-        @TestTargetNew(
-            level = TestLevel.COMPLETE,
-            method = "onBind",
-            args = {android.content.Intent.class}
-        ),
-        @TestTargetNew(
-            level = TestLevel.COMPLETE,
-            method = "onRebind",
-            args = {android.content.Intent.class}
-        ),
-        @TestTargetNew(
-            level = TestLevel.COMPLETE,
-            method = "onUnbind",
-            args = {android.content.Intent.class}
-        )
-    })
-    @MediumTest
-    public void testLocalStartClassPermissionDenied() throws Exception {
-        startExpectNoPermission(mLocalDeniedService);
-    }
-
-    @TestTargets({
-        @TestTargetNew(
-            level = TestLevel.COMPLETE,
-            method = "onStart",
-            args = {android.content.Intent.class, int.class}
-        ),
-        @TestTargetNew(
-            level = TestLevel.COMPLETE,
-            method = "onDestroy",
-            args = {}
-        ),
-        @TestTargetNew(
-            level = TestLevel.COMPLETE,
-            method = "onBind",
-            args = {android.content.Intent.class}
-        ),
-        @TestTargetNew(
-            level = TestLevel.COMPLETE,
-            method = "onRebind",
-            args = {android.content.Intent.class}
-        ),
-        @TestTargetNew(
-            level = TestLevel.COMPLETE,
-            method = "onUnbind",
-            args = {android.content.Intent.class}
-        )
-    })
-    @MediumTest
-    public void testLocalStartActionPermissionDenied() throws Exception {
-        startExpectNoPermission(mLocalServiceDenied);
-    }
-
-    @TestTargets({
-        @TestTargetNew(
-            level = TestLevel.COMPLETE,
-            method = "onStart",
-            args = {android.content.Intent.class, int.class}
-        ),
-        @TestTargetNew(
-            level = TestLevel.COMPLETE,
-            method = "onDestroy",
-            args = {}
-        ),
-        @TestTargetNew(
-            level = TestLevel.COMPLETE,
-            method = "onBind",
-            args = {android.content.Intent.class}
-        ),
-        @TestTargetNew(
-            level = TestLevel.COMPLETE,
-            method = "onRebind",
-            args = {android.content.Intent.class}
-        ),
-        @TestTargetNew(
-            level = TestLevel.COMPLETE,
-            method = "onUnbind",
-            args = {android.content.Intent.class}
-        )
-    })
-    @MediumTest
-    public void testLocalBindClassPermissionDenied() throws Exception {
-        bindExpectNoPermission(mLocalDeniedService);
-    }
-
-    @TestTargets({
-        @TestTargetNew(
-            level = TestLevel.COMPLETE,
-            method = "onStart",
-            args = {android.content.Intent.class, int.class}
-        ),
-        @TestTargetNew(
-            level = TestLevel.COMPLETE,
-            method = "onDestroy",
-            args = {}
-        ),
-        @TestTargetNew(
-            level = TestLevel.COMPLETE,
-            method = "onBind",
-            args = {android.content.Intent.class}
-        ),
-        @TestTargetNew(
-            level = TestLevel.COMPLETE,
-            method = "onRebind",
-            args = {android.content.Intent.class}
-        ),
-        @TestTargetNew(
-            level = TestLevel.COMPLETE,
-            method = "onUnbind",
-            args = {android.content.Intent.class}
-        )
-    })
-    @MediumTest
-    public void testLocalBindActionPermissionDenied() throws Exception {
-        bindExpectNoPermission(mLocalServiceDenied);
+        bindAutoExpectResult(mLocalService_ApplicationHasPermission);
     }
 
     @TestTargets({
@@ -957,7 +834,7 @@
     public void testLocalUnbindTwice() throws Exception {
         EmptyConnection conn = new EmptyConnection();
         mContext.bindService(
-                mLocalServiceGranted, conn, 0);
+                mLocalService_ApplicationHasPermission, conn, 0);
         mContext.unbindService(conn);
         try {
             mContext.unbindService(conn);
diff --git a/tests/tests/content/src/android/content/cts/ContextTest.java b/tests/tests/content/src/android/content/cts/ContextTest.java
index 3eac36a..b662162 100644
--- a/tests/tests/content/src/android/content/cts/ContextTest.java
+++ b/tests/tests/content/src/android/content/cts/ContextTest.java
@@ -16,7 +16,14 @@
 
 package android.content.cts;
 
-import java.io.IOException;
+import com.android.cts.stub.R;
+import com.android.internal.util.XmlUtils;
+
+import dalvik.annotation.TestLevel;
+import dalvik.annotation.TestTargetClass;
+import dalvik.annotation.TestTargetNew;
+import dalvik.annotation.TestTargets;
+import dalvik.annotation.ToBeFixed;
 
 import org.xmlpull.v1.XmlPullParserException;
 
@@ -28,14 +35,7 @@
 import android.util.AttributeSet;
 import android.util.Xml;
 
-import com.android.cts.stub.R;
-import com.android.internal.util.XmlUtils;
-
-import dalvik.annotation.TestTargets;
-import dalvik.annotation.TestLevel;
-import dalvik.annotation.TestTargetNew;
-import dalvik.annotation.TestTargetClass;
-import dalvik.annotation.ToBeFixed;
+import java.io.IOException;
 
 @TestTargetClass(Context.class)
 public class ContextTest extends AndroidTestCase {
@@ -132,7 +132,6 @@
             args = {android.util.AttributeSet.class, int[].class}
         )
     })
-    @ToBeFixed(bug=" ", explanation = "Wrong resource ID can not result in a exception.")
     public void testObtainStyledAttributes() {
         // Test obtainStyledAttributes(int[])
         TypedArray testTypedArray = mContext
@@ -165,17 +164,18 @@
         testTypedArray.recycle();
 
         // Test obtainStyledAttributes(AttributeSet, int[])
+        int[] attrs = android.R.styleable.DatePicker;
         testTypedArray = mContext.obtainStyledAttributes(getAttributeSet(R.layout.context_layout),
-                com.android.internal.R.styleable.DatePicker);
+                attrs);
         assertNotNull(testTypedArray);
-        assertEquals(2, testTypedArray.length());
+        assertEquals(attrs.length, testTypedArray.length());
         testTypedArray.recycle();
 
         // Test obtainStyledAttributes(AttributeSet, int[], int, int)
         testTypedArray = mContext.obtainStyledAttributes(getAttributeSet(R.layout.context_layout),
-                com.android.internal.R.styleable.DatePicker, 0, 0);
+                attrs, 0, 0);
         assertNotNull(testTypedArray);
-        assertEquals(2, testTypedArray.length());
+        assertEquals(attrs.length, testTypedArray.length());
         testTypedArray.recycle();
     }
 
diff --git a/tests/tests/database/src/android/database/sqlite/cts/SQLiteCursorTest.java b/tests/tests/database/src/android/database/sqlite/cts/SQLiteCursorTest.java
index d608c2f..c684a69 100644
--- a/tests/tests/database/src/android/database/sqlite/cts/SQLiteCursorTest.java
+++ b/tests/tests/database/src/android/database/sqlite/cts/SQLiteCursorTest.java
@@ -249,12 +249,7 @@
         assertEquals(3, c.getInt(0));
         // close the database and see if requery throws an exception
         mDatabase.close();
-        try {
-            c.requery();
-            fail("expected IllegalStateException");
-        } catch (IllegalStateException e) {
-            // expected
-        }
+        assertFalse(c.requery());
     }
 
     @TestTargets({
diff --git a/tests/tests/provider/src/android/provider/cts/MediaStore_Images_MediaTest.java b/tests/tests/provider/src/android/provider/cts/MediaStore_Images_MediaTest.java
index f2410f1..8e8d650 100644
--- a/tests/tests/provider/src/android/provider/cts/MediaStore_Images_MediaTest.java
+++ b/tests/tests/provider/src/android/provider/cts/MediaStore_Images_MediaTest.java
@@ -35,10 +35,10 @@
 import android.provider.MediaStore.Images.Media;
 import android.provider.MediaStore.Images.Thumbnails;
 import android.test.InstrumentationTestCase;
-import android.util.Log;
 
 import java.io.File;
 import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
 import java.io.IOException;
 import java.util.ArrayList;
 
@@ -247,11 +247,15 @@
         assertNull(mContentResolver.query(Media.getContentUri(volume), null, null, null, null));
     }
 
-    public void testStoreImagesMediaExternal() {
+    public void testStoreImagesMediaExternal() throws Exception {
         final String externalPath = Environment.getExternalStorageDirectory().getPath() +
                 "/testimage.jpg";
         final String externalPath2 = Environment.getExternalStorageDirectory().getPath() +
                 "/testimage1.jpg";
+
+        int numBytes = 1337;
+        FileCopyHelper.createFile(new File(externalPath), numBytes);
+
         ContentValues values = new ContentValues();
         values.put(Media.ORIENTATION, 0);
         values.put(Media.PICASA_ID, 0);
@@ -265,7 +269,7 @@
         values.put(Media.DATA, externalPath);
         values.put(Media.DISPLAY_NAME, "testimage");
         values.put(Media.MIME_TYPE, "image/jpeg");
-        values.put(Media.SIZE, 86853);
+        values.put(Media.SIZE, numBytes);
         values.put(Media.TITLE, "testimage");
         long dateAdded = System.currentTimeMillis() / 1000;
         values.put(Media.DATE_ADDED, dateAdded);
@@ -296,7 +300,7 @@
             assertEquals("testimage", c.getString(c.getColumnIndex(Media.DISPLAY_NAME)));
             assertEquals("image/jpeg", c.getString(c.getColumnIndex(Media.MIME_TYPE)));
             assertEquals("testimage", c.getString(c.getColumnIndex(Media.TITLE)));
-            assertEquals(86853, c.getInt(c.getColumnIndex(Media.SIZE)));
+            assertEquals(numBytes, c.getInt(c.getColumnIndex(Media.SIZE)));
             long realDateAdded = c.getLong(c.getColumnIndex(Media.DATE_ADDED));
             assertTrue(realDateAdded >= dateAdded);
             assertEquals(dateModified, c.getLong(c.getColumnIndex(Media.DATE_MODIFIED)));
diff --git a/tests/tests/provider/src/android/provider/cts/MediaStore_Video_MediaTest.java b/tests/tests/provider/src/android/provider/cts/MediaStore_Video_MediaTest.java
index 9a720e5..6f7842c 100644
--- a/tests/tests/provider/src/android/provider/cts/MediaStore_Video_MediaTest.java
+++ b/tests/tests/provider/src/android/provider/cts/MediaStore_Video_MediaTest.java
@@ -29,6 +29,8 @@
 import android.provider.MediaStore.Video.Media;
 import android.test.InstrumentationTestCase;
 
+import java.io.File;
+
 @TestTargetClass(MediaStore.Video.Media.class)
 public class MediaStore_Video_MediaTest extends InstrumentationTestCase {
     private ContentResolver mContentResolver;
@@ -56,11 +58,15 @@
         assertNull(mContentResolver.query(Media.getContentUri(volume), null, null, null, null));
     }
 
-    public void testStoreVideoMediaExternal() {
+    public void testStoreVideoMediaExternal() throws Exception {
         final String externalVideoPath = Environment.getExternalStorageDirectory().getPath() +
                  "/video/testvideo.3gp";
         final String externalVideoPath2 = Environment.getExternalStorageDirectory().getPath() +
                 "/video/testvideo1.3gp";
+
+        int numBytes = 1337;
+        FileCopyHelper.createFile(new File(externalVideoPath), numBytes);
+
         ContentValues values = new ContentValues();
         values.put(Media.ALBUM, "cts");
         values.put(Media.ARTIST, "cts team");
@@ -79,11 +85,11 @@
         values.put(Media.DATA, externalVideoPath);
         values.put(Media.DISPLAY_NAME, "testvideo");
         values.put(Media.MIME_TYPE, "video/3gpp");
-        values.put(Media.SIZE, 86853);
+        values.put(Media.SIZE, numBytes);
         values.put(Media.TITLE, "testvideo");
-        long dateAdded = System.currentTimeMillis();
+        long dateAdded = System.currentTimeMillis() / 1000;
         values.put(Media.DATE_ADDED, dateAdded);
-        long dateModified = System.currentTimeMillis();
+        long dateModified = System.currentTimeMillis() / 1000;
         values.put(Media.DATE_MODIFIED, dateModified);
 
         // insert
@@ -115,9 +121,9 @@
             assertEquals("testvideo.3gp", c.getString(c.getColumnIndex(Media.DISPLAY_NAME)));
             assertEquals("video/3gpp", c.getString(c.getColumnIndex(Media.MIME_TYPE)));
             assertEquals("testvideo", c.getString(c.getColumnIndex(Media.TITLE)));
-            assertEquals(86853, c.getInt(c.getColumnIndex(Media.SIZE)));
+            assertEquals(numBytes, c.getInt(c.getColumnIndex(Media.SIZE)));
             long realDateAdded = c.getLong(c.getColumnIndex(Media.DATE_ADDED));
-            assertTrue(realDateAdded > 0);
+            assertTrue(realDateAdded >= dateAdded);
             assertEquals(dateModified, c.getLong(c.getColumnIndex(Media.DATE_MODIFIED)));
             c.close();
 
diff --git a/tests/tests/view/src/android/view/cts/ViewTest.java b/tests/tests/view/src/android/view/cts/ViewTest.java
index 0d3a4c2..f3d449b 100644
--- a/tests/tests/view/src/android/view/cts/ViewTest.java
+++ b/tests/tests/view/src/android/view/cts/ViewTest.java
@@ -4144,30 +4144,25 @@
     @UiThreadTest
     public void testScrolling() {
         MockView view = (MockView) mActivity.findViewById(R.id.mock_view);
-
         view.reset();
         assertEquals(0, view.getScrollX());
         assertEquals(0, view.getScrollY());
         assertFalse(view.hasCalledOnScrollChanged());
-        assertFalse(view.hasCalledInvalidate());
 
         view.scrollTo(0, 0);
         assertEquals(0, view.getScrollX());
         assertEquals(0, view.getScrollY());
         assertFalse(view.hasCalledOnScrollChanged());
-        assertFalse(view.hasCalledInvalidate());
 
         view.scrollBy(0, 0);
         assertEquals(0, view.getScrollX());
         assertEquals(0, view.getScrollY());
         assertFalse(view.hasCalledOnScrollChanged());
-        assertFalse(view.hasCalledInvalidate());
 
         view.scrollTo(10, 100);
         assertEquals(10, view.getScrollX());
         assertEquals(100, view.getScrollY());
         assertTrue(view.hasCalledOnScrollChanged());
-        assertTrue(view.hasCalledInvalidate());
 
         view.reset();
         assertFalse(view.hasCalledOnScrollChanged());
@@ -4175,7 +4170,6 @@
         assertEquals(0, view.getScrollX());
         assertEquals(0, view.getScrollY());
         assertTrue(view.hasCalledOnScrollChanged());
-        assertTrue(view.hasCalledInvalidate());
 
         view.reset();
         assertFalse(view.hasCalledOnScrollChanged());
@@ -4183,7 +4177,6 @@
         assertEquals(-1, view.getScrollX());
         assertEquals(-2, view.getScrollY());
         assertTrue(view.hasCalledOnScrollChanged());
-        assertTrue(view.hasCalledInvalidate());
     }
 
     @TestTargets({
diff --git a/tests/tests/view/src/android/view/cts/View_UsingViewsTest.java b/tests/tests/view/src/android/view/cts/View_UsingViewsTest.java
index 0e3d02e..7bdcfd2 100644
--- a/tests/tests/view/src/android/view/cts/View_UsingViewsTest.java
+++ b/tests/tests/view/src/android/view/cts/View_UsingViewsTest.java
@@ -345,6 +345,7 @@
          */
         TextView v = new TextView(mActivity);
         v.setSingleLine(); // otherwise the multiline state interferes with theses tests
+        v.setEnabled(false);
         v.setText("Test setDuplicateParentStateEnabled");
 
         v.setDuplicateParentStateEnabled(false);
diff --git a/tests/tests/widget/src/android/widget/cts/TextViewTest.java b/tests/tests/widget/src/android/widget/cts/TextViewTest.java
index 703b76b..dd8ea7f 100644
--- a/tests/tests/widget/src/android/widget/cts/TextViewTest.java
+++ b/tests/tests/widget/src/android/widget/cts/TextViewTest.java
@@ -44,6 +44,7 @@
 import android.graphics.drawable.Drawable;
 import android.net.Uri;
 import android.os.Bundle;
+import android.os.Debug;
 import android.test.ActivityInstrumentationTestCase2;
 import android.test.TouchUtils;
 import android.test.UiThreadTest;
@@ -1806,7 +1807,7 @@
         // a key event that will not change the TextView's text
         assertEquals("", mTextView.getText().toString());
         // The icon and error message will not be reset to null
-        assertNotNull(mTextView.getError());
+        assertNull(mTextView.getError());
 
         mInstrumentation.sendStringSync("1");
         // a key event cause changes to the TextView's text
diff --git a/tests/tests/widget/src/android/widget/cts/TimePickerTest.java b/tests/tests/widget/src/android/widget/cts/TimePickerTest.java
index 881693f..8287ae6 100644
--- a/tests/tests/widget/src/android/widget/cts/TimePickerTest.java
+++ b/tests/tests/widget/src/android/widget/cts/TimePickerTest.java
@@ -136,20 +136,19 @@
         int initialHour = 13;
         int initialMinute = 50;
         mTimePicker = new TimePicker(mContext);
-        mTimePicker.setCurrentHour(Integer.valueOf(initialHour));
-        mTimePicker.setCurrentMinute(Integer.valueOf(initialMinute));
+
         MockOnTimeChangeListener listener = new MockOnTimeChangeListener();
         mTimePicker.setOnTimeChangedListener(listener);
+        mTimePicker.setCurrentHour(Integer.valueOf(initialHour));
+        mTimePicker.setCurrentMinute(Integer.valueOf(initialMinute));
+        assertEquals(initialHour, listener.getNotifiedHourOfDay());
+        assertEquals(initialMinute, listener.getNotifiedMinute());
 
         // set the same hour as current
         listener.reset();
         mTimePicker.setCurrentHour(Integer.valueOf(initialHour));
-        assertTrue(listener.hasCalledOnTimeChanged());
-        assertEquals(initialHour, listener.getNotifiedHourOfDay());
-        assertEquals(initialMinute, listener.getNotifiedMinute());
-        assertSame(mTimePicker, listener.getNotifiedView());
+        assertFalse(listener.hasCalledOnTimeChanged());
 
-        listener.reset();
         mTimePicker.setCurrentHour(Integer.valueOf(initialHour + 1));
         assertTrue(listener.hasCalledOnTimeChanged());
         assertEquals(initialHour + 1, listener.getNotifiedHourOfDay());
@@ -159,10 +158,7 @@
         // set the same minute as current
         listener.reset();
         mTimePicker.setCurrentMinute(initialMinute);
-        assertTrue(listener.hasCalledOnTimeChanged());
-        assertEquals(initialHour + 1, listener.getNotifiedHourOfDay());
-        assertEquals(initialMinute, listener.getNotifiedMinute());
-        assertSame(mTimePicker, listener.getNotifiedView());
+        assertFalse(listener.hasCalledOnTimeChanged());
 
         listener.reset();
         mTimePicker.setCurrentMinute(initialMinute + 1);
@@ -174,10 +170,7 @@
         // change time picker mode
         listener.reset();
         mTimePicker.setIs24HourView( !mTimePicker.is24HourView() );
-        assertTrue(listener.hasCalledOnTimeChanged());
-        assertEquals(initialHour + 1, listener.getNotifiedHourOfDay());
-        assertEquals(initialMinute + 1, listener.getNotifiedMinute());
-        assertSame(mTimePicker, listener.getNotifiedView());
+        assertFalse(listener.hasCalledOnTimeChanged());
     }
 
     @TestTargets({
diff --git a/tools/device-setup/TestDeviceSetup/Android.mk b/tools/device-setup/TestDeviceSetup/Android.mk
index 3704be5..413f50b 100644
--- a/tools/device-setup/TestDeviceSetup/Android.mk
+++ b/tools/device-setup/TestDeviceSetup/Android.mk
@@ -30,3 +30,14 @@
 
 include $(BUILD_PACKAGE)
 
+# ======================================================
+# also build a static host library for the device info constants
+include $(CLEAR_VARS)
+
+LOCAL_SRC_FILES := src/android/tests/getinfo/DeviceInfoConstants.java
+
+LOCAL_MODULE_TAGS := optional
+
+LOCAL_MODULE := ctsdeviceinfolib
+
+include $(BUILD_HOST_JAVA_LIBRARY)
diff --git a/tools/device-setup/TestDeviceSetup/src/android/tests/getinfo/DeviceInfoActivity.java b/tools/device-setup/TestDeviceSetup/src/android/tests/getinfo/DeviceInfoActivity.java
index e6c0e14..bcba1cb 100644
--- a/tools/device-setup/TestDeviceSetup/src/android/tests/getinfo/DeviceInfoActivity.java
+++ b/tools/device-setup/TestDeviceSetup/src/android/tests/getinfo/DeviceInfoActivity.java
@@ -64,7 +64,7 @@
             touchScreen = "finger";
         }
         if (touchScreen != null) {
-            DeviceInfoInstrument.addResult(DeviceInfoInstrument.TOUCH_SCREEN,
+            DeviceInfoInstrument.addResult(DeviceInfoConstants.TOUCH_SCREEN,
                     touchScreen);
         }
 
@@ -82,7 +82,7 @@
         }
 
         if (navigation != null) {
-            DeviceInfoInstrument.addResult(DeviceInfoInstrument.NAVIGATION,
+            DeviceInfoInstrument.addResult(DeviceInfoConstants.NAVIGATION,
                     navigation);
         }
 
@@ -97,7 +97,7 @@
             keypad = "12key";
         }
         if (keypad != null) {
-            DeviceInfoInstrument.addResult(DeviceInfoInstrument.KEYPAD, keypad);
+            DeviceInfoInstrument.addResult(DeviceInfoConstants.KEYPAD, keypad);
         }
 
         String[] locales = getAssets().getLocales();
@@ -110,7 +110,7 @@
             }
             localeList.append(";");
         }
-        DeviceInfoInstrument.addResult(DeviceInfoInstrument.LOCALES,
+        DeviceInfoInstrument.addResult(DeviceInfoConstants.LOCALES,
                 localeList.toString());
 
         synchronized (sync) {
diff --git a/tools/device-setup/TestDeviceSetup/src/android/tests/getinfo/DeviceInfoConstants.java b/tools/device-setup/TestDeviceSetup/src/android/tests/getinfo/DeviceInfoConstants.java
new file mode 100644
index 0000000..d181a9b
--- /dev/null
+++ b/tools/device-setup/TestDeviceSetup/src/android/tests/getinfo/DeviceInfoConstants.java
@@ -0,0 +1,60 @@
+/*
+ * Copyright (C) 2011 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.
+ */
+
+package android.tests.getinfo;
+
+/**
+ * Constants for device info attributes to be sent as instrumentation keys.
+ * <p/>
+ * These values should correspond to attributes defined in cts_result.xsd.
+ */
+public interface DeviceInfoConstants {
+
+    public static final String OPEN_GL_ES_VERSION = "openGlEsVersion";
+    public static final String PROCESSES = "processes";
+    public static final String FEATURES = "features";
+    public static final String PHONE_NUMBER = "phoneNumber";
+    public static final String LOCALES = "locales";
+    public static final String IMSI = "imsi";
+    public static final String IMEI = "imei";
+    public static final String NETWORK = "network";
+    public static final String KEYPAD = "keypad";
+    public static final String NAVIGATION = "navigation";
+    public static final String TOUCH_SCREEN = "touch";
+    public static final String SCREEN_Y_DENSITY = "Ydpi";
+    public static final String SCREEN_X_DENSITY = "Xdpi";
+    public static final String SCREEN_SIZE = "screen_size";
+    public static final String SCREEN_DENSITY_BUCKET = "screen_density_bucket";
+    public static final String SCREEN_DENSITY = "screen_density";
+    public static final String SCREEN_HEIGHT = "screen_height";
+    public static final String SCREEN_WIDTH = "screen_width";
+    public static final String VERSION_SDK = "androidPlatformVersion";
+    public static final String VERSION_RELEASE = "buildVersion";
+    public static final String BUILD_ABI = "build_abi";
+    public static final String BUILD_ABI2 = "build_abi2";
+    public static final String BUILD_FINGERPRINT = "build_fingerprint";
+    public static final String BUILD_TYPE = "build_type";
+    public static final String BUILD_MODEL = "build_model";
+    public static final String BUILD_BRAND = "build_brand";
+    public static final String BUILD_MANUFACTURER = "build_manufacturer";
+    public static final String BUILD_BOARD = "build_board";
+    public static final String BUILD_DEVICE = "build_device";
+    public static final String PRODUCT_NAME = "buildName";
+    public static final String BUILD_ID = "buildID";
+    public static final String BUILD_VERSION = "buildVersion";
+    public static final String BUILD_TAGS = "build_tags";
+    public static final String SERIAL_NUMBER = "serialNumber";
+}
diff --git a/tools/device-setup/TestDeviceSetup/src/android/tests/getinfo/DeviceInfoInstrument.java b/tools/device-setup/TestDeviceSetup/src/android/tests/getinfo/DeviceInfoInstrument.java
index 31168fd..1299aae 100644
--- a/tools/device-setup/TestDeviceSetup/src/android/tests/getinfo/DeviceInfoInstrument.java
+++ b/tools/device-setup/TestDeviceSetup/src/android/tests/getinfo/DeviceInfoInstrument.java
@@ -37,43 +37,10 @@
 import java.util.List;
 import java.util.Set;
 
-public class DeviceInfoInstrument extends Instrumentation {
+public class DeviceInfoInstrument extends Instrumentation implements DeviceInfoConstants {
 
     private static final String TAG = "DeviceInfoInstrument";
 
-    // constants for device info attributes to be sent as instrumentation keys
-    // these values should correspond to attributes defined in cts_result.xsd
-    private static final String OPEN_GL_ES_VERSION = "openGlEsVersion";
-    private static final String PROCESSES = "processes";
-    private static final String FEATURES = "features";
-    private static final String PHONE_NUMBER = "phoneNumber";
-    public static final String LOCALES = "locales";
-    private static final String IMSI = "imsi";
-    private static final String IMEI = "imei";
-    private static final String NETWORK = "network";
-    public static final String KEYPAD = "keypad";
-    public static final String NAVIGATION = "navigation";
-    public static final String TOUCH_SCREEN = "touch";
-    private static final String SCREEN_Y_DENSITY = "Ydpi";
-    private static final String SCREEN_X_DENSITY = "Xdpi";
-    private static final String SCREEN_SIZE = "screen_size";
-    private static final String SCREEN_DENSITY_BUCKET = "screen_density_bucket";
-    private static final String SCREEN_DENSITY = "screen_density";
-    private static final String SCREEN_HEIGHT = "screen_height";
-    private static final String SCREEN_WIDTH = "screen_width";
-    private static final String VERSION_SDK = "androidPlatformVersion";
-    private static final String VERSION_RELEASE = "buildVersion";
-    private static final String BUILD_ABI = "build_abi";
-    private static final String BUILD_ABI2 = "build_abi2";
-    private static final String BUILD_FINGERPRINT = "build_fingerprint";
-    private static final String BUILD_TYPE = "build_type";
-    private static final String BUILD_MODEL = "build_model";
-    private static final String BUILD_BRAND = "build_brand";
-    private static final String BUILD_MANUFACTURER = "build_manufacturer";
-    private static final String BUILD_BOARD = "build_board";
-    private static final String BUILD_DEVICE = "build_device";
-    private static final String PRODUCT_NAME = "buildName";
-    private static final String BUILD_ID = "buildID";
     private static Bundle mResults = new Bundle();
 
     public DeviceInfoInstrument() {
diff --git a/tools/host/src/Android.mk b/tools/host/src/Android.mk
index 5ad3998..d9195eb 100644
--- a/tools/host/src/Android.mk
+++ b/tools/host/src/Android.mk
@@ -23,6 +23,8 @@
 LOCAL_JAVA_LIBRARIES := \
     ddmlib-prebuilt junit hosttestlib CtsTestAnnotationsHostLib
 
+LOCAL_STATIC_JAVA_LIBRARIES := ctsdeviceinfolib
+
 LOCAL_MODULE := cts
 
 include $(BUILD_HOST_JAVA_LIBRARY)
diff --git a/tools/host/src/com/android/cts/TestDevice.java b/tools/host/src/com/android/cts/TestDevice.java
index 88bcd68..19f754a 100644
--- a/tools/host/src/com/android/cts/TestDevice.java
+++ b/tools/host/src/com/android/cts/TestDevice.java
@@ -32,6 +32,8 @@
 import com.android.ddmlib.log.LogReceiver;
 import com.android.ddmlib.log.LogReceiver.ILogListener;
 
+import android.tests.getinfo.DeviceInfoConstants;
+
 import java.io.BufferedReader;
 import java.io.FileNotFoundException;
 import java.io.IOException;
@@ -400,42 +402,7 @@
     /**
      * Store the build information of a device
      */
-    public static final class DeviceParameterCollector{
-        // the device info keys expected to be sent from device info instrumentation
-        // these constants should match exactly with those defined in DeviceInfoInstrument.jaa
-        public static final String PRODUCT_NAME = "buildName";
-        public static final String BUILD_VERSION = "buildVersion";
-        public static final String BUILD_ID = "buildID";
-        public static final String BUILD_FINGERPRINT = "build_fingerprint";
-        public static final String BUILD_TAGS = "build_tags";
-        public static final String BUILD_TYPE = "build_type";
-        public static final String BUILD_MANUFACTURER = "build_manufacturer";
-        public static final String BUILD_MODEL = "build_model";
-        public static final String BUILD_BRAND = "build_brand";
-        public static final String BUILD_BOARD = "build_board";
-        public static final String BUILD_DEVICE = "build_device";
-        public static final String BUILD_ABI = "build_abi";
-        public static final String BUILD_ABI2 = "build_abi2";
-        public static final String SCREEN_SIZE = "screen_size";
-        public static final String SCREEN_HEIGHT = "screen_height";
-        public static final String SCREEN_WIDTH = "screen_width";
-        public static final String SCREEN_DENSITY = "screen_density";
-        public static final String SCREEN_DENSITY_BUCKET = "screen_density_bucket";
-        public static final String SERIAL_NUMBER = "serialNumber";
-        public static final String VERSION_SDK = "androidPlatformVersion";
-        public static final String LOCALES = "locales";
-        public static final String SCREEN_Y_DENSITY = "Ydpi";
-        public static final String SCREEN_X_DENSITY = "Xdpi";
-        public static final String TOUCH_SCREEN = "touch";
-        public static final String NAVIGATION = "navigation";
-        public static final String KEYPAD = "keypad";
-        public static final String NETWORK = "network";
-        public static final String IMEI = "imei";
-        public static final String IMSI = "imsi";
-        public static final String PHONE_NUMBER = "phoneNumber";
-        public static final String FEATURES = "features";
-        public static final String PROCESSES = "processes";
-        public static final String OPEN_GL_ES_VERSION = "openGlEsVersion";
+    public static final class DeviceParameterCollector implements DeviceInfoConstants {
 
         private HashMap<String, String> mInfoMap;
 
diff --git a/tools/host/src/res/cts_result.xsd b/tools/host/src/res/cts_result.xsd
index 51bad35..d154bc4 100644
--- a/tools/host/src/res/cts_result.xsd
+++ b/tools/host/src/res/cts_result.xsd
@@ -148,11 +148,12 @@
 
 <xs:complexType name="testPackageType">
   <xs:sequence>
-    <xs:element name="TestSuite" type="testSuiteType"/>
+    <xs:element name="TestSuite" type="testSuiteType" minOccurs="0" maxOccurs="unbounded" />
   </xs:sequence>
   <xs:attribute name="appPackageName" type="xs:string"/>
   <xs:attribute name="digest" type="xs:hexBinary"/>
   <xs:attribute name="name" type="xs:string" use="required"/>
+  <xs:attribute name="signatureCheck" type="xs:boolean" />
 </xs:complexType>
 
 <xs:complexType name="testSuiteType">