PlaceholderSurfaceInterface


@UnstableApi
public interface PlaceholderSurfaceInterface

Known direct subclasses
PlaceholderSurface

A placeholder Surface.


A placeholder Surface.

Summary

Public methods

abstract Surface

Returns the placeholder Surface.

abstract boolean

Returns whether the placeholder surface is secure.

default static boolean

Returns whether the device supports secure placeholder surfaces.

default static PlaceholderSurfaceInterface
newInstance(Context context, boolean secure)

Returns a newly created placeholder surface.

abstract void

Releases the placeholder surface and its underlying resources.

Public methods

getSurface

abstract Surface getSurface()

Returns the placeholder Surface.

isSecure

abstract boolean isSecure()

Returns whether the placeholder surface is secure.

isSecureSupported

default static boolean isSecureSupported(Context context)

Returns whether the device supports secure placeholder surfaces.

Parameters
Context context

Any Context.

Returns
boolean

Whether the device supports secure placeholder surfaces.

newInstance

default static PlaceholderSurfaceInterface newInstance(Context context, boolean secure)

Returns a newly created placeholder surface. The placeholder must be released by calling release when it's no longer required.

When FLAG_IMAGE_READER_PLACEHOLDER_SURFACE is enabled on API 29+, non-secure placeholder surfaces are backed by an android.media.ImageReader instead of an EGL pbuffer surface. Secure placeholder surfaces always use the OpenGL-backed PlaceholderSurface because android.media.ImageReader requires USAGE_PROTECTED_CONTENT in its consumer usage bits to mark the surface as protected, which causes some OMX secure decoders to crash when pushing CPU-locked blank buffers to the placeholder surface on surface switch or shutdown.

Parameters
Context context

Any Context.

boolean secure

Whether a secure surface is required. Must only be requested if isSecureSupported returns true.

Throws
java.lang.IllegalStateException

If a secure surface is requested on a device for which isSecureSupported returns false.

release

abstract void release()

Releases the placeholder surface and its underlying resources.