firmware_TouchMTB: no using ReportRateValidator for stationary fingers

In some gestures, the first finger acts as a stationary finger,
and the second one as a tracking finger. For example, the gesture
RESTING_FINGER_PLUS_2ND_FINGER_MOVE is such a case.

The kernel driver has an internal state machine which keeps track
of the values of event attributes, e.g., ABS_MT_POSITION_X/Y,
ABS_MT_PRESSURE, etc. If a stationary finger is touching the touch
device stably, it is possible that those attributes may not change
across packets. In this case, the kernel driver will not report the
packets at all.

This behavior may affect the correctness when calculating the report
rate. In this patch, we provide the option to ignore the stationary
finger by introducing an optional argument slot. When set "slot=1",
The ReportRateValidator will take into account only the packets of
the second finger. Otherwise, it will count all packets as before
when calculating the report rate.

Specifically, the following gestures with the first finger acting as
a stationary one are affected:
  FINGER_CROSSING,
  FAT_FINGER_MOVE_WITH_RESTING_FINGER,
  RESTING_FINGER_PLUS_2ND_FINGER_MOVE,
  STATIONARY_FINGER_NOT_AFFECTED_BY_2ND_FINGER_TAPS

A list of SYN_REPORT time instants is calculated first, and is then
passed into the methods of computing the report rate and the report
rate metrics.

The get_report_rate method is moved from the mtb module to the
validators module as it should belong to the latter.

BUG=chromium:261897
TEST=the unit tests must all pass on a chromebook machine which
include both cases with and without the slot specified.
$ cd /usr/local/autotest/tests/firmware_TouchMTB
$ python tests/run_all_unittests.py

Change-Id: I1ef90331b9db9a5e79593783dc7e9be340797d5e
Reviewed-on: https://gerrit.chromium.org/gerrit/62614
Reviewed-by: Joseph Shyh-In Hwang <josephsih@chromium.org>
Tested-by: Joseph Shyh-In Hwang <josephsih@chromium.org>
Commit-Queue: Joseph Shyh-In Hwang <josephsih@chromium.org>
5 files changed