Activity size is calculated incorrectly for full screen (immersive) apps in devices with notch/cutout

Steps to repro:

  • Use device with a notch/cutout, or simulate one using Android dev settings
  • Create new GUI project for Android using Projucer
  • Set @android:style/Theme.NoTitleBar.Fullscreen as theme
  • Set main window as kiosk mode component

-> The app is not filling the entire screen. The GUI gets drawn underneath the top cutout area as it should, but there’s a gap in the bottom of the screen. I assume Juce gets the screen dimensions from somewhere where cutout area is not taken into account.

3 Likes

I got my fullscreen app working by forcing Display userArea to equal Display totalArea in juce_android_Windowing.cpp … but this isn’t a general purpose solution of course.

1 Like

Found another workaround after a few minutes of digging around…

In the void setFullScreen (bool) method of juce_android_Windowing.cpp replace:

Rectangle<int> r (shouldBeFullScreen ? Desktop::getInstance().getDisplays().getMainDisplay().userArea
                                     : lastNonFullscreenBounds);

with:

Rectangle<int> r (shouldNavBarsBeHidden(shouldBeFullScreen) ? Desktop::getInstance().getDisplays().getMainDisplay().totalArea
                                                            : shouldBeFullScreen ? Desktop::getInstance().getDisplays().getMainDisplay().userArea
                                                                                 : lastNonFullscreenBounds);

This approach seems to work with a non-kiosked component.

Has there been any investigation into this issue? I’d be happy to dive deeper and potentially submit a pull request.

1 Like

Juce6 Demorunner still has this problem …

2 Likes