BR: safeAreaInsets and userArea report incorrect values

Hi there, I am seeing the following problems on Android with safeAreaInsets and userArea.

  1. When the screen is rotated, the safe area insets are all incorrectly set to zero, whereas iOS the values correctly adapt to all orientations.

  2. When the screen is rotated, the Android status bar moves to the top, leaving more space horizontally, but userArea does not reflect this.

  3. When a translucent theme is used and the navigation bar is displayed permanently (system setting “buttons” as opposed to “swipe gestures”), the safeAreaInsets do not reflect this.

  4. [Edit] The bottom safe area inset (height of the navigation bar) is never reported.

The following screenshot of the demoRunner (modified to not be in kiosk mode and to show the safe area insets) is an example of the first three problems at once:

I think in this case the user area should be the same as the total area (857 x 384) and the safe area insets should be something like: 23 top (status bar), 23 left (camera notch), 0 bottom, 71 right (navigation bar).

In this thread there are more details and screenshots:

By the way, for the translucent theme I did the following:

  • In the Projucer added @style/MyTheme to the “Android theme” field

  • In Android Studio created within app/res/values the file “themes.xml”
    with the following content:

<?xml version="1.0" encoding="utf-8" ?>
    <style name="MyTheme" parent="@android:style/Theme">
        <item name="android:windowTranslucentStatus">true</item>
        <item name="android:windowTranslucentNavigation">true</item>
        <item name="android:windowNoTitle">true</item>
1 Like

Another problem is that if one uses a theme and “android:windowFullscreen” is set to true, then the top safe area inset is never reported. It always has a value of 0, in any orientation (also upright) and regardless of whether kiosk mode is used.

Yet another problem is that older devices do not mantain kiosk mode correctly, as was reported here:

The poster came up with a solution but I’ve found that it only works partially. In my tests (Galaxy 5, API 26) the status bar appears as soon as a selection is made in a pop-up menu.

I’ve found that what does work with older devices is to use a fullscreen theme, but then JUCE cannot report the size of the safe area (top cutout) on newer devices!

My solution for that is to use two different themes. Since the support for cutouts was introduced with API Level 28, I am using a non-fullscreen theme from that level on (placed in the folder values-v28) and a fullscreen one for previous API’s (in the values folder). I am not sure if this is the correct approach, but it seems to work.

Still, JUCE team, please take a look into fixing the safe area insets. It’s very hard to get an app to look right without them!


Hi, I was wondering if anybody is looking into this? I know getting the actual usable area in Android is for some strange reason particularly difficult, but this problem keeps coming up. A few more examples:

1 Like