-
-
Notifications
You must be signed in to change notification settings - Fork 22.7k
Android: Address API 35 UI behavior changes #107742
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
Conversation
I don't think this is a good idea. This PR automatically adjusts the layout padding, which effectively disables While it might make sense to disable Also, Android 15 deprecates the ability to change system bar colors programmatically. So, if we go ahead with this change, every non-immersive Godot app would end up with black bars on the top and bottom, which would clash with the app theme. Personally, I would prefer keeping my app in edge-to-edge mode, rendering the background across the full screen, and placing the main content within the safe area using There's already ways for users to workaround this new restriction without disabling the |
This PR maintains the current behavior prior to the bump to target SDK 35, which is that we only allow the app to be either immersive (system bars auto dismiss) or not edge-to-edge (system bars show and the content don't overlap them); you can test with a 4.4 build and validate that it's the case. Supporting edge-to-edge would be a new feature and that's not the role of this PR. Also given that we're in feature freeze, that would be something to discuss for 4.6 if we want to consider it.
The PR uses |
In short the primary requirement for this PR should be That's all this PR should be tested against, because for most users not paying close attention to Android changes, a change in layout behavior from one version of Godot to the next, in the same project is a breaking change. Once we validate we are maintaining the existing (expected) behavior, we can then discuss how to surface the new edge-to-edge functionality in a way that's easy to integrate. |
Yeah, This PR does maintain the behaviour prior to the bump. However, |
Well it sounds that in either case the plugin is obsolete:
The only issue is that the capability may be lost in Godot 4.5.. If we think that's an issue, then adding an export option to enable edge-to-edge should be trivial; but that means updating the documentation and providing tutorials for 4.5.. if you're up for it, it's worth considering.. |
This is only the case for Android 15+ devices. Without this PR, plugin would work as expected on older devices. |
Yeah, that's my concern, the capability would be lost in 4.5. Okay, Let's go with this PR for now. I'll send one to enable |
aaf8c77
to
cb8e30b
Compare
cb8e30b
to
b9f0307
Compare
@syntaxerror247 I've updated the PR and included an export option for |
b9f0307
to
375bec9
Compare
ff734d8
to
2b51e0d
Compare
0d44e10
to
6e66f8f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great!
a76339a
to
631479f
Compare
- Fix issue on foldable where the embedded window would obscure the main window when launching - Fix edge-to-edge support for non-immersive apps / games - Add edge-to-edge export option to allow non-immersive apps / games to extend edge to edge
631479f
to
2f4c3d4
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! Tested on Pixel 8a
- Android 16
Suggestions:
- mention in the documentation that
edge_to_edge
does not support every device - Reference to the Android documentation, there are probably few users who even know what this is https://developer.android.com/develop/ui/views/layout/edge-to-edge
- Is it possible to change
edge_to_edge
at runtime?
WINDOW_MODE_FULLSCREEN = 3
withoutedge_to_edge
?WINDOW_MODE_EXCLUSIVE_FULLSCREEN = 4
withedge_to_edge
?
- In the
Window Management
demo, I was also able to changeImmersive Mode
at runtime. Perhaps the export settings could be removed(?) if it works at runtime and can be changed via the project settings.
func _on_button_fullscreen_pressed() -> void:
if DisplayServer.window_get_mode() == DisplayServer.WINDOW_MODE_FULLSCREEN:
DisplayServer.window_set_mode(DisplayServer.WINDOW_MODE_WINDOWED)
else:
DisplayServer.window_set_mode(DisplayServer.WINDOW_MODE_FULLSCREEN)
I think, edge-to-edge should be supported for every SDK 24+ device. I haven't tested though.
Not yet! Let's not block this PR, I'll send one to change it at runtime using WINDOW_MODE_MAXIMIZED (for Godot 4.6).
We are keeping the export option to instantly apply the immersive/edge-to-edge mode on launch otherwise it would create a slight noticable delay. ProjectSettings are initialised a bit late in the process. |
Thanks! |
I wanted to try it on my |
@Alex2782 What Android version is your tablet running? And can you send a screenshot or recording of what the test app looks like with the following options:
|
Samsung Android 13. Okay, it's a different issue (theme / style). I was able to identify the |
So it seems to work as expected. I would also expect the navigation bar to be affected when |
I noticed one issue. On dark mode, the status bar icons auto adjust it's color (white/black) based on the background, as expected. However, on light mode it doesn't adjust the color and stays black as seen in screenshot in Alex's comment. |
Follow-up to #106810 (see #106810 (comment)).
Android 15+ (target SDK 35+) enforced edge-to-edge mode for all apps. Most Godot games are immersive by default, so they should be unaffected (system bars auto dismiss), but non-immersive Godot apps and games will now have part of their UI covered by (transparent) system bars.
#106810 addressed the issue for the Android editor by opting out of that behavior, however the opt-out request is no longer respected in Android 16 so it wasn't a full solution.
This PR instead addresses the issue for Godot apps and games (including the Android editor) by updating Godot's layout padding to take into account the system bars and the display cutout.
It also add a new
screen/edge_to_edge
export option to allow apps / games to enable edge to edge support.In addition, the PR also fixes an issue on foldable where the embedded window would obscure the main window when launching.