SurfaceWrapper


@CarProtocol
public final class SurfaceWrapper


A class holding the information needed to render the content on a surface.

Summary

Public constructors

SurfaceWrapper(
    @Nullable IBinder hostToken,
    @Dimension int width,
    @Dimension int height,
    int displayId,
    int densityDpi,
    @NonNull Surface surface
)

Creates a SurfaceWrapper.

Public methods

int

Returns the screen density expressed as dots-per-inch of the android.view.Display for the contained SurfaceView.

int

Returns the display id of the android.view.Display for the SurfaceView contained in this class.

@Dimension int

Returns the height of the contained SurfaceView in pixels.

@Nullable IBinder

Returns the host token corresponding to the SurfaceView contained in this class.

@NonNull Surface

Returns the Surface of the contained SurfaceView.

@Dimension int

Returns the width of the contained SurfaceView in pixels.

Public constructors

SurfaceWrapper

Added in 1.1.0
public SurfaceWrapper(
    @Nullable IBinder hostToken,
    @Dimension int width,
    @Dimension int height,
    int displayId,
    int densityDpi,
    @NonNull Surface surface
)

Creates a SurfaceWrapper.

Parameters
@Nullable IBinder hostToken

a token used for constructing SurfaceControlViewHost. see SurfaceView for more details

@Dimension int width

the width of the surface view in pixels

@Dimension int height

the height of the surface view in pixels

int displayId

the ID of the display showing the surface

int densityDpi

the density of the display showing the surface expressed as dots-per-inch

@NonNull Surface surface

the surface for which the wrapper is created

Public methods

getDensityDpi

Added in 1.1.0
public int getDensityDpi()

Returns the screen density expressed as dots-per-inch of the android.view.Display for the contained SurfaceView.

getDisplayId

Added in 1.1.0
public int getDisplayId()

Returns the display id of the android.view.Display for the SurfaceView contained in this class.

getHeight

Added in 1.1.0
public @Dimension int getHeight()

Returns the height of the contained SurfaceView in pixels.

getHostToken

Added in 1.1.0
public @Nullable IBinder getHostToken()

Returns the host token corresponding to the SurfaceView contained in this class.

getSurface

Added in 1.1.0
public @NonNull Surface getSurface()

Returns the Surface of the contained SurfaceView.

getWidth

Added in 1.1.0
public @Dimension int getWidth()

Returns the width of the contained SurfaceView in pixels.