aboutsummaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
authorTimothy Knight <tknight@google.com>2014-10-11 17:18:10 -0700
committerTimothy Knight <tknight@google.com>2014-10-11 21:58:50 -0700
commit5093c19aad3a02c6714082e72fbda39e801870a1 (patch)
treeff25aa26a29ef8981f9f07cddbbc36792c10ae52 /apps
parentae113792fd6b695cfa6e1d52536e99db410e4298 (diff)
downloadpdk-5093c19aad3a02c6714082e72fbda39e801870a1.tar.gz
CameraITS: Now use a persistent TCP connection across runs.
Changed the basic invocation approach to make ITS fit better into external test harnesses. Change-Id: Iaf0648c4233b5b8639cb75c0e87b6d1c7531ca11
Diffstat (limited to 'apps')
-rw-r--r--apps/CameraITS/README21
-rw-r--r--apps/CameraITS/pymodules/its/device.py131
-rw-r--r--apps/CameraITS/service/src/com/android/camera2/its/ItsService.java273
-rw-r--r--apps/CameraITS/tools/config.py10
-rwxr-xr-xapps/CameraITS/tools/run_scene_tests.sh4
5 files changed, 254 insertions, 185 deletions
diff --git a/apps/CameraITS/README b/apps/CameraITS/README
index fc385f0..191365b 100644
--- a/apps/CameraITS/README
+++ b/apps/CameraITS/README
@@ -215,6 +215,15 @@ The tests/inprog directory contains a mix of unfinished, in-progress, and
incomplete tests. These may or may not be useful in testing a HAL impl.,
and as these tests are copmleted they will be moved into the scene<N> folders.
+When running individual tests from the command line (as in the examples here),
+each test run will ensure that the ItsService is running on the device and is
+ready to accept TCP connections. When using a separate test harness to control
+this infrastructure, the "noinit" command line argument can be provided to
+skip this step; in this case, the test will just try to open a socket to the
+service on the device, and will fail if it's not running and ready.
+
+ python tests/scene1/test_linearity.py noinit
+
3.4. Target exposure
--------------------
@@ -256,6 +265,18 @@ is commented with explanatory remarks.)
python tests/tutorial.py
+3.6. List of command line args
+---------------------------------
+
+The above doc sections describe the following command line arguments that may
+be provided when running a test:
+
+ reboot
+ reboot=N
+ target
+ noinit
+ camera=N
+
4. Known issues
---------------
diff --git a/apps/CameraITS/pymodules/its/device.py b/apps/CameraITS/pymodules/its/device.py
index ea763ef..3134b47 100644
--- a/apps/CameraITS/pymodules/its/device.py
+++ b/apps/CameraITS/pymodules/its/device.py
@@ -41,12 +41,6 @@ class ItsSession(object):
sock: The open socket.
"""
- # TODO: Handle multiple connected devices.
- # The adb program is used for communication with the device. Need to handle
- # the case of multiple devices connected. Currently, uses the "-d" param
- # to adb, which causes it to fail if there is more than one device.
- ADB = "adb -d"
-
# Open a connection to localhost:6000, forwarded to port 6000 on the device.
# TODO: Support multiple devices running over different TCP ports.
IPADDR = '127.0.0.1'
@@ -73,39 +67,59 @@ class ItsSession(object):
CAP_RAW_YUV_JPEG = [{"format":"raw"}, {"format":"yuv"}, {"format":"jpeg"}]
CAP_DNG_YUV_JPEG = [{"format":"dng"}, {"format":"yuv"}, {"format":"jpeg"}]
- def __init__(self):
- reboot_device_on_argv()
- # Get the camera ID to open as an argument.
- camera_id = 0
+ # Method to handle the case where the service isn't already running.
+ # This occurs when a test is invoked directly from the command line, rather
+ # than as a part of a separate test harness which is setting up the device
+ # and the TCP forwarding.
+ def __pre_init(self):
+ # TODO: Handle multiple connected devices.
+ adb = "adb -d"
+
+ # This also includes the optional reboot handling: if the user
+ # provides a "reboot" or "reboot=N" arg, then reboot the device,
+ # waiting for N seconds (default 30) before returning.
for s in sys.argv[1:]:
- if s[:7] == "camera=" and len(s) > 7:
- camera_id = int(s[7:])
+ if s[:6] == "reboot":
+ duration = 30
+ if len(s) > 7 and s[6] == "=":
+ duration = int(s[7:])
+ print "Rebooting device"
+ _run("%s reboot" % (adb));
+ _run("%s wait-for-device" % (adb))
+ time.sleep(duration)
+ print "Reboot complete"
+
# TODO: Figure out why "--user 0" is needed, and fix the problem.
- _run('%s logcat -c' % (self.ADB))
- _run('%s shell am force-stop --user 0 %s' % (self.ADB, self.PACKAGE))
_run(('%s shell am startservice --user 0 -t text/plain '
- '-a %s -d %d') % (self.ADB, self.INTENT_START, camera_id))
- self._wait_until_socket_ready()
- _run('%s forward tcp:%d tcp:%d' % (self.ADB,self.PORT,self.PORT))
- self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
- self.sock.connect((self.IPADDR, self.PORT))
- self.sock.settimeout(self.SOCK_TIMEOUT)
+ '-a %s') % (adb, self.INTENT_START))
- def _wait_until_socket_ready(self):
+ # Wait until the socket is ready to accept a connection.
proc = subprocess.Popen(
- self.ADB.split() + ["logcat"],
+ adb.split() + ["logcat"],
stdout=subprocess.PIPE)
logcat = proc.stdout
while True:
line = logcat.readline().strip()
- if line.find('Waiting for client to connect to socket') >= 0:
+ if line.find('ItsService ready') >= 0:
break
proc.kill()
+ # Setup the TCP-over-ADB forwarding.
+ _run('%s forward tcp:%d tcp:%d' % (adb,self.PORT,self.PORT))
+
+ def __init__(self):
+ if "noinit" not in sys.argv:
+ self.__pre_init()
+ self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
+ self.sock.connect((self.IPADDR, self.PORT))
+ self.sock.settimeout(self.SOCK_TIMEOUT)
+ self.__close_camera()
+ self.__open_camera()
+
def __del__(self):
if hasattr(self, 'sock') and self.sock:
+ self.__close_camera()
self.sock.close()
- _run('%s shell am force-stop --user 0 %s' % (self.ADB, self.PACKAGE))
def __enter__(self):
return self
@@ -117,7 +131,11 @@ class ItsSession(object):
# Read a line (newline-terminated) string serialization of JSON object.
chars = []
while len(chars) == 0 or chars[-1] != '\n':
- chars.append(self.sock.recv(1))
+ ch = self.sock.recv(1)
+ if len(ch) == 0:
+ # Socket was probably closed; otherwise don't get empty strings
+ raise its.error.Error('Problem with socket on device side')
+ chars.append(ch)
line = ''.join(chars)
jobj = json.loads(line)
# Optionally read a binary buffer of a fixed size.
@@ -133,6 +151,25 @@ class ItsSession(object):
buf = numpy.frombuffer(buf, dtype=numpy.uint8)
return jobj, buf
+ def __open_camera(self):
+ # Get the camera ID to open as an argument.
+ camera_id = 0
+ for s in sys.argv[1:]:
+ if s[:7] == "camera=" and len(s) > 7:
+ camera_id = int(s[7:])
+ cmd = {"cmdName":"open", "cameraId":camera_id}
+ self.sock.send(json.dumps(cmd) + "\n")
+ data,_ = self.__read_response_from_socket()
+ if data['tag'] != 'cameraOpened':
+ raise its.error.Error('Invalid command response')
+
+ def __close_camera(self):
+ cmd = {"cmdName":"close"}
+ self.sock.send(json.dumps(cmd) + "\n")
+ data,_ = self.__read_response_from_socket()
+ if data['tag'] != 'cameraClosed':
+ raise its.error.Error('Invalid command response')
+
def do_vibrate(self, pattern):
"""Cause the device to vibrate to a specific pattern.
@@ -454,50 +491,6 @@ def _run(cmd):
subprocess.check_call(
cmd.split(), stdout=devnull, stderr=subprocess.STDOUT)
-def reboot_device(sleep_duration=30):
- """Function to reboot a device and block until it is ready.
-
- Can be used at the start of a test to get the device into a known good
- state. Will disconnect any other adb sessions, so this function is not
- a part of the ItsSession class (which encapsulates a session with a
- device.)
-
- Args:
- sleep_duration: (Optional) the length of time to sleep (seconds) after
- the device comes online before returning; this gives the device
- time to finish booting.
- """
- print "Rebooting device"
- _run("%s reboot" % (ItsSession.ADB));
- _run("%s wait-for-device" % (ItsSession.ADB))
- time.sleep(sleep_duration)
- print "Reboot complete"
-
-def reboot_device_on_argv():
- """Examine sys.argv, and reboot if the "reboot" arg is present.
-
- If the script command line contains either:
-
- reboot
- reboot=30
-
- then the device will be rebooted, and if the optional numeric arg is
- present, then that will be the sleep duration passed to the reboot
- call.
-
- Returns:
- Boolean, indicating whether the device was rebooted.
- """
- for s in sys.argv[1:]:
- if s[:6] == "reboot":
- if len(s) > 7 and s[6] == "=":
- duration = int(s[7:])
- reboot_device(duration)
- elif len(s) == 6:
- reboot_device()
- return True
- return False
-
class __UnitTest(unittest.TestCase):
"""Run a suite of unit tests on this module.
"""
diff --git a/apps/CameraITS/service/src/com/android/camera2/its/ItsService.java b/apps/CameraITS/service/src/com/android/camera2/its/ItsService.java
index 7750464..d7e2525 100644
--- a/apps/CameraITS/service/src/com/android/camera2/its/ItsService.java
+++ b/apps/CameraITS/service/src/com/android/camera2/its/ItsService.java
@@ -92,6 +92,9 @@ public class ItsService extends Service implements SensorEventListener {
private static final long TIMEOUT_IDLE_MS = 2000;
private static final long TIMEOUT_STATE_MS = 500;
+ // Timeout to wait for a capture result after the capture buffer has arrived, in ms.
+ private static final long TIMEOUT_CAP_RES = 2000;
+
private static final int MAX_CONCURRENT_READER_BUFFERS = 8;
// Supports at most RAW+YUV+JPEG, one surface each.
@@ -129,13 +132,11 @@ public class ItsService extends Service implements SensorEventListener {
private volatile ServerSocket mSocket = null;
private volatile SocketRunnable mSocketRunnableObj = null;
- private volatile Thread mSocketThread = null;
private volatile BlockingQueue<ByteBuffer> mSocketWriteQueue =
new LinkedBlockingDeque<ByteBuffer>();
- private final Object mSocketWriteLock = new Object();
+ private final Object mSocketWriteEnqueueLock = new Object();
+ private final Object mSocketWriteDrainLock = new Object();
- private volatile SerializerRunnable mSerializerRunnableObj = null;
- private volatile Thread mSerializerThread = null;
private volatile BlockingQueue<Object[]> mSerializerQueue =
new LinkedBlockingDeque<Object[]>();
@@ -183,11 +184,9 @@ public class ItsService extends Service implements SensorEventListener {
@Override
public void onCreate() {
- }
-
- @Override
- public int onStartCommand(Intent intent, int flags, int startId) {
try {
+ mThreadExitFlag = false;
+
// Get handle to camera manager.
mCameraManager = (CameraManager) this.getSystemService(Context.CAMERA_SERVICE);
if (mCameraManager == null) {
@@ -196,40 +195,6 @@ public class ItsService extends Service implements SensorEventListener {
mBlockingCameraManager = new BlockingCameraManager(mCameraManager);
mCameraListener = new BlockingStateCallback();
- // Open the camera device, and get its properties.
- String[] devices;
- try {
- devices = mCameraManager.getCameraIdList();
- if (devices == null || devices.length == 0) {
- throw new ItsException("No camera devices");
- }
- } catch (CameraAccessException e) {
- throw new ItsException("Failed to get device ID list", e);
- }
-
- // Args are a string, which is just the camera ID to open.
- int cameraId = 0;
- String args = intent.getDataString();
- if (args != null) {
- Logt.i(TAG, String.format("Received intent args: %s", args));
- cameraId = Integer.parseInt(args);
- }
- Logt.i(TAG, String.format("Opening camera %d", cameraId));
-
- mCameraThread = new HandlerThread("ItsCameraThread");
- try {
- mCameraThread.start();
- mCameraHandler = new Handler(mCameraThread.getLooper());
- mCamera = mBlockingCameraManager.openCamera(devices[cameraId],
- mCameraListener, mCameraHandler);
- mCameraCharacteristics = mCameraManager.getCameraCharacteristics(
- devices[cameraId]);
- } catch (CameraAccessException e) {
- throw new ItsException("Failed to open camera", e);
- } catch (BlockingOpenException e) {
- throw new ItsException("Failed to open camera (after blocking)", e);
- }
-
// Register for motion events.
mEvents = new LinkedList<MySensorEvent>();
mSensorManager = (SensorManager)getSystemService(Context.SENSOR_SERVICE);
@@ -251,47 +216,101 @@ public class ItsService extends Service implements SensorEventListener {
}
// Create a thread to handle object serialization.
- mSerializerRunnableObj = new SerializerRunnable();
- mSerializerThread = new Thread(mSerializerRunnableObj);
- mSerializerThread.start();
+ (new Thread(new SerializerRunnable())).start();;
// Create a thread to receive capture results and process them.
mResultThread = new HandlerThread("ResultThread");
mResultThread.start();
mResultHandler = new Handler(mResultThread.getLooper());
+ // Create a thread for the camera device.
+ mCameraThread = new HandlerThread("ItsCameraThread");
+ mCameraThread.start();
+ mCameraHandler = new Handler(mCameraThread.getLooper());
+
// Create a thread to process commands, listening on a TCP socket.
mSocketRunnableObj = new SocketRunnable();
- mSocketThread = new Thread(mSocketRunnableObj);
- mSocketThread.start();
+ (new Thread(mSocketRunnableObj)).start();
} catch (ItsException e) {
Logt.e(TAG, "Service failed to start: ", e);
}
+ }
+
+ @Override
+ public int onStartCommand(Intent intent, int flags, int startId) {
+ try {
+ // Just log a message indicating that the service is running and is able to accept
+ // socket connections.
+ while (!mThreadExitFlag && mSocket==null) {
+ Thread.sleep(1);
+ }
+ if (!mThreadExitFlag){
+ Logt.i(TAG, "ItsService ready");
+ } else {
+ Logt.e(TAG, "Starting ItsService in bad state");
+ }
+ } catch (java.lang.InterruptedException e) {
+ Logt.e(TAG, "Error starting ItsService (interrupted)", e);
+ }
return START_STICKY;
}
@Override
public void onDestroy() {
- try {
- mThreadExitFlag = true;
- for (int i = 0; i < MAX_NUM_OUTPUT_SURFACES; i++) {
- if (mSaveThreads[i] != null) {
- mSaveThreads[i].quit();
- mSaveThreads[i] = null;
- }
+ mThreadExitFlag = true;
+ for (int i = 0; i < MAX_NUM_OUTPUT_SURFACES; i++) {
+ if (mSaveThreads[i] != null) {
+ mSaveThreads[i].quit();
+ mSaveThreads[i] = null;
}
- if (mCameraThread != null) {
- mCameraThread.quitSafely();
- mCameraThread = null;
+ }
+ if (mResultThread != null) {
+ mResultThread.quitSafely();
+ mResultThread = null;
+ }
+ if (mCameraThread != null) {
+ mCameraThread.quitSafely();
+ mCameraThread = null;
+ }
+ }
+
+ public void openCameraDevice(int cameraId) throws ItsException {
+ Logt.i(TAG, String.format("Opening camera %d", cameraId));
+
+ String[] devices;
+ try {
+ devices = mCameraManager.getCameraIdList();
+ if (devices == null || devices.length == 0) {
+ throw new ItsException("No camera devices");
}
- try {
+ } catch (CameraAccessException e) {
+ throw new ItsException("Failed to get device ID list", e);
+ }
+
+ try {
+ mCamera = mBlockingCameraManager.openCamera(devices[cameraId],
+ mCameraListener, mCameraHandler);
+ mCameraCharacteristics = mCameraManager.getCameraCharacteristics(
+ devices[cameraId]);
+ } catch (CameraAccessException e) {
+ throw new ItsException("Failed to open camera", e);
+ } catch (BlockingOpenException e) {
+ throw new ItsException("Failed to open camera (after blocking)", e);
+ }
+ mSocketRunnableObj.sendResponse("cameraOpened", "");
+ }
+
+ public void closeCameraDevice() throws ItsException {
+ try {
+ if (mCamera != null) {
+ Logt.i(TAG, "Closing camera");
mCamera.close();
- } catch (Exception e) {
- throw new ItsException("Failed to close device");
+ mCamera = null;
}
- } catch (ItsException e) {
- Logt.e(TAG, "Script failed: ", e);
+ } catch (Exception e) {
+ throw new ItsException("Failed to close device");
}
+ mSocketRunnableObj.sendResponse("cameraClosed", "");
}
class SerializerRunnable implements Runnable {
@@ -299,7 +318,7 @@ public class ItsService extends Service implements SensorEventListener {
// the reflection).
public void run() {
Logt.i(TAG, "Serializer thread starting");
- while (true) {
+ while (! mThreadExitFlag) {
try {
Object objs[] = mSerializerQueue.take();
JSONObject jsonObj = new JSONObject();
@@ -358,20 +377,29 @@ public class ItsService extends Service implements SensorEventListener {
mOpenSocket = openSocket;
}
+ public void setOpenSocket(Socket openSocket) {
+ mOpenSocket = openSocket;
+ }
+
public void run() {
Logt.i(TAG, "Socket writer thread starting");
while (true) {
try {
ByteBuffer b = mSocketWriteQueue.take();
- if (b.hasArray()) {
- mOpenSocket.getOutputStream().write(b.array());
- } else {
- byte[] barray = new byte[b.capacity()];
- b.get(barray);
- mOpenSocket.getOutputStream().write(barray);
+ synchronized(mSocketWriteDrainLock) {
+ if (mOpenSocket == null) {
+ continue;
+ }
+ if (b.hasArray()) {
+ mOpenSocket.getOutputStream().write(b.array());
+ } else {
+ byte[] barray = new byte[b.capacity()];
+ b.get(barray);
+ mOpenSocket.getOutputStream().write(barray);
+ }
+ mOpenSocket.getOutputStream().flush();
+ Logt.i(TAG, String.format("Wrote to socket: %d bytes", b.capacity()));
}
- mOpenSocket.getOutputStream().flush();
- Logt.i(TAG, String.format("Wrote to socket: %d bytes", b.capacity()));
} catch (IOException e) {
Logt.e(TAG, "Error writing to socket", e);
break;
@@ -403,43 +431,69 @@ public class ItsService extends Service implements SensorEventListener {
} catch (IOException e) {
Logt.e(TAG, "Failed to create socket", e);
}
- try {
- Logt.i(TAG, "Waiting for client to connect to socket");
- mOpenSocket = mSocket.accept();
- if (mOpenSocket == null) {
- Logt.e(TAG, "Socket connection error");
- return;
- }
- Logt.i(TAG, "Socket connected");
- } catch (IOException e) {
- Logt.e(TAG, "Socket open error: ", e);
- return;
- }
- mSocketThread = new Thread(new SocketWriteRunnable(mOpenSocket));
- mSocketThread.start();
+
+ // Create a new thread to handle writes to this socket.
+ mSocketWriteRunnable = new SocketWriteRunnable(null);
+ (new Thread(mSocketWriteRunnable)).start();
+
while (!mThreadExitFlag) {
+ // Receive the socket-open request from the host.
try {
- BufferedReader input = new BufferedReader(
- new InputStreamReader(mOpenSocket.getInputStream()));
- if (input == null) {
- Logt.e(TAG, "Failed to get socket input stream");
- break;
- }
- String line = input.readLine();
- if (line == null) {
- Logt.e(TAG, "Failed to read socket line");
+ Logt.i(TAG, "Waiting for client to connect to socket");
+ mOpenSocket = mSocket.accept();
+ if (mOpenSocket == null) {
+ Logt.e(TAG, "Socket connection error");
break;
}
- processSocketCommand(line);
+ mSocketWriteQueue.clear();
+ mSocketWriteRunnable.setOpenSocket(mOpenSocket);
+ Logt.i(TAG, "Socket connected");
} catch (IOException e) {
- Logt.e(TAG, "Socket read error: ", e);
- break;
- } catch (ItsException e) {
- Logt.e(TAG, "Script error: ", e);
+ Logt.e(TAG, "Socket open error: ", e);
break;
}
+
+ // Process commands over the open socket.
+ while (!mThreadExitFlag) {
+ try {
+ BufferedReader input = new BufferedReader(
+ new InputStreamReader(mOpenSocket.getInputStream()));
+ if (input == null) {
+ Logt.e(TAG, "Failed to get socket input stream");
+ break;
+ }
+ String line = input.readLine();
+ if (line == null) {
+ Logt.i(TAG, "Socket readline retuned null (host disconnected)");
+ break;
+ }
+ processSocketCommand(line);
+ } catch (IOException e) {
+ Logt.e(TAG, "Socket read error: ", e);
+ break;
+ } catch (ItsException e) {
+ Logt.e(TAG, "Script error: ", e);
+ break;
+ }
+ }
+
+ // Close socket and go back to waiting for a new connection.
+ try {
+ synchronized(mSocketWriteDrainLock) {
+ mSocketWriteQueue.clear();
+ mOpenSocket.close();
+ mOpenSocket = null;
+ Logt.i(TAG, "Socket disconnected");
+ }
+ } catch (java.io.IOException e) {
+ Logt.e(TAG, "Exception closing socket");
+ }
}
+
+ // It's an overall error state if the code gets here; no recevery.
+ // Try to do some cleanup, but the service probably needs to be restarted.
Logt.i(TAG, "Socket server loop exited");
+ mThreadExitFlag = true;
try {
if (mOpenSocket != null) {
mOpenSocket.close();
@@ -456,7 +510,6 @@ public class ItsService extends Service implements SensorEventListener {
} catch (java.io.IOException e) {
Logt.w(TAG, "Exception closing socket");
}
- Logt.i(TAG, "Socket server thread exited");
}
public void processSocketCommand(String cmd)
@@ -464,7 +517,12 @@ public class ItsService extends Service implements SensorEventListener {
// Each command is a serialized JSON object.
try {
JSONObject cmdObj = new JSONObject(cmd);
- if ("getCameraProperties".equals(cmdObj.getString("cmdName"))) {
+ if ("open".equals(cmdObj.getString("cmdName"))) {
+ int cameraId = cmdObj.getInt("cameraId");
+ openCameraDevice(cameraId);
+ } else if ("close".equals(cmdObj.getString("cmdName"))) {
+ closeCameraDevice();
+ } else if ("getCameraProperties".equals(cmdObj.getString("cmdName"))) {
doGetProps();
} else if ("startSensorEvents".equals(cmdObj.getString("cmdName"))) {
doStartSensorEvents();
@@ -500,7 +558,7 @@ public class ItsService extends Service implements SensorEventListener {
}
ByteBuffer bstr = ByteBuffer.wrap(
(jsonObj.toString()+"\n").getBytes(Charset.defaultCharset()));
- synchronized(mSocketWriteLock) {
+ synchronized(mSocketWriteEnqueueLock) {
if (bstr != null) {
mSocketWriteQueue.put(bstr);
}
@@ -1039,8 +1097,10 @@ public class ItsService extends Service implements SensorEventListener {
ByteBuffer buf = ByteBuffer.wrap(img);
mSocketRunnableObj.sendResponseCaptureBuffer("rawImage", buf);
} else {
- // Wait until the corresponding capture result is ready.
- while (! mThreadExitFlag) {
+ // Wait until the corresponding capture result is ready, up to a timeout.
+ long t0 = android.os.SystemClock.elapsedRealtime();
+ while (! mThreadExitFlag
+ && android.os.SystemClock.elapsedRealtime()-t0 < TIMEOUT_CAP_RES) {
if (mCaptureResults[count] != null) {
Logt.i(TAG, "Writing capture as DNG");
DngCreator dngCreator = new DngCreator(
@@ -1062,13 +1122,10 @@ public class ItsService extends Service implements SensorEventListener {
mCountCallbacksRemaining.decrementAndGet();
} catch (IOException e) {
Logt.e(TAG, "Script error: ", e);
- mThreadExitFlag = true;
} catch (InterruptedException e) {
Logt.e(TAG, "Script error: ", e);
- mThreadExitFlag = true;
} catch (ItsException e) {
Logt.e(TAG, "Script error: ", e);
- mThreadExitFlag = true;
}
}
};
@@ -1198,10 +1255,8 @@ public class ItsService extends Service implements SensorEventListener {
}
} catch (ItsException e) {
Logt.e(TAG, "Script error: ", e);
- mThreadExitFlag = true;
} catch (Exception e) {
Logt.e(TAG, "Script error: ", e);
- mThreadExitFlag = true;
}
}
diff --git a/apps/CameraITS/tools/config.py b/apps/CameraITS/tools/config.py
index 380c314..6e83412 100644
--- a/apps/CameraITS/tools/config.py
+++ b/apps/CameraITS/tools/config.py
@@ -29,7 +29,7 @@ def main():
The "reboot" or "reboot=<N>" and "camera=<N>" arguments may also be
provided, just as with all the test scripts. The "target" argument is
may also be provided but it has no effect on this script since the cached
- exposure value is cleared regardless..
+ exposure value is cleared regardless.
If no exposure value is provided, the camera will be used to measure
the scene and set a level that will result in the luma (with linear
@@ -43,21 +43,21 @@ def main():
# Command line args, ignoring any args that will be passed down to the
# ItsSession constructor.
- args = [s for s in sys.argv if s[:6] not in ["reboot", "camera", "target"]]
+ args = [s for s in sys.argv if s[:6] not in \
+ ["reboot", "camera", "target", "noinit"]]
if len(args) == 1:
with its.device.ItsSession() as cam:
# Automatically measure target exposure.
its.target.clear_cached_target_exposure()
- its.target.get_target_exposure(cam)
+ exposure = its.target.get_target_exposure(cam)
elif len(args) == 2:
# Hard-code the target exposure.
- exposure = float(args[1])
+ exposure = int(args[1])
its.target.set_hardcoded_exposure(exposure)
else:
print "Usage: python %s [EXPOSURE]"
sys.exit(0)
- exposure = its.target.get_target_exposure()
print "New target exposure set to", exposure
print "This corresponds to %dms at ISO 100" % int(exposure/100/1000000.0)
diff --git a/apps/CameraITS/tools/run_scene_tests.sh b/apps/CameraITS/tools/run_scene_tests.sh
index d21e6a5..c31f36e 100755
--- a/apps/CameraITS/tools/run_scene_tests.sh
+++ b/apps/CameraITS/tools/run_scene_tests.sh
@@ -62,7 +62,7 @@ done
rm -rf out
mkdir -p out
-echo Running tests with args: $REBOOT camera=$CAMERA target
+echo Running tests with args: $REBOOT camera=$CAMERA target noinit
cd out
python ../../../tools/config.py $REBOOT camera=$CAMERA
@@ -79,7 +79,7 @@ do
echo "--------------------------------------------------------------------"
echo "Running test: $T"
echo "--------------------------------------------------------------------"
- python ../"$T" $REBOOT camera=$CAMERA target
+ python ../"$T" $REBOOT camera=$CAMERA noinit target
code=$?
if [ $code -ne 0 ]; then
let failcount=failcount+1