diff options
| author | Yuri Sizov <yuris@humnom.net> | 2023-07-14 18:48:54 +0200 |
|---|---|---|
| committer | Yuri Sizov <yuris@humnom.net> | 2023-07-14 18:48:54 +0200 |
| commit | 70b5330b461bb0a210e8b8bcd76f2cb282262b3d (patch) | |
| tree | 3cd679a44c4b1112690296296f8698a7a43b09f8 /platform/android/export | |
| parent | 2a595c26d970e20e30ae36ca8e8f7863d8240047 (diff) | |
| parent | e01a2693d59cc261f69c503910e2e0fb71911161 (diff) | |
| download | redot-engine-70b5330b461bb0a210e8b8bcd76f2cb282262b3d.tar.gz | |
Merge pull request #78164 from 0xafbf/allow-export-tv-and-launcher
Add options to show icon in Android TV and run app as Android launcher
Diffstat (limited to 'platform/android/export')
| -rw-r--r-- | platform/android/export/export_plugin.cpp | 2 | ||||
| -rw-r--r-- | platform/android/export/gradle_export_util.cpp | 31 |
2 files changed, 21 insertions, 12 deletions
diff --git a/platform/android/export/export_plugin.cpp b/platform/android/export/export_plugin.cpp index 830548d801..b2aa210069 100644 --- a/platform/android/export/export_plugin.cpp +++ b/platform/android/export/export_plugin.cpp @@ -1841,6 +1841,8 @@ void EditorExportPlatformAndroid::get_export_options(List<ExportOption> *r_optio 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)); 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::BOOL, "package/show_in_android_tv"), false)); + r_options->push_back(ExportOption(PropertyInfo(Variant::BOOL, "package/show_as_launcher_app"), 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 ba4487cc4d..8912877faa 100644 --- a/platform/android/export/gradle_export_util.cpp +++ b/platform/android/export/gradle_export_util.cpp @@ -294,11 +294,12 @@ String _get_activity_tag(const Ref<EditorExportPreset> &p_preset, bool p_uses_xr orientation, bool_to_string(bool(GLOBAL_GET("display/window/size/resizable")))); + manifest_activity_text += " <intent-filter>\n" + " <action android:name=\"android.intent.action.MAIN\" />\n" + " <category android:name=\"android.intent.category.LAUNCHER\" />\n"; + if (p_uses_xr) { - manifest_activity_text += " <intent-filter>\n" - " <action android:name=\"android.intent.action.MAIN\" />\n" - " <category android:name=\"android.intent.category.LAUNCHER\" />\n" - "\n" + manifest_activity_text += "\n" " <!-- Enable access to OpenXR on Oculus mobile devices, no-op on other Android\n" " platforms. -->\n" " <category android:name=\"com.oculus.intent.category.VR\" />\n" @@ -308,16 +309,22 @@ String _get_activity_tag(const Ref<EditorExportPreset> &p_preset, bool p_uses_xr " <category android:name=\"org.khronos.openxr.intent.category.IMMERSIVE_HMD\" />\n" "\n" " <!-- Enable VR access on HTC Vive Focus devices. -->\n" - " <category android:name=\"com.htc.intent.category.VRAPP\" />\n" - " </intent-filter>\n"; - } else { - manifest_activity_text += " <intent-filter>\n" - " <action android:name=\"android.intent.action.MAIN\" />\n" - " <category android:name=\"android.intent.category.LAUNCHER\" />\n" - " </intent-filter>\n"; + " <category android:name=\"com.htc.intent.category.VRAPP\" />\n"; + } + + bool uses_leanback_category = p_preset->get("package/show_in_android_tv"); + if (uses_leanback_category) { + manifest_activity_text += " <category android:name=\"android.intent.category.LEANBACK_LAUNCHER\" />\n"; + } + + bool uses_home_category = p_preset->get("package/show_as_launcher_app"); + if (uses_home_category) { + manifest_activity_text += " <category android:name=\"android.intent.category.HOME\" />\n"; + manifest_activity_text += " <category android:name=\"android.intent.category.DEFAULT\" />\n"; } - manifest_activity_text += " </activity>\n"; + manifest_activity_text += " </intent-filter>\n" + " </activity>\n"; return manifest_activity_text; } |
