From d2ccad9f46635974d858497b6ad427cfe7b88c4b Mon Sep 17 00:00:00 2001 From: Alexi Chepura Date: Tue, 24 Oct 2023 16:42:39 +0300 Subject: [PATCH 1/2] xr_wait_frame lock match instead of unwrap --- src/lib.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/lib.rs b/src/lib.rs index ba3c952..6a1d2c2 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -259,7 +259,13 @@ pub fn xr_begin_frame( } { let _span = info_span!("xr_wait_frame").entered(); - *frame_state.lock().unwrap() = frame_waiter.lock().unwrap().wait().unwrap(); + *frame_state.lock().unwrap() = match frame_waiter.lock().unwrap().wait() { + Ok(a) => a, + Err(e) => { + warn!("error: {}", e); + return; + } + }; } { let _span = info_span!("xr_begin_frame").entered(); From 02d1368d25f72a8d4b6a5b449bc46cc489589b5b Mon Sep 17 00:00:00 2001 From: Alexi Chepura Date: Tue, 24 Oct 2023 17:29:25 +0300 Subject: [PATCH 2/2] android example xbuild --- examples/android/README.md | 15 +++++++++++++++ examples/android/manifest.yaml | 25 +++++++++++++++++++++++++ 2 files changed, 40 insertions(+) create mode 100644 examples/android/manifest.yaml diff --git a/examples/android/README.md b/examples/android/README.md index 801a9ad..3936403 100644 --- a/examples/android/README.md +++ b/examples/android/README.md @@ -5,10 +5,25 @@ Get libopenxr_loader.so from the Oculus OpenXR Mobile SDK and add it to `example https://developer.oculus.com/downloads/package/oculus-openxr-mobile-sdk/ `examples/android/runtime_libs/arm64-v8a/libopenxr_loader.so` +## Run Running on Meta Quest can be done with https://github.com/rust-mobile/cargo-apk. ```sh cargo apk run --release ``` +But cargo-apk is deprecated in favour of xbuild https://github.com/rust-mobile/xbuild. +```sh +# Install latest version of xbuild +cargo install --git https://github.com/rust-mobile/xbuild +``` +```sh +# List devices and copy device string "adb:***" +x devices + +# Run on this device +x run --release --device adb:*** +``` +There is [manifest.yaml](./manifest.yaml) example required by xbuild. +Interface for this manifest can be found as AndroidConfig struct in https://github.com/rust-mobile/xbuild/blob/master/xbuild/src/config.rs ## Notes diff --git a/examples/android/manifest.yaml b/examples/android/manifest.yaml new file mode 100644 index 0000000..81a41e0 --- /dev/null +++ b/examples/android/manifest.yaml @@ -0,0 +1,25 @@ +android: + runtime_libs: + - "runtime_libs" + manifest: + package: "org.bevyengine.example_openxr_android" + application: + label: "Bevy Openxr Android" + theme: "@android:style/Theme.DeviceDefault.NoActionBar.Fullscreen" + meta_data: + - name: "com.samsung.android.vr.application.mode" + value: "vr_only" + - name: "com.oculus.supportedDevices" + value: "quest|quest2|quest3" + activities: + - config_changes: "density|keyboard|keyboardHidden|navigation|orientation|screenLayout|screenSize|uiMode" + launch_mode: "singleTask" + orientation: "landscape" + intent_filters: + - actions: + - "android.intent.action.MAIN" + categories: + - "com.oculus.intent.category.VR" + - "android.intent.category.LAUNCHER" + sdk: + target_sdk_version: 32