| Summary: | Enabling fullscreen on Android causes the app to toggle fullscreen mode continuously in a loop | ||
|---|---|---|---|
| Product: | SDL | Reporter: | Olli Kallioinen <olli.kallioinen> |
| Component: | *don't know* | Assignee: | Ryan C. Gordon <icculus> |
| Status: | WAITING --- | QA Contact: | Sam Lantinga <slouken> |
| Severity: | major | ||
| Priority: | P2 | ||
| Version: | HG 2.0 | ||
| Hardware: | Other | ||
| OS: | Android (All) | ||
|
Description
Olli Kallioinen
2018-02-25 16:57:24 UTC
It sounds like Android doesn't know your application can handle screen size changes. Can you check to make sure your app has these set for your activity in AndroidManifest.xml? android:configChanges="keyboard|keyboardHidden|orientation|screenSize" Yep, I have those set. I'll try to investigate a bit too. Here's the project I'm testing with: https://github.com/suikki/simpleSDL After a quick debug run here's what's going on: 02-25 21:41:35.010 19153-19170/com.my.exampleapp D/EGL_emulation: eglMakeCurrent: 0x9d605480: ver 2 0 (tinfo 0x9d603370) 02-25 21:41:35.078 19153-19169/com.my.exampleapp D/EGL_emulation: eglMakeCurrent: 0x9be3c640: ver 2 0 (tinfo 0xa47ed7a0) 02-25 21:41:35.095 19153-19153/com.my.exampleapp V/SDL: surfaceChanged() 02-25 21:41:35.095 19153-19153/com.my.exampleapp V/SDL: pixel format RGB_565 02-25 21:41:35.096 19153-19153/com.my.exampleapp V/SDL: Window size: 768x1280 02-25 21:41:35.099 19153-19169/com.my.exampleapp D/EGL_emulation: eglMakeCurrent: 0x9be3c640: ver 2 0 (tinfo 0xa47ed7a0) 02-25 21:41:35.968 19153-19153/com.my.exampleapp V/SDL: onWindowFocusChanged(): false 02-25 21:41:35.968 19153-19153/com.my.exampleapp V/SDL: nativePause() 02-25 21:41:35.995 19153-19169/com.my.exampleapp D/EGL_emulation: eglMakeCurrent: 0x9be3c640: ver 2 0 (tinfo 0xa47ed7a0) 02-25 21:41:36.010 19153-19153/com.my.exampleapp V/SDL: surfaceChanged() 02-25 21:41:36.010 19153-19153/com.my.exampleapp V/SDL: pixel format RGB_565 02-25 21:41:36.010 19153-19153/com.my.exampleapp V/SDL: Window size: 768x1136 02-25 21:41:36.017 19153-19169/com.my.exampleapp D/EGL_emulation: eglMakeCurrent: 0x9be3c640: ver 2 0 (tinfo 0xa47ed7a0) 02-25 21:41:36.109 19153-19153/com.my.exampleapp V/SDL: onWindowFocusChanged(): true 02-25 21:41:36.109 19153-19153/com.my.exampleapp V/SDL: nativeResume() 02-25 21:41:36.110 19153-19170/com.my.exampleapp D/EGL_emulation: eglMakeCurrent: 0x9d605480: ver 2 0 (tinfo 0x9d603370) 02-25 21:41:36.177 19153-19169/com.my.exampleapp D/EGL_emulation: eglMakeCurrent: 0x9be3c640: ver 2 0 (tinfo 0xa47ed7a0) Seems that the hint popup gives an onWindowFocusChanged() event that causes a call to handleNativeState() that calls nativePause(). Then pause is calling: SDL_OnWindowMinimized() that again calls: SDL_UpdateFullscreenMode() maybe that causes the loop. I'm relatively sure that if you have an Android version that shows this fullscreen hint popup (I don't remember seeing it on older versions). You could reproduce the problem. Although I'm not sure what the logic is for showing the popup, maybe it is only shown on the first run of the program. Probably a related issue on an Android device that has a software navigation bar (not hardware buttons): 1) start app so that it's fullscreen 2) swipe (twice) from the top to bring up the notifications 3) press back Expected behavior: The app return to focus in fullscreen mode Actual behavior: sometimes the navigation buttons are not hidden automatically, and even when they are, the navigation bar does not animate away smoothly but jerks a bit. Probably there are again some extra window state events that restart the animation or sometimes prevent it depending on the event timing. (I was using the same project that I linked above on a nexus 4) I did a bit more testing with a few different versions of Android. Mostly with the emulator as I only have one device here (actually the device is a nexus 5 with android 6.0.1 and not nexus 4 like I said before). emulator with API 19 [4.4.2]: working ok nexus 5 with API 23 [6.0.1]: hiding notifications bugged (see earlier comment) emulator with API 24 [7.0.0]: infinitely looping fullscreen mode (the original issue) emulator with API 25 [7.1.1]: working ok I also tried my test app with an emulator with API level 16. While I didn't see the earlier problems, my test app started with the navigation bar visible, but after switching to another program and back the bar was hidden until touching anywhere on the screen when the bar becomes visible again. This API level does not support the newer immersive mode and it seems that SDL is using the older mode where, if the navigation bar is hidden, the bar will pop back if the screen is touched anywhere. *** I don't think that behavior is useful for games, so I think it would be better to not hide the navigation bar at all for API < 19 *** |