class FakeXrExtensions


A fake for the XrExtensions.

This has fake implementations for a subset of the XrExtension capability that is used by the JXRCore runtime for AndroidXR.

Summary

Nested types

Creates fake activity panel.

Fake AudioTrackExtensions.

A fake implementation of Closeable.

Fake implementation of Extensions Config.

A fake implementation of the XR extensions EnvironmentToken.

A fake implementation of the XR extensions EnvironmentVisibilityState.

A fake implementation of the XR extensions GltfModelToken.

Fake input event.

Fake hit info.

Fake MediaPlayerExtensions.

A fake implementation of the XR extensions Node.

A fake implementation of the XR extensions Node transaction.

A fake implementation of the XR extensions NodeTransform.

A fake implementation of the XR extensions EnvironmentVisibilityState.

Fake ReformEvent.

Fake ReformOptions.

Fake SoundPoolExtensions.

Fake XrSpatialAudioExtensions.

A fake implementation of the XR extensions SpatialState.

Tracks whether an Activity has requested a mode for when it's focused.

Public constructors

Public functions

Unit
addFindableView(view: View, group: ViewGroup)

Synchronously makes a View findable via findViewById().

Unit
attachSpatialEnvironment(activity: Activity, environmentNode: Node)

This function is deprecated.

This method is no longer supported.

Unit
attachSpatialEnvironment(
    activity: Activity,
    environmentNode: Node,
    callback: Consumer<XrExtensionResult!>,
    executor: Executor
)

Attaches an environment node for a given activity to make it visible.

Unit
attachSpatialScene(activity: Activity, sceneNode: Node, windowNode: Node)

This function is deprecated.

This method is no longer supported.

Unit
attachSpatialScene(
    activity: Activity,
    sceneNode: Node,
    windowNode: Node,
    callback: Consumer<XrExtensionResult!>,
    executor: Executor
)

Attaches the given sceneNode as the presentation for the given activity in the space, and asks the system to attach the 2D content of the activity into the given windowNode.

Boolean

This function is deprecated.

This method is no longer supported.

Unit

Synchronously clears the SpatialStateEvent callback that was previously set to the activity via setSpatialStateCallback.

ActivityPanel
createActivityPanel(
    host: Activity,
    launchParameters: ActivityPanelLaunchParameters
)

Synchronously creates an ActivityPanel to be embedded inside the given host activity.

Node

Synchronously creates a node that can host a 2D panel or 3D subspace.

NodeTransaction

Synchronously creates a new transaction that can be used to update multiple Node's data and transformation in the 3D space.

ReformOptions

Synchronously creates a new ReformOptions instance.

SplitEngineBridge

Synchronously returns a SplitEngineBridge.

Subspace
createSubspace(splitEngineBridge: SplitEngineBridge, subspaceId: Int)

Synchronously creates a subspace.

Unit

This function is deprecated.

This method is no longer supported.

Unit
detachSpatialEnvironment(
    activity: Activity,
    callback: Consumer<XrExtensionResult!>,
    executor: Executor
)

Detaches the environment node and its sub tree for a given activity to make it invisible.

Unit

This function is deprecated.

This method is no longer supported.

Unit
detachSpatialScene(
    activity: Activity,
    callback: Consumer<XrExtensionResult!>,
    executor: Executor
)

Detaches the sceneNode that was previously attached for the activity via attachSpatialScene.

CompletableFuture<XrExtensions.SceneViewerResult!>
displayGltfModel(activity: Activity!, gltfModel: GltfModelToken!)

This function is deprecated.

This method is no longer supported.

FakeXrExtensions.FakeActivityPanel
Int

Get the current version of the XrExtensions API.

Unit
getBounds(
    activity: Activity,
    callback: Consumer<Bounds!>,
    executor: Executor
)

This function is deprecated.

Use getSpatialState synchronous getter.

Config

Synchronously returns system config information.

Float
Unit
getSpatialCapabilities(
    activity: Activity,
    callback: Consumer<SpatialCapabilities!>,
    executor: Executor
)

This function is deprecated.

Use getSpatialState synchronous getter.

SpatialState

Synchronously gets the spatial state of the activity.

Node?

Returns the surface tracking node for a view, if there is one.

XrSpatialAudioExtensions

Synchronously returns the implementation of the XrSpatialAudioExtensions component.

Unit
hitTest(
    activity: Activity,
    origin: Vec3,
    direction: Vec3,
    callback: Consumer<HitTestResult!>,
    executor: Executor
)

Hit-tests a ray against the virtual scene.

CompletableFuture<EnvironmentToken!>
loadEnvironment(
    asset: InputStream?,
    regionSizeBytes: Int,
    regionOffsetBytes: Int,
    url: String?
)

This function is deprecated.

This method is no longer supported.

CompletableFuture<EnvironmentToken!>
loadEnvironment(
    asset: InputStream!,
    regionSizeBytes: Int,
    regionOffsetBytes: Int,
    url: String!,
    textureWidth: Int,
    textureHeight: Int
)

This function is deprecated.

This method is no longer supported.

CompletableFuture<GltfModelToken!>
loadGltfModel(
    asset: InputStream?,
    regionSizeBytes: Int,
    regionOffsetBytes: Int,
    url: String?
)

This function is deprecated.

This method is no longer supported.

CompletableFuture<SceneToken!>
loadImpressScene(
    asset: InputStream!,
    regionSizeBytes: Int,
    regionOffsetBytes: Int
)

This function is deprecated.

This method is no longer supported.

Unit
registerSpatialStateCallback(
    activity: Activity,
    callback: Consumer<SpatialState!>,
    executor: Executor
)

Synchronously registers a callback to receive SpatialState for the activity.

Unit

Synchronously removes a findable view from the given group.

Boolean

This function is deprecated.

This method is no longer supported.

Unit
requestFullSpaceMode(
    activity: Activity,
    requestEnter: Boolean,
    callback: Consumer<XrExtensionResult!>,
    executor: Executor
)

Requests to put an activity in a different mode when it has focus.

Boolean

This function is deprecated.

This method is no longer supported.

Unit
Bundle

Synchronously sets the full space mode flag to the given Bundle.

Bundle

Synchronously sets the inherit full space mode environvment flag to the given Bundle.

Bundle
setMainPanelCurvatureRadius(bundle: Bundle, panelCurvatureRadius: Float)

This function is deprecated.

This method is no longer supported.

Unit
setMainWindowCurvatureRadius(activity: Activity, curvatureRadius: Float)

This function is deprecated.

This method is no longer supported.

Unit
setMainWindowSize(activity: Activity, width: Int, height: Int)

This function is deprecated.

This method is no longer supported.

Unit
setMainWindowSize(
    activity: Activity,
    width: Int,
    height: Int,
    callback: Consumer<XrExtensionResult!>,
    executor: Executor
)

Resizes the main window of the given activity to the requested size.

Unit
setPreferredAspectRatio(activity: Activity, preferredRatio: Float)

This function is deprecated.

Use the new interface with a callback.

Unit
setPreferredAspectRatio(
    activity: Activity,
    preferredRatio: Float,
    callback: Consumer<XrExtensionResult!>,
    executor: Executor
)

Sets a preferred main panel aspect ratio for an activity that is not SPATIAL_UI_CAPABLE.

Unit
setSpatialStateCallback(
    activity: Activity,
    callback: Consumer<SpatialStateEvent!>,
    executor: Executor
)

This function is deprecated.

This method is no longer supported.

FakeXrExtensions.FakeNode

This function is deprecated.

This method is no longer supported.

FakeXrExtensions.FakeNode

This function is deprecated.

This method is no longer supported.

Public constructors

FakeXrExtensions

Added in 1.0.0-alpha01
FakeXrExtensions()

Public functions

addFindableView

Added in 1.0.0-alpha01
fun addFindableView(view: View, group: ViewGroup): Unit

Synchronously makes a View findable via findViewById().

This is done without it being a child of the given group.

Parameters
view: View

the view to add as findable.

group: ViewGroup

a group that is part of the hierarchy that findViewById() will be called on.

attachSpatialEnvironment

Added in 1.0.0-alpha01
Deprecated in 1.0.0-alpha01
fun attachSpatialEnvironment(activity: Activity, environmentNode: Node): Unit

attachSpatialEnvironment

Added in 1.0.0-alpha01
fun attachSpatialEnvironment(
    activity: Activity,
    environmentNode: Node,
    callback: Consumer<XrExtensionResult!>,
    executor: Executor
): Unit

Attaches an environment node for a given activity to make it visible.

SysUI will attach the environment node to the task node when the activity gains the APP_ENVIRONMENTS_CAPABLE capability.

This method can be called multiple times, SysUI will attach the new environment node and detach the old environment node if it exists.

Note that once an environmentNode is attached and the caller gains APP_ENVIRONMENTS_CAPABLE capability, spatial callback's environment visibility status changes to APP_VISIBLE even if your application hasn't set a skybox or geometry to the environment node yet. For that reason, call this API only when your application wants to show a skybox or geometry. Otherwise, the APP_VISIBLE spatial state may lead to an unexpected behavior. For example, home environment's ambient audio (if any) may stop even if the user can still see the home environment.

Parameters
activity: Activity

the activity that provides the environment node to attach.

environmentNode: Node

the environment node provided by the activity to be attached.

callback: Consumer<XrExtensionResult!>

the callback that will be called with the result. XrExtensionResult will indicate either of the following: XrExtensionResult.XR_RESULT_SUCCESS: The request has been accepted, and the client can expect that a spatial state callback with an updated SpatialState will run shortly. XrExtensionResult.XR_RESULT_SUCCESS_NOT_VISIBLE: The request has been accepted, but will not immediately change the spatial state. A spatial state callback with an updated SpatialState won't run until the activity becomes APP_ENVIRONMENTS_CAPABLE. XrExtensionResult.XR_RESULT_IGNORED_ALREADY_APPLIED: The request has been ignored because the activity is already in the requested state. XrExtensionResult.XR_RESULT_ERROR_NOT_ALLOWED: The request has been rejected because the activity does not have the required capability (e.g. called by an embedded guest activity.) XrExtensionResult.XR_RESULT_ERROR_SYSTEM: A unrecoverable service side error has happened.

executor: Executor

the executor the callback will be called on.

attachSpatialScene

Added in 1.0.0-alpha01
Deprecated in 1.0.0-alpha01
fun attachSpatialScene(activity: Activity, sceneNode: Node, windowNode: Node): Unit

attachSpatialScene

Added in 1.0.0-alpha01
fun attachSpatialScene(
    activity: Activity,
    sceneNode: Node,
    windowNode: Node,
    callback: Consumer<XrExtensionResult!>,
    executor: Executor
): Unit

Attaches the given sceneNode as the presentation for the given activity in the space, and asks the system to attach the 2D content of the activity into the given windowNode.

The sceneNode will only be visible if the activity is visible as in a lifecycle state between onStart and onStop and is SPATIAL_UI_CAPABLE too.

One activity can only attach one scene node. When a new scene node is attached for the same activity, the previous one will be detached.

Parameters
activity: Activity

the owner activity of the sceneNode.

sceneNode: Node

the node to show as the presentation of the activity.

windowNode: Node

a leash node to allow the app to control the position and size of the activity's main window.

callback: Consumer<XrExtensionResult!>

the callback that will be called with the result. XrExtensionResult will indicate either of the following: XrExtensionResult.XR_RESULT_SUCCESS: The request has been accepted, and the client can expect that a spatial state callback with an updated SpatialState will run shortly. XrExtensionResult.XR_RESULT_SUCCESS_NOT_VISIBLE: The request has been accepted, but will not immediately change the spatial state. A spatial state callback with an updated SpatialState won't run until the activity becomes SPATIAL_UI_CAPABLE. XrExtensionResult.XR_RESULT_IGNORED_ALREADY_APPLIED: The request has been ignored because the activity is already in the requested state. XrExtensionResult.XR_RESULT_ERROR_NOT_ALLOWED: The request has been rejected because the activity does not have the required capability (e.g. called by an embedded guest activity.) XrExtensionResult.XR_RESULT_ERROR_SYSTEM: A unrecoverable service side error has happened.

executor: Executor

the executor the callback will be called on.

canEmbedActivityPanel

Added in 1.0.0-alpha01
Deprecated in 1.0.0-alpha01
fun canEmbedActivityPanel(activity: Activity): Boolean

clearSpatialStateCallback

Added in 1.0.0-alpha01
fun clearSpatialStateCallback(activity: Activity): Unit

Synchronously clears the SpatialStateEvent callback that was previously set to the activity via setSpatialStateCallback.

When an Activity is destroyed, it must call this method to clear the callback that was set for itself.

Parameters
activity: Activity

the activity for the callback to listen to.

createActivityPanel

Added in 1.0.0-alpha01
fun createActivityPanel(
    host: Activity,
    launchParameters: ActivityPanelLaunchParameters
): ActivityPanel

Synchronously creates an ActivityPanel to be embedded inside the given host activity.

Caller must make sure the host can embed ActivityPanel. See (. When embedding is possible, SpatialState's SpatialCapabilities has SPATIAL_ACTIVITY_EMBEDDING_CAPABLE.

For the ActivityPanel to be shown in the scene, caller needs to attach the getNode to the scene node attached through attachSpatialScene.

This API throws IllegalArgumentException if it is called by an embedded (guest) activity.

Parameters
host: Activity

the host activity to embed the ActivityPanel.

launchParameters: ActivityPanelLaunchParameters

the parameters to define the initial state of the .

Returns
ActivityPanel

the ActivityPanel created.

Throws
java.lang.IllegalStateException

if the host is not allowed to embed .

createNode

Added in 1.0.0-alpha01
fun createNode(): Node

Synchronously creates a node that can host a 2D panel or 3D subspace.

Returns
Node

A Node.

createNodeTransaction

Added in 1.0.0-alpha01
fun createNodeTransaction(): NodeTransaction

Synchronously creates a new transaction that can be used to update multiple Node's data and transformation in the 3D space.

Returns
NodeTransaction

A NodeTransaction that can be used to queue the updates and submit to backend at once.

createReformOptions

Added in 1.0.0-alpha01
fun createReformOptions(callback: Consumer<ReformEvent!>, executor: Executor): ReformOptions

Synchronously creates a new ReformOptions instance.

Parameters
callback: Consumer<ReformEvent!>

the callback that will be called with reform events.

executor: Executor

the executor the callback will be called on.

Returns
ReformOptions

the new builder instance.

createSplitEngineBridge

Added in 1.0.0-alpha01
fun createSplitEngineBridge(): SplitEngineBridge

Synchronously returns a SplitEngineBridge.

createSubspace

Added in 1.0.0-alpha01
fun createSubspace(splitEngineBridge: SplitEngineBridge, subspaceId: Int): Subspace

Synchronously creates a subspace.

Parameters
splitEngineBridge: SplitEngineBridge

The splitEngineBridge.

subspaceId: Int

The unique identifier of the subspace.

Returns
Subspace

A Subspace that can be used to render 3D content in.

detachSpatialEnvironment

Added in 1.0.0-alpha01
Deprecated in 1.0.0-alpha01
fun detachSpatialEnvironment(activity: Activity): Unit

detachSpatialEnvironment

Added in 1.0.0-alpha01
fun detachSpatialEnvironment(
    activity: Activity,
    callback: Consumer<XrExtensionResult!>,
    executor: Executor
): Unit

Detaches the environment node and its sub tree for a given activity to make it invisible.

This method will detach and cleanup the environment node and its subtree passed from the activity.

Parameters
activity: Activity

the activity with which SysUI will detach and clean up the environment node tree.

callback: Consumer<XrExtensionResult!>

the callback that will be called with the result. XrExtensionResult will indicate either of the following: XrExtensionResult.XR_RESULT_SUCCESS: The request has been accepted, and the client can expect that a spatial state callback with an updated SpatialState will run shortly. XrExtensionResult.XR_RESULT_SUCCESS_NOT_VISIBLE: The request has been accepted, but will not immediately change the spatial state. A spatial state callback with an updated SpatialState won't run until the activity becomes APP_ENVIRONMENTS_CAPABLE. XrExtensionResult.XR_RESULT_IGNORED_ALREADY_APPLIED: The request has been ignored because the activity is already in the requested state. XrExtensionResult.XR_RESULT_ERROR_SYSTEM: A unrecoverable service side error has happened.

executor: Executor

the executor the callback will be called on.

detachSpatialScene

Added in 1.0.0-alpha01
Deprecated in 1.0.0-alpha01
fun detachSpatialScene(activity: Activity): Unit

detachSpatialScene

Added in 1.0.0-alpha01
fun detachSpatialScene(
    activity: Activity,
    callback: Consumer<XrExtensionResult!>,
    executor: Executor
): Unit

Detaches the sceneNode that was previously attached for the activity via attachSpatialScene.

When an Activity is destroyed, it must call this method to detach the scene node that was attached for itself.

Parameters
activity: Activity

the owner activity of the sceneNode.

callback: Consumer<XrExtensionResult!>

the callback that will be called with the result. XrExtensionResult will indicate either of the following: XrExtensionResult.XR_RESULT_SUCCESS: The request has been accepted, and the client can expect that a spatial state callback with an updated SpatialState will run shortly. XrExtensionResult.XR_RESULT_SUCCESS_NOT_VISIBLE: The request has been accepted, but will not immediately change the spatial state. A spatial state callback with an updated SpatialState won't run until the activity becomes SPATIAL_UI_CAPABLE. XrExtensionResult.XR_RESULT_IGNORED_ALREADY_APPLIED: The request has been ignored because the activity is already in the requested state. XrExtensionResult.XR_RESULT_ERROR_SYSTEM: A unrecoverable service side error has happened.

executor: Executor

the executor the callback will be called on.

displayGltfModel

Added in 1.0.0-alpha01
Deprecated in 1.0.0-alpha01
fun displayGltfModel(activity: Activity!, gltfModel: GltfModelToken!): CompletableFuture<XrExtensions.SceneViewerResult!>

Suppressed to allow CompletableFuture.

getActivityPanelForHost

Added in 1.0.0-alpha01
fun getActivityPanelForHost(host: Activity): FakeXrExtensions.FakeActivityPanel

getApiVersion

Added in 1.0.0-alpha01
fun getApiVersion(): Int

Get the current version of the XrExtensions API.

getBounds

Added in 1.0.0-alpha01
fun getBounds(
    activity: Activity,
    callback: Consumer<Bounds!>,
    executor: Executor
): Unit

Gets the bounds of the activity.

Parameters
activity: Activity

the activity to get the bounds.

callback: Consumer<Bounds!>

the callback to run. If the activity is not found in SysUI, the callback runs with a null Bounds.

executor: Executor

the executor that the callback will be called on.

getConfig

Added in 1.0.0-alpha01
fun getConfig(): Config

Synchronously returns system config information.

Returns
Config

A Config object.

getPreferredAspectRatio

Added in 1.0.0-alpha01
fun getPreferredAspectRatio(): Float

getSpatialCapabilities

Added in 1.0.0-alpha01
fun getSpatialCapabilities(
    activity: Activity,
    callback: Consumer<SpatialCapabilities!>,
    executor: Executor
): Unit

Gets the spatial capabilities of the activity.

Parameters
activity: Activity

the activity to get the capabilities.

callback: Consumer<SpatialCapabilities!>

the callback to run. If the activity is not found in SysUI, the callback runs with a null SpatialCapabilities.

executor: Executor

the executor that the callback will be called on.

getSpatialState

Added in 1.0.0-alpha01
fun getSpatialState(activity: Activity): SpatialState

Synchronously gets the spatial state of the activity.

Do not call the API from the Binder thread. That may cause a deadlock.

This API throws IllegalArgumentException if it is called by an embedded (guest) activity, and also throws RuntimeException if the calling thread is interrupted.

Parameters
activity: Activity

the activity to get the capabilities.

Returns
SpatialState

the state of the activity.

getSurfaceTrackingNode

Added in 1.0.0-alpha01
fun getSurfaceTrackingNode(view: View): Node?

Returns the surface tracking node for a view, if there is one.

The surface tracking node is centered on the Surface that the view is attached to, and is sized to match the surface's size. Note that the view's position in the surface can be retrieved via View.getLocationInSurface().

Parameters
view: View

the view.

Returns
Node?

the surface tracking node, or null if no such node exists.

getXrSpatialAudioExtensions

Added in 1.0.0-alpha01
fun getXrSpatialAudioExtensions(): XrSpatialAudioExtensions

Synchronously returns the implementation of the XrSpatialAudioExtensions component.

hitTest

Added in 1.0.0-alpha01
fun hitTest(
    activity: Activity,
    origin: Vec3,
    direction: Vec3,
    callback: Consumer<HitTestResult!>,
    executor: Executor
): Unit

Hit-tests a ray against the virtual scene. If the ray hits an object in the scene, information about the hit will be passed to the callback. If nothing is hit, the hit distance will be infinite. Note that attachSpatialScene() must be called before calling this method. Otherwise, an IllegalArgumentException is thrown.

Parameters
activity: Activity

the requesting activity.

origin: Vec3

the origin of the ray to test, in the activity's task coordinates.

direction: Vec3

the direction of the ray to test, in the activity's task coordinates.

callback: Consumer<HitTestResult!>

the callback that will be called with the hit test result.

executor: Executor

the executor the callback will be called on.

loadEnvironment

Added in 1.0.0-alpha01
Deprecated in 1.0.0-alpha01
fun loadEnvironment(
    asset: InputStream?,
    regionSizeBytes: Int,
    regionOffsetBytes: Int,
    url: String?
): CompletableFuture<EnvironmentToken!>

Suppressed to allow CompletableFuture.

loadEnvironment

Added in 1.0.0-alpha01
Deprecated in 1.0.0-alpha01
fun loadEnvironment(
    asset: InputStream!,
    regionSizeBytes: Int,
    regionOffsetBytes: Int,
    url: String!,
    textureWidth: Int,
    textureHeight: Int
): CompletableFuture<EnvironmentToken!>

Suppressed to allow CompletableFuture.

loadGltfModel

Added in 1.0.0-alpha01
Deprecated in 1.0.0-alpha01
fun loadGltfModel(
    asset: InputStream?,
    regionSizeBytes: Int,
    regionOffsetBytes: Int,
    url: String?
): CompletableFuture<GltfModelToken!>

Suppressed to allow CompletableFuture.

loadImpressScene

Added in 1.0.0-alpha01
Deprecated in 1.0.0-alpha01
fun loadImpressScene(
    asset: InputStream!,
    regionSizeBytes: Int,
    regionOffsetBytes: Int
): CompletableFuture<SceneToken!>

Suppressed to allow CompletableFuture.

registerSpatialStateCallback

Added in 1.0.0-alpha01
fun registerSpatialStateCallback(
    activity: Activity,
    callback: Consumer<SpatialState!>,
    executor: Executor
): Unit

Synchronously registers a callback to receive SpatialState for the activity.

One activity can only set one callback. When a new callback is set for the same activity, the previous one will be cleared.

The executor's execute() method will soon be called to run the callback with the current state when it is available, but it never happens directly from within this call.

This API throws IllegalArgumentException if it is called by an embedded (guest) activity.

Parameters
activity: Activity

the activity for the callback to listen to.

callback: Consumer<SpatialState!>

the callback to set.

executor: Executor

the executor that the callback will be called on.

removeFindableView

Added in 1.0.0-alpha01
fun removeFindableView(view: View, group: ViewGroup): Unit

Synchronously removes a findable view from the given group.

Parameters
view: View

the view to remove as findable.

group: ViewGroup

the group to remove the findable view from.

requestFullSpaceMode

Added in 1.0.0-alpha01
Deprecated in 1.0.0-alpha01
fun requestFullSpaceMode(activity: Activity): Boolean

requestFullSpaceMode

Added in 1.0.0-alpha01
fun requestFullSpaceMode(
    activity: Activity,
    requestEnter: Boolean,
    callback: Consumer<XrExtensionResult!>,
    executor: Executor
): Unit

Requests to put an activity in a different mode when it has focus.

Parameters
activity: Activity

the activity that requires to enter full space mode.

requestEnter: Boolean

when true, activity is put in full space mode. Home space mode otherwise.

callback: Consumer<XrExtensionResult!>

the callback that will be called with the result. XrExtensionResult will indicate either of the following: XrExtensionResult.XR_RESULT_SUCCESS: The request has been accepted, and the client can expect that a spatial state callback with an updated SpatialState will run shortly. XrExtensionResult.XR_RESULT_IGNORED_ALREADY_APPLIED: The request has been ignored because the activity is already in the requested mode. XrExtensionResult.XR_RESULT_ERROR_NOT_ALLOWED: The request has been rejected because the activity does not have the required capability (e.g. not the top activity in a top task in the desktop, called by an embedded guest activity.) XrExtensionResult.XR_RESULT_ERROR_SYSTEM: A unrecoverable service side error has happened.

executor: Executor

the executor the callback will be called on.

requestHomeSpaceMode

Added in 1.0.0-alpha01
Deprecated in 1.0.0-alpha01
fun requestHomeSpaceMode(activity: Activity): Boolean

sendSpatialState

Added in 1.0.0-alpha01
fun sendSpatialState(spatialState: SpatialState): Unit

setFullSpaceMode

Added in 1.0.0-alpha01
fun setFullSpaceMode(bundle: Bundle): Bundle

Synchronously sets the full space mode flag to the given Bundle.

The Bundle then could be used to launch an Activity with requesting to enter full space mode through startActivity. If there's a bundle used for customizing how the Activity should be started by ActivityOptions.toBundle or androidx.core.app.ActivityOptionsCompat.toBundle, it's suggested to use the bundle to call this method.

The flag will be ignored when no Intent.FLAG_ACTIVITY_NEW_TASK is set in the bundle, or it is not started from a focused Activity context.

This flag is also ignored when the android.window.PROPERTY_XR_ACTIVITY_START_MODE property is set to a value other than XR_ACTIVITY_START_MODE_UNDEFINED in the AndroidManifest.xml file for the activity being launched.

Parameters
bundle: Bundle

the input bundle to set with the full space mode flag.

Returns
Bundle

the input bundle with the full space mode flag set.

setFullSpaceModeWithEnvironmentInherited

Added in 1.0.0-alpha01
fun setFullSpaceModeWithEnvironmentInherited(bundle: Bundle): Bundle

Synchronously sets the inherit full space mode environvment flag to the given Bundle.

The Bundle then could be used to launch an Activity with requesting to enter full space mode while inherit the existing environment through startActivity. If there's a bundle used for customizing how the Activity should be started by ActivityOptions.toBundle or , it's suggested to use the bundle to call this method.

When launched, the activity will be in full space mode and also inherits the environment from the launching activity. If the inherited environment needs to be animated, the launching activity has to continue updating the environment even after the activity is put into the stopped state.

The flag will be ignored when no Intent.FLAG_ACTIVITY_NEW_TASK is set in the intent, or it is not started from a focused Activity context.

The flag will also be ignored when there is no environment to inherit or the activity has its own environment set already.

This flag is ignored too when the android.window.PROPERTY_XR_ACTIVITY_START_MODE property is set to a value other than XR_ACTIVITY_START_MODE_UNDEFINED in the AndroidManifest.xml file for the activity being launched.

For security reasons, Z testing for the new activity is disabled, and the activity is always drawn on top of the inherited environment. Because Z testing is disabled, the activity should not spatialize itself, and should not curve its panel too much either.

Parameters
bundle: Bundle

the input bundle to set with the inherit full space mode environment flag.

Returns
Bundle

the input bundle with the inherit full space mode flag set.

setMainPanelCurvatureRadius

Added in 1.0.0-alpha01
Deprecated in 1.0.0-alpha01
fun setMainPanelCurvatureRadius(bundle: Bundle, panelCurvatureRadius: Float): Bundle

setMainWindowCurvatureRadius

Added in 1.0.0-alpha01
Deprecated in 1.0.0-alpha01
fun setMainWindowCurvatureRadius(activity: Activity, curvatureRadius: Float): Unit

setMainWindowSize

Added in 1.0.0-alpha01
Deprecated in 1.0.0-alpha01
fun setMainWindowSize(activity: Activity, width: Int, height: Int): Unit

setMainWindowSize

Added in 1.0.0-alpha01
fun setMainWindowSize(
    activity: Activity,
    width: Int,
    height: Int,
    callback: Consumer<XrExtensionResult!>,
    executor: Executor
): Unit

Resizes the main window of the given activity to the requested size.

Parameters
activity: Activity

the activity whose main window should be resized.

width: Int

the new main window width in pixels.

height: Int

the new main window height in pixels.

callback: Consumer<XrExtensionResult!>

the callback that will be called with the result. XrExtensionResult will indicate either of the following: XrExtensionResult.XR_RESULT_SUCCESS: The request has been accepted, and the client can expect that a spatial state callback with an updated SpatialState will run shortly. XrExtensionResult.XR_RESULT_SUCCESS_NOT_VISIBLE: The request has been accepted, but will not immediately change the spatial state. A spatial state callback with an updated SpatialState won't run until the activity becomes SPATIAL_UI_CAPABLE. XrExtensionResult.XR_RESULT_IGNORED_ALREADY_APPLIED: The request has been ignored because the activity is already in the requested state. XrExtensionResult.XR_RESULT_ERROR_NOT_ALLOWED: The request has been rejected because the activity does not have the required capability (e.g. called by an embedded guest activity.) XrExtensionResult.XR_RESULT_ERROR_SYSTEM: A unrecoverable service side error has happened.

executor: Executor

the executor the callback will be called on.

setPreferredAspectRatio

Added in 1.0.0-alpha01
fun setPreferredAspectRatio(activity: Activity, preferredRatio: Float): Unit

Sets a preferred main panel aspect ratio for home space mode.

The ratio is only applied to the activity. If the activity launches another activity in the same task, the ratio is not applied to the new activity. Also, while the activity is in full space mode, the preference is temporarily removed.

Parameters
activity: Activity

the activity to set the preference.

preferredRatio: Float

the aspect ratio determined by taking the panel's width over its height. A value <= 0.0f means there are no preferences.

setPreferredAspectRatio

Added in 1.0.0-alpha01
fun setPreferredAspectRatio(
    activity: Activity,
    preferredRatio: Float,
    callback: Consumer<XrExtensionResult!>,
    executor: Executor
): Unit

Sets a preferred main panel aspect ratio for an activity that is not SPATIAL_UI_CAPABLE.

The ratio is only applied to the activity. If the activity launches another activity in the same task, the ratio is not applied to the new activity. Also, while the activity is SPATIAL_UI_CAPABLE, the preference is temporarily removed. While the activity is SPATIAL_UI_CAPABLE, use ReformOptions API instead.

Parameters
activity: Activity

the activity to set the preference.

preferredRatio: Float

the aspect ratio determined by taking the panel's width over its height. A value <= 0.0f means there are no preferences.

callback: Consumer<XrExtensionResult!>

the callback that will be called with the result. XrExtensionResult will indicate either of the following: XrExtensionResult.XR_RESULT_SUCCESS: The request has been accepted, and the client can expect that a spatial state callback with an updated SpatialState will run shortly. XrExtensionResult.XR_RESULT_SUCCESS_NOT_VISIBLE: The request has been accepted, but will not immediately change the spatial state. A spatial state callback with an updated SpatialState won't run until the activity loses the SPATIAL_UI_CAPABLE capability. XrExtensionResult.XR_RESULT_IGNORED_ALREADY_APPLIED: The request has been ignored because the activity is already in the requested state. XrExtensionResult.XR_RESULT_ERROR_NOT_ALLOWED: The request has been rejected because the activity does not have the required capability (e.g. called by an embedded guest activity.) XrExtensionResult.XR_RESULT_ERROR_SYSTEM: A unrecoverable service side error has happened.

executor: Executor

the executor the callback will be called on.

setSpatialStateCallback

Added in 1.0.0-alpha01
Deprecated in 1.0.0-alpha01
fun setSpatialStateCallback(
    activity: Activity,
    callback: Consumer<SpatialStateEvent!>,
    executor: Executor
): Unit

testGetNodeWithEnvironmentToken

Added in 1.0.0-alpha01
Deprecated in 1.0.0-alpha01
fun testGetNodeWithEnvironmentToken(token: EnvironmentToken): FakeXrExtensions.FakeNode

Returns a FakeNode with corresponding environmentToken if it was created and found

testGetNodeWithGltfToken

Added in 1.0.0-alpha01
Deprecated in 1.0.0-alpha01
fun testGetNodeWithGltfToken(token: GltfModelToken): FakeXrExtensions.FakeNode

Returns a FakeNode with corresponding gltfModelToken if it was created and found

Public properties

fakeEnvironmentNode

Added in 1.0.0-alpha01
val fakeEnvironmentNodeFakeXrExtensions.FakeNode!

fakeNodeForMainWindow

Added in 1.0.0-alpha01
val fakeNodeForMainWindowFakeXrExtensions.FakeNode!

fakeTaskNode

Added in 1.0.0-alpha01
val fakeTaskNodeFakeXrExtensions.FakeNode!

mainWindowHeight

Added in 1.0.0-alpha01
val mainWindowHeightInt

mainWindowWidth

Added in 1.0.0-alpha01
val mainWindowWidthInt

openXrWorldSpaceType

Added in 1.0.0-alpha01
var openXrWorldSpaceTypeInt

spatialStateCallback

Added in 1.0.0-alpha01
val spatialStateCallbackConsumer<SpatialState!>!