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

Commit a3690d4f authored by Jeff Brown's avatar Jeff Brown Committed by Android Git Automerger
Browse files

am 120a4594: Drop all dispatcher state when dispatcher is disabled.

parents ea651a23 fef5b042
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -1032,6 +1032,9 @@ private:
    // Splitting motion events across windows.
    MotionEntry* splitMotionEvent(const MotionEntry* originalMotionEntry, BitSet32 pointerIds);

    // Reset and drop everything the dispatcher is doing.
    void resetAndDropEverythingLocked(const char* reason);

    // Dump state.
    void dumpDispatchStateLocked(String8& dump);
    void logDispatchStateLocked();
+23 −1
Original line number Diff line number Diff line
@@ -1302,6 +1302,9 @@ Failed:
    }

Unresponsive:
    // Reset temporary touch state to ensure we release unnecessary references to input channels.
    mTempTouchState.reset();

    nsecs_t timeSpentWaitingForApplication = getTimeSpentWaitingForApplicationLocked(currentTime);
    updateDispatchStatisticsLocked(currentTime, entry,
            injectionResult, timeSpentWaitingForApplication);
@@ -2590,6 +2593,10 @@ void InputDispatcher::setInputDispatchMode(bool enabled, bool frozen) {
                resetANRTimeoutsLocked();
            }

            if (mDispatchEnabled && !enabled) {
                resetAndDropEverythingLocked("dispatcher is being disabled");
            }

            mDispatchEnabled = enabled;
            mDispatchFrozen = frozen;
            changed = true;
@@ -2608,6 +2615,21 @@ void InputDispatcher::setInputDispatchMode(bool enabled, bool frozen) {
    }
}

void InputDispatcher::resetAndDropEverythingLocked(const char* reason) {
#if DEBUG_FOCUS
    LOGD("Resetting and dropping all events (%s).", reason);
#endif

    synthesizeCancelationEventsForAllConnectionsLocked(InputState::CANCEL_ALL_EVENTS, reason);

    resetKeyRepeatLocked();
    releasePendingEventLocked();
    drainInboundQueueLocked();
    resetTargetsLocked();

    mTouchState.reset();
}

void InputDispatcher::logDispatchStateLocked() {
    String8 dump;
    dumpDispatchStateLocked(dump);