Fix XR Android manifest metadata

- Adds the parameters for supported Meta devices, which is required to access some device specific capabilities
- Remove the 'com.samsung.android.vr.application.mode' metadata when we're not using the VrApi plugin
This commit is contained in:
Fredia Huya-Kouadio 2022-01-26 08:58:47 -08:00
parent 6b68d2f177
commit 5deeb38a70
3 changed files with 13 additions and 3 deletions

View file

@ -987,14 +987,14 @@ void EditorExportPlatformAndroid::_fix_manifest(const Ref<EditorExportPreset> &p
if (tname == "meta-data" && attrname == "name" && value == "xr_mode_metadata_name") { if (tname == "meta-data" && attrname == "name" && value == "xr_mode_metadata_name") {
// Update the meta-data 'android:name' attribute based on the selected XR mode. // Update the meta-data 'android:name' attribute based on the selected XR mode.
if (xr_mode_index == XR_MODE_OVR || xr_mode_index == XR_MODE_OPENXR) { if (xr_mode_index == XR_MODE_OVR) {
string_table.write[attr_value] = "com.samsung.android.vr.application.mode"; string_table.write[attr_value] = "com.samsung.android.vr.application.mode";
} }
} }
if (tname == "meta-data" && attrname == "value" && value == "xr_mode_metadata_value") { if (tname == "meta-data" && attrname == "value" && value == "xr_mode_metadata_value") {
// Update the meta-data 'android:value' attribute based on the selected XR mode. // Update the meta-data 'android:value' attribute based on the selected XR mode.
if (xr_mode_index == XR_MODE_OVR || xr_mode_index == XR_MODE_OPENXR) { if (xr_mode_index == XR_MODE_OVR) {
string_table.write[attr_value] = "vr_only"; string_table.write[attr_value] = "vr_only";
} }
} }

View file

@ -287,7 +287,9 @@ String _get_application_tag(const Ref<EditorExportPreset> &p_preset, bool p_has_
bool_to_string(p_has_storage_permission)); bool_to_string(p_has_storage_permission));
if (uses_xr) { if (uses_xr) {
manifest_application_text += " <meta-data tools:node=\"replace\" android:name=\"com.samsung.android.vr.application.mode\" android:value=\"vr_only\" />\n"; if (xr_mode_index == XR_MODE_OVR) {
manifest_application_text += " <meta-data tools:node=\"replace\" android:name=\"com.samsung.android.vr.application.mode\" android:value=\"vr_only\" />\n";
}
bool hand_tracking_enabled = (int)(p_preset->get("xr_features/hand_tracking")) > XR_HAND_TRACKING_NONE; bool hand_tracking_enabled = (int)(p_preset->get("xr_features/hand_tracking")) > XR_HAND_TRACKING_NONE;
if (hand_tracking_enabled) { if (hand_tracking_enabled) {
@ -297,6 +299,8 @@ String _get_application_tag(const Ref<EditorExportPreset> &p_preset, bool p_has_
" <meta-data tools:node=\"replace\" android:name=\"com.oculus.handtracking.frequency\" android:value=\"%s\" />\n", " <meta-data tools:node=\"replace\" android:name=\"com.oculus.handtracking.frequency\" android:value=\"%s\" />\n",
hand_tracking_frequency); hand_tracking_frequency);
} }
} else {
manifest_application_text += " <meta-data tools:node=\"remove\" android:name=\"com.oculus.supportedDevices\" />\n";
} }
manifest_application_text += _get_activity_tag(p_preset); manifest_application_text += _get_activity_tag(p_preset);
manifest_application_text += " </application>\n"; manifest_application_text += " </application>\n";

View file

@ -50,6 +50,12 @@
android:name="xr_hand_tracking_metadata_name" android:name="xr_hand_tracking_metadata_name"
android:value="xr_hand_tracking_metadata_value"/> android:value="xr_hand_tracking_metadata_value"/>
<!-- Supported Meta devices -->
<!-- This is removed by the exporter if the xr mode is not VR. -->
<meta-data
android:name="com.oculus.supportedDevices"
android:value="all" />
<activity <activity
android:name=".GodotApp" android:name=".GodotApp"
android:label="@string/godot_project_name_string" android:label="@string/godot_project_name_string"