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

Commit 4e68fbfe authored by Siarhei Vishniakou's avatar Siarhei Vishniakou
Browse files

Return early in doDispatchCycleFinishedLockedInterruptible

Reduce the identation of the entire method by returning early if entry
is null.

Bug: 70668286
Test: none
Change-Id: Ic9239c4f7e3566cd584a57973d9e8ed08d8c0287
parent 7e69851c
Loading
Loading
Loading
Loading
+42 −40
Original line number Diff line number Diff line
@@ -4237,13 +4237,16 @@ void InputDispatcher::doOnPointerDownOutsideFocusLockedInterruptible(CommandEntr
void InputDispatcher::doDispatchCycleFinishedLockedInterruptible(
        CommandEntry* commandEntry) {
    sp<Connection> connection = commandEntry->connection;
    nsecs_t finishTime = commandEntry->eventTime;
    const nsecs_t finishTime = commandEntry->eventTime;
    uint32_t seq = commandEntry->seq;
    bool handled = commandEntry->handled;
    const bool handled = commandEntry->handled;

    // Handle post-event policy actions.
    DispatchEntry* dispatchEntry = connection->findWaitQueueEntry(seq);
    if (dispatchEntry) {
    if (!dispatchEntry) {
        return;
    }

    nsecs_t eventDuration = finishTime - dispatchEntry->deliveryTime;
    if (eventDuration > SLOW_EVENT_PROCESSING_WARNING_TIMEOUT) {
        std::string msg =
@@ -4256,12 +4259,12 @@ void InputDispatcher::doDispatchCycleFinishedLockedInterruptible(
    bool restartEvent;
    if (dispatchEntry->eventEntry->type == EventEntry::TYPE_KEY) {
        KeyEntry* keyEntry = static_cast<KeyEntry*>(dispatchEntry->eventEntry);
            restartEvent = afterKeyEventLockedInterruptible(connection,
                    dispatchEntry, keyEntry, handled);
        restartEvent =
                afterKeyEventLockedInterruptible(connection, dispatchEntry, keyEntry, handled);
    } else if (dispatchEntry->eventEntry->type == EventEntry::TYPE_MOTION) {
        MotionEntry* motionEntry = static_cast<MotionEntry*>(dispatchEntry->eventEntry);
            restartEvent = afterMotionEventLockedInterruptible(connection,
                    dispatchEntry, motionEntry, handled);
        restartEvent = afterMotionEventLockedInterruptible(connection, dispatchEntry, motionEntry,
                                                           handled);
    } else {
        restartEvent = false;
    }
@@ -4284,7 +4287,6 @@ void InputDispatcher::doDispatchCycleFinishedLockedInterruptible(
    // Start the next dispatch cycle for this connection.
    startDispatchCycleLocked(now(), connection);
}
}

bool InputDispatcher::afterKeyEventLockedInterruptible(const sp<Connection>& connection,
        DispatchEntry* dispatchEntry, KeyEntry* keyEntry, bool handled) {