From 6d8c0b2fc3c0287a474569d44316b00bf58188c2 Mon Sep 17 00:00:00 2001 From: ed Date: Thu, 4 Feb 2021 14:34:53 +0000 Subject: [PATCH] Android: Set layoutInDisplayCutoutMode to LAYOUT_IN_DISPLAY_CUTOUT_MODE_ALWAYS so fullscreen kiosk apps fill the entire display on devices with cutouts --- .../native/juce_android_Windowing.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/modules/juce_gui_basics/native/juce_android_Windowing.cpp b/modules/juce_gui_basics/native/juce_android_Windowing.cpp index a1bf386f6c..ae6959d0ef 100644 --- a/modules/juce_gui_basics/native/juce_android_Windowing.cpp +++ b/modules/juce_gui_basics/native/juce_android_Windowing.cpp @@ -309,6 +309,18 @@ public: env->SetIntField (windowLayoutParams.get(), AndroidWindowManagerLayoutParams.gravity, GRAVITY_LEFT | GRAVITY_TOP); env->SetIntField (windowLayoutParams.get(), AndroidWindowManagerLayoutParams.windowAnimations, 0x01030000 /* android.R.style.Animation */); + if (getAndroidSDKVersion() >= 28) + { + jfieldID layoutInDisplayCutoutModeFieldId = env->GetFieldID (AndroidWindowManagerLayoutParams, + "layoutInDisplayCutoutMode", + "I"); + + if (layoutInDisplayCutoutModeFieldId != nullptr) + env->SetIntField (windowLayoutParams.get(), + layoutInDisplayCutoutModeFieldId, + LAYOUT_IN_DISPLAY_CUTOUT_MODE_ALWAYS); + } + if (Desktop::getInstance().getKioskModeComponent() != nullptr) setNavBarsHidden (true); @@ -953,6 +965,7 @@ private: static constexpr int TYPE_APPLICATION = 0x2; static constexpr int FLAG_NOT_TOUCH_MODAL = 0x20, FLAG_LAYOUT_IN_SCREEN = 0x100, FLAG_LAYOUT_NO_LIMITS = 0x200; static constexpr int PIXEL_FORMAT_OPAQUE = -1, PIXEL_FORMAT_TRANSPARENT = -2; + static constexpr int LAYOUT_IN_DISPLAY_CUTOUT_MODE_ALWAYS = 0x3; GlobalRef view, viewGroup, buffer; bool viewGroupIsWindow = false, fullScreen = false, navBarsHidden = false;