Skip to content

Commit 5e95a70

Browse files
prabirmspAndroid (Google) Code Review
authored andcommitted
Merge changes I223071a2,I7dfe648c into main
* changes: Print Motion/KeyEvent's eventId as a hex string Increase the test timeout used when waiting for events to be traced
2 parents 5e8cb59 + f5abab6 commit 5e95a70

2 files changed

Lines changed: 7 additions & 3 deletions

File tree

libs/input/Input.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -374,7 +374,7 @@ std::ostream& operator<<(std::ostream& out, const KeyEvent& event) {
374374
out << ", deviceId=" << event.getDeviceId();
375375
out << ", source=" << inputEventSourceToString(event.getSource());
376376
out << ", displayId=" << event.getDisplayId();
377-
out << ", eventId=" << event.getId();
377+
out << ", eventId=0x" << std::hex << event.getId() << std::dec;
378378
out << "}";
379379
return out;
380380
}
@@ -1051,7 +1051,7 @@ std::ostream& operator<<(std::ostream& out, const MotionEvent& event) {
10511051
out << ", deviceId=" << event.getDeviceId();
10521052
out << ", source=" << inputEventSourceToString(event.getSource());
10531053
out << ", displayId=" << event.getDisplayId();
1054-
out << ", eventId=" << event.getId();
1054+
out << ", eventId=0x" << std::hex << event.getId() << std::dec;
10551055
out << "}";
10561056
return out;
10571057
}

services/inputflinger/tests/FakeInputTracingBackend.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,11 @@ namespace android::inputdispatcher {
2323

2424
namespace {
2525

26-
constexpr auto TRACE_TIMEOUT = std::chrono::milliseconds(100);
26+
// Use a larger timeout while waiting for events to be traced, compared to the timeout used while
27+
// waiting to receive events through the input channel. Events are traced from a separate thread,
28+
// which does not have the same high thread priority as the InputDispatcher's thread, so the tracer
29+
// is expected to lag behind the Dispatcher at times.
30+
constexpr auto TRACE_TIMEOUT = std::chrono::seconds(5);
2731

2832
base::ResultError<> error(const std::ostringstream& ss) {
2933
return base::ResultError(ss.str(), BAD_VALUE);

0 commit comments

Comments
 (0)