godot/platform/android/export/export_plugin.cpp

/**************************************************************************/
/*  export_plugin.cpp                                                     */
/**************************************************************************/
/*                         This file is part of:                          */
/*                             GODOT ENGINE                               */
/*                        https://godotengine.org                         */
/**************************************************************************/
/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur.                  */
/*                                                                        */
/* Permission is hereby granted, free of charge, to any person obtaining  */
/* a copy of this software and associated documentation files (the        */
/* "Software"), to deal in the Software without restriction, including    */
/* without limitation the rights to use, copy, modify, merge, publish,    */
/* distribute, sublicense, and/or sell copies of the Software, and to     */
/* permit persons to whom the Software is furnished to do so, subject to  */
/* the following conditions:                                              */
/*                                                                        */
/* The above copyright notice and this permission notice shall be         */
/* included in all copies or substantial portions of the Software.        */
/*                                                                        */
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,        */
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF     */
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY   */
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,   */
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE      */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.                 */
/**************************************************************************/

#include "export_plugin.h"

#include "gradle_export_util.h"
#include "logo_svg.gen.h"
#include "run_icon_svg.gen.h"

#include "core/config/project_settings.h"
#include "core/io/dir_access.h"
#include "core/io/file_access.h"
#include "core/io/image_loader.h"
#include "core/io/json.h"
#include "core/io/marshalls.h"
#include "core/version.h"
#include "drivers/png/png_driver_common.h"
#include "editor/editor_log.h"
#include "editor/editor_node.h"
#include "editor/editor_paths.h"
#include "editor/editor_settings.h"
#include "editor/export/export_template_manager.h"
#include "editor/import/resource_importer_texture_settings.h"
#include "editor/themes/editor_scale.h"
#include "main/splash.gen.h"
#include "scene/resources/image_texture.h"

#include "modules/modules_enabled.gen.h" // For mono and svg.
#ifdef MODULE_SVG_ENABLED
#include "modules/svg/image_loader_svg.h"
#endif

#ifdef ANDROID_ENABLED
#include "../os_android.h"
#endif

#include <string.h>

static const char *android_perms[] =;

static const char *MISMATCHED_VERSIONS_MESSAGE =;

static const char *GDEXTENSION_LIBS_PATH =;

static const int icon_densities_count =;
static const char *launcher_icon_option =;
static const char *launcher_adaptive_icon_foreground_option =;
static const char *launcher_adaptive_icon_background_option =;
static const char *launcher_adaptive_icon_monochrome_option =;

static const LauncherIcon launcher_icons[icon_densities_count] =;

static const LauncherIcon launcher_adaptive_icon_foregrounds[icon_densities_count] =;

static const LauncherIcon launcher_adaptive_icon_backgrounds[icon_densities_count] =;

static const LauncherIcon launcher_adaptive_icon_monochromes[icon_densities_count] =;

static const int EXPORT_FORMAT_APK =;
static const int EXPORT_FORMAT_AAB =;

static const char *APK_ASSETS_DIRECTORY =;
static const char *AAB_ASSETS_DIRECTORY =;

static const int OPENGL_MIN_SDK_VERSION =; // Should match the value in 'platform/android/java/app/config.gradle#minSdk'
static const int VULKAN_MIN_SDK_VERSION =;
static const int DEFAULT_TARGET_SDK_VERSION =; // Should match the value in 'platform/android/java/app/config.gradle#targetSdk'

#ifndef ANDROID_ENABLED
void EditorExportPlatformAndroid::_check_for_changes_poll_thread(void *ud) {}

void EditorExportPlatformAndroid::_update_preset_status() {}
#endif

String EditorExportPlatformAndroid::get_project_name(const String &p_name) const {}

String EditorExportPlatformAndroid::get_package_name(const String &p_package) const {}

// Returns the project name without invalid characters
// or the "noname" string if all characters are invalid.
String EditorExportPlatformAndroid::get_valid_basename() const {}

String EditorExportPlatformAndroid::get_assets_directory(const Ref<EditorExportPreset> &p_preset, int p_export_format) const {}

bool EditorExportPlatformAndroid::is_package_name_valid(const String &p_package, String *r_error) const {}

bool EditorExportPlatformAndroid::is_project_name_valid() const {}

bool EditorExportPlatformAndroid::_should_compress_asset(const String &p_path, const Vector<uint8_t> &p_data) {}

zip_fileinfo EditorExportPlatformAndroid::get_zip_fileinfo() {}

Vector<EditorExportPlatformAndroid::ABI> EditorExportPlatformAndroid::get_abis() {}

#ifndef DISABLE_DEPRECATED
/// List the gdap files in the directory specified by the p_path parameter.
Vector<String> EditorExportPlatformAndroid::list_gdap_files(const String &p_path) {}

Vector<PluginConfigAndroid> EditorExportPlatformAndroid::get_plugins() {}

Vector<PluginConfigAndroid> EditorExportPlatformAndroid::get_enabled_plugins(const Ref<EditorExportPreset> &p_presets) {}
#endif // DISABLE_DEPRECATED

Error EditorExportPlatformAndroid::store_in_apk(APKExportData *ed, const String &p_path, const Vector<uint8_t> &p_data, int compression_method) {}

Error EditorExportPlatformAndroid::save_apk_so(void *p_userdata, const SharedObject &p_so) {}

Error EditorExportPlatformAndroid::save_apk_file(void *p_userdata, const String &p_path, const Vector<uint8_t> &p_data, int p_file, int p_total, const Vector<String> &p_enc_in_filters, const Vector<String> &p_enc_ex_filters, const Vector<uint8_t> &p_key) {}

Error EditorExportPlatformAndroid::ignore_apk_file(void *p_userdata, const String &p_path, const Vector<uint8_t> &p_data, int p_file, int p_total, const Vector<String> &p_enc_in_filters, const Vector<String> &p_enc_ex_filters, const Vector<uint8_t> &p_key) {}

Error EditorExportPlatformAndroid::copy_gradle_so(void *p_userdata, const SharedObject &p_so) {}

bool EditorExportPlatformAndroid::_has_read_write_storage_permission(const Vector<String> &p_permissions) {}

bool EditorExportPlatformAndroid::_has_manage_external_storage_permission(const Vector<String> &p_permissions) {}

bool EditorExportPlatformAndroid::_uses_vulkan() {}

void EditorExportPlatformAndroid::_notification(int p_what) {}

void EditorExportPlatformAndroid::_create_editor_debug_keystore_if_needed() {}

void EditorExportPlatformAndroid::_get_permissions(const Ref<EditorExportPreset> &p_preset, bool p_give_internet, Vector<String> &r_permissions) {}

void EditorExportPlatformAndroid::_write_tmp_manifest(const Ref<EditorExportPreset> &p_preset, bool p_give_internet, bool p_debug) {}

void EditorExportPlatformAndroid::_fix_manifest(const Ref<EditorExportPreset> &p_preset, Vector<uint8_t> &p_manifest, bool p_give_internet) {}

String EditorExportPlatformAndroid::_get_keystore_path(const Ref<EditorExportPreset> &p_preset, bool p_debug) {}

String EditorExportPlatformAndroid::_parse_string(const uint8_t *p_bytes, bool p_utf8) {}

void EditorExportPlatformAndroid::_fix_resources(const Ref<EditorExportPreset> &p_preset, Vector<uint8_t> &r_manifest) {}

void EditorExportPlatformAndroid::_load_image_data(const Ref<Image> &p_splash_image, Vector<uint8_t> &p_data) {}

void EditorExportPlatformAndroid::_process_launcher_icons(const String &p_file_name, const Ref<Image> &p_source_image, int dimension, Vector<uint8_t> &p_data) {}

void EditorExportPlatformAndroid::load_icon_refs(const Ref<EditorExportPreset> &p_preset, Ref<Image> &icon, Ref<Image> &foreground, Ref<Image> &background, Ref<Image> &monochrome) {}

void EditorExportPlatformAndroid::_copy_icons_to_gradle_project(const Ref<EditorExportPreset> &p_preset,
		const Ref<Image> &p_main_image,
		const Ref<Image> &p_foreground,
		const Ref<Image> &p_background,
		const Ref<Image> &p_monochrome) {}

Vector<EditorExportPlatformAndroid::ABI> EditorExportPlatformAndroid::get_enabled_abis(const Ref<EditorExportPreset> &p_preset) {}

void EditorExportPlatformAndroid::get_preset_features(const Ref<EditorExportPreset> &p_preset, List<String> *r_features) const {}

String EditorExportPlatformAndroid::get_export_option_warning(const EditorExportPreset *p_preset, const StringName &p_name) const {}

void EditorExportPlatformAndroid::get_export_options(List<ExportOption> *r_options) const {}

bool EditorExportPlatformAndroid::get_export_option_visibility(const EditorExportPreset *p_preset, const String &p_option) const {}

String EditorExportPlatformAndroid::get_name() const {}

String EditorExportPlatformAndroid::get_os_name() const {}

Ref<Texture2D> EditorExportPlatformAndroid::get_logo() const {}

bool EditorExportPlatformAndroid::should_update_export_options() {}

bool EditorExportPlatformAndroid::poll_export() {}

int EditorExportPlatformAndroid::get_options_count() const {}

String EditorExportPlatformAndroid::get_options_tooltip() const {}

String EditorExportPlatformAndroid::get_option_label(int p_index) const {}

String EditorExportPlatformAndroid::get_option_tooltip(int p_index) const {}

String EditorExportPlatformAndroid::get_device_architecture(int p_index) const {}

Error EditorExportPlatformAndroid::run(const Ref<EditorExportPreset> &p_preset, int p_device, BitField<EditorExportPlatform::DebugFlags> p_debug_flags) {}

Ref<Texture2D> EditorExportPlatformAndroid::get_run_icon() const {}

String EditorExportPlatformAndroid::get_java_path() {}

String EditorExportPlatformAndroid::get_keytool_path() {}

String EditorExportPlatformAndroid::get_adb_path() {}

String EditorExportPlatformAndroid::get_apksigner_path(int p_target_sdk, bool p_check_executes) {}

static bool has_valid_keystore_credentials(String &r_error_str, const String &p_keystore, const String &p_username, const String &p_password, const String &p_type) {}

bool EditorExportPlatformAndroid::has_valid_username_and_password(const Ref<EditorExportPreset> &p_preset, String &r_error) {}

bool EditorExportPlatformAndroid::has_valid_export_configuration(const Ref<EditorExportPreset> &p_preset, String &r_error, bool &r_missing_templates, bool p_debug) const {}

bool EditorExportPlatformAndroid::has_valid_project_configuration(const Ref<EditorExportPreset> &p_preset, String &r_error) const {}

List<String> EditorExportPlatformAndroid::get_binary_extensions(const Ref<EditorExportPreset> &p_preset) const {}

String EditorExportPlatformAndroid::get_apk_expansion_fullpath(const Ref<EditorExportPreset> &p_preset, const String &p_path) {}

Error EditorExportPlatformAndroid::save_apk_expansion_file(const Ref<EditorExportPreset> &p_preset, bool p_debug, const String &p_path) {}

void EditorExportPlatformAndroid::get_command_line_flags(const Ref<EditorExportPreset> &p_preset, const String &p_path, BitField<EditorExportPlatform::DebugFlags> p_flags, Vector<uint8_t> &r_command_line_flags) {}

Error EditorExportPlatformAndroid::sign_apk(const Ref<EditorExportPreset> &p_preset, bool p_debug, const String &export_path, EditorProgress &ep) {}

void EditorExportPlatformAndroid::_clear_assets_directory(const Ref<EditorExportPreset> &p_preset) {}

void EditorExportPlatformAndroid::_remove_copied_libs(String p_gdextension_libs_path) {}

String EditorExportPlatformAndroid::join_list(const List<String> &p_parts, const String &p_separator) {}

String EditorExportPlatformAndroid::join_abis(const Vector<EditorExportPlatformAndroid::ABI> &p_parts, const String &p_separator, bool p_use_arch) {}

String EditorExportPlatformAndroid::_get_plugins_names(const Ref<EditorExportPreset> &p_preset) const {}

String EditorExportPlatformAndroid::_resolve_export_plugin_android_library_path(const String &p_android_library_path) const {}

bool EditorExportPlatformAndroid::_is_clean_build_required(const Ref<EditorExportPreset> &p_preset) {}

Error EditorExportPlatformAndroid::export_project(const Ref<EditorExportPreset> &p_preset, bool p_debug, const String &p_path, BitField<EditorExportPlatform::DebugFlags> p_flags) {}

Error EditorExportPlatformAndroid::export_project_helper(const Ref<EditorExportPreset> &p_preset, bool p_debug, const String &p_path, int export_format, bool should_sign, BitField<EditorExportPlatform::DebugFlags> p_flags) {}

void EditorExportPlatformAndroid::get_platform_features(List<String> *r_features) const {}

void EditorExportPlatformAndroid::resolve_platform_feature_priorities(const Ref<EditorExportPreset> &p_preset, HashSet<String> &p_features) {}

EditorExportPlatformAndroid::EditorExportPlatformAndroid() {}

EditorExportPlatformAndroid::~EditorExportPlatformAndroid() {}