HowTo simulate Trackball/Cursor movement on android device?
I have purchased an Samsung Galaxy I9000 Phone, knowing that it does not have either a trackball nor a touchpad/cursorkeys. I thought: simply write an application that reads gestures and sends/generates the appropriate cursor events. Checking the SDK documantation and found that this is possible after granting my application the permission 'INJECT_EVENTS': "Allows an application to inject user events (keys, touch, trackball) into the event stream and deliver them to ANY window. Without this permission, you can only deliver events to windows in your own process.".
This clearly states that this permission is available at application level, not only at system/firmware level.
After several hours of experimentation I did not find any way to get 开发者_JAVA技巧my program to inject cursor events to any other program than my own. How can this be achieved without having the permission 'INJECT_EVENTS'?
As @adamp points out in the comments, there isn't a way to do this without the INJECT_EVENTS permission as that would be a huge security bug. Furthermore, this question and this bug seem to indicate that INJECT_EVENTS is a system-level permission and not available to non-system apps.
精彩评论