CameraITS: add timeout value for do_capture

When background request is enabled.

Bug: 28967300
Change-Id: Id6abcb9aa6f74787fcda5fd044bea91c3f944af6
diff --git a/apps/CameraITS/pymodules/its/device.py b/apps/CameraITS/pymodules/its/device.py
index 076f335..eb1ff3f 100644
--- a/apps/CameraITS/pymodules/its/device.py
+++ b/apps/CameraITS/pymodules/its/device.py
@@ -58,6 +58,10 @@
 
     # Seconds timeout on each socket operation.
     SOCK_TIMEOUT = 10.0
+    # Additional timeout in seconds when ITS service is doing more complicated
+    # operations, for example: issuing warmup requests before actual capture.
+    EXTRA_SOCK_TIMEOUT = 5.0
+
     SEC_TO_NSEC = 1000*1000*1000.0
 
     PACKAGE = 'com.android.cts.verifier.camera.its'
@@ -635,6 +639,8 @@
 
         extended_timeout = longest_exp_time / self.SEC_TO_NSEC + \
                 self.SOCK_TIMEOUT
+        if repeat_request:
+            extended_timeout += self.EXTRA_SOCK_TIMEOUT
         self.sock.settimeout(extended_timeout)
 
         print "Capturing %d frame%s with %d format%s [%s]" % (