Repository navigation
Keep a Meta Quest headset awake through the proximity override - #4
Merged
Merged
Conversation
On a Quest, a screen wake lock does not stop the proximity sensor from putting the headset to sleep when it is taken off. The com.oculus.vrpowermanager.prox_close broadcast does: it makes the headset act as if it is worn, needs no permission, and an ordinary app may send it. On a Quest, Keep screen on becomes "Keep headset awake". The service sends prox_close when it starts and every minute after, and automation_disable when it stops, so the sensor works again. Tested on a Quest 3: with the headset off, it stayed awake until the timer ended and slept seconds later. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changed
On a Meta Quest, Keep screen on becomes Keep headset awake:
KeepScreenOnServicestill holds the screen wake lock. On a Quest it also sends thecom.oculus.vrpowermanager.prox_closebroadcast when it starts and every minute after. When the timer ends or the user stops it, it sendscom.oculus.vrpowermanager.automation_disable, so the proximity sensor works again.DevicePlatformreplacessupportsKeepAwakewithsupportsStayAwakeandneedsProximityOverride. A newProximityOverrideobject holds the broadcast actions and the renewal interval. Unit tests cover both.Phones behave exactly as before.
Why
A wake lock and
stay_on_while_plugged_indon't stop the Quest's proximity sensor from putting the headset to sleep about 20 seconds after it is taken off.prox_closemakes the headset act as if it is worn. Meta Quest Developer Hub's Proximity Sensor switch uses the same override.On the Quest 3, both broadcasts are handled by receivers in
system_serverthat require no permission, and neither action is a protected broadcast. Sent with an ordinary app's user ID, they kept the headset awake and released it.Reviewer notes
onDestroy, the override stays on until it lapses or the headset restarts.Testing
./gradlew testDebugUnitTest lintDebug assembleDebugpasses.🤖 Generated with Claude Code