Merge pull request #86761 from Alex2782/fix_get_windows_safe_area

Fix `get_window_safe_area` on Android
This commit is contained in:
Rémi Verschelde 2024-01-04 14:26:42 +01:00
commit dbd139c91c
No known key found for this signature in database
GPG key ID: C3336907360768E1

View file

@ -178,12 +178,10 @@ public class GodotIO {
}
public int[] getDisplaySafeArea() {
DisplayMetrics metrics = activity.getResources().getDisplayMetrics();
Display display = activity.getWindowManager().getDefaultDisplay();
Point size = new Point();
display.getRealSize(size);
Rect rect = new Rect();
activity.getWindow().getDecorView().getWindowVisibleDisplayFrame(rect);
int[] result = { 0, 0, size.x, size.y };
int[] result = { rect.left, rect.top, rect.right, rect.bottom };
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
WindowInsets insets = activity.getWindow().getDecorView().getRootWindowInsets();
DisplayCutout cutout = insets.getDisplayCutout();