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

This reverts commit 02975994c1.

Accidentally reverted the wrong commit

(cherry picked from commit b19ecb4032)
This commit is contained in:
Sam Lantinga 2026-05-17 12:15:48 -07:00
parent 59b38dfe85
commit da76e438be

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);
}
});
}
/**