Wait longer for configuration change
Configuration changes can take > 50 ms. But currently, we are only
waiting for 50 ms. If the cloud device is remote, it can be slow, so the
current timeout is not sufficient.
Extend the timeout for the cases where we expect the event to happen. At
the same time, we don't need to wait for a long time to check that an
event did not happen. Most of the time, the device is fast. On average,
the event happens within 14 ms, with a standard deviation of 4.6 ms.
Therefore, if we wait for 30 ms for an event to not happen, and the code
is faulty, then the test is highly likely to fail.
This would ensure that we don't encounter too many flakes, and the test
will be mostly red if the code is faulty.
Bug: 149155998
Test: tested on a remote cloud device (which is slow)
Test: /data/nativetest/inputflinger_tests/inputflinger_tests
--gtest_repeat=100
Change-Id: Ibd5ec86ef17ff6fac1d115a3fcc337fed7b20ae5
diff --git a/services/inputflinger/tests/InputReader_test.cpp b/services/inputflinger/tests/InputReader_test.cpp
index 618aefc..3d26e75 100644
--- a/services/inputflinger/tests/InputReader_test.cpp
+++ b/services/inputflinger/tests/InputReader_test.cpp
@@ -1748,7 +1748,8 @@
virtual void SetUp() override {
mFakePolicy = new FakeInputReaderPolicy();
- mTestListener = new TestInputListener(50ms);
+ mTestListener = new TestInputListener(2000ms /*eventHappenedTimeout*/,
+ 30ms /*eventDidNotHappenTimeout*/);
mReader = new InputReader(std::make_shared<EventHub>(), mFakePolicy, mTestListener);
ASSERT_EQ(mReader->start(), OK);