Methods Summary |
---|
public void | closeCamera(com.android.ex.camera2.portability.CameraAgent$CameraProxy camera, boolean synced)Closes the camera device.
try {
if (synced) {
// Don't bother to wait since camera is in bad state.
if (getCameraState().isInvalid()) {
return;
}
final WaitDoneBundle bundle = new WaitDoneBundle();
getDispatchThread().runJobSync(new Runnable() {
@Override
public void run() {
getCameraHandler().obtainMessage(CameraActions.RELEASE).sendToTarget();
getCameraHandler().post(bundle.mUnlockRunnable);
}}, bundle.mWaitLock, CAMERA_OPERATION_TIMEOUT_MS, "camera release");
} else {
getDispatchThread().runJob(new Runnable() {
@Override
public void run() {
getCameraHandler().removeCallbacksAndMessages(null);
getCameraHandler().obtainMessage(CameraActions.RELEASE).sendToTarget();
}});
}
} catch (final RuntimeException ex) {
getCameraExceptionHandler().onDispatchThreadException(ex);
}
|
public abstract CameraDeviceInfo | getCameraDeviceInfo()
|
protected abstract CameraExceptionHandler | getCameraExceptionHandler()
|
protected abstract android.os.Handler | getCameraHandler()
|
protected abstract CameraStateHolder | getCameraState()
|
protected abstract DispatchThread | getDispatchThread()
|
public void | openCamera(android.os.Handler handler, int cameraId, com.android.ex.camera2.portability.CameraAgent$CameraOpenCallback callback)Opens the camera of the specified ID asynchronously. The camera device
will be opened in the camera handler thread and will be returned through
the {@link CameraAgent.CameraOpenCallback#
onCameraOpened(com.android.camera.cameradevice.CameraAgent.CameraProxy)}.
try {
getDispatchThread().runJob(new Runnable() {
@Override
public void run() {
getCameraHandler().obtainMessage(CameraActions.OPEN_CAMERA, cameraId, 0,
CameraOpenCallbackForward.getNewInstance(handler, callback)).sendToTarget();
}
});
} catch (final RuntimeException ex) {
getCameraExceptionHandler().onDispatchThreadException(ex);
}
|
public abstract void | recycle()Recycles the resources used by this instance. CameraAgent will be in
an unusable state after calling this.
|
public abstract void | setCameraExceptionHandler(CameraExceptionHandler exceptionHandler)Sets a callback for handling camera api runtime exceptions on
a handler.
|