I have a need to inject touch events across application boundaries, without root. The reason is that I have an external touch screen that I'd like to use to "replace" phone screen. Think of the touch screen as just a larger version of the phone screen. I already am casting the screen, and have written a service to capture the touch events on the external screen. Now I'd like to send them to the phone, as if they were sent from the phone. The solution can not need a computer (as the touch screen needs to attach via USB OTG) There is FRep, VNC (non-root), and AutoInput that all seem to do at least some touch events across application boundaries without root. For other reasons, I have to use Jelly Bean or above, so UiAutomation might be my best solution.
I've seen this response (How to inject click event with Android UiAutomation.injectInputEvent) and it looks like it might be just what I need, just I can't get it to work. It just crashes on automation.injectInputEvent(motionDown, true);