Use chrono for dispatching timeout
To prevent confusion about the units of dispatchingTimeout, convert to
chrono.
Bug: 155931890
Test: atest inputflinger_tests
Change-Id: Icfcb3bad7188052a6b047b3cbe836be8d928fad2
diff --git a/services/inputflinger/tests/InputDispatcher_test.cpp b/services/inputflinger/tests/InputDispatcher_test.cpp
index ea4d885..cf5a3ab 100644
--- a/services/inputflinger/tests/InputDispatcher_test.cpp
+++ b/services/inputflinger/tests/InputDispatcher_test.cpp
@@ -198,13 +198,14 @@
mConfigurationChangedTime = when;
}
- virtual nsecs_t notifyAnr(const sp<InputApplicationHandle>& application,
- const sp<IBinder>& windowToken, const std::string&) override {
+ std::chrono::nanoseconds notifyAnr(const sp<InputApplicationHandle>& application,
+ const sp<IBinder>& windowToken,
+ const std::string&) override {
std::scoped_lock lock(mLock);
mAnrApplications.push(application);
mAnrWindowTokens.push(windowToken);
mNotifyAnr.notify_all();
- return mAnrTimeout.count();
+ return mAnrTimeout;
}
virtual void notifyInputChannelBroken(const sp<IBinder>&) override {}
@@ -585,7 +586,7 @@
FakeApplicationHandle() {
mInfo.name = "Fake Application";
mInfo.token = new BBinder();
- mInfo.dispatchingTimeout = DISPATCHING_TIMEOUT.count();
+ mInfo.dispatchingTimeout = DISPATCHING_TIMEOUT;
}
virtual ~FakeApplicationHandle() {}
@@ -594,7 +595,7 @@
}
void setDispatchingTimeout(std::chrono::nanoseconds timeout) {
- mInfo.dispatchingTimeout = timeout.count();
+ mInfo.dispatchingTimeout = timeout;
}
};
@@ -767,7 +768,7 @@
mInfo.name = name;
mInfo.layoutParamsFlags = 0;
mInfo.layoutParamsType = InputWindowInfo::TYPE_APPLICATION;
- mInfo.dispatchingTimeout = DISPATCHING_TIMEOUT.count();
+ mInfo.dispatchingTimeout = DISPATCHING_TIMEOUT;
mInfo.frameLeft = 0;
mInfo.frameTop = 0;
mInfo.frameRight = WIDTH;
@@ -791,7 +792,7 @@
void setFocus(bool hasFocus) { mInfo.hasFocus = hasFocus; }
void setDispatchingTimeout(std::chrono::nanoseconds timeout) {
- mInfo.dispatchingTimeout = timeout.count();
+ mInfo.dispatchingTimeout = timeout;
}
void setPaused(bool paused) { mInfo.paused = paused; }