public abstract class

SurfaceRequest.Result

extends java.lang.Object

 java.lang.Object

↳androidx.camera.core.SurfaceRequest.Result

Overview

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

Summary

Fields
public static final intRESULT_INVALID_SURFACE

Provided surface could not be used by the camera.

public static final intRESULT_REQUEST_CANCELLED

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

public static final intRESULT_SURFACE_ALREADY_PROVIDED

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

public static final intRESULT_SURFACE_USED_SUCCESSFULLY

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

public static final intRESULT_WILL_NOT_PROVIDE_SURFACE

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

Methods
public abstract intgetResultCode()

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

public abstract SurfacegetSurface()

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

from java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Fields

public static final int RESULT_SURFACE_USED_SUCCESSFULLY

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 and any underlying resources.

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

public static final int RESULT_REQUEST_CANCELLED

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

It is safe to release or reuse , assuming it was not previously attached to a camera via SurfaceRequest.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().

public static final int RESULT_INVALID_SURFACE

Provided surface could not be used by the camera.

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

public static final int RESULT_SURFACE_ALREADY_PROVIDED

Surface was not attached to the camera through this invocation of SurfaceRequest.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 SurfaceRequest.provideSurface(Surface, Executor, Consumer).

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

public static final int RESULT_WILL_NOT_PROVIDE_SURFACE

Surface was not attached to the camera through this invocation of SurfaceRequest.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 SurfaceRequest.willNotProvideSurface().

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

Methods

public abstract int getResultCode()

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

Returns:

One of SurfaceRequest.Result.RESULT_SURFACE_USED_SUCCESSFULLY, SurfaceRequest.Result.RESULT_REQUEST_CANCELLED, SurfaceRequest.Result.RESULT_INVALID_SURFACE, or SurfaceRequest.Result.RESULT_SURFACE_ALREADY_PROVIDED, SurfaceRequest.Result.RESULT_WILL_NOT_PROVIDE_SURFACE.

public abstract Surface getSurface()

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

Returns:

the surface.