From a715a00d7663ae2bafc31e61f679d1a1ad4c4430 Mon Sep 17 00:00:00 2001 From: Fredia Huya-Kouadio Date: Wed, 1 Feb 2023 14:05:39 -0800 Subject: Clean up the XR export logic Remove the XR export logic from the legacy build system: - On Android, Godot 4 export requires the use of Android plugins which are not supported by the legacy build system - Provides added flexibility for configuring the Android manifest for XR specific capabilities. --- platform/android/export/export_plugin.cpp | 46 ++++---------------------- platform/android/export/gradle_export_util.cpp | 30 ++++++++++++++--- platform/android/export/gradle_export_util.h | 2 +- platform/android/java/app/AndroidManifest.xml | 21 ------------ 4 files changed, 32 insertions(+), 67 deletions(-) (limited to 'platform/android') diff --git a/platform/android/export/export_plugin.cpp b/platform/android/export/export_plugin.cpp index 0902be9595..c02acbee83 100644 --- a/platform/android/export/export_plugin.cpp +++ b/platform/android/export/export_plugin.cpp @@ -899,10 +899,6 @@ void EditorExportPlatformAndroid::_fix_manifest(const Ref &p bool screen_support_large = p_preset->get("screen/support_large"); bool screen_support_xlarge = p_preset->get("screen/support_xlarge"); - int xr_mode_index = p_preset->get("xr_features/xr_mode"); - int hand_tracking_index = p_preset->get("xr_features/hand_tracking"); - int hand_tracking_frequency_index = p_preset->get("xr_features/hand_tracking_frequency"); - bool backup_allowed = p_preset->get("user_data_backup/allow"); int app_category = p_preset->get("package/app_category"); bool retain_data_on_uninstall = p_preset->get("package/retain_data_on_uninstall"); @@ -1046,25 +1042,6 @@ void EditorExportPlatformAndroid::_fix_manifest(const Ref &p } } - // Hand tracking related configurations - if (xr_mode_index == XR_MODE_OPENXR && hand_tracking_index > XR_HAND_TRACKING_NONE) { - if (tname == "meta-data" && attrname == "name" && value == "xr_hand_tracking_metadata_name") { - string_table.write[attr_value] = "com.oculus.handtracking.frequency"; - } - - if (tname == "meta-data" && attrname == "value" && value == "xr_hand_tracking_metadata_value") { - string_table.write[attr_value] = (hand_tracking_frequency_index == XR_HAND_TRACKING_FREQUENCY_LOW ? "LOW" : "HIGH"); - } - - if (tname == "meta-data" && attrname == "name" && value == "xr_hand_tracking_version_name") { - string_table.write[attr_value] = "com.oculus.handtracking.version"; - } - - if (tname == "meta-data" && attrname == "value" && value == "xr_hand_tracking_version_value") { - string_table.write[attr_value] = "V2.0"; - } - } - iofs += 20; } @@ -1079,23 +1056,6 @@ void EditorExportPlatformAndroid::_fix_manifest(const Ref &p Vector feature_required_list; Vector feature_versions; - if (xr_mode_index == XR_MODE_OPENXR) { - // Check for hand tracking - if (hand_tracking_index > XR_HAND_TRACKING_NONE) { - feature_names.push_back("oculus.software.handtracking"); - feature_required_list.push_back(hand_tracking_index == XR_HAND_TRACKING_REQUIRED); - feature_versions.push_back(-1); // no version attribute should be added. - } - - // Check for passthrough - int passthrough_mode = p_preset->get("xr_features/passthrough"); - if (passthrough_mode > XR_PASSTHROUGH_NONE) { - feature_names.push_back("com.oculus.feature.PASSTHROUGH"); - feature_required_list.push_back(passthrough_mode == XR_PASSTHROUGH_REQUIRED); - feature_versions.push_back(-1); - } - } - if (feature_names.size() > 0) { ofs += 24; // skip over end tag @@ -2334,6 +2294,12 @@ bool EditorExportPlatformAndroid::has_valid_project_configuration(const Refget("xr_features/xr_mode"); int hand_tracking = p_preset->get("xr_features/hand_tracking"); int passthrough_mode = p_preset->get("xr_features/passthrough"); + if (xr_mode_index == XR_MODE_OPENXR && !custom_build_enabled) { + valid = false; + err += TTR("OpenXR requires \"Use Custom Build\" to be enabled"); + err += "\n"; + } + if (xr_mode_index != XR_MODE_OPENXR) { if (hand_tracking > XR_HAND_TRACKING_NONE) { valid = false; diff --git a/platform/android/export/gradle_export_util.cpp b/platform/android/export/gradle_export_util.cpp index 4fdcca68e9..5e71116c10 100644 --- a/platform/android/export/gradle_export_util.cpp +++ b/platform/android/export/gradle_export_util.cpp @@ -276,17 +276,39 @@ String _get_xr_features_tag(const Ref &p_preset) { return manifest_xr_features; } -String _get_activity_tag(const Ref &p_preset) { +String _get_activity_tag(const Ref &p_preset, bool p_uses_xr) { String orientation = _get_android_orientation_label(DisplayServer::ScreenOrientation(int(GLOBAL_GET("display/window/handheld/orientation")))); String manifest_activity_text = vformat( " \n", bool_to_string(p_preset->get("package/exclude_from_recents")), orientation, bool_to_string(bool(GLOBAL_GET("display/window/size/resizable")))); + + if (p_uses_xr) { + manifest_activity_text += " \n" + " \n" + " \n" + "\n" + " \n" + " \n" + "\n" + " \n" + " \n" + " \n"; + } else { + manifest_activity_text += " \n" + " \n" + " \n" + " \n"; + } + manifest_activity_text += " \n"; return manifest_activity_text; } @@ -307,9 +329,7 @@ String _get_application_tag(const Ref &p_preset, bool p_has_ " android:hasFragileUserData=\"%s\"\n" " android:requestLegacyExternalStorage=\"%s\"\n" " tools:replace=\"android:allowBackup,android:appCategory,android:isGame,android:hasFragileUserData,android:requestLegacyExternalStorage\"\n" - " tools:ignore=\"GoogleAppIndexingWarning\">\n\n" - " \n" - " \n", + " tools:ignore=\"GoogleAppIndexingWarning\">\n\n", bool_to_string(p_preset->get("user_data_backup/allow")), _get_app_category_label(app_category_index), bool_to_string(is_game), @@ -327,7 +347,7 @@ String _get_application_tag(const Ref &p_preset, bool p_has_ manifest_application_text += " \n"; } } - manifest_application_text += _get_activity_tag(p_preset); + manifest_application_text += _get_activity_tag(p_preset, uses_xr); manifest_application_text += " \n"; return manifest_application_text; } diff --git a/platform/android/export/gradle_export_util.h b/platform/android/export/gradle_export_util.h index 0fa857cb75..fe5888e11c 100644 --- a/platform/android/export/gradle_export_util.h +++ b/platform/android/export/gradle_export_util.h @@ -118,7 +118,7 @@ String _get_screen_sizes_tag(const Ref &p_preset); String _get_xr_features_tag(const Ref &p_preset); -String _get_activity_tag(const Ref &p_preset); +String _get_activity_tag(const Ref &p_preset, bool p_uses_xr); String _get_application_tag(const Ref &p_preset, bool p_has_read_write_storage_permission); diff --git a/platform/android/java/app/AndroidManifest.xml b/platform/android/java/app/AndroidManifest.xml index 1969f9c814..ce4a2ecfe4 100644 --- a/platform/android/java/app/AndroidManifest.xml +++ b/platform/android/java/app/AndroidManifest.xml @@ -31,23 +31,6 @@ android:name="org.godotengine.editor.version" android:value="${godotEditorVersion}" /> - - - - - - - - - - - - - - - - -- cgit v1.2.3