ITS: pull focal length from capture, not properties

bug: 128624201

Change-Id: I111051231cbdfc4067493858eb2e59bdc1c011e9
diff --git a/apps/CameraITS/tools/run_all_tests.py b/apps/CameraITS/tools/run_all_tests.py
index 4cc0151..ad0760b1 100644
--- a/apps/CameraITS/tools/run_all_tests.py
+++ b/apps/CameraITS/tools/run_all_tests.py
@@ -77,11 +77,17 @@
     """Determine the camera field of view from internal params."""
     with ItsSession(camera_id) as cam:
         props = cam.get_camera_properties()
+        focal_ls = props['android.lens.info.availableFocalLengths']
+        if len(focal_ls) > 1:
+            print 'Doing capture to determine logical camera focal length'
+            cap = cam.do_capture(its.objects.auto_capture_request())
+            focal_l = cap['metadata']['android.lens.focalLength']
+        else:
+            focal_l = focal_ls[0]
+    sensor_size = props['android.sensor.info.physicalSize']
+    diag = math.sqrt(sensor_size['height'] ** 2 +
+                     sensor_size['width'] ** 2)
     try:
-        focal_l = props['android.lens.info.availableFocalLengths'][0]
-        sensor_size = props['android.sensor.info.physicalSize']
-        diag = math.sqrt(sensor_size['height'] ** 2 +
-                         sensor_size['width'] ** 2)
         fov = str(round(2 * math.degrees(math.atan(diag / (2 * focal_l))), 2))
     except ValueError:
         fov = str(0)