diff options
| author | Jeff Brown <jeffbrown@google.com> | 2012-05-24 18:57:32 -0700 |
|---|---|---|
| committer | Jeff Brown <jeffbrown@google.com> | 2012-05-24 19:34:39 -0700 |
| commit | 8249fc61837db488191213ac85355287cf8b4fdd (patch) | |
| tree | e9b5f09ae2fac930313bb1878c818f7d6a4343ab /services | |
| parent | 53d003f0e77291e7382c4871e0828014b470ab9f (diff) | |
| download | frameworks_base-8249fc61837db488191213ac85355287cf8b4fdd.zip frameworks_base-8249fc61837db488191213ac85355287cf8b4fdd.tar.gz frameworks_base-8249fc61837db488191213ac85355287cf8b4fdd.tar.bz2 | |
Don't ANR on hover, scroll or if a window goes away.
Prevents ANR on hover or scroll events.
Prevents ANR in the case where one finger touches a window which
is subsequently removed then a second finger comes along and tries
to touch something.
Change-Id: I985ccb70cd86659992328f14f8a705f3f05ea2e5
Diffstat (limited to 'services')
| -rw-r--r-- | services/input/InputDispatcher.cpp | 39 |
1 files changed, 24 insertions, 15 deletions
diff --git a/services/input/InputDispatcher.cpp b/services/input/InputDispatcher.cpp index 1062d68..c8e11c2 100644 --- a/services/input/InputDispatcher.cpp +++ b/services/input/InputDispatcher.cpp @@ -1226,27 +1226,36 @@ int32_t InputDispatcher::findTouchedWindowTargetsLocked(nsecs_t currentTime, isSplit = true; } else if (isSplit) { // New window does not support splitting but we have already split events. - // Assign the pointer to the first foreground window we find. - // (May be NULL which is why we put this code block before the next check.) - newTouchedWindowHandle = mTempTouchState.getFirstForegroundWindowHandle(); + // Ignore the new window. + newTouchedWindowHandle = NULL; } - // If we did not find a touched window then fail. + // Handle the case where we did not find a window. if (newTouchedWindowHandle == NULL) { - if (mFocusedApplicationHandle != NULL) { + // Try to assign the pointer to the first foreground window we find, if there is one. + newTouchedWindowHandle = mTempTouchState.getFirstForegroundWindowHandle(); + if (newTouchedWindowHandle == NULL) { + // There is no touched window. If this is an initial down event + // then wait for a window to appear that will handle the touch. This is + // to ensure that we report an ANR in the case where an application has started + // but not yet put up a window and the user is starting to get impatient. + if (maskedAction == AMOTION_EVENT_ACTION_DOWN + && mFocusedApplicationHandle != NULL) { #if DEBUG_FOCUS - ALOGD("Waiting because there is no touched window but there is a " - "focused application that may eventually add a new window: %s.", - getApplicationWindowLabelLocked(mFocusedApplicationHandle, NULL).string()); + ALOGD("Waiting because there is no touched window but there is a " + "focused application that may eventually add a new window: %s.", + getApplicationWindowLabelLocked( + mFocusedApplicationHandle, NULL).string()); #endif - injectionResult = handleTargetsNotReadyLocked(currentTime, entry, - mFocusedApplicationHandle, NULL, nextWakeupTime); - goto Unresponsive; - } + injectionResult = handleTargetsNotReadyLocked(currentTime, entry, + mFocusedApplicationHandle, NULL, nextWakeupTime); + goto Unresponsive; + } - ALOGI("Dropping event because there is no touched window or focused application."); - injectionResult = INPUT_EVENT_INJECTION_FAILED; - goto Failed; + ALOGI("Dropping event because there is no touched window."); + injectionResult = INPUT_EVENT_INJECTION_FAILED; + goto Failed; + } } // Set target flags. |
