ViewfinderSurfaceRequest


class ViewfinderSurfaceRequest


The request to get a Surface to display camera feed.

This request contains requirements for the surface resolution and camera device information from CameraCharacteristics.

Calling requestSurfaceAsync with this request will send the request to the surface provider, which is either a TextureView or SurfaceView and get a ListenableFuture of Surface.

Calling markSurfaceSafeToRelease will notify the surface provider that the surface is not needed and related resources can be released.

Summary

Public functions

CameraViewfinder.ImplementationMode?

Returns the androidx.camera.viewfinder.CameraViewfinder.ImplementationMode.

Int

Returns the camera lens facing.

Size

Returns the resolution of the requested Surface.

Int

Returns the sensor orientation.

Unit

Closes the viewfinder surface to mark it as safe to release.

Protected functions

Unit

Public functions

getLensFacing

Added in 1.4.0-alpha10
Deprecated in 1.4.0-alpha10
fun getLensFacing(): Int

Returns the camera lens facing.

The value is set by setLensFacing, which can be retrieved from CameraCharacteristics by key LENS_FACING.

Returns
Int

The lens facing.

getResolution

Added in 1.4.0-alpha10
Deprecated in 1.4.0-alpha10
fun getResolution(): Size

Returns the resolution of the requested Surface.

The value is set by Builder. The surface which fulfills this request must have the resolution specified here in order to fulfill the resource requirements of the camera.

Returns
Size

The guaranteed supported resolution.

getSensorOrientation

Added in 1.4.0-alpha10
Deprecated in 1.4.0-alpha10
fun getSensorOrientation(): Int

Returns the sensor orientation.

The value is set by setSensorOrientation, which can be retrieved from CameraCharacteristics by key SENSOR_ORIENTATION.

Returns
Int

The sensor orientation.

markSurfaceSafeToRelease

Added in 1.4.0-alpha10
Deprecated in 1.4.0-alpha10
fun markSurfaceSafeToRelease(): Unit

Closes the viewfinder surface to mark it as safe to release.

This method should be called by the user when the requested surface is not needed and related resources can be released.

Protected functions

finalize

protected fun finalize(): Unit