I'm playing around with SDL2 on Android and I have a problem when setting the orientation to stay in landscape.
I have the following lines in my AndroidManifest.xml:
android:screenOrientation="landscape"
android:configChanges="keyboardHidden|orientation"
Without the orientation|screenSize and landscape line, everything is fine. When these lines are added and I tap the back button (to close that app), I get the following log line printed over and over:
E libEGL : eglSwapBuffersWithDamageKHR:1089 error 300d (EGL_BAD_SURFACE)
I am only using SDL functions for rendering with no OpenGL code.
Any ideas why setting the orientation in the manifest would cause this? Is this not the correct way to lock orientation?
Update:
Setting the orientation in the onCreate method is good workaround and seems to do the job. Here's the line of code for that:
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE);
It would still be good to know why setting the orientation in the manifest breaks everything. Setting it to portrait is fine, it's just setting it to landscape that gives the issue.
Update 2:
Setting the orientation in the onCreate method is mostly fine. Closing the app doesn't cause problems, switching to the home screen is fine and so is switching to another application. I found the app would open back up again with no problems. I did find that the app would crash when the screen turns off. Again, this issue only occurs when the app is locked in landscape mode, in portrait it works fine. In the logging I noticed that the onDestroy method is being called when the power button is press in landscape mode, but it's not being called in portrait. When turning the screen on again to resume, the onCreate method isn't even called. It just stops.
I may end up locking the screen in portrait and just rendering everything sideways.