Fix rumble not working due to deprecated API call (#1454)

This commit is contained in:
T2Fat2Fly
2026-09-01 01:20:34 -05:00
committed by GitHub
parent 583f662a87
commit 3c6a0d12f5
@@ -133,7 +133,16 @@ public class ControllerHandler implements InputManager.InputDeviceListener, UsbD
this.conn = conn;
this.gestures = gestures;
this.prefConfig = prefConfig;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
this.deviceVibratorManager = (VibratorManager) activityContext.getSystemService(Context.VIBRATOR_MANAGER_SERVICE);
this.deviceVibrator = (Vibrator) this.deviceVibratorManager.getDefaultVibrator();
}
else {
this.deviceVibratorManager = null;
this.deviceVibrator = (Vibrator) activityContext.getSystemService(Context.VIBRATOR_SERVICE);
}
this.deviceSensorManager = (SensorManager) activityContext.getSystemService(Context.SENSOR_SERVICE);
this.inputManager = (InputManager) activityContext.getSystemService(Context.INPUT_SERVICE);
this.mainThreadHandler = new Handler(Looper.getMainLooper());
@@ -144,13 +153,6 @@ public class ControllerHandler implements InputManager.InputDeviceListener, UsbD
this.backgroundHandlerThread.start();
this.backgroundThreadHandler = new Handler(backgroundHandlerThread.getLooper());
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
this.deviceVibratorManager = (VibratorManager) activityContext.getSystemService(Context.VIBRATOR_MANAGER_SERVICE);
}
else {
this.deviceVibratorManager = null;
}
this.sceManager = new SceManager(activityContext);
this.sceManager.start();