Android app screen goes black on startup for a few seconds

On my android games I render a full screen sized image immediately on the game starting up as a splash screen, and then load up all the resources needed to draw the first actual game scene. That’s always worked fine but since updating from SDL 2.0.8 to 2.0.12 and updating to the latest Android Studio my splash screen shows for an instant but then the screen goes black and it seems like the Android status bar appears at the top and scrolls off upwards. It’s not a show-stopper as my game then carries on and a few seconds later my first scene appears OK, but it looks untidy.

Is there a setting I need to change to fix this? Is Android trying to display its own (blank) splash screen moments after my app has started and does its first render? Or is SDL doing something I need to disable?

There are several way of implementing a splash screen.

If you do it within your SDL code: I’m not sure why it would be black.
How does it behave on Desktop ?
Can you reproduce with a test-case: like draw SplashScreen … SDL_Delay() … Draw other frames ?

Could be the way you load up the resources: Something not thread safe ? Calling SDL_Renderer ? Can you try valgrind ?

You could also use a SplashScreen for your Android app like this:

AndroidManifest.xml:

<application ... android:theme="@style/splashScreenTheme"

res/values/style.xml:

<resources>
<style name="splashScreenTheme" parent="@android:style/Theme.NoTitleBar.Fullscreen">
    <item name="android:windowBackground">@drawable/splash_shelf</item>
</style>
</resources>

res/drawable/splash_shelf.xml:

<bitmap xmlns:android="http://schemas.android.com/apk/res/android"
   android:src="@drawable/splash_screen"
   android:filter="true"
   />

Your image:
./res/drawable/splash_screen.png