I am developing an Android application that uses accessibility-service, and I want to disable explore-by-touch when the user opens specific applications like Piano, Games, etc.
I read API documentation of setTouchExplorationPassthroughRegion()
public void setTouchExplorationPassthroughRegion (int displayId,
Region region)
When AccessibilityServiceInfo#FLAG_REQUEST_TOUCH_EXPLORATION_MODE is enabled, this function requests that touch interactions starting in the specified region of the screen bypass the touch explorer and go straight to the view hierarchy. There can only be one-touch exploration passthrough region per display. Requesting a new touch explorationpassthrough region clears the existing one. To disable this passthrough and return to the original behaviour, pass in an empty region. When AccessibilityServiceInfo.FLAG_REQUEST_TOUCH_EXPLORATION_MODE is disabled this function has no effect.
So I tried the above function in Android-11 but explore-by-touch is not getting disabled. What can I do to disable explore-by-touch in some applications.
Note: The user might be running his own Accessibility-Service like TalkBack screen reader which also uses the Explore-By-Touch feature.