interface CameraDeviceSetupCompat


Interface for checking if a SessionConfiguration is supported by the device.

This interface is a compatible version of the CameraDevice.CameraDeviceSetup class.

Implementations of this interface must be able to check if a SessionConfiguration is supported. They will check both the output streams and the session parameters, then return whether the combination works for the given camera. For example, a camera device may support HDR and 60FPS frame rate, but not both at the same time.

Summary

Public functions

CameraDeviceSetupCompat.SupportQueryResult

Checks if the SessionConfiguration is supported.

CameraDeviceSetupCompat.SupportQueryResult

Checks if the set of features in SessionConfigurationLegacy is supported for the given camera.

Public functions

isSessionConfigurationSupported

Added in 1.5.0-beta01
fun isSessionConfigurationSupported(sessionConfig: SessionConfiguration): CameraDeviceSetupCompat.SupportQueryResult

Checks if the SessionConfiguration is supported.

Parameters
sessionConfig: SessionConfiguration

The SessionConfiguration to check.

Throws
android.hardware.camera2.CameraAccessException

if the camera device is no longer connected or has encountered a fatal error.

isSessionConfigurationSupportedLegacy

Added in 1.5.0-beta01
fun isSessionConfigurationSupportedLegacy(
    sessionConfig: SessionConfigurationLegacy
): CameraDeviceSetupCompat.SupportQueryResult

Checks if the set of features in SessionConfigurationLegacy is supported for the given camera.

This method and the legacy classes are provided to allow querying camera device capabilities without the need to call openCamera. It must only be used for devices that do not support CameraDevice.CameraDeviceSetup and will throw an IllegalStateException when used for a cameraId for which isCameraDeviceSetupSupported returns true.

Even on older devices that do not support android.hardware.camera2.CameraDevice.CameraDeviceSetup, if the CameraDevice object can be obtained using openCamera, then isSessionConfigurationSupported should be used as the android.hardware.camera2.CaptureRequest returned by Camera2 generally has more information pre-filled from the template which may change the result.

Note that this method does not, and can not query camera2's isSessionConfigurationSupported, so the returned getSource will never be SOURCE_ANDROID_FRAMEWORK. Additionally, there is a small possibility that the result of Camera2's isSessionConfigurationSupported contradicts the result of this call. In such cases, a RESULT_UNSUPPORTED result can be considered authoritative, but RESULT_SUPPORTED may or may not be correct and is considered best effort.

WARNING: Use this method is discouraged for most developers. isSessionConfigurationSupported should be used wherever possible. This method should only be used if performance is critical on older devices and you understand and protect against the caveats documented above.

Parameters
sessionConfig: SessionConfigurationLegacy

The SessionConfigurationLegacy to check.