InputDispatcher: Update tests to verify spy window gesture monitors
Before we enable spy window gesture monitors, we update the tests to
ensure that the behavior of a gesture monitor will not change when its
implementation is switched to a spy window.
Bug: 162194035
Test: atest inputflinger_tests
Change-Id: Id2130d782a04abbdcbf0cc412e53ad849ccb9275
diff --git a/services/inputflinger/dispatcher/InputDispatcher.h b/services/inputflinger/dispatcher/InputDispatcher.h
index 7564839..bff6cac 100644
--- a/services/inputflinger/dispatcher/InputDispatcher.h
+++ b/services/inputflinger/dispatcher/InputDispatcher.h
@@ -148,6 +148,9 @@
void cancelCurrentTouch() override;
+ // Public to allow tests to verify that a Monitor can get ANR.
+ void setMonitorDispatchingTimeoutForTest(std::chrono::nanoseconds timeout);
+
private:
enum class DropReason {
NOT_DROPPED,
@@ -324,8 +327,12 @@
bool runCommandsLockedInterruptable() REQUIRES(mLock);
void postCommandLocked(Command&& command) REQUIRES(mLock);
+ // The dispatching timeout to use for Monitors.
+ std::chrono::nanoseconds mMonitorDispatchingTimeout GUARDED_BY(mLock);
+
nsecs_t processAnrsLocked() REQUIRES(mLock);
- std::chrono::nanoseconds getDispatchingTimeoutLocked(const sp<IBinder>& token) REQUIRES(mLock);
+ std::chrono::nanoseconds getDispatchingTimeoutLocked(const sp<Connection>& connection)
+ REQUIRES(mLock);
// Input filter processing.
bool shouldSendKeyToInputFilterLocked(const NotifyKeyArgs* args) REQUIRES(mLock);