Open hajile95 opened 5 years ago
Yes it is technically possible and makes sense. AFAIK you might need to capture onKeyDown events on a full screen overlay with accessibility permissions (TYPE_ACCESSIBILITY_OVERLAY) and then route to the core and use to clicking
Any tips on where I could put things to make this work? I've been digging through the code trying to learn how it all works, but I'm a fairly inexperienced developer. Would I need to create a new overlay, or is there one that already exists that I could capture an onKeyDown event?
Based on initial investigation with my limited knowledge, it looks like that could fit in the OverlayView class, but I'm not quite sure how all that works.
Also would it be possible to utilize BroadcastReceivers? Not exactly sure how those work, but stumbled across them trying to learn how to capture inputs in a service.
Perhaps an easier option is to intercept the callback
AccessibilityService.onKeyEvent
You will also need to provide some additional permissions to your accessibility service. See the following link for further details. https://developer.android.com/reference/android/accessibilityservice/AccessibilityService.html#onKeyEvent(android.view.KeyEvent)
Hope it helps.
I have been trying to override the AccessibilityService.onKeyEvent method, but have been unsuccessful in capturing anything. Maybe I haven't added the right permissions, but I am having trouble finding what needs to be added.
So I tried adding this flag as well as a few others to the manifest under the TheAccessibilityService class, and overrode the onKeyEvent method within the class, but it doesn't seem to ever be called when I click a button. Could something else be consuming the event before it can get to the service?
Try disabling any other accessibility service.
Would it be possible to create a click based on an Xbox gamepad button press? I have tried implementing an onKeyDown listener in some of the classes, but have not been successful in capturing gamepad inputs.
This could be a helpful feature if using the Xbox adaptive controller as an input method. Being able to just look and click could be valuable to someone who has some ability to press a large button.