From 31730bef1a33968e89ac87ef318d9cfa9df2c4be Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Wed, 24 Jul 2024 12:51:51 -0700 Subject: [PATCH] Fixed running on Android 10 and older (thanks @AntTheAlchemist!) --- .../main/java/org/libsdl/app/SDLSurface.java | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/android-project/app/src/main/java/org/libsdl/app/SDLSurface.java b/android-project/app/src/main/java/org/libsdl/app/SDLSurface.java index 0617757465953..d896f6ce4a663 100644 --- a/android-project/app/src/main/java/org/libsdl/app/SDLSurface.java +++ b/android-project/app/src/main/java/org/libsdl/app/SDLSurface.java @@ -194,16 +194,15 @@ public void surfaceChanged(SurfaceHolder holder, // Window inset @Override public WindowInsets onApplyWindowInsets(View v, WindowInsets insets) { - Insets combined = insets.getInsets(WindowInsets.Type.statusBars() | - WindowInsets.Type.navigationBars() | - WindowInsets.Type.captionBar() | - WindowInsets.Type.systemGestures() | - WindowInsets.Type.mandatorySystemGestures() | - WindowInsets.Type.tappableElement() | - WindowInsets.Type.displayCutout() | - WindowInsets.Type.systemOverlays()); - - SDLActivity.onNativeInsetsChanged(combined.left, combined.right, combined.top, combined.bottom); + if (Build.VERSION.SDK_INT >= 30 /* Android 11 (R) */) { + Insets combined = insets.getInsets(WindowInsets.Type.systemBars() | + WindowInsets.Type.systemGestures() | + WindowInsets.Type.mandatorySystemGestures() | + WindowInsets.Type.tappableElement() | + WindowInsets.Type.displayCutout()); + + SDLActivity.onNativeInsetsChanged(combined.left, combined.right, combined.top, combined.bottom); + } // Pass these to any child views in case they need them return insets;