Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP/DNM: Android: Input device sensor troubleshooting #12885

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

dreamsyntax
Copy link
Member

@dreamsyntax dreamsyntax commented Jun 22, 2024

Note, the code is very ugly right now as I just want to figure out the issue.

The this.sensorDetails cannot be accessed with sensorEvent.sensor because the instances do NOT match. As such using it as an accessor fails and returns null.

This line 262 DolphinSensorEventListener: val sensorDetails = sensorDetails[sensorEvent.sensor] will always return null.

Current state:

  • works for one controller
  • two controllers sometimes throw a ConcurrentModificationException in Android SDK unregisterListener. I think you can't have two separate SensorThreads call it at the same time, otherwise this happens? Not really sure.

Stacktrack when having two controllers with sensors connected and then suspending:

FATAL EXCEPTION: SensorThread
                                                                                                    Process: org.dolphinemu.dolphinemu.debug, PID: 23444
                                                                                                    java.util.ConcurrentModificationException
                                                                                                    	at java.util.ArrayList$Itr.checkForComodification(ArrayList.java:1111)
                                                                                                    	at java.util.ArrayList$Itr.next(ArrayList.java:1064)
                                                                                                    	at android.hardware.input.InputDeviceSensorManager$InputSensorEventListenerDelegate.removeSensor(InputDeviceSensorManager.java:283)
                                                                                                    	at android.hardware.input.InputDeviceSensorManager.unregisterListenerInternal(InputDeviceSensorManager.java:515)
                                                                                                    	at android.hardware.input.InputDeviceSensorManager.-$$Nest$munregisterListenerInternal(Unknown Source:0)
                                                                                                    	at android.hardware.input.InputDeviceSensorManager$InputSensorManager.unregisterListenerImpl(InputDeviceSensorManager.java:606)
                                                                                                    	at android.hardware.SensorManager.unregisterListener(SensorManager.java:687)
                                                                                                    	at org.dolphinemu.dolphinemu.features.input.model.DolphinSensorEventListener.setSensorSuspended(DolphinSensorEventListener.kt:415)
                                                                                                    	at org.dolphinemu.dolphinemu.features.input.model.DolphinSensorEventListener.onSensorChanged(DolphinSensorEventListener.kt:367)
                                                                                                    	at android.hardware.input.InputDeviceSensorManager$InputSensorEventListenerDelegate.handleMessage(InputDeviceSensorManager.java:368)
                                                                                                    	at android.os.Handler.dispatchMessage(Handler.java:107)
                                                                                                    	at android.os.Looper.loopOnce(Looper.java:232)
                                                                                                    	at android.os.Looper.loop(Looper.java:317)
                                                                                                    	at android.os.HandlerThread.run(HandlerThread.java:85)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
1 participant