add bootup time measurement with infra for host test

- allow time-out for host: the same TimeoutReq annotation
- result thrown via the same exception mechanism
- some common codes shared between device and host moved to lib/commonutil
- changed exception signature of some common code

Change-Id: I02b0ed08cf259b6519d776a0539b8303e1e7baf2
diff --git a/tools/tradefed-host/src/com/android/cts/tradefed/testtype/TestPackageDef.java b/tools/tradefed-host/src/com/android/cts/tradefed/testtype/TestPackageDef.java
index 06f940a..ffbb930 100644
--- a/tools/tradefed-host/src/com/android/cts/tradefed/testtype/TestPackageDef.java
+++ b/tools/tradefed-host/src/com/android/cts/tradefed/testtype/TestPackageDef.java
@@ -200,6 +200,10 @@
         if (HOST_SIDE_ONLY_TEST.equals(mTestType)) {
             CLog.d("Creating host test for %s", mName);
             JarHostTest hostTest = new JarHostTest();
+            if (mTimeoutInMins >= 0) {
+                CLog.d("Setting new timeout to " + mTimeoutInMins + " mins");
+                hostTest.setTimeout(mTimeoutInMins * 60 * 1000);
+            }
             hostTest.setRunName(getUri());
             hostTest.setJarFileName(mJarPath);
             hostTest.setTests(mTests);