Black screen on android devices after reopen app

Hello, openflashers!
I’m using the DisplayingABitmap example on android devices(v4 and v5). After switching to home screen and then returning to the app I can see only black screen. In legacy mode there is no such problem.
lime: 2.4.1 [2.4.2]
openfl-samples: [2.2.2]
openfl: 3.0.6 [3.0.7]

Does it output anything in logcat? My (wild) guess is that it may have something to do with the OpenGL context getting lost.

Logcat trace after reopen app is
V/SDL (16113): onResume()
V/SDL (16113): surfaceCreated()
V/SDL (16113): surfaceChanged()
V/SDL (16113): pixel format RGB_565
V/SDL (16113): Window size:480x854
D/DASH - select( 291): sensors_select_callback: select canceled by request
W/WindowManager( 291): Layout repeat skipped after too many iterations
W/WindowManager( 291): Layout repeat skipped after too many iterations
W/WindowManager( 291): Layout repeat skipped after too many iterations
W/WindowManager( 291): Animation repeat aborted after too many iterations
D/SurfaceFlinger( 136): Release buffer at 0x86d28

If anyone would like to help on this, it would be awesome

I’ve tried the Lime “Hello World” app, which only does a GL clear, which should continue to work even if there has been a loss of context. However, there is still the same problem. I’m not sure if this is related to a bug or problem within SDL2, or if there is something else we need to do in how we are handling our support here

I tried updating to a newer version of SDL but received crashes at startup, even after updating the Android Java templates and other files. I would really like to have unified support over SDL2 for Lime 2, but that requires figuring this one out :confused:

I’ve noticed the following strange behavior:

  1. Open app, everything works fine
  2. Use home key to go back to the home screen (since back key doesn’t work)
  3. Reopen app, black screen
  4. Lock phone and then unlock, app is shown normally again

Maybe its because the context is being restored only for specific events? That’s my guess.

EDIT: The problem seems to be SDLActivity.mIsSurfaceReady not being true when handleResume() is called, which means that nativeResume() is not getting called all the time

When I look at the code, it seems like (perhaps) handleResume needs to be called. When onResume occurs and the surface is not ready, it does not handleResume, but maybe when the surface is created again, handleResume is still never called