Recently want to implement the touch screen event recording, and make timestamp tag, similar to the getevent/setevent under the ADB shell, looked up a lot of information, the following is some summary.
Implementation method:
1, using the OnClick method and so on. This method can only be used in your own activity and view, if you want to detect other activity, such as the keyboard is not.
2. Start with the Linux kernel. Intercepts events prior to event distribution, enabling event capture for any activity.
The process of Android touch event:
http://blog.csdn.net/sunnyfans/article/details/8221505
In the Linux kernel, the event is written directly to/dev/input/event*, and then another thread continuously flushes the event. Therefore, to realize the monitoring and injection, is to achieve the/dev/input/event* read and write.
Requirements:
1. ROOT
2. Get SU (Super user privileges)
Analyze event:
To clarify the meaning of each event representative, we use the getevent under the ADB shell to illustrate
From the top down you can see EVENT6 on behalf of Compass (Compass), Event3 for touch screen, below is the event7 (light sensing) event that is heard. The specific agreement can be see this article http://www.ddjava.com/blog/blog.html?blogId=612
This method can be used to monitor Android device events on the PC, but the disadvantage is to be connected to the computer. If it doesn't matter if the face is attached to the computer, you can end up with a script that handles the data http://www.jtben.com/document/919575
C4droid implementation:
C4droid is an app that compiles C/C + + on Android phones, and can operate directly on the underlying Linux kernel in the language of the.
http://tieba.baidu.com/p/2960331527#48299953890l
Java implementations:
Learning ... Live
Get Su, monitor dev/input/event*