public final class XrDevice


Provides hardware capabilities of the device.

Summary

Nested types

public final class XrDevice.DisplayBlendMode

This class is deprecated. Use androidx.xr.runtime.DisplayBlendMode instead.

Public methods

static final @NonNull XrDevice

Get the current XrDevice for the provided Session.

static final @NonNull XrDevice
@ExperimentalXrDeviceLifecycleApi
getCurrentDevice(
    @NonNull Context context,
    @NonNull Session session,
    @NonNull CoroutineContext coroutineContext
)

Get the current XrDevice for the provided Context.

final @NonNull Lifecycle

Returns this XrDevice's Lifecycle.

final @NonNull DisplayBlendMode

Returns the preferred display blend mode for this session.

Public methods

getCurrentDevice

Added in 1.0.0-alpha11
public static final @NonNull XrDevice getCurrentDevice(@NonNull Session session)

Get the current XrDevice for the provided Session.

Parameters
@NonNull Session session

the Session connected to the device.

getCurrentDevice

Added in 1.0.0-alpha11
@ExperimentalXrDeviceLifecycleApi
public static final @NonNull XrDevice getCurrentDevice(
    @NonNull Context context,
    @NonNull Session session,
    @NonNull CoroutineContext coroutineContext
)

Get the current XrDevice for the provided Context.

Parameters
@NonNull Context context

the Context associated with the device

@NonNull Session session

the Session connected to the device

@NonNull CoroutineContext coroutineContext

the CoroutineContext to use for the XrDevice operations

Throws
IllegalArgumentException

if the provided Context is not supported

getLifecycle

Added in 1.0.0-alpha11
@ExperimentalXrDeviceLifecycleApi
public final @NonNull Lifecycle getLifecycle()

Returns this XrDevice's Lifecycle.

The value will be the Projected device's lifecycle if its Context was used when calling getCurrentDevice. Otherwise, the Session's lifecycle will be returned.

getPreferredDisplayBlendMode

Added in 1.0.0-alpha11
public final @NonNull DisplayBlendMode getPreferredDisplayBlendMode()

Returns the preferred display blend mode for this session.

Returns
@NonNull DisplayBlendMode

The DisplayBlendMode that is preferred by the Session for rendering. DisplayBlendMode.NO_DISPLAY will be returned if there are no supported blend modes available.

Throws
IllegalStateException

if the Session has been destroyed.