Google is committed to advancing racial equity for Black communities. See how.

Result

abstract class Result
kotlin.Any
   ↳ androidx.camera.core.SurfaceRequest.Result

Result of providing a surface to a SurfaceRequest via provideSurface(Surface, Executor, Consumer).

Summary

Constants

static Int

Provided surface could not be used by the camera.

static Int

Provided surface was never attached to the camera due to the SurfaceRequest being cancelled by the camera.

static Int

Surface was not attached to the camera through this invocation of provideSurface(Surface, Executor, Consumer) due to the SurfaceRequest already being complete with a surface.

static Int

Provided surface was successfully used by the camera and eventually detached once no longer needed by the camera.

static Int

Surface was not attached to the camera through this invocation of provideSurface(Surface, Executor, Consumer) due to the SurfaceRequest already being marked as "will not provide surface".

Public methods

abstract Int

Returns the result of invoking provideSurface(Surface, Executor, Consumer) with the surface from getSurface().

abstract Surface

The surface used to complete a SurfaceRequest with provideSurface(Surface, Executor, Consumer).

Constants

RESULT_INVALID_SURFACE

static val RESULT_INVALID_SURFACE: Int

Provided surface could not be used by the camera.

This is likely due to the Surface being closed prematurely or the resolution of the surface not matching the resolution specified by SurfaceRequest#getResolution().

Value: 2

RESULT_REQUEST_CANCELLED

static val RESULT_REQUEST_CANCELLED: Int

Provided surface was never attached to the camera due to the SurfaceRequest being cancelled by the camera.

It is safe to release or reuse Surface, assuming it was not previously attached to a camera via provideSurface(Surface, Executor, Consumer). If reusing the surface for a future surface request, it should be verified that the surface still matches the resolution specified by SurfaceRequest#getResolution().

Value: 1

RESULT_SURFACE_ALREADY_PROVIDED

static val RESULT_SURFACE_ALREADY_PROVIDED: Int

Surface was not attached to the camera through this invocation of provideSurface(Surface, Executor, Consumer) due to the SurfaceRequest already being complete with a surface.

The SurfaceRequest has already been completed by a previous invocation of provideSurface(Surface, Executor, Consumer).

It is safe to release or reuse the Surface, assuming it was not previously attached to a camera via provideSurface(Surface, Executor, Consumer).

Value: 3

RESULT_SURFACE_USED_SUCCESSFULLY

static val RESULT_SURFACE_USED_SUCCESSFULLY: Int

Provided surface was successfully used by the camera and eventually detached once no longer needed by the camera.

This result denotes that it is safe to release the Surface and any underlying resources.

For compatibility reasons, the Surface object should not be reused by future SurfaceRequests, and a new surface should be created instead.

Value: 0

RESULT_WILL_NOT_PROVIDE_SURFACE

static val RESULT_WILL_NOT_PROVIDE_SURFACE: Int

Surface was not attached to the camera through this invocation of provideSurface(Surface, Executor, Consumer) due to the SurfaceRequest already being marked as "will not provide surface".

The SurfaceRequest has already been marked as 'will not provide surface' by a previous invocation of willNotProvideSurface().

It is safe to release or reuse the Surface, assuming it was not previously attached to a camera via provideSurface(Surface, Executor, Consumer).

Value: 4

Public methods

getSurface

@NonNull abstract fun getSurface(): Surface

The surface used to complete a SurfaceRequest with provideSurface(Surface, Executor, Consumer).

Return
Surface the surface.