summaryrefslogtreecommitdiff
path: root/services/inputflinger/dispatcher/InputDispatcher.h
diff options
context:
space:
mode:
authorSiarhei Vishniakou <svv@google.com>2019-11-21 18:10:54 -0800
committerSiarhei Vishniakou <svv@google.com>2019-12-03 17:54:35 -0800
commit2bfa905445b677143f20056561661ee134792184 (patch)
tree7d0bb37cc50dcaf88aea3b5ee3cbea4f9e1d6126 /services/inputflinger/dispatcher/InputDispatcher.h
parent75bed1e67098294ec45072e3aab0013ce45025ce (diff)
downloadnative-2bfa905445b677143f20056561661ee134792184.tar.gz
Wait until dispatcher is idle
Add a mechanism for waiting until the dispatcher is idle. This will allow tests to not have to wait until a specific timeout is reached when asserting that a callback did not happen. For example, the current test approach is like this: 1) do something 2) monitor policy for a certain amount of time 3) check that the thing you are interested in did not happen. With this approach, we will modify this behaviour to be as follows: 1) do something 2) wait until dispatcher is idle 3) check that the thing didn't happen. In this case, the dispatcher is idle condition will happen sooner than the timeout in the original approach. This will help keep the tests fast. Bug: 70668286 Test: atest inputflinger_tests Change-Id: I2ac5e38ccbc388fe6d94832405b68ef9e52d25f4
Diffstat (limited to 'services/inputflinger/dispatcher/InputDispatcher.h')
-rw-r--r--services/inputflinger/dispatcher/InputDispatcher.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/services/inputflinger/dispatcher/InputDispatcher.h b/services/inputflinger/dispatcher/InputDispatcher.h
index 5d7d812692..38f86742b3 100644
--- a/services/inputflinger/dispatcher/InputDispatcher.h
+++ b/services/inputflinger/dispatcher/InputDispatcher.h
@@ -81,6 +81,7 @@ public:
virtual void dump(std::string& dump) override;
virtual void monitor() override;
+ virtual bool waitForIdle() override;
virtual void dispatchOnce() override;
@@ -129,6 +130,7 @@ private:
std::mutex mLock;
std::condition_variable mDispatcherIsAlive;
+ std::condition_variable mDispatcherEnteredIdle;
sp<Looper> mLooper;