Add a build for CTS Verifier framework library.

Change-Id: I69df3ff3907957795e061aa564ca57b3a292eb9b
diff --git a/apps/CtsVerifier/Android.mk b/apps/CtsVerifier/Android.mk
index 34246cc..c40d981 100644
--- a/apps/CtsVerifier/Android.mk
+++ b/apps/CtsVerifier/Android.mk
@@ -53,6 +53,32 @@
 
 include $(BUILD_PACKAGE)
 
+# Build CTS verifier framework as a libary.
+
+include $(CLEAR_VARS)
+
+define java-files-in
+$(sort $(patsubst ./%,%, \
+  $(shell cd $(LOCAL_PATH) ; \
+          find -L $(1) -maxdepth 1 -name *.java -and -not -name ".*") \
+ ))
+endef
+
+LOCAL_MODULE := cts-verifier-framework
+LOCAL_AAPT_FLAGS := --auto-add-overlay --extra-packages android.support.v4
+LOCAL_SDK_VERSION := current
+LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/res
+LOCAL_SRC_FILES := \
+    $(call java-files-in, src/com/android/cts/verifier) \
+    $(call java-files-in, src/com/android/cts/verifier/backup) \
+    $(call all-java-files-under, src/android) \
+    $(call all-Iaidl-files-under, src)
+
+LOCAL_STATIC_JAVA_LIBRARIES := android-support-v4 \
+                               compatibility-common-util-devicesidelib_v2 \
+                               compatibility-device-util_v2 \
+
+include $(BUILD_STATIC_JAVA_LIBRARY)
 
 # opencv library
 include $(CLEAR_VARS)
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/PassFailButtons.java b/apps/CtsVerifier/src/com/android/cts/verifier/PassFailButtons.java
index 5a08558..90eae39 100644
--- a/apps/CtsVerifier/src/com/android/cts/verifier/PassFailButtons.java
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/PassFailButtons.java
@@ -399,16 +399,14 @@
     private static void setTestResultAndFinish(android.app.Activity activity, String testId,
             String testDetails, ReportLog reportLog, View target) {
         boolean passed;
-        switch (target.getId()) {
-            case R.id.pass_button:
-                passed = true;
-                break;
-            case R.id.fail_button:
-                passed = false;
-                break;
-            default:
-                throw new IllegalArgumentException("Unknown id: " + target.getId());
+        if (target.getId() == R.id.pass_button) {
+            passed = true;
+        } else if (target.getId() == R.id.fail_button) {
+            passed = false;
+        } else {
+            throw new IllegalArgumentException("Unknown id: " + target.getId());
         }
+
         setTestResultAndFinishHelper(activity, testId, testDetails, passed, reportLog);
     }
 
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/TestListActivity.java b/apps/CtsVerifier/src/com/android/cts/verifier/TestListActivity.java
index 976ff32..c317997 100644
--- a/apps/CtsVerifier/src/com/android/cts/verifier/TestListActivity.java
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/TestListActivity.java
@@ -137,21 +137,16 @@
     }
 
     private boolean handleMenuItemSelected(int id) {
-        switch (id) {
-            case R.id.clear:
-                handleClearItemSelected();
-                return true;
-
-            case R.id.view:
-                handleViewItemSelected();
-                return true;
-
-            case R.id.export:
-                handleExportItemSelected();
-                return true;
-
-            default:
-                return false;
+        if (id == R.id.clear) {
+            handleClearItemSelected();
+        } else if (id == R.id.view) {
+            handleViewItemSelected();
+        } else if (id == R.id.export) {
+            handleExportItemSelected();
+        } else {
+            return false;
         }
+
+        return true;
     }
 }