diff options
author | Pedro J. Estébanez <pedrojrulez@gmail.com> | 2021-05-25 17:36:02 +0200 |
---|---|---|
committer | Pedro J. Estébanez <pedrojrulez@gmail.com> | 2021-05-25 17:47:32 +0200 |
commit | 1179421068a8d6f1afa94c953e27e7dd9784847a (patch) | |
tree | 67421aed2aab692fa495f2228ebe8788a708f41b /platform/android/export | |
parent | f164c00a94793234879dc1824bd657db6df939ec (diff) |
Allow basic user data backup on Android
Diffstat (limited to 'platform/android/export')
-rw-r--r-- | platform/android/export/export.cpp | 8 | ||||
-rw-r--r-- | platform/android/export/gradle_export_util.h | 7 |
2 files changed, 12 insertions, 3 deletions
diff --git a/platform/android/export/export.cpp b/platform/android/export/export.cpp index ec2618a3d5..073c9dc6ef 100644 --- a/platform/android/export/export.cpp +++ b/platform/android/export/export.cpp @@ -857,6 +857,8 @@ class EditorExportPlatformAndroid : public EditorExportPlatform { int xr_mode_index = p_preset->get("xr_features/xr_mode"); + bool backup_allowed = p_preset->get("user_data_backup/allow"); + Vector<String> perms; // Write permissions into the perms variable. _get_permissions(p_preset, p_give_internet, perms); @@ -949,6 +951,10 @@ class EditorExportPlatformAndroid : public EditorExportPlatform { } } + if (tname == "application" && attrname == "allowBackup") { + encode_uint32(backup_allowed, &p_manifest.write[iofs + 16]); + } + if (tname == "instrumentation" && attrname == "targetPackage") { string_table.write[attr_value] = get_package_name(package_name); } @@ -1684,6 +1690,8 @@ public: r_options->push_back(ExportOption(PropertyInfo(Variant::BOOL, "screen/support_large"), true)); r_options->push_back(ExportOption(PropertyInfo(Variant::BOOL, "screen/support_xlarge"), true)); + r_options->push_back(ExportOption(PropertyInfo(Variant::BOOL, "user_data_backup/allow"), false)); + r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "command_line/extra_args"), "")); r_options->push_back(ExportOption(PropertyInfo(Variant::BOOL, "apk_expansion/enable"), false)); diff --git a/platform/android/export/gradle_export_util.h b/platform/android/export/gradle_export_util.h index 48e7fd46ac..0bb94dcc97 100644 --- a/platform/android/export/gradle_export_util.h +++ b/platform/android/export/gradle_export_util.h @@ -258,10 +258,11 @@ String _get_activity_tag(const Ref<EditorExportPreset> &p_preset) { } String _get_application_tag(const Ref<EditorExportPreset> &p_preset) { - String manifest_application_text = + String manifest_application_text = vformat( " <application android:label=\"@string/godot_project_name_string\"\n" - " android:allowBackup=\"false\" tools:ignore=\"GoogleAppIndexingWarning\"\n" - " android:icon=\"@mipmap/icon\">\n\n"; + " android:allowBackup=\"%s\" tools:ignore=\"GoogleAppIndexingWarning\"\n" + " android:icon=\"@mipmap/icon\">\n\n", + bool_to_string(p_preset->get("user_data_backup/allow"))); manifest_application_text += _get_activity_tag(p_preset); manifest_application_text += " </application>\n"; |