Search code examples
androidkotlinaccessibilityservice

Missing clicks when creating clicks using dispatchGesture of AccessibilityService


I am trying to create clicks on the screen using dispatchGesture method of the Android AccessibilityService. Swipes works fine but when dispatching clicks, somehow randomly fails to apply on the screen.

GestureResultCallback actually tells it's completed but nothing on the actual screen Sometimes I can see clicks on the screen but missing clicks probability is high here.

What I have tried:

  • I tried to increase the starting time of the stroke in the gesture description
  • I tried to add some delay before executing the gesture

Solution

  • The problem was the duration of the GestureStroke.

    I set it like mentioned here in the CTS code.

    ViewConfiguration.getTapTimeout()

    Now clicks are executing properly.