From 89977d0d162270a25774c60ea6ca291e7ecda656 Mon Sep 17 00:00:00 2001
From: Arquimedes <[EMAIL REDACTED]>
Date: Sun, 15 Sep 2024 03:49:45 -0300
Subject: [PATCH] Update SDLActivity.java
Fix Full immersive mode in Android 9 and higher.
LAYOUT_IN_DISPLAY_CUTOUT_MODE_SHORT_EDGES
will make sure to use all the screen when the fullscreen flag is enabled.
The other option is
LAYOUT_IN_DISPLAY_CUTOUT_MODE_ALWAYS will work in some cases but in devices that have a camera in the middle this flag will not work.
---
.../app/src/main/java/org/libsdl/app/SDLActivity.java | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/android-project/app/src/main/java/org/libsdl/app/SDLActivity.java b/android-project/app/src/main/java/org/libsdl/app/SDLActivity.java
index a0b2b639b33f8..6fd5aa14d334b 100644
--- a/android-project/app/src/main/java/org/libsdl/app/SDLActivity.java
+++ b/android-project/app/src/main/java/org/libsdl/app/SDLActivity.java
@@ -790,6 +790,11 @@ public void handleMessage(Message msg) {
window.clearFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
SDLActivity.mFullscreenModeActive = false;
}
+ if (Build.VERSION.SDK_INT >= 28 /* Android 9 (Pie) */) {
+ window.getAttributes().layoutInDisplayCutoutMode = WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_SHORT_EDGES;
+ }
+
+
}
} else {
Log.e(TAG, "error handling message, getContext() returned no Activity");