use of android.hardware.camera2.params.SessionConfiguration in project robolectric by robolectric.
the class ShadowCameraDeviceImpl method createCaptureSession.
@Implementation(minSdk = VERSION_CODES.P)
protected void createCaptureSession(SessionConfiguration config) throws CameraAccessException {
checkIfCameraClosedOrInError();
CameraCaptureSession session = createCameraCaptureSession(config.getStateCallback());
config.getExecutor().execute(() -> config.getStateCallback().onConfigured(session));
}
use of android.hardware.camera2.params.SessionConfiguration in project robolectric by robolectric.
the class ShadowCameraDeviceImplTest method createCaptureSession_configuration_throwsIllegalStateExceptionAfterClose.
@Test
@Config(sdk = VERSION_CODES.P)
public void createCaptureSession_configuration_throwsIllegalStateExceptionAfterClose() throws CameraAccessException {
cameraDevice.close();
SessionConfiguration configuration = new SessionConfiguration(SessionConfiguration.SESSION_REGULAR, Collections.singletonList(new OutputConfiguration(mock(Surface.class))), MoreExecutors.directExecutor(), new CaptureSessionCallback(/*useExecutor=*/
true));
IllegalStateException thrown = assertThrows(IllegalStateException.class, () -> cameraDevice.createCaptureSession(configuration));
assertThat(thrown).hasMessageThat().contains("CameraDevice was already closed");
}
use of android.hardware.camera2.params.SessionConfiguration in project robolectric by robolectric.
the class ShadowCameraDeviceImplTest method createCaptureSession_configuration.
@Test
@Config(sdk = VERSION_CODES.P)
public void createCaptureSession_configuration() throws CameraAccessException {
Surface mockSurface = mock(Surface.class);
builder = cameraDevice.createCaptureRequest(CameraDevice.TEMPLATE_RECORD);
builder.addTarget(mockSurface);
SessionConfiguration configuration = new SessionConfiguration(SessionConfiguration.SESSION_REGULAR, Collections.singletonList(new OutputConfiguration(mockSurface)), MoreExecutors.directExecutor(), new CaptureSessionCallback(/*useExecutor=*/
true));
cameraDevice.createCaptureSession(configuration);
}
Aggregations