Refactor timestamp for input events
Each input event has a timestamp that describes when the event occurred. Currently, that timestamp is being generated in the evdev layer of the kernel, which does not accurately represent the actual touch down time. In the touch driver, the input event comes in as an interrupt. During the hard interrupt portion, the timestamp from kernel is acquired, and then passed down to user space as EV_MSC MSC_TIMESTAMP report. The previous attempt at getting a more accurate time for input_event was to use MSC_TIMESTAMP to reconstruct the original input_event time at interrupt. However, upon further discussion, it was decided that this does not utilize the existing Linux api properly, since there's no guarantee that all input devices will use MSC_TIMESTAMP in this manner. As a result, we will be adding new kernel api for providing the timestamp information to evdev from the touch driver, thus overridding the original timestamp. In the meantime, we refactor the existing code to better prepare it for metrics monitoring. We also remove a 2012 workaround here for dealing with incorrect timestamps on input events. Since the kernel version 4.0, the client's queue is flushed when it requests to switch to another clock source. We no longer need to worry about having futuristic timestamps, because the clock source is set during input device open in EventHub. Bug: 7291243 Bug: 62940136 Bug: 111431676 Test: atest -a inputflinger_tests Change-Id: Ia2239514db5af7e4ddda723db7fac10e03157cb6
Loading
Please register or sign in to comment