@Override
 protected void tearDown() throws Exception {
   mHandlerThread.quitSafely();
   mHandler = null;
   mCameraListener = null;
   for (CameraHolder camera : mCameraHolders) {
     if (camera.isOpenned()) {
       camera.close();
       camera = null;
     }
   }
   super.tearDown();
 }
 protected List<Size> getOrderedPreviewSizes(String cameraId) {
   CameraHolder camera = getCameraHolder(cameraId);
   assertTrue("Camera is not openned", camera.isOpenned());
   return camera.getOrderedPreviewSizes();
 }
 protected StaticMetadata getStaticInfo(String cameraId) {
   CameraHolder camera = getCameraHolder(cameraId);
   assertTrue("Camera is not openned", camera.isOpenned());
   return camera.getStaticInfo();
 }
 protected void stopPreview(String cameraId) throws Exception {
   CameraHolder camera = getCameraHolder(cameraId);
   assertTrue("Camera " + cameraId + " preview is not running", camera.isPreviewStarted());
   camera.stopPreview();
 }
 protected void startPreview(
     String cameraId, List<Surface> outputSurfaces, CaptureCallback listener) throws Exception {
   CameraHolder camera = getCameraHolder(cameraId);
   assertTrue("Camera " + cameraId + " is not openned", camera.isOpenned());
   camera.startPreview(outputSurfaces, listener);
 }
 protected void closeCamera(String cameraId) throws Exception {
   CameraHolder camera = getCameraHolder(cameraId);
   camera.close();
 }
 protected void openCamera(String cameraId) throws Exception {
   CameraHolder camera = getCameraHolder(cameraId);
   assertFalse("Camera has already opened", camera.isOpenned());
   camera.open();
   return;
 }