Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Android: Add isGame application attribute, default to true #50028

Merged
merged 1 commit into from
Jul 1, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions platform/android/export/export.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -892,6 +892,7 @@ 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");
bool classify_as_game = p_preset->get("package/classify_as_game");

Vector<String> perms;
// Write permissions into the perms variable.
Expand Down Expand Up @@ -989,6 +990,10 @@ class EditorExportPlatformAndroid : public EditorExportPlatform {
encode_uint32(backup_allowed, &p_manifest.write[iofs + 16]);
}

if (tname == "application" && attrname == "isGame") {
encode_uint32(classify_as_game, &p_manifest.write[iofs + 16]);
}

if (tname == "instrumentation" && attrname == "targetPackage") {
string_table.write[attr_value] = get_package_name(package_name);
}
Expand Down Expand Up @@ -1707,6 +1712,7 @@ class EditorExportPlatformAndroid : public EditorExportPlatform {
r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "package/unique_name", PROPERTY_HINT_PLACEHOLDER_TEXT, "ext.domain.name"), "org.godotengine.$genname"));
r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "package/name", PROPERTY_HINT_PLACEHOLDER_TEXT, "Game Name [default if blank]"), ""));
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::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"), ""));
Expand Down
10 changes: 7 additions & 3 deletions platform/android/export/gradle_export_util.h
Original file line number Diff line number Diff line change
Expand Up @@ -252,9 +252,13 @@ String _get_activity_tag(const Ref<EditorExportPreset> &p_preset) {
String _get_application_tag(const Ref<EditorExportPreset> &p_preset) {
String manifest_application_text = vformat(
" <application android:label=\"@string/godot_project_name_string\"\n"
" android:allowBackup=\"%s\" tools:ignore=\"GoogleAppIndexingWarning\"\n"
" android:icon=\"@mipmap/icon\">\n\n",
bool_to_string(p_preset->get("user_data_backup/allow")));
" android:allowBackup=\"%s\"\n"
" android:icon=\"@mipmap/icon\"\n"
" android:isGame=\"%s\"\n"
" tools:replace=\"android:allowBackup,android:isGame\"\n"
" tools:ignore=\"GoogleAppIndexingWarning\">\n\n",
bool_to_string(p_preset->get("user_data_backup/allow")),
bool_to_string(p_preset->get("package/classify_as_game")));

manifest_application_text += _get_activity_tag(p_preset);
manifest_application_text += " </application>\n";
Expand Down
5 changes: 3 additions & 2 deletions platform/android/java/app/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,9 @@
<application
android:label="@string/godot_project_name_string"
android:allowBackup="false"
tools:ignore="GoogleAppIndexingWarning"
android:icon="@mipmap/icon" >
android:icon="@mipmap/icon"
android:isGame="true"
tools:ignore="GoogleAppIndexingWarning" >

<!-- Records the version of the Godot editor used for building -->
<meta-data
Expand Down