Open JJdeGroot opened 2 years ago
A less than ideal option would be to use the "Bypass TalkBack" gesture before each gesture attempt.
4-finger double tap and hold Only available on device with multi-finger TalkBack gestures. Description: "When you use the pass-through gesture, the system interprets the next gesture like TalkBack is off. For example, if you single-finger swipe from the top of the screen, you get the notification shade."
In the current version of the app (v1.0.2) the app cannot yet detect gestures when TalkBack is enabled.
One of the techniques is intercepting motion events, which works for basic gesture detection. But for advanced gestures, such as angular gestures, e.g. open the context menu, the motion events are not passed to the app.
An idea I had to overcome this, was to implement an AccessibilityService. This way, you can override the onGesture method and broadcast the gesture to the app. The implementation can be found in the ScreenReaderService file.
There are some problems with this implementation:
First: it requires users to enable the service through the accessibility settings of their device. This is a complex series of steps. I have tested this with users, and for most it was too difficult and/or scary to do.
Secondly: there are potential bugs which cause the device to "brick". This can happen because the ScreenReaderService receives all the gestures, but doesn't perform any actions upon receiving them. The service should de-activate itself when the gesture training is inactive, but this doesn't work with 100% confidence on all Android devices.
For the second issue, I looked into the new setGestureDetectionPassthrough method which was added in Android API 30. It looked promising, but I did not manage to get it to work. I did not notice different behavior compared to not setting a passthrough region.
I hope others have more idea's to recognize gestures when TalkBack is active.