Add InputChannel::waitForMessage and use it in EndToEndNativeInputTest
The EndToEndNativeInputTest::waitForEventAvailable(timeoutMs) is similar
in implementation to InputChannel::probablyHasInput(), but can stop
after a timeout.
Add InputChannel::waitForMessage(std::chrono::milliseconds timeout) for
use in tests and use it to replace the waitForEventAvailable().
The difference of the new method from probablyHasInput() is that the
latter does not get repeated (because it is not necessary to implement
the hint). Repeating happens only on EINTR to allow tests to return
before timeout expiration when there are problems with the channel
setup. In the end the implementations are rather different.
Bug: b/314973388
Test: atest frameworks/native/libs/gui/tests/EndToEndNativeInputTest.cpp
Test: atest InputPublisherAndConsumerTest
Change-Id: I806aad14e4fba223a5cbbe49cea862f9b8279f24
3 files changed