diff options
author | 2010-10-27 19:31:24 -0700 | |
---|---|---|
committer | 2010-10-27 19:31:24 -0700 | |
commit | df3cccf3dc6b59ec4a45d80fb483022360e13830 (patch) | |
tree | ad6c69291a1bb02fbf694b0e5ce03258d419bb49 /libs/ui/InputDispatcher.cpp | |
parent | 96abb48dff22a54de4ddcdd427d8e5a261d0facc (diff) | |
parent | 120a4594855951ed5eb185fdfc19bf98efef3ba2 (diff) |
am 120a4594: Drop all dispatcher state when dispatcher is disabled.
Diffstat (limited to 'libs/ui/InputDispatcher.cpp')
-rw-r--r-- | libs/ui/InputDispatcher.cpp | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/libs/ui/InputDispatcher.cpp b/libs/ui/InputDispatcher.cpp index fef814818313..ae81d2615e49 100644 --- a/libs/ui/InputDispatcher.cpp +++ b/libs/ui/InputDispatcher.cpp @@ -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); @@ -2586,10 +2589,14 @@ void InputDispatcher::setInputDispatchMode(bool enabled, bool frozen) { AutoMutex _l(mLock); if (mDispatchEnabled != enabled || mDispatchFrozen != frozen) { - if (mDispatchFrozen && ! frozen) { + if (mDispatchFrozen && !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); |