From 605502a0d2a2c311c56b56dfaea6a119902b4132 Mon Sep 17 00:00:00 2001 From: Fredia Huya-Kouadio Date: Thu, 9 Dec 2021 08:49:32 -0800 Subject: [PATCH] Enable configuration of the `android:excludeFromRecents` activity attribute. (cherry picked from commit cfa81ff32a3b074bc284cda3790166385fa15918) --- platform/android/export/export_plugin.cpp | 6 ++++++ platform/android/export/gradle_export_util.cpp | 4 +++- platform/android/java/app/AndroidManifest.xml | 1 + 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/platform/android/export/export_plugin.cpp b/platform/android/export/export_plugin.cpp index 0f6da6d3ab9..12693810e30 100644 --- a/platform/android/export/export_plugin.cpp +++ b/platform/android/export/export_plugin.cpp @@ -846,6 +846,7 @@ void EditorExportPlatformAndroid::_fix_manifest(const Ref &p bool backup_allowed = p_preset->get("user_data_backup/allow"); bool classify_as_game = p_preset->get("package/classify_as_game"); bool retain_data_on_uninstall = p_preset->get("package/retain_data_on_uninstall"); + bool exclude_from_recents = p_preset->get("package/exclude_from_recents"); Vector perms; // Write permissions into the perms variable. @@ -959,6 +960,10 @@ void EditorExportPlatformAndroid::_fix_manifest(const Ref &p encode_uint32(screen_orientation, &p_manifest.write[iofs + 16]); } + if (tname == "activity" && attrname == "excludeFromRecents") { + encode_uint32(exclude_from_recents, &p_manifest.write[iofs + 16]); + } + if (tname == "supports-screens") { if (attrname == "smallScreens") { encode_uint32(screen_support_small ? 0xFFFFFFFF : 0, &p_manifest.write[iofs + 16]); @@ -1703,6 +1708,7 @@ void EditorExportPlatformAndroid::get_export_options(List *r_optio r_options->push_back(ExportOption(PropertyInfo(Variant::BOOL, "package/signed"), true)); r_options->push_back(ExportOption(PropertyInfo(Variant::BOOL, "package/classify_as_game"), true)); r_options->push_back(ExportOption(PropertyInfo(Variant::BOOL, "package/retain_data_on_uninstall"), false)); + r_options->push_back(ExportOption(PropertyInfo(Variant::BOOL, "package/exclude_from_recents"), false)); r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, launcher_icon_option, PROPERTY_HINT_FILE, "*.png"), "")); r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, launcher_adaptive_icon_foreground_option, PROPERTY_HINT_FILE, "*.png"), "")); diff --git a/platform/android/export/gradle_export_util.cpp b/platform/android/export/gradle_export_util.cpp index 9120f252fb7..ca0b3b04298 100644 --- a/platform/android/export/gradle_export_util.cpp +++ b/platform/android/export/gradle_export_util.cpp @@ -253,8 +253,10 @@ String _get_activity_tag(const Ref &p_preset) { OS::get_singleton()->get_screen_orientation_from_string(GLOBAL_GET("display/window/handheld/orientation"))); String manifest_activity_text = vformat( " \n", + bool_to_string(p_preset->get("package/exclude_from_recents")), orientation); if (uses_xr) { manifest_activity_text += " \n"; diff --git a/platform/android/java/app/AndroidManifest.xml b/platform/android/java/app/AndroidManifest.xml index a7dbf296e5b..16799c1a267 100644 --- a/platform/android/java/app/AndroidManifest.xml +++ b/platform/android/java/app/AndroidManifest.xml @@ -48,6 +48,7 @@ android:label="@string/godot_project_name_string" android:theme="@style/GodotAppSplashTheme" android:launchMode="singleTask" + android:excludeFromRecents="false" android:screenOrientation="landscape" android:configChanges="orientation|keyboardHidden|screenSize|smallestScreenSize|density|keyboard|navigation|screenLayout|uiMode" android:resizeableActivity="false"