Skip to content

Commit b6bbd40

Browse files
committed
Merge pull request #98971 from syntaxerror247/new_appCategory
Add `CATEGORY_UNDEFINED` option in Android export
2 parents 2705202 + b2cb858 commit b6bbd40

File tree

3 files changed

+13
-6
lines changed

3 files changed

+13
-6
lines changed

platform/android/export/export_plugin.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -1898,7 +1898,7 @@ void EditorExportPlatformAndroid::get_export_options(List<ExportOption> *r_optio
18981898
r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "package/unique_name", PROPERTY_HINT_PLACEHOLDER_TEXT, "ext.domain.name"), "com.example.$genname", false, true));
18991899
r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "package/name", PROPERTY_HINT_PLACEHOLDER_TEXT, "Game Name [default if blank]"), ""));
19001900
r_options->push_back(ExportOption(PropertyInfo(Variant::BOOL, "package/signed"), true));
1901-
r_options->push_back(ExportOption(PropertyInfo(Variant::INT, "package/app_category", PROPERTY_HINT_ENUM, "Accessibility,Audio,Game,Image,Maps,News,Productivity,Social,Video"), APP_CATEGORY_GAME));
1901+
r_options->push_back(ExportOption(PropertyInfo(Variant::INT, "package/app_category", PROPERTY_HINT_ENUM, "Accessibility,Audio,Game,Image,Maps,News,Productivity,Social,Video,Undefined"), APP_CATEGORY_GAME));
19021902
r_options->push_back(ExportOption(PropertyInfo(Variant::BOOL, "package/retain_data_on_uninstall"), false));
19031903
r_options->push_back(ExportOption(PropertyInfo(Variant::BOOL, "package/exclude_from_recents"), false));
19041904
r_options->push_back(ExportOption(PropertyInfo(Variant::BOOL, "package/show_in_android_tv"), false));

platform/android/export/gradle_export_util.cpp

+11-5
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,8 @@ int _get_app_category_value(int category_index) {
8888
return 7;
8989
case APP_CATEGORY_SOCIAL:
9090
return 4;
91+
case APP_CATEGORY_UNDEFINED:
92+
return -1;
9193
case APP_CATEGORY_VIDEO:
9294
return 2;
9395
case APP_CATEGORY_GAME:
@@ -311,17 +313,21 @@ String _get_application_tag(const Ref<EditorExportPlatform> &p_export_platform,
311313
" <application android:label=\"@string/godot_project_name_string\"\n"
312314
" android:allowBackup=\"%s\"\n"
313315
" android:icon=\"@mipmap/icon\"\n"
314-
" android:appCategory=\"%s\"\n"
315316
" android:isGame=\"%s\"\n"
316317
" android:hasFragileUserData=\"%s\"\n"
317-
" android:requestLegacyExternalStorage=\"%s\"\n"
318-
" tools:replace=\"android:allowBackup,android:appCategory,android:isGame,android:hasFragileUserData,android:requestLegacyExternalStorage\"\n"
319-
" tools:ignore=\"GoogleAppIndexingWarning\">\n\n",
318+
" android:requestLegacyExternalStorage=\"%s\"\n",
320319
bool_to_string(p_preset->get("user_data_backup/allow")),
321-
_get_app_category_label(app_category_index),
322320
bool_to_string(is_game),
323321
bool_to_string(p_preset->get("package/retain_data_on_uninstall")),
324322
bool_to_string(p_has_read_write_storage_permission));
323+
if (app_category_index != APP_CATEGORY_UNDEFINED) {
324+
manifest_application_text += vformat(" android:appCategory=\"%s\"\n", _get_app_category_label(app_category_index));
325+
manifest_application_text += " tools:replace=\"android:allowBackup,android:appCategory,android:isGame,android:hasFragileUserData,android:requestLegacyExternalStorage\"\n";
326+
} else {
327+
manifest_application_text += " tools:remove=\"android:appCategory\"\n";
328+
manifest_application_text += " tools:replace=\"android:allowBackup,android:isGame,android:hasFragileUserData,android:requestLegacyExternalStorage\"\n";
329+
}
330+
manifest_application_text += " tools:ignore=\"GoogleAppIndexingWarning\">\n\n";
325331

326332
Vector<Ref<EditorExportPlugin>> export_plugins = EditorExport::get_singleton()->get_export_plugins();
327333
for (int i = 0; i < export_plugins.size(); i++) {

platform/android/export/gradle_export_util.h

+1
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ static const int APP_CATEGORY_NEWS = 5;
5555
static const int APP_CATEGORY_PRODUCTIVITY = 6;
5656
static const int APP_CATEGORY_SOCIAL = 7;
5757
static const int APP_CATEGORY_VIDEO = 8;
58+
static const int APP_CATEGORY_UNDEFINED = 9;
5859

5960
// Supported XR modes.
6061
// This should match the entries in 'platform/android/java/lib/src/org/godotengine/godot/xr/XRMode.java'

0 commit comments

Comments
 (0)