Fields Summary |
---|
public android.hardware.Camera | mCamera |
private String | TAG |
private static final int | CAMERA_ID |
private static final long | WAIT_GENERIC |
private static final long | WAIT_ZOOM_ANIMATION |
protected static final String | CAMERA_STRESS_IMAGES_DIRECTORY |
private static final String | CAMERA_STRESS_IMAGES_PREFIX |
private final CameraErrorCallback | mCameraErrorCallback |
private android.hardware.Camera.ShutterCallback | shutterCallback |
private android.hardware.Camera.PictureCallback | rawCallback |
private android.hardware.Camera.PictureCallback | jpegCallback |
Methods Summary |
---|
public void | capturePhoto()Helper method for taking a photo
mCamera.takePicture(shutterCallback, rawCallback, jpegCallback);
Thread.sleep(WAIT_GENERIC);
mCamera.stopPreview();
mCamera.release();
|
public void | cleanupTestImages()Helper method for cleaning up pics taken during tests
try {
File stressImagesDirectory = new File(String.format("%s/%s",
Environment.getExternalStorageDirectory(), CAMERA_STRESS_IMAGES_DIRECTORY));
File[] stressImages = stressImagesDirectory.listFiles();
for (File f : stressImages) {
f.delete();
}
} catch (SecurityException e) {
Log.e(TAG, "Security manager access violation: " + e.toString());
}
|
public android.hardware.Camera.Parameters | getCameraParameters()Helper method for getting the available parameters of the default camera
mCamera = Camera.open(CAMERA_ID);
Parameters params = mCamera.getParameters();
mCamera.release();
return params;
|
public void | setParameters(android.hardware.Camera.Parameters params)Helper method for setting the camera parameters
try {
mCamera.setParameters(params);
} catch (Exception e) {
Log.e(TAG, "Error setting camera parameters");
}
|
public void | setupCameraTest()Helper method for prepping test
// Create the test images directory if it doesn't exist
File stressImagesDirectory = new File(String.format("%s/%s",
Environment.getExternalStorageDirectory(), CAMERA_STRESS_IMAGES_DIRECTORY));
if (!stressImagesDirectory.exists()) {
stressImagesDirectory.mkdir();
}
mCamera = Camera.open(CAMERA_ID);
|
public void | startCameraPreview(android.view.SurfaceHolder surfaceHolder)Helper method for starting up the camera preview
mCamera.setErrorCallback(mCameraErrorCallback);
mCamera.setPreviewDisplay(surfaceHolder);
mCamera.startPreview();
Thread.sleep(WAIT_GENERIC);
|