From 91930459895f179f360414ae9a0d7a9253a4fedd Mon Sep 17 00:00:00 2001 From: JosJuice Date: Sat, 15 Jun 2024 14:09:22 +0200 Subject: [PATCH] Revert "Android: Disable input device sensor input due to crash" This reverts commit 75fb1a7edfb12f490b08ab0b76a8e2f1536d2d9b. --- .../input/model/DolphinSensorEventListener.kt | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/input/model/DolphinSensorEventListener.kt b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/input/model/DolphinSensorEventListener.kt index 6076b67384..6aa5ce2fc0 100644 --- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/input/model/DolphinSensorEventListener.kt +++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/input/model/DolphinSensorEventListener.kt @@ -60,18 +60,11 @@ class DolphinSensorEventListener : SensorEventListener { constructor(inputDevice: InputDevice) { rotateCoordinatesForScreenOrientation = false canSuspendSensorsIndividually = false - sensorManager = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) { - inputDevice.sensorManager - - // TODO: There is a bug where after suspending sensors, onSensorChanged can get called for - // a sensor that we never registered as a listener for. The way our code is currently written, - // this causes a NullPointerException, but if we checked for null we would instead have the - // problem of being spammed with onSensorChanged calls even though the sensor shouldn't be - // enabled. For now, let's comment out the ability to use InputDevice sensors. - - //addSensors(); + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) { + sensorManager = inputDevice.sensorManager + addSensors() } else { - null + sensorManager = null } sortSensorDetails() }