Skip to content

Android: Fix DisplayServer.get_display_safe_area() issues #108102

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

Merged
merged 1 commit into from
Jul 1, 2025

Conversation

syntaxerror247
Copy link
Member

@syntaxerror247 syntaxerror247 commented Jun 29, 2025

DisplayServer.get_display_safe_area() was previously unreliable:

  • It did not account for dock/taskbar on tablets.
  • In landscape mode, it failed to account for the cutout area.
  • In reverse portrait, it would double-subtract the cutout, resulting in an incorrect safe area.
  • If edge-to-edge mode was disabled, it gave more incorrect area, etc.

This PR rewrites the safe area logic to address all of these cases. It now reliably returns the correct safe area in my testing with different physical and virtual devices.

Fixes #105462

Test Project: safe_area_test.zip

Copy link
Member

@Alex2782 Alex2782 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Test, Video - LG Nexus 5X - Android 8, Edge to Edge + Immersive Mode
test_nexus5x.mp4

on Samsung Tab S7 - Android 13

master branch, 51px of the status bar was not taken into account (only edge ​​to edge, without Immersive Mode)

[P: (0, 51), S: (2560, 1498)]
[P: (0, 51), S: (1600, 2458)]

this PR. (1498 - 1447 = 51)

[P: (0, 51), S: (2560, 1447)]
[P: (0, 51), S: (1600, 2407)]

@Alex2782
Copy link
Member

Alex2782 commented Jun 29, 2025

Fixes also #62783 ? (v3.4.4 after cherrypick maybe)

@Repiteo Repiteo merged commit 098f325 into godotengine:master Jul 1, 2025
20 checks passed
@Repiteo
Copy link
Contributor

Repiteo commented Jul 1, 2025

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

DisplayServer.get_display_safe_area is too small on some android phones in some orientations
3 participants