public abstract class CameraAgent extends Object
CameraAgent.openCamera
to get an instance
of CameraAgent.CameraProxy
to control the camera. Classes
implementing this interface should have its own one unique Thread
other than the main thread for camera operations. Camera device callbacks
are wrapped since the client should not deal with
android.hardware.Camera
directly.
TODO: provide callback interfaces for:
android.hardware.Camera.ErrorCallback
,
android.hardware.Camera.OnZoomChangeListener
, andModifier and Type | Class and Description |
---|---|
static interface |
CameraAgent.CameraAFCallback
An interface which wraps
Camera.AutoFocusCallback . |
static interface |
CameraAgent.CameraAFMoveCallback
An interface which wraps
Camera.AutoFocusMoveCallback . |
static interface |
CameraAgent.CameraErrorCallback
An interface which wraps
Camera.ErrorCallback |
static interface |
CameraAgent.CameraFaceDetectionCallback
An interface which wraps
Camera.FaceDetectionListener . |
static interface |
CameraAgent.CameraOpenCallback
An interface to be called for any events when opening or closing the
camera device.
|
static class |
CameraAgent.CameraOpenCallbackForward
A callback helps to invoke the original callback on another
Handler . |
static interface |
CameraAgent.CameraPictureCallback
An interface which wraps
Camera.PictureCallback . |
static interface |
CameraAgent.CameraPreviewDataCallback
An interface which wraps
Camera.PreviewCallback . |
static class |
CameraAgent.CameraProxy
An interface that takes camera operation requests and post messages to the
camera handler thread.
|
static interface |
CameraAgent.CameraShutterCallback
An interface which wraps
Camera.ShutterCallback . |
static interface |
CameraAgent.CameraStartPreviewCallback
An interface to be called when the camera preview has started.
|
static class |
CameraAgent.CameraStartPreviewCallbackForward |
static class |
CameraAgent.WaitDoneBundle |
Modifier and Type | Field and Description |
---|---|
static long |
CAMERA_OPERATION_TIMEOUT_MS |
Constructor and Description |
---|
CameraAgent() |
Modifier and Type | Method and Description |
---|---|
void |
closeCamera(CameraAgent.CameraProxy camera,
boolean synced)
Closes the camera device.
|
abstract CameraDeviceInfo |
getCameraDeviceInfo() |
protected abstract CameraExceptionHandler |
getCameraExceptionHandler() |
protected abstract Handler |
getCameraHandler() |
protected abstract CameraStateHolder |
getCameraState() |
protected abstract DispatchThread |
getDispatchThread() |
void |
openCamera(Handler handler,
int cameraId,
CameraAgent.CameraOpenCallback callback)
Opens the camera of the specified ID asynchronously.
|
abstract void |
recycle()
Recycles the resources used by this instance.
|
abstract void |
setCameraExceptionHandler(CameraExceptionHandler exceptionHandler)
Sets a callback for handling camera api runtime exceptions on
a handler.
|
public static final long CAMERA_OPERATION_TIMEOUT_MS
public void openCamera(Handler handler, int cameraId, CameraAgent.CameraOpenCallback callback)
onCameraOpened(com.android.camera.cameradevice.CameraAgent.CameraProxy)
.handler
- The Handler
in which the callback
was handled.callback
- The callback for the result.cameraId
- The camera ID to open.public void closeCamera(CameraAgent.CameraProxy camera, boolean synced)
camera
- The camera to close. null
means all.synced
- Whether this call should be synchronous.public abstract void setCameraExceptionHandler(CameraExceptionHandler exceptionHandler)
public abstract void recycle()
public abstract CameraDeviceInfo getCameraDeviceInfo()
protected abstract Handler getCameraHandler()
protected abstract DispatchThread getDispatchThread()
protected abstract CameraStateHolder getCameraState()
protected abstract CameraExceptionHandler getCameraExceptionHandler()