Loading
Fixing Concurrent Modification Exception in TouchpadDebugView
A race conditions is being hit because the updates in TouchpadVisualizationView are happening from different threads. In this case, hardware state update is received (which happens on the InputReader thread) at the same time as the onDraw (which happens on the UI thread). So, Handlers is used to start posting the updateHardwareState and and updateGestureInfo in TouchpadDebugView and onDraw and onTouchpadHardwareStateNotified in TouchpadVisualizationView. Test: $ atest TouchpadDebugViewTest Test: $ atest TouchpadDebugViewControllerTests Test: Presubmit checks Bug: 368743974 Flag: com.android.hardware.input.touchpad_visualizer Change-Id: I14df74b188b3ba8aadd49e1ce4098e7da1cc1dcb