summaryrefslogtreecommitdiffstats
path: root/libs/ui
diff options
context:
space:
mode:
authorJeff Brown <jeffbrown@google.com>2010-10-27 18:43:51 -0700
committerJeff Brown <jeffbrown@google.com>2010-10-27 18:43:51 -0700
commit120a4594855951ed5eb185fdfc19bf98efef3ba2 (patch)
tree74fc123ad9fd79bc8d077dc019f5f669e4596e89 /libs/ui
parentaa93bcd62482719c146a411008e1eac94135b6a4 (diff)
downloadframeworks_base-120a4594855951ed5eb185fdfc19bf98efef3ba2.zip
frameworks_base-120a4594855951ed5eb185fdfc19bf98efef3ba2.tar.gz
frameworks_base-120a4594855951ed5eb185fdfc19bf98efef3ba2.tar.bz2
Drop all dispatcher state when dispatcher is disabled.
This patch makes the dispatcher drop all of its state when it is disabled (when the screen turns off). This ensures that the dispatcher does not get stuck thinking a pointer is still down if the screen turned off while the user was touching the display (such as a fat touch while hitting the power button). Bug: 3098344 Change-Id: If50ef5804870aa1acd3179fd4b40e3cda58dd39d
Diffstat (limited to 'libs/ui')
-rw-r--r--libs/ui/InputDispatcher.cpp24
1 files changed, 23 insertions, 1 deletions
diff --git a/libs/ui/InputDispatcher.cpp b/libs/ui/InputDispatcher.cpp
index fef8148..ae81d26 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);