Merge "Camera2: LEGACY: Support prepare(), sort of." into mnc-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
6faa3acaad
@@ -114,6 +114,11 @@ public abstract class CameraCaptureSession implements AutoCloseable {
|
||||
* the Surface provided to prepare must not be used as a target of a CaptureRequest submitted
|
||||
* to this session.</p>
|
||||
*
|
||||
* <p>{@link android.hardware.camera2.CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL_LEGACY LEGACY}
|
||||
* devices cannot pre-allocate output buffers; for those devices,
|
||||
* {@link StateCallback#onSurfacePrepared} will be immediately called, and no preallocation is
|
||||
* done.</p>
|
||||
*
|
||||
* @param surface the output Surface for which buffers should be pre-allocated. Must be one of
|
||||
* the output Surfaces used to create this session.
|
||||
*
|
||||
|
||||
@@ -202,6 +202,7 @@ public class CameraDeviceUserShim implements ICameraDeviceUser {
|
||||
private static final int CAMERA_IDLE = 1;
|
||||
private static final int CAPTURE_STARTED = 2;
|
||||
private static final int RESULT_RECEIVED = 3;
|
||||
private static final int PREPARED = 4;
|
||||
|
||||
private final HandlerThread mHandlerThread;
|
||||
private Handler mHandler;
|
||||
@@ -253,7 +254,9 @@ public class CameraDeviceUserShim implements ICameraDeviceUser {
|
||||
|
||||
@Override
|
||||
public void onPrepared(int streamId) {
|
||||
// TODO
|
||||
Message msg = getHandler().obtainMessage(PREPARED,
|
||||
/*arg1*/ streamId, /*arg2*/ 0);
|
||||
getHandler().sendMessage(msg);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -301,6 +304,11 @@ public class CameraDeviceUserShim implements ICameraDeviceUser {
|
||||
mCallbacks.onResultReceived(result, resultExtras);
|
||||
break;
|
||||
}
|
||||
case PREPARED: {
|
||||
int streamId = msg.arg1;
|
||||
mCallbacks.onPrepared(streamId);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
throw new IllegalArgumentException(
|
||||
"Unknown callback message " + msg.what);
|
||||
@@ -631,7 +639,9 @@ public class CameraDeviceUserShim implements ICameraDeviceUser {
|
||||
return CameraBinderDecorator.ENODEV;
|
||||
}
|
||||
|
||||
// TODO: Implement and fire callback
|
||||
// LEGACY doesn't support actual prepare, just signal success right away
|
||||
mCameraCallbacks.onPrepared(streamId);
|
||||
|
||||
return CameraBinderDecorator.NO_ERROR;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user