In my testing, this results in text edit events followed by text input events. Any ASCII characters will generate scancode events based on a hypothetical US keyboard layout.
Fixes https://github.com/libsdl-org/SDL/issues/3377
Since accessing Bluetooth prompts the user for permission on both Android and iOS, and we only need it for Steam Controller support, we'll leave it off by default. You can enable it by setting the hint SDL_HINT_JOYSTICK_HIDAPI_STEAM to "1" before calling SDL_Init()
Fixes https://github.com/libsdl-org/SDL/issues/4952
Direct access to the external storage is no longer allowed as of SDK 30. But on older version of Android you will still need WRITE_EXTERNAL_STORAGE in order to request the Download Manager to download files to your external file folder.
"If your app targets Android 12, you must specify the mutability of each PendingIntent object that your app creates. This additional requirement improves your app's security."
Thanks @FormularSumo and @cgutman
You can't set the intent to be immutable, otherwise the USB system can't set the device and permission in the response. This works fine on Android 12 without an immutable intent.
"If your app targets Android 12, you must specify the mutability of each PendingIntent object that your app creates. This additional requirement improves your app's security."
FLAG_IMMUTABLE was added in API 23 so that's why I'm using "> API 23". Using API 30 would also fix the Android 12 issue. Alternatively if PendingIntents should be mutable you could change it to "FLAG_MUTABLE".
It's already set with ANativeWindow_setGeometry, and eventually set/changed also by eglCreateWindowSurface.
- avoid issues with older device where SurfaceView cycle create/changed/destroy appears broken:
calling create/changed/changed, and leading to "deuqueBuffer failed at server side, error: -19", with black screen.
- re-read the format after egl window surface is created, to report the correct one (sometimes, changed from RGBA8888 to RGB24)
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