CameraITS: various ITS improvement

1. run_all_tests.py now don't require a camera id argument.
   The script now iterate through all cameras automatically.
2. run_all_tests.py will now repeat capturing a image for
   user to visually check if current device placement is good
   for ITS testing. This should help front camera test since
   front camera will be facing test scene.
3. CtsVerifier will now save ITS test summaries and reported
   errors.
4. Enable pass button if all cameras on device are legacy level.

Change-Id: Ic8740f65dbaa67b0dc2d2aa8737355c0dffe1b6f
diff --git a/apps/CameraITS/tools/validate_scene.py b/apps/CameraITS/tools/validate_scene.py
new file mode 100644
index 0000000..e1e89f2
--- /dev/null
+++ b/apps/CameraITS/tools/validate_scene.py
@@ -0,0 +1,60 @@
+# Copyright 2015 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.
+
+import sys
+import its.device
+import its.objects
+import its.image
+
+def main():
+    """capture a yuv image and save it to argv[1]
+    """
+    camera_id = -1
+    out_path = ""
+    for s in sys.argv[1:]:
+        if s[:7] == "camera=" and len(s) > 7:
+            camera_id = s[7:]
+        elif s[:4] == "out=" and len(s) > 4:
+            out_path = s[4:]
+
+    if camera_id == -1:
+        print "Error: need to specify which camera to use"
+        assert(False)
+
+    with its.device.ItsSession() as cam:
+        raw_input("Press Enter after placing camera " + camera_id +
+                " to frame the test scene")
+        # Converge 3A prior to capture.
+        cam.do_3a(do_af=True, lock_ae=True, lock_awb=True)
+        props = cam.get_camera_properties()
+        req = its.objects.fastest_auto_capture_request(props)
+        req["android.control.awbLock"] = True
+        req["android.control.aeLock"] = True
+        while True:
+            print "Capture an image to check the test scene"
+            cap = cam.do_capture(req)
+            img = its.image.convert_capture_to_rgb_image(cap)
+            if out_path != "":
+                its.image.write_image(img, out_path)
+            print "Please check scene setup in", out_path
+            choice = raw_input(
+                "Is the image okay for ITS scene1? (Y/N)").lower()
+            if choice == "y":
+                break
+            else:
+                raw_input("Press Enter after placing camera " + camera_id +
+                          " to frame the test scene")
+
+if __name__ == '__main__':
+    main()