feat: launch Quest SteamVR and harden XR lifecycle

This commit is contained in:
XxJSONDeruloxX committed 2026-10-14 18:10:20 -04:00
1 parent e1d096127c
commit 7277386cd3
8 files changed
+152 -52

No files matched your search

+11 -5
View File
@@ -3,7 +3,8 @@ param(
[Parameter(Mandatory = $true)][string]$Adb,
[string]$Sdk = "$env:USERPROFILE\android-sdk",
[string]$NdkVersion = '27.3.13750724',
[string]$BuildTools = '35.0.0'
[string]$BuildTools = '35.0.0',
[string]$Apk
)
$ErrorActionPreference = 'Stop'
function Invoke-Checked([string]$Program, [string[]]$Arguments) {
@@ -14,11 +15,16 @@ function Invoke-Checked([string]$Program, [string[]]$Arguments) {
$repo = Split-Path $PSScriptRoot -Parent
Push-Location $repo
try {
Invoke-Checked .\gradlew.bat @(':questxr:assembleDebug', "-PndkVersion=$NdkVersion", '-PskipRust=true', '--console=plain')
if (-not $Apk) {
Invoke-Checked .\gradlew.bat @(':questxr:assembleDebug', "-PndkVersion=$NdkVersion", '-PskipRust=true', '--console=plain')
$Apk = 'questxr\build\outputs\apk\debug\questxr-debug.apk'
}
if (-not (Test-Path -LiteralPath $Apk -PathType Leaf)) { throw 'APK input does not exist' }
New-Item -ItemType Directory -Path build\quest-deploy -Force | Out-Null
$tools = Join-Path $Sdk "build-tools\$BuildTools"
$aligned = 'questxr\build\questxr-aligned.apk'
$signed = 'questxr\build\questxr-signed.apk'
Invoke-Checked "$tools\zipalign.exe" @('-f', '-p', '4', 'questxr\build\outputs\apk\debug\questxr-debug.apk', $aligned)
$aligned = 'build\quest-deploy\aligned.apk'
$signed = 'build\quest-deploy\signed.apk'
Invoke-Checked "$tools\zipalign.exe" @('-f', '-p', '4', $Apk, $aligned)
Invoke-Checked "$tools\apksigner.bat" @('sign', '--key', "$KeyDirectory\droiddeck-release.pk8", '--cert', "$KeyDirectory\droiddeck-release.x509.pem", '--out', $signed, $aligned)
$certificate = Invoke-Checked "$tools\apksigner.bat" @('verify', '--print-certs', $signed)
$expected = (Get-Content keystore\release-signer.sha256 -Raw).Trim()
+37 -17
View File
@@ -17,15 +17,19 @@ def main():
parser.add_argument('--require-controllers', action='store_true')
parser.add_argument('--surface', action='store_true')
parser.add_argument('--guest', action='store_true')
parser.add_argument('--keep-awake', action='store_true')
parser.add_argument('--steamvr', action='store_true')
args = parser.parse_args()
if args.seconds < 5 or args.seconds > 600:
parser.error('--seconds must be between 5 and 600')
if args.steamvr and not args.guest:
parser.error('--steamvr requires --guest')
serial = resolve_serial(args.adb, args.serial)
args.output.mkdir(parents=True, exist_ok=True)
def adb(*command):
return subprocess.run([args.adb, '-s', serial, *command], check=True,
capture_output=True, text=True).stdout
capture_output=True, text=True, timeout=15).stdout
package = 'com.droiddeck.launcher' if args.guest else 'com.droiddeck.questxr'
health_path = f'/sdcard/Android/data/{package}/files/xr-health.json'
@@ -33,40 +37,56 @@ def main():
adb('shell', 'am', 'force-stop', package)
adb('shell', 'rm', '-f', health_path)
adb('shell', 'input', 'keyevent', 'KEYCODE_WAKEUP')
adb('shell', 'am', 'broadcast', '-a', 'com.oculus.vrpowermanager.prox_close')
component = f'{package}/.QuestXrActivity' if args.guest else f'{package}/android.app.NativeActivity'
launch = ['shell', 'am', 'start', '-n', component]
if args.surface:
launch += ['--ez', 'surface_test', 'true']
if args.guest:
launch += ['--ez', 'guest_surface', 'true']
adb(*launch)
if args.steamvr:
launch += ['--ez', 'start_steamvr', 'true']
samples = []
failure = None
deadline = time.monotonic() + args.seconds
while time.monotonic() < deadline:
time.sleep(1)
try:
adb('shell', 'am', 'broadcast', '-a', 'com.oculus.vrpowermanager.prox_close')
try:
sample = json.loads(adb('shell', 'cat', health_path))
samples.append(sample)
if sample.get('error'):
failure = sample['error']
break
except (subprocess.CalledProcessError, json.JSONDecodeError):
pass
log = adb('logcat', '-d', '-s', 'DroidDeckXR:I', 'OpenXR-Loader:W', 'AndroidRuntime:E')
adb(*launch)
deadline = time.monotonic() + args.seconds
while time.monotonic() < deadline:
time.sleep(1)
adb('shell', 'am', 'broadcast', '-a', 'com.oculus.vrpowermanager.prox_close')
try:
sample = json.loads(adb('shell', 'cat', health_path))
samples.append(sample)
if sample.get('error'):
failure = sample['error']
break
except (subprocess.CalledProcessError, json.JSONDecodeError):
pass
except (subprocess.CalledProcessError, subprocess.TimeoutExpired) as error:
failure = f'ADB operation failed: {type(error).__name__}'
finally:
if not args.keep_awake:
try:
adb('shell', 'am', 'broadcast', '-a', 'com.oculus.vrpowermanager.prox_far')
except (subprocess.CalledProcessError, subprocess.TimeoutExpired):
failure = failure or 'Could not restore headset proximity after testing'
try:
log = adb('logcat', '-d', '-s', 'DroidDeckXR:I', 'OpenXR-Loader:W', 'AndroidRuntime:E')
except (subprocess.CalledProcessError, subprocess.TimeoutExpired) as error:
log = str(error)
(args.output / 'logcat.txt').write_text(log, encoding='utf-8')
if len(samples) < 2:
failure = failure or 'No advancing telemetry; check runtime initialization and headset wake/proximity'
elif samples[-1]['rendered'] - samples[0]['rendered'] < 72:
failure = failure or 'Fewer than 72 additional stereo frames were submitted'
elif not any(sample['sessionState'] == 5 and sample['headFlags'] & 3 == 3 for sample in samples):
failure = failure or 'No focused session with valid position and orientation'
elif not any(sample['sessionState'] == 5 and sample['headFlags'] & 15 == 15 for sample in samples):
failure = failure or 'No focused session with tracked 6DoF position and orientation'
elif args.require_controllers and not any(all(sample['controllersActive']) for sample in samples):
failure = failure or 'Both controllers did not become active'
elif args.guest and samples[-1].get('guestFrames', 0) - samples[0].get('guestFrames', 0) < 72:
failure = failure or 'No advancing guest GPU presentation; submitting an XR layer alone is insufficient'
elif args.steamvr and samples[-1].get('steamvrState') != 4:
failure = failure or 'SteamVR did not report RUNNING'
elif samples[-1].get('source') != ('guest' if args.guest else 'surface' if args.surface else 'native'):
failure = failure or 'Wrong projection source'
report = {'ok': failure is None, 'error': failure, 'samples': samples}
+1 -1
View File
@@ -424,7 +424,7 @@ public:
VRDriverInput()->UpdateBooleanComponent(padTouch_, hand.active &&
(std::abs(hand.stick[0]) + std::abs(hand.stick[1]) > 0.01f || (hand.buttons & 1u)), 0);
VRDriverInput()->UpdateBooleanComponent(menu_, hand.active && (hand.buttons & 12u), 0);
VRDriverInput()->UpdateBooleanComponent(system_, false, 0);
VRDriverInput()->UpdateBooleanComponent(system_, hand.active && !right_ && (hand.buttons & 8u), 0);
}
void Update(const HmdQuaternion_t &head, const PadState *pad) {