Ported: Update resize settings:

- Unlock resizing for the Godot Editor
- Add an option to specify whether a game is resizeable for the Godot template
- m4gr3d
4ff726b933
This commit is contained in:
Relintai 2022-07-26 12:25:24 +02:00
parent e63464d675
commit d14f7d0134
4 changed files with 17 additions and 9 deletions

View File

@ -834,6 +834,7 @@ void EditorExportPlatformAndroid::_fix_manifest(const Ref<EditorExportPreset> &p
bool classify_as_game = p_preset->get("package/classify_as_game"); 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 retain_data_on_uninstall = p_preset->get("package/retain_data_on_uninstall");
bool exclude_from_recents = p_preset->get("package/exclude_from_recents"); bool exclude_from_recents = p_preset->get("package/exclude_from_recents");
bool is_resizeable = p_preset->get("screen/is_resizeable");
Vector<String> perms; Vector<String> perms;
// Write permissions into the perms variable. // Write permissions into the perms variable.
@ -951,6 +952,10 @@ void EditorExportPlatformAndroid::_fix_manifest(const Ref<EditorExportPreset> &p
encode_uint32(exclude_from_recents, &p_manifest.write[iofs + 16]); encode_uint32(exclude_from_recents, &p_manifest.write[iofs + 16]);
} }
if (tname == "activity" && attrname == "resizeableActivity") {
encode_uint32(is_resizeable, &p_manifest.write[iofs + 16]);
}
if (tname == "supports-screens") { if (tname == "supports-screens") {
if (attrname == "smallScreens") { if (attrname == "smallScreens") {
encode_uint32(screen_support_small ? 0xFFFFFFFF : 0, &p_manifest.write[iofs + 16]); encode_uint32(screen_support_small ? 0xFFFFFFFF : 0, &p_manifest.write[iofs + 16]);
@ -1669,6 +1674,7 @@ void EditorExportPlatformAndroid::get_export_options(List<ExportOption> *r_optio
r_options->push_back(ExportOption(PropertyInfo(Variant::BOOL, "screen/support_normal"), true)); r_options->push_back(ExportOption(PropertyInfo(Variant::BOOL, "screen/support_normal"), true));
r_options->push_back(ExportOption(PropertyInfo(Variant::BOOL, "screen/support_large"), true)); 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, "screen/support_xlarge"), true));
r_options->push_back(ExportOption(PropertyInfo(Variant::BOOL, "screen/is_resizeable"), false));
r_options->push_back(ExportOption(PropertyInfo(Variant::BOOL, "user_data_backup/allow"), false)); r_options->push_back(ExportOption(PropertyInfo(Variant::BOOL, "user_data_backup/allow"), false));

View File

@ -229,11 +229,13 @@ String _get_activity_tag(const Ref<EditorExportPreset> &p_preset) {
OS::get_singleton()->get_screen_orientation_from_string(GLOBAL_GET("display/window/handheld/orientation"))); OS::get_singleton()->get_screen_orientation_from_string(GLOBAL_GET("display/window/handheld/orientation")));
String manifest_activity_text = vformat( String manifest_activity_text = vformat(
" <activity android:name=\"com.pandemonium.game.PandemoniumApp\" " " <activity android:name=\"com.pandemonium.game.PandemoniumApp\" "
"tools:replace=\"android:screenOrientation,android:excludeFromRecents\" " "tools:replace=\"android:screenOrientation,android:excludeFromRecents,android:resizeableActivity\" "
"android:excludeFromRecents=\"%s\" " "android:excludeFromRecents=\"%s\" "
"android:screenOrientation=\"%s\">\n", "android:screenOrientation=\"%s\" "
"android:resizeableActivity=\"%s\">\n",
bool_to_string(p_preset->get("package/exclude_from_recents")), bool_to_string(p_preset->get("package/exclude_from_recents")),
orientation); orientation,
bool_to_string(p_preset->get("screen/is_resizeable")));
manifest_activity_text += " <meta-data tools:node=\"remove\" android:name=\"com.oculus.vr.focusaware\" />\n"; manifest_activity_text += " <meta-data tools:node=\"remove\" android:name=\"com.oculus.vr.focusaware\" />\n";
manifest_activity_text += " </activity>\n"; manifest_activity_text += " </activity>\n";
return manifest_activity_text; return manifest_activity_text;

View File

@ -29,8 +29,7 @@
android:name=".PandemoniumProjectManager" android:name=".PandemoniumProjectManager"
android:configChanges="orientation|keyboardHidden|screenSize|smallestScreenSize|density|keyboard|navigation|screenLayout|uiMode" android:configChanges="orientation|keyboardHidden|screenSize|smallestScreenSize|density|keyboard|navigation|screenLayout|uiMode"
android:launchMode="singleTask" android:launchMode="singleTask"
android:resizeableActivity="false" android:screenOrientation="userLandscape"
android:screenOrientation="landscape"
android:exported="true" android:exported="true"
android:theme="@android:style/Theme.Black.NoTitleBar.Fullscreen" android:theme="@android:style/Theme.Black.NoTitleBar.Fullscreen"
android:process=":PandemoniumProjectManager"> android:process=":PandemoniumProjectManager">
@ -46,8 +45,7 @@
android:configChanges="orientation|keyboardHidden|screenSize|smallestScreenSize|density|keyboard|navigation|screenLayout|uiMode" android:configChanges="orientation|keyboardHidden|screenSize|smallestScreenSize|density|keyboard|navigation|screenLayout|uiMode"
android:process=":PandemoniumEditor" android:process=":PandemoniumEditor"
android:launchMode="singleTask" android:launchMode="singleTask"
android:resizeableActivity="false" android:screenOrientation="userLandscape"
android:screenOrientation="landscape"
android:theme="@android:style/Theme.Black.NoTitleBar.Fullscreen"> android:theme="@android:style/Theme.Black.NoTitleBar.Fullscreen">
</activity> </activity>
@ -57,8 +55,7 @@
android:label="@string/pandemonium_project_name_string" android:label="@string/pandemonium_project_name_string"
android:process=":PandemoniumGame" android:process=":PandemoniumGame"
android:launchMode="singleTask" android:launchMode="singleTask"
android:resizeableActivity="false" android:screenOrientation="userLandscape"
android:screenOrientation="landscape"
android:theme="@android:style/Theme.Black.NoTitleBar.Fullscreen"> android:theme="@android:style/Theme.Black.NoTitleBar.Fullscreen">
</activity> </activity>

View File

@ -207,11 +207,14 @@ void PandemoniumIOJavaWrapper::hide_vk() {
} }
void PandemoniumIOJavaWrapper::set_screen_orientation(int p_orient) { void PandemoniumIOJavaWrapper::set_screen_orientation(int p_orient) {
// The Godot Android Editor sets its own orientation via its AndroidManifest
#ifndef TOOLS_ENABLED
if (_set_screen_orientation) { if (_set_screen_orientation) {
JNIEnv *env = get_jni_env(); JNIEnv *env = get_jni_env();
ERR_FAIL_COND(env == nullptr); ERR_FAIL_COND(env == nullptr);
env->CallVoidMethod(pandemonium_io_instance, _set_screen_orientation, p_orient); env->CallVoidMethod(pandemonium_io_instance, _set_screen_orientation, p_orient);
} }
#endif
} }
int PandemoniumIOJavaWrapper::get_screen_orientation() const { int PandemoniumIOJavaWrapper::get_screen_orientation() const {