FakeXrExtensions.FakeNode


public final class FakeXrExtensions.FakeNode implements Parcelable


A fake implementation of the XR extensions Node.

Summary

Public methods

int
float
@Nullable IBinder
@Nullable EnvironmentToken

This method is deprecated.

This method is no longer supported.

@Nullable Executor
@Nullable GltfModelToken

This method is deprecated.

This method is no longer supported.

@Nullable Consumer<InputEvent>
@Nullable String
@Nullable FakeXrExtensions.FakeNode
@Nullable Consumer<Integer>
@Nullable ReformOptions
@Nullable SurfaceControlViewHost.SurfacePackage
@Nullable Executor
@Nullable Consumer<NodeTransform>
float
float
float
float
float
float
float
boolean
void
listenForInput(
    @NonNull Consumer<InputEvent> listener,
    @NonNull Executor executor
)

Begins listening for 6DOF input events on this Node, and any descendant Nodes that do not have their own event listener set.

void
requestPointerCapture(
    @NonNull Consumer<Integer> stateCallback,
    @NonNull Executor executor
)

Requests pointer capture.

void
void
void

Sets the focus target for non-pointer input (eg, keyboard events) when this Node is clicked.

void

Removes the listener for 6DOF input events from this Node.

void

Disables previously-requested pointer capture on this node.

@NonNull Closeable
subscribeToTransform(
    @NonNull Consumer<NodeTransform> transformCallback,
    @NonNull Executor executor
)

Subscribes to the transform of this node, relative to the OpenXR reference space used as world space for the shared scene.

void
writeToParcel(@NonNull Parcel in, int flags)

Inherited Constants

From android.os.Parcelable
static final int
static final int

Public fields

alpha

Added in 1.0.0-alpha01
public float alpha

anchorId

Added in 1.0.0-alpha01
public IBinder anchorId

environment

Added in 1.0.0-alpha01
Deprecated in 1.0.0-alpha01
public EnvironmentToken environment

executor

Added in 1.0.0-alpha01
public Executor executor

gltfModel

Added in 1.0.0-alpha01
Deprecated in 1.0.0-alpha01
public GltfModelToken gltfModel

isVisible

Added in 1.0.0-alpha01
public boolean isVisible

listener

Added in 1.0.0-alpha01
public Consumer<InputEventlistener

name

Added in 1.0.0-alpha01
public String name

pointerCaptureStateCallback

Added in 1.0.0-alpha01
public Consumer<IntegerpointerCaptureStateCallback

reformOptions

Added in 1.0.0-alpha01
public ReformOptions reformOptions

transformExecutor

Added in 1.0.0-alpha01
public Executor transformExecutor

transformListener

Added in 1.0.0-alpha01
public Consumer<NodeTransformtransformListener

wOrientation

Added in 1.0.0-alpha01
public float wOrientation

xOrientation

Added in 1.0.0-alpha01
public float xOrientation

xPosition

Added in 1.0.0-alpha01
public float xPosition

yOrientation

Added in 1.0.0-alpha01
public float yOrientation

yPosition

Added in 1.0.0-alpha01
public float yPosition

zOrientation

Added in 1.0.0-alpha01
public float zOrientation

zPosition

Added in 1.0.0-alpha01
public float zPosition

Public methods

describeContents

Added in 1.0.0-alpha01
public int describeContents()

getAlpha

Added in 1.0.0-alpha01
public float getAlpha()

getAnchorId

Added in 1.0.0-alpha01
public @Nullable IBinder getAnchorId()

getEnvironment

Added in 1.0.0-alpha01
Deprecated in 1.0.0-alpha01
public @Nullable EnvironmentToken getEnvironment()

getExecutor

Added in 1.0.0-alpha01
public @Nullable Executor getExecutor()

getGltfModel

Added in 1.0.0-alpha01
Deprecated in 1.0.0-alpha01
public @Nullable GltfModelToken getGltfModel()

getListener

Added in 1.0.0-alpha01
public @Nullable Consumer<InputEventgetListener()

getName

Added in 1.0.0-alpha01
public @Nullable String getName()

getPointerCaptureStateCallback

Added in 1.0.0-alpha01
public @Nullable Consumer<IntegergetPointerCaptureStateCallback()

getReformOptions

Added in 1.0.0-alpha01
public @Nullable ReformOptions getReformOptions()

getTransformExecutor

Added in 1.0.0-alpha01
public @Nullable Executor getTransformExecutor()

getTransformListener

Added in 1.0.0-alpha01
public @Nullable Consumer<NodeTransformgetTransformListener()

getWOrientation

Added in 1.0.0-alpha01
public float getWOrientation()

getXOrientation

Added in 1.0.0-alpha01
public float getXOrientation()

getXPosition

Added in 1.0.0-alpha01
public float getXPosition()

getYOrientation

Added in 1.0.0-alpha01
public float getYOrientation()

getYPosition

Added in 1.0.0-alpha01
public float getYPosition()

getZOrientation

Added in 1.0.0-alpha01
public float getZOrientation()

getZPosition

Added in 1.0.0-alpha01
public float getZPosition()

isVisible

Added in 1.0.0-alpha01
public boolean isVisible()

listenForInput

Added in 1.0.0-alpha01
public void listenForInput(
    @NonNull Consumer<InputEvent> listener,
    @NonNull Executor executor
)

Begins listening for 6DOF input events on this Node, and any descendant Nodes that do not have their own event listener set. The event listener is called on the provided Executor. Calling this method replaces any existing event listener for this node.

requestPointerCapture

Added in 1.0.0-alpha01
public void requestPointerCapture(
    @NonNull Consumer<Integer> stateCallback,
    @NonNull Executor executor
)

Requests pointer capture. All XR input events that hit this node or any of its children are delivered as normal; any other input events that would otherwise be dispatched elsewhere will instead be delivered to the input queue of this node (without hit info).

The stateCallback is called immediately with the current state of this pointer capture. Whenever this node is visible and a descendant of a task that is not bounded (is in FSM or overlay space), pointer capture will be active; otherwise it will be paused.

If pointer capture is explicitly stopped by a new call to requestPointerCapture() on the same node, or by a call to stopPointerCapture(), POINTER_CAPTURE_STATE_STOPPED is passed (and the stateCallback will not be called subsequently; also, the app can be sure that no more captured pointer events will be delivered based on that request). This also occurs if the node is destroyed without explicitly stopping pointer capture, or if a new call to requestPointerCapture() is made on the same node without stopping the previous request.

If there are multiple pointer capture requests (eg from other apps) that could be active at the same time, the most recently requested one is activated; all other requests stay paused.

There can only be a single request per Node. If a new requestPointerCapture() call is made on the same node without stopping the previous pointer capture request, the previous request is automatically stopped.

Parameters
@NonNull Consumer<Integer> stateCallback

a callback that will be called when pointer capture state changes.

@NonNull Executor executor

the executor the callback will be called on.

sendInputEvent

Added in 1.0.0-alpha01
public void sendInputEvent(@NonNull InputEvent event)

sendTransformEvent

Added in 1.0.0-alpha01
public void sendTransformEvent(
    @NonNull FakeXrExtensions.FakeNodeTransform nodeTransform
)

setNonPointerFocusTarget

Added in 1.0.0-alpha01
public void setNonPointerFocusTarget(@NonNull AttachedSurfaceControl focusTarget)

Sets the focus target for non-pointer input (eg, keyboard events) when this Node is clicked. The new target is the focusTarget's underlying View Root.

stopListeningForInput

Added in 1.0.0-alpha01
public void stopListeningForInput()

Removes the listener for 6DOF input events from this Node.

stopPointerCapture

Added in 1.0.0-alpha01
public void stopPointerCapture()

Disables previously-requested pointer capture on this node. The stateCallback callback will be called with POINTER_CAPTURE_STOPPED.

subscribeToTransform

Added in 1.0.0-alpha01
public @NonNull Closeable subscribeToTransform(
    @NonNull Consumer<NodeTransform> transformCallback,
    @NonNull Executor executor
)

Subscribes to the transform of this node, relative to the OpenXR reference space used as world space for the shared scene. See XrExtensions.getOpenXrWorldSpaceType(). The provided matrix transforms a point in this node's local coordinate system into a point in world space coordinates. For example, NodeTransform.getTransform() * (0, 0, 0, 1) is the position of this node in world space. The first non-null transform will be returned immediately after the subscription set-up is complete. Note that the returned closeable must be closed by calling close() to prevent wasting system resources associated with the subscription.

Parameters
@NonNull Consumer<NodeTransform> transformCallback

a callback that will be called when this node's transform changes.

@NonNull Executor executor

the executor the callback will be called on.

Returns
@NonNull Closeable

a Closeable that must be used to cancel the subscription by calling close().

writeToParcel

Added in 1.0.0-alpha01
public void writeToParcel(@NonNull Parcel in, int flags)