summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteve Kondik <shade@chemlab.org>2012-06-10 13:46:17 +0400
committerGerrit Code Review <gerrit@review.cyanogenmod.com>2012-06-10 13:46:17 +0400
commit52dc9589aace904a13b729c7b2098c478545d066 (patch)
treed63aca4336aa3a241b1a83469528e027db95bb4f
parent1acdadceb0054ad8ff4ea35cc076ff613846a0e4 (diff)
parent4e80674d82b11c9c5189b87e644311e44af5130a (diff)
downloadframeworks_base-52dc9589aace904a13b729c7b2098c478545d066.zip
frameworks_base-52dc9589aace904a13b729c7b2098c478545d066.tar.gz
frameworks_base-52dc9589aace904a13b729c7b2098c478545d066.tar.bz2
Merge "Input: Fix some Applications ANR issue in monkey test" into ics
-rw-r--r--services/input/InputDispatcher.cpp39
1 files changed, 23 insertions, 16 deletions
diff --git a/services/input/InputDispatcher.cpp b/services/input/InputDispatcher.cpp
index 7303392..652166d 100644
--- a/services/input/InputDispatcher.cpp
+++ b/services/input/InputDispatcher.cpp
@@ -1390,28 +1390,35 @@ int32_t InputDispatcher::findTouchedWindowTargetsLocked(nsecs_t currentTime,
// New window supports splitting.
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
- LOGD("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());
+ LOGD("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;
+ }
+ LOGI("Dropping event because there is no touched window.");
+ injectionResult = INPUT_EVENT_INJECTION_FAILED;
+ goto Failed;
}
-
- LOGI("Dropping event because there is no touched window or focused application.");
- injectionResult = INPUT_EVENT_INJECTION_FAILED;
- goto Failed;
}
// Set target flags.