diff options
Diffstat (limited to 'platform/android/export/export_plugin.cpp')
| -rw-r--r-- | platform/android/export/export_plugin.cpp | 52 |
1 files changed, 41 insertions, 11 deletions
diff --git a/platform/android/export/export_plugin.cpp b/platform/android/export/export_plugin.cpp index d0db7b2e6c..74d22bc44f 100644 --- a/platform/android/export/export_plugin.cpp +++ b/platform/android/export/export_plugin.cpp @@ -379,14 +379,15 @@ void EditorExportPlatformAndroid::_check_for_changes_poll_thread(void *ud) { } else if (p.begins_with("ro.build.version.sdk=")) { d.api_level = p.get_slice("=", 1).to_int(); } else if (p.begins_with("ro.product.cpu.abi=")) { - d.description += "CPU: " + p.get_slice("=", 1).strip_edges() + "\n"; + d.architecture = p.get_slice("=", 1).strip_edges(); + d.description += "CPU: " + d.architecture + "\n"; } else if (p.begins_with("ro.product.manufacturer=")) { d.description += "Manufacturer: " + p.get_slice("=", 1).strip_edges() + "\n"; } else if (p.begins_with("ro.board.platform=")) { d.description += "Chipset: " + p.get_slice("=", 1).strip_edges() + "\n"; } else if (p.begins_with("ro.opengles.version=")) { uint32_t opengl = p.get_slice("=", 1).to_int(); - d.description += "OpenGL: " + itos(opengl >> 16) + "." + itos((opengl >> 8) & 0xFF) + "." + itos((opengl)&0xFF) + "\n"; + d.description += "OpenGL: " + itos(opengl >> 16) + "." + itos((opengl >> 8) & 0xFF) + "." + itos((opengl) & 0xFF) + "\n"; } } @@ -415,7 +416,7 @@ void EditorExportPlatformAndroid::_check_for_changes_poll_thread(void *ud) { } } - if (EDITOR_GET("export/android/shutdown_adb_on_exit")) { + if (ea->has_runnable_preset.is_set() && EDITOR_GET("export/android/shutdown_adb_on_exit")) { String adb = get_adb_path(); if (!FileAccess::exists(adb)) { return; //adb not configured @@ -830,8 +831,9 @@ bool EditorExportPlatformAndroid::_uses_vulkan() { void EditorExportPlatformAndroid::_notification(int p_what) { #ifndef ANDROID_ENABLED if (p_what == NOTIFICATION_POSTINITIALIZE) { - ERR_FAIL_NULL(EditorExport::get_singleton()); - EditorExport::get_singleton()->connect_presets_runnable_updated(callable_mp(this, &EditorExportPlatformAndroid::_update_preset_status)); + if (EditorExport::get_singleton()) { + EditorExport::get_singleton()->connect_presets_runnable_updated(callable_mp(this, &EditorExportPlatformAndroid::_update_preset_status)); + } } #endif } @@ -1911,13 +1913,22 @@ void EditorExportPlatformAndroid::get_export_options(List<ExportOption> *r_optio } bool EditorExportPlatformAndroid::get_export_option_visibility(const EditorExportPreset *p_preset, const String &p_option) const { + if (p_preset == nullptr) { + return true; + } + + bool advanced_options_enabled = p_preset->are_advanced_options_enabled(); + if (p_option == "graphics/opengl_debug" || + p_option == "command_line/extra_args" || + p_option == "permissions/custom_permissions") { + return advanced_options_enabled; + } if (p_option == "gradle_build/gradle_build_directory" || p_option == "gradle_build/android_source_template") { - // @todo These are experimental options - keep them hidden for now. - //return (bool)p_preset->get("gradle_build/use_gradle_build"); - return false; - } else if (p_option == "custom_template/debug" || p_option == "custom_template/release") { + return advanced_options_enabled && bool(p_preset->get("gradle_build/use_gradle_build")); + } + if (p_option == "custom_template/debug" || p_option == "custom_template/release") { // The APK templates are ignored if Gradle build is enabled. - return !p_preset->get("gradle_build/use_gradle_build"); + return advanced_options_enabled && !bool(p_preset->get("gradle_build/use_gradle_build")); } return true; } @@ -1982,6 +1993,12 @@ String EditorExportPlatformAndroid::get_option_tooltip(int p_index) const { return s; } +String EditorExportPlatformAndroid::get_device_architecture(int p_index) const { + ERR_FAIL_INDEX_V(p_index, devices.size(), ""); + MutexLock lock(device_lock); + return devices[p_index].architecture; +} + Error EditorExportPlatformAndroid::run(const Ref<EditorExportPreset> &p_preset, int p_device, int p_debug_flags) { ERR_FAIL_INDEX_V(p_device, devices.size(), ERR_INVALID_PARAMETER); @@ -2391,9 +2408,22 @@ bool EditorExportPlatformAndroid::has_valid_export_configuration(const Ref<Edito err += template_err; } } else { + // Validate the custom gradle android source template. + bool android_source_template_valid = false; + const String android_source_template = p_preset->get("gradle_build/android_source_template"); + if (!android_source_template.is_empty()) { + android_source_template_valid = FileAccess::exists(android_source_template); + if (!android_source_template_valid) { + err += TTR("Custom Android source template not found.") + "\n"; + } + } + + // Validate the installed build template. bool installed_android_build_template = FileAccess::exists(ExportTemplateManager::get_android_build_directory(p_preset).path_join("build.gradle")); if (!installed_android_build_template) { - r_missing_templates = !exists_export_template("android_source.zip", &err); + if (!android_source_template_valid) { + r_missing_templates = !exists_export_template("android_source.zip", &err); + } err += TTR("Android build template not installed in the project. Install it from the Project menu.") + "\n"; } else { r_missing_templates = false; |
