Safe Area not reported correctly on some Android Devices?

The function GetWindowSafeArea/GetRenderSafe area returns incorrectly on one of my android devices. I am drawing a padded rectangle around the safe area for a visual representation on the top left of both of these devices.

On the left, the Samsung galaxy S20 shows a safe area box matching the camera notch.

On the right, the Oppo A9 device is told a 0x0 safe area is needed, even though there is a camera notch.

Strangely, on the Oppo A9, for a brief moment on startup, the safe area is correct, and then half a second later, SDL sends a message saying there is no notch.

Oppo logs on startup:

[debug] WindowSizeInPixels: 720x1461
[debug] GetWindowSize: 720x1461
[debug] WindowPixelDensity: 1
[info] safe area changed 0x64 720x1322 (scale 1.7)

Oppo half a second later:

[debug] resize event 720x1461 -> 720x1600
[info]     safe area was 0x64 720x1322 (scale 1.7)
[info].    safe area changed 0x0 720x1600 (scale 1.7)

It’s almost like, the app, during startup, is told a smaller area is available (with notch), and then a larger area is available (without a notch). Perhaps it is related to the app requesting that it is a full screen (no android button area) app.

Is this a bug, or am I misunderstanding something? The documentation doesn’t seem to clarify why there is a GetWindowSafeArea and a GetRenderSafeArea but they seem to return the same values anyway?

I don’t have an answer yet, but I think I know the problem. If you request that your SDL3 app (via the Android manifest) uses full screen, like this:

android:theme="@android:style/Theme.NoTitleBar.Fullscreen"

By doing this, SDL3 correctly allows you to draw where the camera notch and OS nav menu (now hidden) would have been.

The problem is, SDL_GetRenderSafeArea is reporting padding at the top (for the camera notch) and also reporting padding at the bottom (for the OS menu).

  • We need to respect the “top” padding so the top menu doesn’t go under the camera notch.
  • We don’t want to respect the “bottom” padding, because the OS menu is now just a giant blank space. The bottom menu should use the space at the bottom (where the OS used to draw its menu).

The bottom game menu shouldn’t be forced up and leave a giant blank space at the bottom of the screen.

I can’t just “ignore bottom padding where OS menu would be” because the phone could be rotated.

Is there a way to tell SDL3 SDL_GetRenderSafeArea to realize that we are in full screen mode?

The window flags I am using are SDL_WINDOW_FULLSCREEN | SDL_WINDOW_BORDERLESS | SDL_WINDOW_RESIZABLE