Clean up Camera Analyzer UI a little bit.

- Increase font size
- Add more consistent not run/fail/succeed labeling
- Add icons/color coding to individual tests

Change-Id: Id5297f37442dd2aa880c8b9fd35117a51e7ddf91
diff --git a/apps/CtsVerifier/res/layout/ca_main.xml b/apps/CtsVerifier/res/layout/ca_main.xml
index c41bcf6..467ed01 100644
--- a/apps/CtsVerifier/res/layout/ca_main.xml
+++ b/apps/CtsVerifier/res/layout/ca_main.xml
@@ -58,11 +58,11 @@
     <LinearLayout android:orientation="vertical"
       android:layout_width="fill_parent" android:layout_height="match_parent"
       android:layout_weight="1">
-	       
+
        <ListView android:id="@+id/ca_tests"
             android:layout_width="fill_parent"
             android:layout_height="wrap_content"
-	    android:layout_weight="1"
+            android:layout_weight="1"
             android:layout_marginLeft="10px"/>
 
       <ImageView android:id="@+id/resultview" android:layout_height="wrap_content"
diff --git a/apps/CtsVerifier/res/layout/ca_row.xml b/apps/CtsVerifier/res/layout/ca_row.xml
index 0e09793..6e3575d 100644
--- a/apps/CtsVerifier/res/layout/ca_row.xml
+++ b/apps/CtsVerifier/res/layout/ca_row.xml
@@ -3,17 +3,26 @@
     android:layout_width="fill_parent"
     android:layout_height="wrap_content"
     >
+    <ImageView
+        android:id="@+id/caTestIcon"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_marginRight="10dp"
+        android:src="@android:drawable/ic_menu_camera"
+        />
     <TextView
         android:id="@+id/caTestName"
         android:layout_width="wrap_content"
         android:layout_height="wrap_content"
-        android:layout_marginRight="10px"
+        android:layout_marginRight="10dp"
+        android:textSize="18sp"
         />
     <TextView
         android:id="@+id/caTestResult"
         android:layout_width="fill_parent"
         android:layout_height="wrap_content"
         android:gravity="right"
-        android:layout_marginLeft="10px"
+        android:layout_marginLeft="10dp"
+        android:textSize="15sp"
         />
 </LinearLayout>
diff --git a/apps/CtsVerifier/res/values/strings.xml b/apps/CtsVerifier/res/values/strings.xml
index b70d148..ee84a70 100644
--- a/apps/CtsVerifier/res/values/strings.xml
+++ b/apps/CtsVerifier/res/values/strings.xml
@@ -280,13 +280,14 @@
 
     <!-- Strings for Camera Analyzer -->
     <string name="camera_analyzer">Camera Analyzer</string>
-    <string name="ca_find_checkerboard_label">Find color checker</string>
-    <string name="ca_exposure_test_label">Exposure Comp. Test</string>
+    <string name="ca_find_checkerboard_label">Find target</string>
+    <string name="ca_check_formats_label">Output formats</string>
+    <string name="ca_exposure_test_label">Exposure Comp.</string>
     <string name="ca_result_label">Results will be here</string>
-    <string name="ca_wb_test_label">White Balance Test</string>
-    <string name="ca_lock_test_label">Auto Exposure Lock Test</string>
-    <string name="ca_metering_label">Metering Area Test</string>
-    <string name="ca_focus_modes_label">Focus Modes Test</string>
+    <string name="ca_wb_test_label">White Balance</string>
+    <string name="ca_lock_test_label">AE Lock</string>
+    <string name="ca_metering_label">Metering Area</string>
+    <string name="ca_focus_modes_label">Focus Modes</string>
     <string name="ca_info">This test checks the image quality of the camera of this device. It requires a MacBeth 4x6 color checker. With an ADK board and a lamp connected to it on the Relay 1 port, all tests can be run automatically. Without the ADK board, all the tests except the Auto Exposure Lock Test can be run automatically and the Auto Exposure Lock Test will require users to turn on/off a lamp according to the instruction given. </string>
 
     <!-- Strings for USB accessory test activity -->
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/camera/analyzer/AutoLockTest.java b/apps/CtsVerifier/src/com/android/cts/verifier/camera/analyzer/AutoLockTest.java
index 6b40d2a..9181b29 100644
--- a/apps/CtsVerifier/src/com/android/cts/verifier/camera/analyzer/AutoLockTest.java
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/camera/analyzer/AutoLockTest.java
@@ -103,7 +103,7 @@
     /** Boolean to indicate whether there is an ADK attached. */
     private boolean mUsingUsb = false;
     /** Test results.*/
-    private String[] mTestResults;
+    private int[] mTestResults;
     /** Number of tests. */
     private int mNumTests;
     /** Singleton test instance.*/
@@ -161,16 +161,16 @@
      */
     private void openAccessory(UsbAccessory accessory) {
         Log.d(TAG, "openAccessory: " + accessory);
-	mFileDescriptor = mUsbManager.openAccessory(accessory);
+        mFileDescriptor = mUsbManager.openAccessory(accessory);
 
         if (mFileDescriptor != null) {
-	    mAccessory = accessory;
-	    FileDescriptor fd = mFileDescriptor.getFileDescriptor();
+            mAccessory = accessory;
+            FileDescriptor fd = mFileDescriptor.getFileDescriptor();
             mOutputStream = new FileOutputStream(fd);
-	    Log.d(TAG, "accessory opened");
-	} else {
+            Log.d(TAG, "accessory opened");
+        } else {
             Log.d(TAG, "accessory open fail");
-	}
+        }
 
         // Unlocks the thread lock of waiting for the USB to be ready.
         synchronized (mUsbSetup) {
@@ -184,14 +184,14 @@
      * Closes the ADK and detaches the output stream from it.
      */
     private void closeAccessory() {
-	try {
-	    if (mFileDescriptor != null) {
+        try {
+            if (mFileDescriptor != null) {
                 mFileDescriptor.close();
-	    }
-	} catch (IOException e) {
+            }
+        } catch (IOException e) {
         } finally {
-	    mFileDescriptor = null;
-	    mAccessory = null;
+            mFileDescriptor = null;
+            mAccessory = null;
         }
     }
 
@@ -226,9 +226,9 @@
         mReferenceCompareResults = new ArrayList<Boolean>();
         mReferenceLogs = new ArrayList<String>();
         mNumTests = 4;
-        mTestResults = new String[mNumTests];
+        mTestResults = new int[mNumTests];
         for (int i = 0; i < mNumTests; ++i) {
-            mTestResults[i] = "...";
+            mTestResults[i] = CameraTests.CAMERA_TEST_NOT_RUN;
         }
     }
 
@@ -981,9 +981,9 @@
               }
          }
         if (groupTestPassed) {
-            mTestResults[index] = "Passed";
+            mTestResults[index] = CameraTests.CAMERA_TEST_SUCCESS;
         } else {
-            mTestResults[index] = "Failed";
+            mTestResults[index] = CameraTests.CAMERA_TEST_FAILURE;
         }
     }
 
@@ -1026,7 +1026,7 @@
     }
 
     @Override
-    public String getResult(int index) {
+    public int getResult(int index) {
         return mTestResults[index];
     }
 
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/camera/analyzer/CameraAnalyzerActivity.java b/apps/CtsVerifier/src/com/android/cts/verifier/camera/analyzer/CameraAnalyzerActivity.java
index ffe9d06..34e8d2d 100644
--- a/apps/CtsVerifier/src/com/android/cts/verifier/camera/analyzer/CameraAnalyzerActivity.java
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/camera/analyzer/CameraAnalyzerActivity.java
@@ -21,6 +21,7 @@
 import android.app.Activity;
 import android.graphics.Bitmap;
 import android.graphics.BitmapFactory;
+import android.graphics.Color;
 import android.graphics.ImageFormat;
 import android.hardware.Camera;
 import android.hardware.Camera.CameraInfo;
@@ -456,11 +457,29 @@
         public View getView(int position, View convertView, ViewGroup parent) {
             LayoutInflater inflater = getLayoutInflater();
             View row = inflater.inflate(R.layout.ca_row, parent, false);
+            ImageView iconField = (ImageView) row.findViewById(R.id.caTestIcon);
             TextView nameField = (TextView) row.findViewById(R.id.caTestName);
             TextView resultField = (TextView) row.findViewById(R.id.caTestResult);
             if (mCurrentTest != null) {
                 nameField.setText(mCurrentTest.getTestName(position));
-                resultField.setText(mCurrentTest.getResult(position));
+                int result = mCurrentTest.getResult(position);
+                switch (result) {
+                    case CameraTests.CAMERA_TEST_SUCCESS:
+                        resultField.setText("Success");
+                        iconField.setBackgroundColor(Color.rgb(0x99,0xCC,00));
+                        resultField.setTextColor(Color.rgb(0x99,0xCC,00));
+                        break;
+                    case CameraTests.CAMERA_TEST_FAILURE:
+                        resultField.setText("Failed!");
+                        iconField.setBackgroundColor(Color.rgb(0xFF,0x44,0x44));
+                        resultField.setTextColor(Color.rgb(0xFF,0x44,0x44));
+                        break;
+                    case CameraTests.CAMERA_TEST_NOT_RUN:
+                        resultField.setText("Tap to run");
+                        iconField.setBackgroundColor(Color.rgb(0x00,0x99,0xCC));
+                        resultField.setTextColor(Color.rgb(0x33,0xB5,0xE5));
+                        break;
+                }
             }
             return row;
         }
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/camera/analyzer/CameraTests.java b/apps/CtsVerifier/src/com/android/cts/verifier/camera/analyzer/CameraTests.java
index 7cea762..ed99524 100644
--- a/apps/CtsVerifier/src/com/android/cts/verifier/camera/analyzer/CameraTests.java
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/camera/analyzer/CameraTests.java
@@ -37,6 +37,10 @@
  */
 public abstract class CameraTests{
 
+    public static final int CAMERA_TEST_NOT_RUN = 0;
+    public static final int CAMERA_TEST_SUCCESS = 1;
+    public static final int CAMERA_TEST_FAILURE = 2;
+
     private static final String TAG = "CameraTests";
 
     /** Memory address of the color checker centers. */
@@ -144,7 +148,7 @@
 
     public abstract String getTestName(int index);
 
-    public abstract String getResult(int index);
+    public abstract int getResult(int index);
 
     public abstract int getNumTests();
 
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/camera/analyzer/ColorCheckerTest.java b/apps/CtsVerifier/src/com/android/cts/verifier/camera/analyzer/ColorCheckerTest.java
index dd2a966..ad171b4 100644
--- a/apps/CtsVerifier/src/com/android/cts/verifier/camera/analyzer/ColorCheckerTest.java
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/camera/analyzer/ColorCheckerTest.java
@@ -51,6 +51,7 @@
     private static ColorCheckerTest singletonTest = null;
 
     private boolean mFindCheckerSuccess = false;
+    private boolean mHasRunOnce = false;
 
     /**
      * Constructs a <code>ColorCheckerTest</code> instance with a given
@@ -97,6 +98,7 @@
         Log.v(TAG, "ColorCheckerTest thread started!");
         mAutoFocusSuccess = false;
         mFindCheckerSuccess = false;
+        mHasRunOnce = true;
         // Sets camera focus mode to Auto focus if it is supported.
         if (mAutoFocusEnabled) {
             while (!mAutoFocusSuccess) {
@@ -222,11 +224,15 @@
     }
 
     @Override
-    public String getResult(int index) {
+    public int getResult(int index) {
         if (mFindCheckerSuccess) {
-          return "Passed";
+            return CameraTests.CAMERA_TEST_SUCCESS;
         } else {
-          return "Failed";
+            if (mHasRunOnce) {
+                return CameraTests.CAMERA_TEST_FAILURE;
+            } else {
+                return CameraTests.CAMERA_TEST_NOT_RUN;
+            }
         }
     }
 
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/camera/analyzer/ExposureCompensationTest.java b/apps/CtsVerifier/src/com/android/cts/verifier/camera/analyzer/ExposureCompensationTest.java
index d9da4b6..9a8d9f0 100644
--- a/apps/CtsVerifier/src/com/android/cts/verifier/camera/analyzer/ExposureCompensationTest.java
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/camera/analyzer/ExposureCompensationTest.java
@@ -41,7 +41,7 @@
     /** Memory address of the native test handler.*/
     private long mTestHandler;
     /** Test results. */
-    private String[] mTestResults;
+    private int[] mTestResults;
     /** Number of sub-tests. */
     private int mNumTests;
     /** Camera Parameters. */
@@ -64,9 +64,9 @@
         mNumTests = (int) ((float) (mParams.getMaxExposureCompensation() -
                                     mParams.getMinExposureCompensation())
                             * mParams.getExposureCompensationStep());
-        mTestResults = new String[mNumTests + 1];
+        mTestResults = new int[mNumTests + 1];
         for (int i = 0; i < mNumTests + 1; ++i) {
-            mTestResults[i] = "...";
+            mTestResults[i] = CameraTests.CAMERA_TEST_NOT_RUN;
         }
     }
 
@@ -183,7 +183,7 @@
     }
 
     @Override
-    public String getResult(int index) {
+    public int getResult(int index) {
         return mTestResults[index];
     }
 
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/camera/analyzer/MeteringTest.java b/apps/CtsVerifier/src/com/android/cts/verifier/camera/analyzer/MeteringTest.java
index ff5067a..9ff559f 100644
--- a/apps/CtsVerifier/src/com/android/cts/verifier/camera/analyzer/MeteringTest.java
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/camera/analyzer/MeteringTest.java
@@ -72,7 +72,7 @@
     /** Reference test logs. */
     private ArrayList<String> mReferenceLogs;
     /** Test result to show. */
-    private String[] mTestResults;
+    private int[] mTestResults;
     /** Number of tests. */
     private int mNumTests;
     /** Camera Parameters. */
@@ -114,9 +114,9 @@
         mReferenceCompareResults = new ArrayList<Boolean>();
         mReferenceLogs = new ArrayList<String>();
         mNumTests = 3;
-        mTestResults = new String[mNumTests];
+        mTestResults = new int[mNumTests];
         for (int i = 0; i < mNumTests; ++i) {
-            mTestResults[i] = "...";
+            mTestResults[i] = CameraTests.CAMERA_TEST_NOT_RUN;
         }
     }
 
@@ -219,9 +219,9 @@
          }
 
         if (groupTestPassed) {
-            mTestResults[index] = "Passed";
+            mTestResults[index] = CameraTests.CAMERA_TEST_SUCCESS;
         } else {
-            mTestResults[index] = "Failed";
+            mTestResults[index] = CameraTests.CAMERA_TEST_FAILURE;
         }
 
     }
@@ -587,7 +587,7 @@
     }
 
     @Override
-    public String getResult(int index) {
+    public int getResult(int index) {
         return mTestResults[index];
     }
 
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/camera/analyzer/WhiteBalanceTest.java b/apps/CtsVerifier/src/com/android/cts/verifier/camera/analyzer/WhiteBalanceTest.java
index f3bab86..a4111eb 100644
--- a/apps/CtsVerifier/src/com/android/cts/verifier/camera/analyzer/WhiteBalanceTest.java
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/camera/analyzer/WhiteBalanceTest.java
@@ -62,7 +62,7 @@
     /** Thread lock. */
     private final Object mProcessingImage = new Object();
     /** Test result to show. */
-    private String[] mTestResults;
+    private int[] mTestResults;
     /** Number of test. */
     private int mNumTests;
     /** Camera Parameters. */
@@ -86,9 +86,9 @@
         mParams = mTestCamera.getParameters();
         mWhiteBalanceList = mParams.getSupportedWhiteBalance();
         mNumTests = mWhiteBalanceList.size() + 1;
-        mTestResults = new String[mNumTests];
+        mTestResults = new int[mNumTests];
         for (int i = 0; i < mNumTests; ++i) {
-            mTestResults[i] = "...";
+            mTestResults[i] = CameraTests.CAMERA_TEST_NOT_RUN;
         }
 
         if (mWhiteBalanceList != null) {
@@ -223,9 +223,9 @@
                                   colorTemperature));
         if ((colorTemperature >= mReferenceTemperature[index - 1][0]) &&
                 (colorTemperature <= mReferenceTemperature[index - 1][1])) {
-            mTestResults[index] = "Passed";
+            mTestResults[index] = CameraTests.CAMERA_TEST_SUCCESS;
         } else {
-            mTestResults[index] = "Failed";
+            mTestResults[index] = CameraTests.CAMERA_TEST_FAILURE;
         }
 
     }
@@ -255,7 +255,7 @@
     }
 
     @Override
-    public String getResult(int index) {
+    public int getResult(int index) {
         return mTestResults[index];
     }