CameraDeviceCompat { public static void createCaptureSession(@NonNull CameraDevice device, @NonNull SessionConfigurationCompat config) throws CameraAccessException { IMPL.createCaptureSession(device, config); } private  CameraDeviceCompat(); static void createCaptureSession(@NonNull CameraDevice device,
            @NonNull SessionConfigurationCompat config); @RestrictTo(Scope.LIBRARY)
    static final int SESSION_OPERATION_MODE_NORMAL; @RestrictTo(Scope.LIBRARY)
    static final int SESSION_OPERATION_MODE_CONSTRAINED_HIGH_SPEED; }
@Test @Config(maxSdk = 23) @SuppressWarnings("unchecked") public void createCaptureSession_createsSession_withBaseMethod() throws CameraAccessException { SessionConfigurationCompat sessionConfig = new SessionConfigurationCompat( SessionConfigurationCompat.SESSION_REGULAR, mOutputs, mock(Executor.class), mock(CameraCaptureSession.StateCallback.class)); CameraDeviceCompat.createCaptureSession(mCameraDevice, sessionConfig); verify(mCameraDevice, times(1)).createCaptureSession( any(List.class), any(CameraCaptureSession.StateCallback.class), any(Handler.class)); }
@Test @Config(minSdk = 24, maxSdk = 27) @SuppressWarnings("unchecked") public void createCaptureSession_createsSession_byOutputConfiguration() throws CameraAccessException { SessionConfigurationCompat sessionConfig = new SessionConfigurationCompat( SessionConfigurationCompat.SESSION_REGULAR, mOutputs, mock(Executor.class), mock(CameraCaptureSession.StateCallback.class)); CameraDeviceCompat.createCaptureSession(mCameraDevice, sessionConfig); verify(mCameraDevice, times(1)).createCaptureSessionByOutputConfigurations( any(List.class), any(CameraCaptureSession.StateCallback.class), any(Handler.class)); }
@Test @Config(minSdk = 28) @SuppressWarnings("unchecked") public void createCaptureSession_createsSession_bySessionConfiguration() throws CameraAccessException { SessionConfigurationCompat sessionConfig = new SessionConfigurationCompat( SessionConfigurationCompat.SESSION_REGULAR, mOutputs, mock(Executor.class), mock(CameraCaptureSession.StateCallback.class)); CameraDeviceCompat.createCaptureSession(mCameraDevice, sessionConfig); verify(mCameraDevice, times(1)).createCaptureSession( any(SessionConfiguration.class)); }
@Test(expected = IllegalArgumentException.class) @Config(maxSdk = 22) public void createCaptureSession_throwsForReprocessableSession() throws CameraAccessException { SessionConfigurationCompat sessionConfig = new SessionConfigurationCompat( SessionConfigurationCompat.SESSION_REGULAR, mOutputs, mock(Executor.class), mock(CameraCaptureSession.StateCallback.class)); sessionConfig.setInputConfiguration(mock(InputConfigurationCompat.class)); CameraDeviceCompat.createCaptureSession(mCameraDevice, sessionConfig); }
@Test(expected = IllegalArgumentException.class) @Config(maxSdk = 22) public void createCaptureSession_throwsForHighSpeedSession() throws CameraAccessException { SessionConfigurationCompat sessionConfig = new SessionConfigurationCompat( SessionConfigurationCompat.SESSION_HIGH_SPEED, mOutputs, mock(Executor.class), mock(CameraCaptureSession.StateCallback.class)); CameraDeviceCompat.createCaptureSession(mCameraDevice, sessionConfig); }
@Test @Config(minSdk = 23, maxSdk = 23) @SuppressWarnings("unchecked") public void createCaptureSession_createsReprocessableSession() throws CameraAccessException { SessionConfigurationCompat sessionConfig = new SessionConfigurationCompat( SessionConfigurationCompat.SESSION_REGULAR, mOutputs, mock(Executor.class), mock(CameraCaptureSession.StateCallback.class)); sessionConfig.setInputConfiguration(Objects.requireNonNull( InputConfigurationCompat.wrap(mock(InputConfiguration.class)))); CameraDeviceCompat.createCaptureSession(mCameraDevice, sessionConfig); verify(mCameraDevice, times(1)).createReprocessableCaptureSession( any(InputConfiguration.class), any(List.class), any(CameraCaptureSession.StateCallback.class), any(Handler.class)); }
@Test @Config(minSdk = 24, maxSdk = 27) @SuppressWarnings("unchecked") public void createCaptureSession_createsReprocessableSession_byConfiguration() throws CameraAccessException { SessionConfigurationCompat sessionConfig = new SessionConfigurationCompat( SessionConfigurationCompat.SESSION_REGULAR, mOutputs, mock(Executor.class), mock(CameraCaptureSession.StateCallback.class)); sessionConfig.setInputConfiguration(Objects.requireNonNull( InputConfigurationCompat.wrap(mock(InputConfiguration.class)))); CameraDeviceCompat.createCaptureSession(mCameraDevice, sessionConfig); verify(mCameraDevice, times(1)).createReprocessableCaptureSessionByConfigurations( any(InputConfiguration.class), any(List.class), any(CameraCaptureSession.StateCallback.class), any(Handler.class)); }
@Test @Config(minSdk = 23, maxSdk = 27) @SuppressWarnings("unchecked") public void createCaptureSession_createsHighSpeedSession() throws CameraAccessException { SessionConfigurationCompat sessionConfig = new SessionConfigurationCompat( SessionConfigurationCompat.SESSION_HIGH_SPEED, mOutputs, mock(Executor.class), mock(CameraCaptureSession.StateCallback.class)); CameraDeviceCompat.createCaptureSession(mCameraDevice, sessionConfig); verify(mCameraDevice, times(1)).createConstrainedHighSpeedCaptureSession( any(List.class), any(CameraCaptureSession.StateCallback.class), any(Handler.class)); }