You've already forked UnrealEngineUWP
mirror of
https://github.com/izzy2lost/UnrealEngineUWP.git
synced 2026-03-26 18:15:20 -07:00
There were a few issues with the OpenXR APL provided by Oculus that needed repairing in order to support proper standalone OpenXR on Oculus Quest devices. * Attach intent.category.VR to appropriate Splash or Game activity * Enabling oculus.vr.focusaware correctly, and associated with correct activity * Supporting AndroidThunkCpp_IsOculusMobileApplication in engine With this change, we can run OpenXR on Quest totally standalone, w/o any Oculus plugin! #jira UE-141357 #rb Chris.Babcock #preflight 622a9816d51810f7ad4d3cd1 #lockdown Michal.Valient #ROBOMERGE-AUTHOR: robert.srinivasiah #ROBOMERGE-SOURCE: CL 19345882 in //UE5/Release-5.0/... via CL 19349314 #ROBOMERGE-BOT: UE5 (Release-Engine-Staging -> Main) (v926-19321884) [CL 19350269 by robert srinivasiah in ue5-main branch]
171 lines
6.5 KiB
XML
171 lines
6.5 KiB
XML
<?xml version="1.0" encoding="utf-8"?>
|
|
<!--LibOVRPlatform plugin additions-->
|
|
<root xmlns:android="http://schemas.android.com/apk/res/android">
|
|
<!-- init section is always evaluated once per architecture -->
|
|
<init>
|
|
<log text="OculusOpenXRLoader"/>
|
|
<setBool result="bCpuArchSupported" value="false"/>
|
|
<isArch arch="arm64-v8a">
|
|
<setBool result="bCpuArchSupported" value="true"/>
|
|
</isArch>
|
|
<setBoolFromPropertyContains result="bPackageForOculusQuest" ini="Engine" section="/Script/AndroidRuntimeSettings.AndroidRuntimeSettings" property="PackageForOculusMobile" contains="Quest"/>
|
|
<setBoolFromPropertyContains result="bPackageForOculusQuest2" ini="Engine" section="/Script/AndroidRuntimeSettings.AndroidRuntimeSettings" property="PackageForOculusMobile" contains="Quest2"/>
|
|
<setBoolOr result="bPackageForOculusMobile" arg1="$B(bPackageForOculusQuest)" arg2="$B(bPackageForOculusQuest2)"/>
|
|
<setBoolAnd result="bPackageForOculusQuestAndQuest2" arg1="$B(bPackageForOculusQuest)" arg2="$B(bPackageForOculusQuest2)"/>
|
|
|
|
<if condition="bCpuArchSupported">
|
|
<false>
|
|
<setBool result="bPackageForOculusMobile" value="false"/>
|
|
<setBool result="bPackageForOculusQuestAndQuest2" value="false"/>
|
|
</false>
|
|
</if>
|
|
</init>
|
|
|
|
<!-- optional updates applied to AndroidManifest.xml -->
|
|
<androidManifestUpdates>
|
|
<if condition="bPackageForOculusMobile">
|
|
<true>
|
|
<addFeature android:name="android.hardware.vr.headtracking" android:version="1" android:required="true" />
|
|
|
|
<!-- Detect existence of intent-filter in either GameActivity or SplashActivity, game by default -->
|
|
<setString result="targetActivityName" value="com.epicgames.unreal.GameActivity"/>
|
|
<loopElements tag="activity">
|
|
<setStringFromAttribute result="scanActivityName" tag="$" name="android:name"/>
|
|
<setBoolIsEqual result="bSplashActivityExists" arg1="$S(scanActivityName)" arg2="com.epicgames.unreal.SplashActivity"/>
|
|
|
|
<if condition="bSplashActivityExists">
|
|
<true>
|
|
<log text="OculusOpenXR: SplashActivity detected!"/>
|
|
<setString result="targetActivityName" value="com.epicgames.unreal.SplashActivity"/>
|
|
</true>
|
|
</if>
|
|
</loopElements>
|
|
|
|
<!-- Add Activity Specific Flags -->
|
|
<loopElements tag="activity">
|
|
<setStringFromAttribute result="activityName" tag="$" name="android:name"/>
|
|
|
|
<setBoolIsEqual result="bMatchTargetActivity" arg1="$S(activityName)" arg2="$S(targetActivityName)"/>
|
|
|
|
<if condition="bMatchTargetActivity">
|
|
<true>
|
|
<log text="OculusOpenXR: manifest updates for $S(targetActivityName)"/>
|
|
|
|
<!-- Add VR Intent Filter, Permissions, and Features -->
|
|
<setElement result="vrIntent" value="category"/>
|
|
<addAttribute tag="$vrIntent" name="android:name" value="com.oculus.intent.category.VR"/>
|
|
<addElement tag="intent-filter" name="vrIntent"/>
|
|
|
|
<addPermission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
|
|
<addFeature android:name="android.hardware.usb.host"/>
|
|
|
|
<setElement result="focusAware" value="meta-data" />
|
|
<addAttribute tag="$focusAware" name="android:name" value="com.oculus.vr.focusaware" />
|
|
<addAttribute tag="$focusAware" name="android:value" value="true" />
|
|
<addElement tag="activity" name="focusAware"/>
|
|
</true>
|
|
</if>
|
|
</loopElements>
|
|
|
|
<!-- Add Application Specific Flags -->
|
|
<loopElements tag="application">
|
|
<!-- Add SupportedDevices Tag -->
|
|
<!-- TODO: Why do we retain 'delmar' when quest2 seems to be supported? -->
|
|
<setElement result ="supportedDevices" value="meta-data" />
|
|
<addAttribute tag="$supportedDevices" name="android:name" value="com.oculus.supportedDevices" />
|
|
<if condition="bPackageForOculusQuestAndQuest2">
|
|
<true>
|
|
<addAttribute tag="$supportedDevices" name="android:value" value="quest|delmar" />
|
|
</true>
|
|
<false>
|
|
<if condition="bPackageForOculusQuest2">
|
|
<true>
|
|
<addAttribute tag="$supportedDevices" name="android:value" value="delmar" />
|
|
</true>
|
|
<false>
|
|
<addAttribute tag="$supportedDevices" name="android:value" value="quest" />
|
|
</false>
|
|
</if>
|
|
</false>
|
|
</if>
|
|
<addElement tag="application" name="supportedDevices"/>
|
|
|
|
</loopElements>
|
|
</true>
|
|
</if>
|
|
</androidManifestUpdates>
|
|
|
|
<!-- optional additions to the GameActivity class in GameActivity.java -->
|
|
<gameActivityClassAdditions>
|
|
<insert>
|
|
/** Whether this application was packaged for Oculus Mobile or not */
|
|
public boolean PackagedForOculusMobile = false;
|
|
|
|
// check the manifest to determine if we are a Oculus Mobile application
|
|
public boolean AndroidThunkJava_IsOculusMobileApplication()
|
|
{
|
|
return PackagedForOculusMobile;
|
|
}
|
|
</insert>
|
|
</gameActivityClassAdditions>
|
|
|
|
<!-- optional additions to GameActivity onCreate metadata reading in GameActivity.java -->
|
|
<gameActivityReadMetadataAdditions>
|
|
<if condition="bPackageForOculusMobile">
|
|
<true>
|
|
<insert>
|
|
boolean hasVR = false;
|
|
|
|
Intent vrIntent = new Intent(Intent.ACTION_MAIN, null);
|
|
vrIntent.addCategory("com.oculus.intent.category.VR");
|
|
vrIntent.addFlags(PackageManager.GET_INTENT_FILTERS);
|
|
vrIntent.setPackage(getApplicationContext().getPackageName());
|
|
|
|
PackageManager pkgManager = getApplicationContext().getPackageManager();
|
|
if (pkgManager != null)
|
|
{
|
|
if(!pkgManager.queryIntentActivities(vrIntent, PackageManager.GET_INTENT_FILTERS).isEmpty())
|
|
{
|
|
hasVR = true;
|
|
}
|
|
}
|
|
|
|
if (hasVR)
|
|
{
|
|
PackagedForOculusMobile = true;
|
|
Log.debug("Found OpenXR Oculus Mobile mode.");
|
|
}
|
|
else
|
|
{
|
|
PackagedForOculusMobile = false;
|
|
Log.debug("No OpenXR Oculus Mobile mode detected.");
|
|
}
|
|
</insert>
|
|
</true>
|
|
</if>
|
|
</gameActivityReadMetadataAdditions>
|
|
|
|
|
|
<!-- optional files or directories to copy to Intermediate/Android/APK -->
|
|
<resourceCopies>
|
|
<if condition="bCpuArchSupported">
|
|
<true>
|
|
<log text="Copying libopenxr_loader.so"/>
|
|
<copyFile src="$S(EngineDir)/Source/ThirdParty/Oculus/OculusOpenXRLoader/OculusOpenXRLoader/Lib/arm64-v8a/libopenxr_loader.so"
|
|
dst="$S(BuildDir)/libs/arm64-v8a/libopenxr_loader.so" />
|
|
</true>
|
|
</if>
|
|
</resourceCopies>
|
|
|
|
|
|
<!-- optional libraries to load in GameActivity.java before libUnreal.so -->
|
|
<soLoadLibrary>
|
|
<!-- need this if plugin enabled and supported architecture, even if not packaged for LibOVRPlatform -->
|
|
<if condition="bCpuArchSupported">
|
|
<true>
|
|
<loadLibrary name="openxr_loader" failmsg="openxr_loader library not loaded and may be required for Oculus VR." />
|
|
</true>
|
|
</if>
|
|
</soLoadLibrary>
|
|
</root>
|