Move createKeyEvent to a static function

This function is static already, but currently marked as part of
InputDispatcher. Move it to cpp only.

Bug: 175593831
Test: atest inputflinger_tests
Change-Id: I4e7aedc84526202382da0dd3c478cb0a7b3409d7
diff --git a/services/inputflinger/dispatcher/InputDispatcher.cpp b/services/inputflinger/dispatcher/InputDispatcher.cpp
index 0dfa027..ba01ade 100644
--- a/services/inputflinger/dispatcher/InputDispatcher.cpp
+++ b/services/inputflinger/dispatcher/InputDispatcher.cpp
@@ -435,6 +435,14 @@
     return interface_cast<IPlatformCompatNative>(service);
 }
 
+static KeyEvent createKeyEvent(const KeyEntry& entry) {
+    KeyEvent event;
+    event.initialize(entry.id, entry.deviceId, entry.source, entry.displayId, INVALID_HMAC,
+                     entry.action, entry.flags, entry.keyCode, entry.scanCode, entry.metaState,
+                     entry.repeatCount, entry.downTime, entry.eventTime);
+    return event;
+}
+
 // --- InputDispatcher ---
 
 InputDispatcher::InputDispatcher(const sp<InputDispatcherPolicyInterface>& policy)
@@ -3131,8 +3139,8 @@
 
 void InputDispatcher::synthesizeCancelationEventsForAllConnectionsLocked(
         const CancelationOptions& options) {
-    for (const auto& pair : mConnectionsByFd) {
-        synthesizeCancelationEventsForConnectionLocked(pair.second, options);
+    for (const auto& [fd, connection] : mConnectionsByFd) {
+        synthesizeCancelationEventsForConnectionLocked(connection, options);
     }
 }
 
@@ -5533,14 +5541,6 @@
     mLock.lock();
 }
 
-KeyEvent InputDispatcher::createKeyEvent(const KeyEntry& entry) {
-    KeyEvent event;
-    event.initialize(entry.id, entry.deviceId, entry.source, entry.displayId, INVALID_HMAC,
-                     entry.action, entry.flags, entry.keyCode, entry.scanCode, entry.metaState,
-                     entry.repeatCount, entry.downTime, entry.eventTime);
-    return event;
-}
-
 void InputDispatcher::reportDispatchStatistics(std::chrono::nanoseconds eventDuration,
                                                const Connection& connection, bool handled) {
     // TODO Write some statistics about how long we spend waiting.