OSDN Git Service

Fix resampling for multiple pointers
authorSiarhei Vishniakou <svv@google.com>
Tue, 7 Nov 2017 05:16:47 +0000 (21:16 -0800)
committerSiarhei Vishniakou <svv@google.com>
Fri, 9 Mar 2018 22:53:02 +0000 (14:53 -0800)
commit3bb597138bc53416b3049caa48c618075ec24231
tree6edd367d43b5b9d03fdcc4a587d694b5dd7de61d
parentb5b25545e6909ee0705e29c3d76f07a788189aae
Fix resampling for multiple pointers

If more than one pointer is present and identical coordinates are
encountered for any pointer, the lastResample value will not be
invalidated (by clearing its bits). As a result, the same lastResample
value will be used to subsequently rewriteMessage any time in the
future. This can cause significant jumps in the pointer coordinates, and
is a bug. To further clarify, this bug has only to do with resampling
and nothing to do with both pointers having the same X or Y value.

This CL makes this logic to be per-pointer. As soon as non-identical
value is encountered and the timing conditions are such that the
resampled value is not needed to be used, the lastResample bit for that
pointer will be cleared, meaning that the value in lastResample for this
pointer is stale. This value will no longer be used anywhere.

When performing resampling, allow the process to happen on a per-pointer
basis. If one of the pointers has encountered events with identical
coordinates, then use the previously resampled value (do not resample
again), if that value is still valid (see above). Otherwise, the normal
resampling path will be taken. On the other pointers that do not have
identical coordinates, go through the normal path as well.

Bug: 68840121
Test: recorded a repro event with inputstudio and replayed it while
observing the screen. Saw that the coordinates jump before the fix,
and do not jump with the fix.

Change-Id: If43c323759de8f0184b76221d1ae599a75349ce9
Merged-In: If43c323759de8f0184b76221d1ae599a75349ce9
include/input/InputTransport.h
libs/input/InputTransport.cpp