Add locks to InputDispatcher_test
The variables inside the policy are being called from the test thread
and the InputDispatcher thread. They are being accessed without a lock
today. This is OK because we are waiting for dispatcher to go to idle
today, but in ag/10847700 we will have dispatcher not idle, and need to
have a way to wait for a policy callback from the test thread with a
certain timeout.
Add locks to the policy variables here to reduce the diff.
Bug: 143459140
Test: atest inputflinger_tests
Change-Id: I77f5ec15cdfd55ce4c4dfcb501071b2c7c961b1b
diff --git a/services/inputflinger/dispatcher/Entry.cpp b/services/inputflinger/dispatcher/Entry.cpp
index 49630ad..a1eb007 100644
--- a/services/inputflinger/dispatcher/Entry.cpp
+++ b/services/inputflinger/dispatcher/Entry.cpp
@@ -37,6 +37,8 @@
return "MOVE";
case AMOTION_EVENT_ACTION_UP:
return "UP";
+ case AMOTION_EVENT_ACTION_CANCEL:
+ return "CANCEL";
case AMOTION_EVENT_ACTION_POINTER_DOWN:
return "POINTER_DOWN";
case AMOTION_EVENT_ACTION_POINTER_UP:
@@ -57,6 +59,7 @@
}
return StringPrintf("%" PRId32, action);
}
+
VerifiedKeyEvent verifiedKeyEventFromKeyEntry(const KeyEntry& entry) {
return {{VerifiedInputEvent::Type::KEY, entry.deviceId, entry.eventTime, entry.source,
entry.displayId},