diff --git a/src/android/jar/src/org/qtproject/qt/android/QtActivityDelegate.java b/src/android/jar/src/org/qtproject/qt/android/QtActivityDelegate.java index 2a00975aee..31440cfa02 100644 --- a/src/android/jar/src/org/qtproject/qt/android/QtActivityDelegate.java +++ b/src/android/jar/src/org/qtproject/qt/android/QtActivityDelegate.java @@ -133,13 +133,13 @@ public class QtActivityDelegate return; m_systemUiVisibility = systemUiVisibility; + setLayoutInDisplayCutoutMode(); - int systemUiVisibilityFlags = 0; + int systemUiVisibilityFlags = View.SYSTEM_UI_FLAG_VISIBLE; switch (m_systemUiVisibility) { case SYSTEM_UI_VISIBILITY_NORMAL: m_activity.getWindow().addFlags(WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN); m_activity.getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN); - systemUiVisibilityFlags = View.SYSTEM_UI_FLAG_VISIBLE; break; case SYSTEM_UI_VISIBILITY_FULLSCREEN: m_activity.getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN); @@ -157,7 +157,6 @@ public class QtActivityDelegate | WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION | WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS); m_activity.getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN); - systemUiVisibilityFlags = View.SYSTEM_UI_FLAG_VISIBLE; break; }; @@ -166,6 +165,17 @@ public class QtActivityDelegate m_layout.requestLayout(); } + private void setLayoutInDisplayCutoutMode() + { + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) { + int cutOutMode = WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_DEFAULT; + if (SYSTEM_UI_VISIBILITY_FULLSCREEN == m_systemUiVisibility) + cutOutMode = WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_SHORT_EDGES; + + m_activity.getWindow().getAttributes().layoutInDisplayCutoutMode = cutOutMode; + } + } + public void updateFullScreen() { if (m_systemUiVisibility == SYSTEM_UI_VISIBILITY_FULLSCREEN) {