ste-phil Posted January 26 Share Posted January 26 Hello, I am required to develop an OpenXR application with Java/C++ that has support for Android Activity switching. I reverse engineered the HTC unity package to determine the correct stuff that needs to be in the Android Manifest file and to be able to create this in a simple android studio project. My project structure should look like the following. An Android application with 2 activities. The "MAIN" activity is just a 2D activity (could also be an OpenXR 'immersive' activity, depending on our future needs). This main activity is used to provide some input and latter on open the 2nd activity via an Android Intent. The second activity is basically on OpenXR application based on the hello_xr application provided by Khronos. Now the issue is that when it comes to switching from the main activity to the second one. I am currently switching via a simple Intent where I specify the target activity. This all works great because it calls the android_main() of the 2nd activity and executes the code (creatiion of an openxrinstance / session / etc) until it comes to the actual rendering of the layers where the OpenXR runtime just passes the "shouldRender = false" flag in the xrWaitFrame() (https://registry.khronos.org/OpenXR/specs/1.0/man/html/xrWaitFrame.html). This stays like that forever (tested for at least a minute), so I am assuming it dead locked somewhere. Investigating logcat does not show any errors at all only a specific line that is printed forever while the screen stays black. Googling that line yields nothing so I am assuming it is something internal. RENDER_ATWC: Prvious PredictedDisplay:11310562046231 >= New PredictedDisplay:11310561646160, Set New PredictedDisplay to 11310561746160 The application part of my android manifest looks like this: (When using the PlayerActivity as a startup activity everything works fine and the OpenXR application runs as expected) <application android:allowBackup="false" android:extractNativeLibs="true" android:icon="@mipmap/ic_launcher" android:label="@string/app_name"> <activity android:name=".MainActivity" android:configChanges="screenSize|screenLayout|orientation|keyboardHidden|keyboard|navigation|uiMode|density" android:excludeFromRecents="false" android:exported="true" android:launchMode="singleTask" android:resizeableActivity="false" android:screenOrientation="landscape" android:theme="@android:style/Theme.Black.NoTitleBar.Fullscreen" tools:ignore="NonResizeableActivity"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> <category android:name="org.khronos.openxr.intent.category.IMMERSIVE_HMD" /> </intent-filter> </activity> <activity android:name=".PlayerActivity" android:configChanges="screenSize|screenLayout|orientation|keyboardHidden|keyboard|navigation|uiMode|density" android:excludeFromRecents="false" android:exported="true" android:launchMode="singleTask" android:resizeableActivity="false" android:screenOrientation="landscape" android:theme="@android:style/Theme.Black.NoTitleBar.Fullscreen" tools:ignore="NonResizeableActivity"> <!-- Tell NativeActivity the name of the .so --> <meta-data android:name="android.app.lib_name" android:value="lib-name" /> <intent-filter> <!-- <action android:name="android.intent.action.MAIN" />--> <!-- <category android:name="android.intent.category.LAUNCHER" />--> <category android:name="org.khronos.openxr.intent.category.IMMERSIVE_HMD" /> </intent-filter> </activity> If you want the full log of one run, I could also provide that. In order to reproduce the issue, its possible to use the hello_xr sample and extend it with a new Java activity that opens the hello_xr activity. I would be glad to receive any input on that matter, because I have now been trying a lot of different stuff already and I have a feeling that it is somehow related to the underlying OpenXR runtime and I have no idea how to debug that. Link to comment Share on other sites More sharing options...
Sean Lu Posted January 30 Share Posted January 30 Hi ste-phil, May I know the SDK version you used? and what did you do to build your application? Thanks. Link to comment Share on other sites More sharing options...
ste-phil Posted January 30 Author Share Posted January 30 Hi, thanks for the answer! I am not using any SDK since I am making a native Android application. As far as I understand this is only required for Unity/Unreal projects. In my case, I am just using the required OpenXR Loader stated here (https://developer.vive.com/resources/openxr/unity/download/latest/) which then launches the already installed OpenXR Runtime already installed on the device. I am currently just using some modified version of the hello_xr example by Khronos and Android Studio in conjunction with the Native development stuff (NDK, Cmake, Gradle, etc..) to make an APK that installs on the device. Link to comment Share on other sites More sharing options...
VIVE_chengnay Posted January 30 Share Posted January 30 Hi @ste-phil, Could you provide sample apk or full log for further investigation? It will be better for us to test it on our device. Link to comment Share on other sites More sharing options...
ste-phil Posted January 30 Author Share Posted January 30 Sure thing, but then I will have to create a reproduction example before. I will have time to do this on Thursday/Friday. In the meantime, if you have any further suggestions feel free to let me know. Link to comment Share on other sites More sharing options...
ste-phil Posted February 1 Author Share Posted February 1 Hi, I was able to make a sample which is based on the hello_xr project from OpenXR. Unfortunately the project was too big to upload here, so I put it on a WeTransfer https://we.tl/t-G7tnwnSVD2 where you can download it. Run the project: Open the android studio project located in the folder "OpenXR-SDK-Source\src\tests\hello_xr". If you want to switch to a single activity workflow to test the behaviour, just use the PlayerActivity as the Main/Launch Activity. If you need any further information please let me know! Thanks for the help. Link to comment Share on other sites More sharing options...
VIVE_chengnay Posted February 2 Share Posted February 2 Hi @ste-phil, I downloaded the source code and open with Android Studio, but it failed to compile successfully. Do I just select Build>Build Bundle>Build APK? Link to comment Share on other sites More sharing options...
ste-phil Posted February 2 Author Share Posted February 2 You should just be able to run any configuration directly. What's the issue when compiling? Maybe you need to get the required dependencies. (correct sdk version, ndk, cmake, etc) Link to comment Share on other sites More sharing options...
ste-phil Posted February 7 Author Share Posted February 7 Hello just wanted to ask if there is any progress on this issue and if you will look into the issue at all. It would be very helpful for us to have some insight on what's going on and how to tackle this. Thanks for the information. Link to comment Share on other sites More sharing options...
VIVE_chengnay Posted February 15 Share Posted February 15 Hi @ste-phil, I am still resolving how to build the project. I just upgrade Android Studio to Hedgehog, let you know when I done compiling. It seems to stuck here forever, did I miss any config setup? Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now