Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 2e2ea99e authored by Siarhei Vishniakou's avatar Siarhei Vishniakou
Browse files

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
parent 58cfc60c
Loading
Loading
Loading
Loading
+10 −10
Original line number Original line Diff line number Diff line
@@ -435,6 +435,14 @@ static sp<IPlatformCompatNative> getCompatService() {
    return interface_cast<IPlatformCompatNative>(service);
    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::InputDispatcher(const sp<InputDispatcherPolicyInterface>& policy)
InputDispatcher::InputDispatcher(const sp<InputDispatcherPolicyInterface>& policy)
@@ -3131,8 +3139,8 @@ int InputDispatcher::handleReceiveCallback(int fd, int events, void* data) {


void InputDispatcher::synthesizeCancelationEventsForAllConnectionsLocked(
void InputDispatcher::synthesizeCancelationEventsForAllConnectionsLocked(
        const CancelationOptions& options) {
        const CancelationOptions& options) {
    for (const auto& pair : mConnectionsByFd) {
    for (const auto& [fd, connection] : mConnectionsByFd) {
        synthesizeCancelationEventsForConnectionLocked(pair.second, options);
        synthesizeCancelationEventsForConnectionLocked(connection, options);
    }
    }
}
}


@@ -5533,14 +5541,6 @@ void InputDispatcher::doPokeUserActivityLockedInterruptible(CommandEntry* comman
    mLock.lock();
    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,
void InputDispatcher::reportDispatchStatistics(std::chrono::nanoseconds eventDuration,
                                               const Connection& connection, bool handled) {
                                               const Connection& connection, bool handled) {
    // TODO Write some statistics about how long we spend waiting.
    // TODO Write some statistics about how long we spend waiting.
+0 −1
Original line number Original line Diff line number Diff line
@@ -606,7 +606,6 @@ private:
                                             DispatchEntry* dispatchEntry, MotionEntry& motionEntry,
                                             DispatchEntry* dispatchEntry, MotionEntry& motionEntry,
                                             bool handled) REQUIRES(mLock);
                                             bool handled) REQUIRES(mLock);
    void doPokeUserActivityLockedInterruptible(CommandEntry* commandEntry) REQUIRES(mLock);
    void doPokeUserActivityLockedInterruptible(CommandEntry* commandEntry) REQUIRES(mLock);
    KeyEvent createKeyEvent(const KeyEntry& entry);
    void doOnPointerDownOutsideFocusLockedInterruptible(CommandEntry* commandEntry) REQUIRES(mLock);
    void doOnPointerDownOutsideFocusLockedInterruptible(CommandEntry* commandEntry) REQUIRES(mLock);


    // Statistics gathering.
    // Statistics gathering.