This could fix a rare crash if:
- onConfigurationChanged is called before onCreate();
or
shared libraries failed to load and onConfigurationChanged() is called
"In the second half of 2021, new apps will be required to publish with the Android App Bundle on Google Play"
(see https://developer.android.com/guide/app-bundle)
And "Android App Bundles don't support APK expansion (*.obb) files".
Improve handling of landscape/portrait orientation. Promote to SCREEN_ORIENTATION_SENSOR_* when needed.
Android window can be somehow resizable.
If SDL_WINDOW_RESIZABLE is set, window size change is allowed, for instance when orientation changes (provided the hint allows it).
Rare exception, not catch-able, which appears when the activity gets in a broken
state.
java.lang.IllegalStateException:
at android.app.FragmentManagerImpl.checkStateLoss (FragmentManagerImpl.java:1323)
at android.app.FragmentManagerImpl.popBackStackImmediate (FragmentManagerImpl.java:493)
at android.app.Activity.onBackPressed (Activity.java:2215)
at org.libsdl.app.SDLActivity.onBackPressed (SDLActivity.java)
at android.app.Activity.onKeyUp (Activity.java:2193)
at android.view.KeyEvent.dispatch (KeyEvent.java:2685)
at android.app.Activity.dispatchKeyEvent (Activity.java:2423)
at org.libsdl.app.SDLActivity.dispatchKeyEvent (SDLActivity.java)
nullcheck the device coming back from InputDevice.getDevice(deviceId) in new code added to sdlactivity.onkey.
java.lang.NullPointerException:
at org.libsdl.app.SDLSurface.onKey (SDLActivity.java:1793)
at android.view.View.dispatchKeyEvent (View.java:13321)
at android.view.ViewGroup.dispatchKeyEvent (ViewGroup.java:1912)
at android.view.ViewGroup.dispatchKeyEvent (ViewGroup.java:1912)
at android.view.ViewGroup.dispatchKeyEvent (ViewGroup.java:1912)
at android.view.ViewGroup.dispatchKeyEvent (ViewGroup.java:1912)
at com.android.internal.policy.DecorView.superDispatchKeyEvent (DecorView.java:685)
at com.android.internal.policy.PhoneWindow.superDispatchKeyEvent (PhoneWindow.java:1869)
at android.app.Activity.dispatchKeyEvent (Activity.java:3447)
at org.libsdl.app.SDLActivity.dispatchKeyEvent (SDLActivity.java:496)
@dang @saml @dave
In API 28, 0 width views can't take focus, so if someone tries to position the IME without setting a width, they'll stop getting text events.
Tested on Android 9: with a 0 size, it would send correctly letters a, b, c, etc. but not numbers.
Anthony @ POW Games
I tried adding different configChanges and sure enough, "navigation" worked! Now bluetooth controllers hot-plug nicely. So shall we add it as a default to the AndroidManifest.xml?
Funny that this is how this activity is described:
"navigation" The navigation type (trackball/dpad) has changed. (This should never normally happen.)
I think the reason behind this is because the bluetooth game controller I was testing doubles-up as a keyboard, which probably comes with a DPAD? It's a MOCUTE-032X_B63-88CE