-
-
Notifications
You must be signed in to change notification settings - Fork 21.1k
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
Implement DisplayServer::screen_get_usable_rect() for Android #43104
Implement DisplayServer::screen_get_usable_rect() for Android #43104
Conversation
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.
I haven't tested, but the code looks fine apart from the little detail I've pointed out.
Another thing that needs to be addressed is DisplayCutout
is min API level 28 and the current minimum is 21.
https://developer.android.com/reference/android/view/DisplayCutout
Is there any way we could disable this code if API < 28? I don't know if Java allows something like that.
Otherwise, we need to decide if it's ok to raise the minimum API level to 28 for 4.0.
I'd say not OK, that excludes way too many users (40% of the market according to https://gs.statcounter.com/android-version-market-share/mobile/worldwide). |
Eep! Thank you for bringing attention to the minimum API version, @pouleyKetchoupp. I think there's a mechanism for checking the device's supported API version? (I haven't done much android development) Since older devices probably don't have cutouts anyway, would returning the full screen rectangle on devices with API <28 be a sufficient work around? Thanks for the feedback! |
@Klowner Yes I think full screen rectangle would be fine as a fallback if you can figure out how to support both API versions. |
c448894
to
d753a54
Compare
There we go, all squashed down 👍 |
d753a54
to
c57cf9f
Compare
c57cf9f
to
96e22bd
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 to me. I've tested the fallback case and it works fine. I don't have a device with recent enough API to test the cutout itself.
Thanks! |
Could I cherry pick this in 3.x.x or would it be incompatible? Do I have to use 4.0 for this feature? |
This has already been merged in the |
Fixes #20044 for me! Instead of showing letterboxes on the side, the full display is used, and
OS.get_window_safe_area()
should return a rectangle which excludes a device's cutout shapes.It looks like lots of the methods for handling the cutout areas were updated in Android API 30, but hopefully this will work well enough for now.