Reapply "Change controller sensor state on the main UI thread on Android"

This reverts commit 02975994c1.

Accidentally reverted the wrong commit
This commit is contained in:
Sam Lantinga
2026-05-17 12:15:48 -07:00
parent 02975994c1
commit b19ecb4032

View File

@@ -91,7 +91,13 @@ public class SDLControllerManager
* This method is called by SDL using JNI.
*/
static void joystickSetSensorsEnabled(int device_id, boolean enabled) {
mJoystickHandler.setSensorsEnabled(device_id, enabled);
// Run this on the UI thread so we don't race with enableSensor() in SDLSurface.java
SDL.getContext().runOnUiThread(new Runnable() {
@Override
public void run() {
mJoystickHandler.setSensorsEnabled(device_id, enabled);
}
});
}
/**