I have a Service that can draw a Canvas on top of all applications using a SYSTEM_ALERT_WINDOW which contains a custom View.
My Service and custom View both implement View.OnTouchListener
The onTouch(View v, MotionEvent ev){} method of the Service returns true while the custom View returns false. This allows me to display my custom View on top of all apps and still interact with the underlying Activity. This part works.
I also want the Service to simulate a touch event in the specified coordinates in the current Activity that is underneath the SYSTEM_ALERT_WINDOW.
I was hoping I could call View.dispatchTouchEvent(...) on the custom View and because onTouch(...) returns false, the touch event would get passed on to the underlying Activity. It does not work.
How can I simulate touch events in any Activity in this situation?
I have used code from the following sources...
Draw a canvas on top of all applications:
http://www.piwai.info/chatheads-basics/
Draw an Android canvas on top of all applications?
Passing touches to underlying app:
How can I interact with elements behind a translucent Android app?
Simulating touches: