FakeJxrPlatformAdapter


public final class FakeJxrPlatformAdapter


Test-only implementation of JxrPlatformAdapter

Summary

Public constructors

Public methods

void

Adds the given {@link Consumer} as a listener to be invoked when this Session's current SpatialCapabilities change.

TextureResource

Borrows the reflection texture from the currently set environment IBL.

void

Releases the listener previously added by setSpatialVisibilityChangedListener.

@NonNull ActivityPanelEntity
createActivityPanelEntity(
    @NonNull Pose pose,
    @NonNull PixelDimensions windowBoundsPx,
    @NonNull String name,
    @NonNull Activity hostActivity,
    @NonNull Entity parent
)

Factory function to create ActivityPanel to launch/move activity into.

@NonNull AnchorEntity

A factory function to create an Anchor entity from a {@link androidx.xr.runtime.internal.Anchor}.

@NonNull AnchorEntity
createAnchorEntity(
    @NonNull Dimensions bounds,
    @NonNull PlaneType planeType,
    @NonNull PlaneSemantic planeSemantic,
    @NonNull Duration searchTimeout
)

A factory function to create an Anchor entity.

@NonNull AnchorPlacement
createAnchorPlacementForPlanes(
    @NonNull Set<@NonNull PlaneType> planeTypeFilter,
    @NonNull Set<@NonNull PlaneSemantic> planeSemanticFilter
)

Creates an instance of an AnchorPlacement object.

@NonNull Entity
createEntity(@NonNull Pose pose, @NonNull String name, @NonNull Entity parent)

A factory function to create a content-less entity.

@NonNull GltfEntity
createGltfEntity(
    @NonNull Pose pose,
    @NonNull GltfModelResource loadedGltf,
    @NonNull Entity parentEntity
)

A factory function to create a SceneCore GltfEntity.

@NonNull InteractableComponent

Create an Interactable component.

@NonNull LoggingEntity

A function to create a XR Runtime Entity.

@NonNull MovableComponent
createMovableComponent(
    boolean systemMovable,
    boolean scaleInZ,
    @NonNull Set<@NonNull AnchorPlacement> anchorPlacement,
    boolean shouldDisposeParentAnchor
)

Create an instance of MovableComponent.

@NonNull PanelEntity
createPanelEntity(
    @NonNull Context context,
    @NonNull Pose pose,
    @NonNull View view,
    @NonNull Dimensions dimensions,
    @NonNull String name,
    @NonNull Entity parent
)

A factory function to create a platform PanelEntity.

@NonNull PanelEntity
createPanelEntity(
    @NonNull Context context,
    @NonNull Pose pose,
    @NonNull View view,
    @NonNull PixelDimensions pixelDimensions,
    @NonNull String name,
    @NonNull Entity parent
)

A factory function to create a platform PanelEntity.

@NonNull AnchorEntity
createPersistedAnchorEntity(
    @NonNull UUID uuid,
    @NonNull Duration searchTimeout
)

A factory function to recreate an Anchor entity which was persisted in a previous session.

@NonNull PointerCaptureComponent

Create an instance of {@link PointerCaptureComponent}.

@NonNull ResizableComponent
createResizableComponent(
    @NonNull Dimensions minimumSize,
    @NonNull Dimensions maximumSize
)

Create an instance of ResizableComponent.

@NonNull SpatialPointerComponent
@NonNull SubspaceNodeEntity
createSubspaceNodeEntity(
    @NonNull SubspaceNode subspaceNode,
    @NonNull Dimensions size
)

A factory function to create a SubspaceNodeEntity.

@NonNull SurfaceEntity
createSurfaceEntity(
    int stereoMode,
    @NonNull SurfaceEntity.CanvasShape canvasShape,
    @NonNull Pose pose,
    @NonNull Entity parentEntity
)

A factory function for an Entity which displays drawable surfaces.

ListenableFuture<@NonNull MaterialResource>
createWaterMaterial(boolean isAlphaMapVersion)

Creates a water material by querying it from the system's built-in materials.

void

Destroys the given texture resource.

void

Destroys the given water material resource.

void

Disposes of the resources used by the platform adapter.

@NonNull ActivitySpace

Returns the Activity Space entity at the root of the scene.

@NonNull Entity

Returns the entity that represents the ActivitySpace root.

@NonNull AudioTrackExtensionsWrapper

Returns a AudioTrackExtensionsWrapper instance.

CameraViewActivityPose
getCameraViewActivityPose(int cameraType)

Returns the CameraViewActivityPose for the specified camera type or null if it is not ready/available.

HeadActivityPose

Returns the HeadActivityPose for the session or null if it not ready.

@NonNull PanelEntity

Get the PanelEntity associated with the main window for the Runtime.

@NonNull MediaPlayerExtensionsWrapper

Returns a MediaPlayerExtensionsWrapper instance.

@NonNull PerceptionSpaceActivityPose

Returns the PerceptionSpaceActivityPose for the Session.

TextureResource

Returns the reflection texture from the given IBL.

@NonNull SoundPoolExtensionsWrapper

Returns a SoundPoolExtensionsWrapper instance.

@NonNull SpatialCapabilities

Return the Spatial Capabilities set that are currently supported by the platform.

@NonNull SpatialEnvironment

Returns the Environment for the Session.

@NonNull ListenableFuture<@NonNull ExrImageResource>

Loads an ExrImage for the given asset name from the assets folder using the Split Engine route.

@NonNull ListenableFuture<@NonNull ExrImageResource>
loadExrImageByByteArray(
    @NonNull byte[] assetData,
    @NonNull String assetKey
)

Loads an ExrImage from a provided byte array using the Split Engine route.

@NonNull ListenableFuture<@NonNull GltfModelResource>

Loads glTF Asset for the given asset name from the assets folder using the Split Engine route.

@NonNull ListenableFuture<@NonNull GltfModelResource>
loadGltfByByteArray(@NonNull byte[] assetData, @NonNull String assetKey)

Loads glTF Asset from a provided byte array.

ListenableFuture<@NonNull TextureResource>

Loads a texture resource for the given asset name or URL.

void

Releases the given {@link Consumer} from receiving updates when the Session's {@link SpatialCapabilities} change.

void

If the primary Activity for the Session that owns this object has focus, causes it to be placed in FullSpace Mode.

void

If the primary Activity for the Session that owns this object has focus, causes it to be placed in HomeSpace Mode.

void
setAlphaMap(
    @NonNull MaterialResource material,
    @NonNull TextureResource alphaMap
)

Sets the alpha map for the water material.

void
setAlphaStepMultiplier(
    @NonNull MaterialResource material,
    float alphaStepMultiplier
)

Sets the alpha step multiplier for the water material.

@NonNull Bundle

Sets the full space mode flag to the given {@link Bundle}.

@NonNull Bundle

Sets the inherit full space mode environment flag to the given {@link Bundle}.

void
setNormalBoundary(
    @NonNull MaterialResource material,
    float normalBoundary
)

Sets the normal boundary for the water material.

void
setNormalMap(
    @NonNull MaterialResource material,
    @NonNull TextureResource normalMap
)

Sets the normal map texture for the water material.

void
setNormalSpeed(@NonNull MaterialResource material, float normalSpeed)

Sets the normal speed for the water material.

void
setNormalTiling(@NonNull MaterialResource material, float normalTiling)

Sets the normal tiling for the water material.

void
setNormalZ(@NonNull MaterialResource material, float normalZ)

Sets the normal z for the water material.

void
setPreferredAspectRatio(@NonNull Activity activity, float preferredRatio)

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

void
setReflectionCube(
    @NonNull MaterialResource material,
    @NonNull TextureResource reflectionCube
)

Sets the reflection cube texture for the water material.

void

Sets the listener to be invoked when the spatial visibility of the rendered content of the entire scene (all entities, including children of anchors and activitySpace) changes within the user's field of view.

void

Starts the renderer.

void

Stops the renderer.

Public constructors

FakeJxrPlatformAdapter

Added in 1.0.0-alpha04
public FakeJxrPlatformAdapter()

Public methods

addSpatialCapabilitiesChangedListener

Added in 1.0.0-alpha04
public void addSpatialCapabilitiesChangedListener(
    @NonNull Executor callbackExecutor,
    @NonNull Consumer<@NonNull SpatialCapabilities> listener
)

Adds the given {@link Consumer} as a listener to be invoked when this Session's current SpatialCapabilities change. {@link Consumer#accept(SpatialCapabilities)} will be invoked on the given Executor.

borrowReflectionTexture

Added in 1.0.0-alpha04
public TextureResource borrowReflectionTexture()

Borrows the reflection texture from the currently set environment IBL.

clearSpatialVisibilityChangedListener

Added in 1.0.0-alpha04
public void clearSpatialVisibilityChangedListener()

Releases the listener previously added by setSpatialVisibilityChangedListener.

createActivityPanelEntity

Added in 1.0.0-alpha04
public @NonNull ActivityPanelEntity createActivityPanelEntity(
    @NonNull Pose pose,
    @NonNull PixelDimensions windowBoundsPx,
    @NonNull String name,
    @NonNull Activity hostActivity,
    @NonNull Entity parent
)

Factory function to create ActivityPanel to launch/move activity into.

Parameters
@NonNull Pose pose

Initial pose of the panel.

@NonNull PixelDimensions windowBoundsPx

Boundary for the window

@NonNull String name

Name of the panel.

@NonNull Activity hostActivity

Activity to host the panel.

@NonNull Entity parent

Parent entity.

createAnchorEntity

Added in 1.0.0-alpha04
public @NonNull AnchorEntity createAnchorEntity(@NonNull Anchor anchor)

A factory function to create an Anchor entity from a {@link androidx.xr.runtime.internal.Anchor}.

Parameters
@NonNull Anchor anchor

The {@link androidx.xr.runtime.internal.Anchor} to create the Anchor entity from.

createAnchorEntity

Added in 1.0.0-alpha04
public @NonNull AnchorEntity createAnchorEntity(
    @NonNull Dimensions bounds,
    @NonNull PlaneType planeType,
    @NonNull PlaneSemantic planeSemantic,
    @NonNull Duration searchTimeout
)

A factory function to create an Anchor entity.

Parameters
@NonNull Dimensions bounds

Bounds for this Anchor.

@NonNull PlaneType planeType

Orientation of the plane to which this anchor should attach.

@NonNull PlaneSemantic planeSemantic

Semantic type of the plane to which this anchor should attach.

@NonNull Duration searchTimeout

How long to search for an anchor. If this is Duration.ZERO, this will search for an anchor indefinitely.

createAnchorPlacementForPlanes

Added in 1.0.0-alpha04
public @NonNull AnchorPlacement createAnchorPlacementForPlanes(
    @NonNull Set<@NonNull PlaneType> planeTypeFilter,
    @NonNull Set<@NonNull PlaneSemantic> planeSemanticFilter
)

Creates an instance of an AnchorPlacement object.

This can be used in movable components to specify the anchor placement for the entity.

Parameters
@NonNull Set<@NonNull PlaneType> planeTypeFilter

A set of plane types to filter for.

@NonNull Set<@NonNull PlaneSemantic> planeSemanticFilter

A set of plane semantics to filter for.

createEntity

Added in 1.0.0-alpha04
public @NonNull Entity createEntity(@NonNull Pose pose, @NonNull String name, @NonNull Entity parent)

A factory function to create a content-less entity. This entity is used as a connection point for attaching children entities and managing them (i.e. setPose()) as a group.

Parameters
@NonNull Pose pose

Initial pose of the entity.

@NonNull String name

Name of the entity.

@NonNull Entity parent

Parent entity.

createGltfEntity

Added in 1.0.0-alpha04
public @NonNull GltfEntity createGltfEntity(
    @NonNull Pose pose,
    @NonNull GltfModelResource loadedGltf,
    @NonNull Entity parentEntity
)

A factory function to create a SceneCore GltfEntity. The parent may be the activity space or GltfEntity in the scene.

createInteractableComponent

Added in 1.0.0-alpha04
public @NonNull InteractableComponent createInteractableComponent(
    @NonNull Executor executor,
    @NonNull InputEventListener listener
)

Create an Interactable component.

Parameters
@NonNull Executor executor

Executor to use for input callbacks.

@NonNull InputEventListener listener

JxrPlatformAdapter.InputEventListener for this component.

Returns
@NonNull InteractableComponent

InteractableComponent instance.

createLoggingEntity

Added in 1.0.0-alpha04
public @NonNull LoggingEntity createLoggingEntity(@NonNull Pose pose)

A function to create a XR Runtime Entity.

createMovableComponent

Added in 1.0.0-alpha04
public @NonNull MovableComponent createMovableComponent(
    boolean systemMovable,
    boolean scaleInZ,
    @NonNull Set<@NonNull AnchorPlacement> anchorPlacement,
    boolean shouldDisposeParentAnchor
)

Create an instance of MovableComponent. This component allows the user to move the entity.

Parameters
boolean systemMovable

A boolean which causes the system to automatically apply transform updates to the entity in response to user interaction.

boolean scaleInZ

A boolean which tells the system to update the scale of the Entity as the user moves it closer and further away. This is mostly useful for Panel auto-rescaling with Distance

@NonNull Set<@NonNull AnchorPlacement> anchorPlacement

AnchorPlacement information for when to anchor the entity.

boolean shouldDisposeParentAnchor

A boolean which tells the system to dispose of the parent anchor if that entity was created by the moveable component and is moved off of it.

createPanelEntity

Added in 1.0.0-alpha04
public @NonNull PanelEntity createPanelEntity(
    @NonNull Context context,
    @NonNull Pose pose,
    @NonNull View view,
    @NonNull Dimensions dimensions,
    @NonNull String name,
    @NonNull Entity parent
)

A factory function to create a platform PanelEntity. The parent can be any entity.

Parameters
@NonNull Context context

Application Context.

@NonNull Pose pose

Initial pose of the panel.

@NonNull View view

View inflating this panel.

@NonNull Dimensions dimensions

Size of the panel in meters.

@NonNull String name

Name of the panel.

@NonNull Entity parent

Parent entity.

createPanelEntity

Added in 1.0.0-alpha04
public @NonNull PanelEntity createPanelEntity(
    @NonNull Context context,
    @NonNull Pose pose,
    @NonNull View view,
    @NonNull PixelDimensions pixelDimensions,
    @NonNull String name,
    @NonNull Entity parent
)

A factory function to create a platform PanelEntity. The parent can be any entity.

Parameters
@NonNull Context context

Application Context.

@NonNull Pose pose

Initial pose of the panel.

@NonNull View view

View inflating this panel.

@NonNull PixelDimensions pixelDimensions

Dimensions for the underlying surface for the given view in pixels.

@NonNull String name

Name of the panel.

@NonNull Entity parent

Parent entity.

createPersistedAnchorEntity

Added in 1.0.0-alpha04
public @NonNull AnchorEntity createPersistedAnchorEntity(
    @NonNull UUID uuid,
    @NonNull Duration searchTimeout
)

A factory function to recreate an Anchor entity which was persisted in a previous session.

Parameters
@NonNull UUID uuid

The UUID of the persisted anchor.

@NonNull Duration searchTimeout

How long to search for an anchor. If this is Duration.ZERO, this will search for an anchor indefinitely.

createPointerCaptureComponent

Added in 1.0.0-alpha04
public @NonNull PointerCaptureComponent createPointerCaptureComponent(
    @NonNull Executor executor,
    @NonNull PointerCaptureComponent.StateListener stateListener,
    @NonNull InputEventListener inputListener
)

Create an instance of {@link PointerCaptureComponent}. This component allows the user to capture and redirect to itself all input that would be received by entities other than the Entity it is attached to and that entity's children.

In order to enable pointer capture, an application must be in full space and the entity it is attached to must be visible.

Attach this component to the entity to enable pointer capture, detach the component to restore normal input flow.

Parameters
@NonNull Executor executor

Executor used to propagate state and input events.

@NonNull PointerCaptureComponent.StateListener stateListener

Callback for updates to the state of pointer capture. Pointer capture may be temporarily lost by the application for a variety of reasons and this callback will notify of when that happens.

@NonNull InputEventListener inputListener

Callback that will receive captured InputEvents

createResizableComponent

Added in 1.0.0-alpha04
public @NonNull ResizableComponent createResizableComponent(
    @NonNull Dimensions minimumSize,
    @NonNull Dimensions maximumSize
)

Create an instance of ResizableComponent. This component allows the user to resize the entity.

Parameters
@NonNull Dimensions minimumSize

Minimum size constraint.

@NonNull Dimensions maximumSize

Maximum size constraint.

createSpatialPointerComponent

Added in 1.0.0-alpha04
public @NonNull SpatialPointerComponent createSpatialPointerComponent()

createSubspaceNodeEntity

Added in 1.0.0-alpha04
public @NonNull SubspaceNodeEntity createSubspaceNodeEntity(
    @NonNull SubspaceNode subspaceNode,
    @NonNull Dimensions size
)

A factory function to create a SubspaceNodeEntity.

Parameters
@NonNull SubspaceNode subspaceNode

The SubspaceNode to create the SubspaceNodeEntity from.

@NonNull Dimensions size

The size to make the SubspaceNodeEntity.

createSurfaceEntity

Added in 1.0.0-alpha04
public @NonNull SurfaceEntity createSurfaceEntity(
    int stereoMode,
    @NonNull SurfaceEntity.CanvasShape canvasShape,
    @NonNull Pose pose,
    @NonNull Entity parentEntity
)

A factory function for an Entity which displays drawable surfaces.

createWaterMaterial

Added in 1.0.0-alpha04
public ListenableFuture<@NonNull MaterialResourcecreateWaterMaterial(boolean isAlphaMapVersion)

Creates a water material by querying it from the system's built-in materials. The future returned by this method will fire listeners on the UI thread if Runnable::run is supplied.

destroyTexture

Added in 1.0.0-alpha04
public void destroyTexture(@NonNull TextureResource texture)

Destroys the given texture resource.

destroyWaterMaterial

Added in 1.0.0-alpha04
public void destroyWaterMaterial(@NonNull MaterialResource material)

Destroys the given water material resource.

dispose

Added in 1.0.0-alpha04
public void dispose()

Disposes of the resources used by the platform adapter.

getActivitySpace

Added in 1.0.0-alpha04
public @NonNull ActivitySpace getActivitySpace()

Returns the Activity Space entity at the root of the scene.

getActivitySpaceRootImpl

Added in 1.0.0-alpha04
public @NonNull Entity getActivitySpaceRootImpl()

Returns the entity that represents the ActivitySpace root.

SDK's factory methods are expected to use this entity as the default parent for all content entities when no parent is specified.

getAudioTrackExtensionsWrapper

Added in 1.0.0-alpha04
public @NonNull AudioTrackExtensionsWrapper getAudioTrackExtensionsWrapper()

Returns a AudioTrackExtensionsWrapper instance.

getCameraViewActivityPose

Added in 1.0.0-alpha04
public CameraViewActivityPose getCameraViewActivityPose(int cameraType)

Returns the CameraViewActivityPose for the specified camera type or null if it is not ready/available.

getHeadActivityPose

Added in 1.0.0-alpha04
public HeadActivityPose getHeadActivityPose()

Returns the HeadActivityPose for the session or null if it not ready.

getMainPanelEntity

Added in 1.0.0-alpha04
public @NonNull PanelEntity getMainPanelEntity()

Get the PanelEntity associated with the main window for the Runtime.

getMediaPlayerExtensionsWrapper

Added in 1.0.0-alpha04
public @NonNull MediaPlayerExtensionsWrapper getMediaPlayerExtensionsWrapper()

Returns a MediaPlayerExtensionsWrapper instance.

getPerceptionSpaceActivityPose

Added in 1.0.0-alpha04
public @NonNull PerceptionSpaceActivityPose getPerceptionSpaceActivityPose()

Returns the PerceptionSpaceActivityPose for the Session.

getReflectionTextureFromIbl

Added in 1.0.0-alpha04
public TextureResource getReflectionTextureFromIbl(@NonNull ExrImageResource iblToken)

Returns the reflection texture from the given IBL.

getSoundPoolExtensionsWrapper

Added in 1.0.0-alpha04
public @NonNull SoundPoolExtensionsWrapper getSoundPoolExtensionsWrapper()

Returns a SoundPoolExtensionsWrapper instance.

getSpatialCapabilities

Added in 1.0.0-alpha04
public @NonNull SpatialCapabilities getSpatialCapabilities()

Return the Spatial Capabilities set that are currently supported by the platform.

getSpatialEnvironment

Added in 1.0.0-alpha04
public @NonNull SpatialEnvironment getSpatialEnvironment()

Returns the Environment for the Session.

loadExrImageByAssetName

Added in 1.0.0-alpha04
public @NonNull ListenableFuture<@NonNull ExrImageResourceloadExrImageByAssetName(@NonNull String assetName)

Loads an ExrImage for the given asset name from the assets folder using the Split Engine route.

loadExrImageByByteArray

Added in 1.0.0-alpha04
public @NonNull ListenableFuture<@NonNull ExrImageResourceloadExrImageByByteArray(
    @NonNull byte[] assetData,
    @NonNull String assetKey
)

Loads an ExrImage from a provided byte array using the Split Engine route.

loadGltfByAssetName

Added in 1.0.0-alpha04
public @NonNull ListenableFuture<@NonNull GltfModelResourceloadGltfByAssetName(@NonNull String assetName)

Loads glTF Asset for the given asset name from the assets folder using the Split Engine route. The future returned by this method will fire listeners on the UI thread if Runnable::run is supplied.

loadGltfByByteArray

Added in 1.0.0-alpha04
public @NonNull ListenableFuture<@NonNull GltfModelResourceloadGltfByByteArray(@NonNull byte[] assetData, @NonNull String assetKey)

Loads glTF Asset from a provided byte array. The future returned by this method will fire listeners on the UI thread if Runnable::run is supplied.

loadTexture

Added in 1.0.0-alpha04
public ListenableFuture<@NonNull TextureResourceloadTexture(@NonNull String assetName, @NonNull TextureSampler sampler)

Loads a texture resource for the given asset name or URL. The future returned by this method will fire listeners on the UI thread if Runnable::run is supplied.

removeSpatialCapabilitiesChangedListener

Added in 1.0.0-alpha04
public void removeSpatialCapabilitiesChangedListener(
    @NonNull Consumer<@NonNull SpatialCapabilities> listener
)

Releases the given {@link Consumer} from receiving updates when the Session's {@link SpatialCapabilities} change.

requestFullSpaceMode

Added in 1.0.0-alpha04
public void requestFullSpaceMode()

If the primary Activity for the Session that owns this object has focus, causes it to be placed in FullSpace Mode. Otherwise, this call does nothing.

requestHomeSpaceMode

Added in 1.0.0-alpha04
public void requestHomeSpaceMode()

If the primary Activity for the Session that owns this object has focus, causes it to be placed in HomeSpace Mode. Otherwise, this call does nothing.

setAlphaMap

Added in 1.0.0-alpha04
public void setAlphaMap(
    @NonNull MaterialResource material,
    @NonNull TextureResource alphaMap
)

Sets the alpha map for the water material.

setAlphaStepMultiplier

Added in 1.0.0-alpha04
public void setAlphaStepMultiplier(
    @NonNull MaterialResource material,
    float alphaStepMultiplier
)

Sets the alpha step multiplier for the water material.

setFullSpaceMode

Added in 1.0.0-alpha04
public @NonNull Bundle setFullSpaceMode(@NonNull Bundle bundle)

Sets the full space mode flag to the given {@link Bundle}.

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

The flag will be ignored when no {@link 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 {@link 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
@NonNull Bundle bundle

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

Returns
@NonNull Bundle

the input {@code bundle} with the full space mode flag set.

setFullSpaceModeWithEnvironmentInherited

Added in 1.0.0-alpha04
public @NonNull Bundle setFullSpaceModeWithEnvironmentInherited(@NonNull Bundle bundle)

Sets the inherit full space mode environment flag to the given {@link Bundle}.

The {@link Bundle} then could be used to launch an {@link Activity} with requesting to enter full space mode while inherit the existing environment through {@link Activity#startActivity}. If there's a bundle used for customizing how the {@link Activity} should be started by {@link ActivityOptions.toBundle} or {@link androidx.core.app.ActivityOptionsCompat.toBundle}, 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 {@link 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 {@link 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.

Parameters
@NonNull Bundle bundle

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

Returns
@NonNull Bundle

the input {@code bundle} with the inherit full space mode flag set.

setNormalBoundary

Added in 1.0.0-alpha04
public void setNormalBoundary(
    @NonNull MaterialResource material,
    float normalBoundary
)

Sets the normal boundary for the water material.

setNormalMap

Added in 1.0.0-alpha04
public void setNormalMap(
    @NonNull MaterialResource material,
    @NonNull TextureResource normalMap
)

Sets the normal map texture for the water material.

setNormalSpeed

Added in 1.0.0-alpha04
public void setNormalSpeed(@NonNull MaterialResource material, float normalSpeed)

Sets the normal speed for the water material.

setNormalTiling

Added in 1.0.0-alpha04
public void setNormalTiling(@NonNull MaterialResource material, float normalTiling)

Sets the normal tiling for the water material.

setNormalZ

Added in 1.0.0-alpha04
public void setNormalZ(@NonNull MaterialResource material, float normalZ)

Sets the normal z for the water material.

setPreferredAspectRatio

Added in 1.0.0-alpha04
public void setPreferredAspectRatio(@NonNull Activity activity, float preferredRatio)

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.

If the activity's current aspect ratio differs from the {@code preferredRatio}, the panel is automatically resized. This resizing preserves the panel's area. To avoid runtime resizing, consider specifying the desired aspect ratio in your {@code AndroidManifest.xml}. This ensures your activity launches with the preferred aspect ratio from the start.

Parameters
@NonNull Activity activity

the activity to set the preference.

float preferredRatio

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

setReflectionCube

Added in 1.0.0-alpha04
public void setReflectionCube(
    @NonNull MaterialResource material,
    @NonNull TextureResource reflectionCube
)

Sets the reflection cube texture for the water material.

setSpatialVisibilityChangedListener

Added in 1.0.0-alpha04
public void setSpatialVisibilityChangedListener(
    @NonNull Executor callbackExecutor,
    @NonNull Consumer<@NonNull SpatialVisibility> listener
)

Sets the listener to be invoked when the spatial visibility of the rendered content of the entire scene (all entities, including children of anchors and activitySpace) changes within the user's field of view.

This API only checks if the bounds of the renderable content are within the user's field of view. It does not check if the rendered content is visible to the user. For example, if the user is looking straight ahead, and there's only a single invisible child entity (alpha = 0) in front of the user, this API will return SpatialVisibility.WITHIN_FOV even though the user cannot see anything.

The listener is invoked on the provided executor. If the app intends to modify the UI elements/views during the callback, the app should provide the thread executor that is appropriate for the UI operations. For example, if the app is using the main thread to render the UI, the app should provide the main thread (Looper.getMainLooper()) executor. If the app is using a separate thread to render the UI, the app should provide the executor for that thread.

There can only be one listener set at a time. If a new listener is set, the previous listener will be released.

Parameters
@NonNull Executor callbackExecutor

The executor to run the listener on.

@NonNull Consumer<@NonNull SpatialVisibility> listener

The Consumer to be invoked asynchronously on the given callbackExecutor whenever the spatial visibility of the renderable content changes. The parameter passed to the Consumer’s accept method is the new value for SpatialVisibility.

startRenderer

Added in 1.0.0-alpha04
public void startRenderer()

Starts the renderer.

stopRenderer

Added in 1.0.0-alpha04
public void stopRenderer()

Stops the renderer.