Skip to content

Quest input and session fixes: ray requests, animation prop, VRActivity re-entry, sound preload (bridge half) - #638

Draft
oliedis wants to merge 8 commits into
developfrom
claude/quest-input-fixes
Draft

oliedis wants to merge 8 commits into
developfrom
claude/quest-input-fixes

Conversation

@oliedis

@oliedis oliedis commented Nov 28, 2026 •

Copy link
Copy Markdown
Member

Fixes for the Quest bugs the XR Demos apps (Soak Squad and others) found on Quest 3 with 3.2.3, all re-checked as still present in 3.3.0. This PR is the viro half: the Android bridge and the Quest JavaScript. The renderer half is ReactVision/virocore#476.

Not tested on a headset. No Quest was available. Nothing below has run on a device. examples/quest-input-validation is a scene and a checklist for doing that.

What changed

Brief item Status Workaround ID
2.1 Crash: ray asked for before the controller is attached Fixed viroreact-controller-ray-before-attach
2.3 Ray promises that never settle Fixed here in the bridge, and at the source in virocore#476 viroreact-controller-ray-weak-callback
2.4 animation prop set again re-plays a running animation Fixed (none given)
2.2 ViroController.onClickState receives nothing on Quest Instrumented, plus one bridge defect fixed. Root cause unknown viroreact-quest-controller-click-route (keep)
2.6 Two navigators after leaving and re-entering The two clear defects fixed (none given)
2.7 onHandUpdate not forwarded on Quest JavaScript forwarded. No native emitter exists viroreact-quest-hand-update (keep)
2.10 Bundled sounds fail to preload Fixed (none given)
2.8, 2.9 glTF In virocore#476
2.5 Input on the main thread Not attempted: design proposal, follow-up

2.1 and 2.3: getControllerRayAsync / getControllerForwardAsync

  • VRTController no longer dereferences a null native controller. Both calls reject with E_CONTROLLER_NOT_READY before the scene is attached, after tear down, and when the tag is not a mounted ViroController.
  • The renderer holds each request's callback through a weak JNI reference and nothing else held it. ControllerModule now holds every request until it is answered, and rejects with E_CONTROLLER_TIMEOUT after 2 s if the renderer never answers. Every path settles the promise exactly once. This works with the current renderer; virocore#476 also fixes the reference itself.
  • Behaviour change: getControllerRayAsync used to resolve null when the tag was not a VRTController; it now rejects. A source with no ray of its own still resolves null.
  • iOS checked: getRayAsync resolves nil and the forward vector path has no equivalent dereference. No change.

2.4: animation prop

VRTNode.setAnimation compares name, run, loop, delay, duration and interruptible with the values last applied and returns when nothing changed. Before, every re-application called playAnimation (twice on a Viro3DObject), which logged a warning on the main thread, and restarted an interruptible animation. The message is now verbose.

2.2: controller clicks

The break is not located. What the bridge can contribute is here:

  • A ViroInput trace (adb shell setprop log.tag.ViroInput VERBOSE) of each click reaching ComponentEventDelegate.onClick and ViroEventEmitter.emit, and of each VRTController having its delegate set, clicks enabled and being torn down. virocore#476 traces the renderer's hops under the same tag. The example's README says how to read it.
  • A real bridge defect, which may or may not be the cause: the renderer delivers controller events to the delegate set last, and when that VRTController was torn down (a pushed scene popped, a second ViroController unmounted) the survivor never got the delegate back. It now does, and a second ViroController under one navigator logs a warning.

2.6: VRActivity re-entry

  • VRLauncherModule watches activity lifecycle and sends ViroVRActivityFinishing once per VRActivity that starts finishing (the generated activity finishing itself, the system, or exitVRScene()). No change to the generated VRActivity.kt, so no new prebuild is needed.
  • On that event, and at once in exitVRScene(), VRQuestNavigatorBridge.retireEntryPoints() drops every mounted entry point's intent and op subscriptions. Ops were affected too: a stale listener took push / pop meant for the next view.
  • launchVRScene holds the launch while a VRActivity is finishing and not destroyed, until onActivityDestroyed or 4 s. This is a wait, not a refusal, so the Enter button still works in that window. startActivity now runs on the main thread.
  • Not done, on purpose: ending the headset view when ViroXRSceneNavigator unmounts. That is new behaviour, not a defect fix.

2.7: onHandUpdate

Forwarded from ViroXRSceneNavigator through the intent to ViroVRSceneNavigator, which now passes it to the native view as onHandUpdateViro (it was declared in the props but never wired). The handler will still not be called. VRTVRSceneNavigatorManager only registers the event name: nothing in viro_bridge sends it, and ViroViewOpenXR has no hand-joint listener to send it from. The brief's "its native manager emits onHandUpdateViro" does not hold in 3.3.0. Adding the emitter is a per-frame data path that needs a design and a device; see virocore#476.

2.10: sound preload

SoundModule.preloadSounds passed the string straight to new SoundData(path). In a release build a bundled sound is a resource name with no scheme, and the renderer downloads anything that is not res:/<id> as a URL, which is the IO error downloading file at URL [assets_audio_squirtstart] in the logs. preloadSounds now resolves the name through Helper.parseUri, as VRTBaseSound does for a ViroSound's own source. No renderer change is needed: VROModelIOUtil::retrieveResourceAsync already reads res: paths from the app's resources.

Verification

  • npx jest: 1131 tests pass, 7 of them new (__test__/questSessionLifecycle.test.ts). 23 suites fail to load, the same 23 as on develop: they need the sibling viro-web-renderer checkout.
  • tsc --noEmit: no errors outside the web files, which need the same checkout.
  • Java: the 12 changed or new bridge files compile with javac against React Native 0.88.1's react-android classes, the shipped renderer classes and the shipped bridge classes. 7 JUnit tests pass for the two pure-Java pieces (android/viro_bridge/src/test), run with JUnit directly.
  • Not run: the Gradle build. dl.google.com is blocked in the environment this was written in, so there was no Android SDK or Android Gradle Plugin. :viro_bridge:assembleRelease and the new tests under Gradle have not run.
  • android/react_viro/react_viro-release.aar is not rebuilt, and neither is viro_renderer-release.aar. Until prepare_release.sh runs, none of the Android changes reach an app.

To check on a Quest 3

Use examples/quest-input-validation (its README has the full table). In short:

  1. Launch 10 times: no NullPointerException; early ray requests reject with E_CONTROLLER_NOT_READY, later ones resolve.
  2. Run 5 minutes under GC pressure: no unsettled ray requests, no timeouts, more than 10,000 resolved.
  3. 100 re-renders with an inline animation: one start, no Unable to play animation lines.
  4. Each trigger, A, B, X, Y and menu, aimed at nothing, at a node with no handlers, and after re-entering: read the ViroInput trace to see where a click stops.
  5. Enter, Home, return and enter again quickly, 20 times: one scene mounted each time, one VRActivity, no crash.
  6. Release build: ViroSound.preloadSounds of bundled MP3s resolves result: true for each, on first launch and after re-entering the headset view.

Follow-up

  • 2.5: deliver controller clicks and ray answers off the main thread, or through JSI, and expose a synchronous read of the latest controller pose per source. A design proposal, not attempted here.
  • 2.7: a hand-joint emitter in the renderer and the bridge.

🤖 Generated with Claude Code

https://claude.ai/code/session_01JoDeNibskBVXyR57tP3WdH

doranteseduardo and others added 5 commits November 26, 2026 17:54
…e attach

getControllerRayAsync and getControllerForwardAsync threw a NullPointerException on
the main thread when the ViroController's scene had not reached the renderer, and
never settled when the callback, which the renderer holds weakly, was collected
before the answer. They now reject with E_CONTROLLER_NOT_READY, the bridge holds
each request until it is answered, and a request the renderer never answers
rejects with E_CONTROLLER_TIMEOUT after 2 seconds.

Also for ViroController events: a verbose ViroInput trace of clicks through the
bridge, and the event delegate goes back to a mounted ViroController when a
newer one is torn down.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JoDeNibskBVXyR57tP3WdH
Under Fabric a parent re-render with a new but equal animation object applied
the prop again, which logged 'Unable to play animation in state RUNNING' on the
main thread each time (twice on a Viro3DObject) and restarted an interruptible
animation.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JoDeNibskBVXyR57tP3WdH
Its React surface stays mounted until the activity is destroyed, with its
ViroQuestEntryPoint still subscribed to intents and navigator ops. VRLauncher
now reports a VRActivity that starts finishing, entry points stop listening,
and launchVRScene waits for a finishing VRActivity to be destroyed.

Also forwards onHandUpdate from ViroXRSceneNavigator through to the native
view. Nothing native sends the event yet.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JoDeNibskBVXyR57tP3WdH
…ase build

A require()d sound is a resource name with no scheme in a release build. It was
handed to the renderer as it came, which downloads anything that is not res:/<id>
as a URL, so every preload failed.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JoDeNibskBVXyR57tP3WdH
@oliedis oliedis changed the title Quest input and session fixes: ray requests, animation prop, VRActivity re-entry (bridge half) Quest input and session fixes: ray requests, animation prop, VRActivity re-entry, sound preload (bridge half) Nov 28, 2026
… dispatcher check

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JoDeNibskBVXyR57tP3WdH
…tializeCore

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JoDeNibskBVXyR57tP3WdH
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants