Loading services/input/InputDispatcher.cpp +24 −15 Original line number Original line Diff line number Diff line Loading @@ -1226,28 +1226,37 @@ int32_t InputDispatcher::findTouchedWindowTargetsLocked(nsecs_t currentTime, isSplit = true; isSplit = true; } else if (isSplit) { } else if (isSplit) { // New window does not support splitting but we have already split events. // New window does not support splitting but we have already split events. // Assign the pointer to the first foreground window we find. // Ignore the new window. // (May be NULL which is why we put this code block before the next check.) newTouchedWindowHandle = NULL; newTouchedWindowHandle = mTempTouchState.getFirstForegroundWindowHandle(); } } // If we did not find a touched window then fail. // Handle the case where we did not find a window. if (newTouchedWindowHandle == NULL) { 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 #if DEBUG_FOCUS ALOGD("Waiting because there is no touched window but there is a " ALOGD("Waiting because there is no touched window but there is a " "focused application that may eventually add a new window: %s.", "focused application that may eventually add a new window: %s.", getApplicationWindowLabelLocked(mFocusedApplicationHandle, NULL).string()); getApplicationWindowLabelLocked( mFocusedApplicationHandle, NULL).string()); #endif #endif injectionResult = handleTargetsNotReadyLocked(currentTime, entry, injectionResult = handleTargetsNotReadyLocked(currentTime, entry, mFocusedApplicationHandle, NULL, nextWakeupTime); mFocusedApplicationHandle, NULL, nextWakeupTime); goto Unresponsive; goto Unresponsive; } } ALOGI("Dropping event because there is no touched window or focused application."); ALOGI("Dropping event because there is no touched window."); injectionResult = INPUT_EVENT_INJECTION_FAILED; injectionResult = INPUT_EVENT_INJECTION_FAILED; goto Failed; goto Failed; } } } // Set target flags. // Set target flags. int32_t targetFlags = InputTarget::FLAG_FOREGROUND | InputTarget::FLAG_DISPATCH_AS_IS; int32_t targetFlags = InputTarget::FLAG_FOREGROUND | InputTarget::FLAG_DISPATCH_AS_IS; Loading Loading
services/input/InputDispatcher.cpp +24 −15 Original line number Original line Diff line number Diff line Loading @@ -1226,28 +1226,37 @@ int32_t InputDispatcher::findTouchedWindowTargetsLocked(nsecs_t currentTime, isSplit = true; isSplit = true; } else if (isSplit) { } else if (isSplit) { // New window does not support splitting but we have already split events. // New window does not support splitting but we have already split events. // Assign the pointer to the first foreground window we find. // Ignore the new window. // (May be NULL which is why we put this code block before the next check.) newTouchedWindowHandle = NULL; newTouchedWindowHandle = mTempTouchState.getFirstForegroundWindowHandle(); } } // If we did not find a touched window then fail. // Handle the case where we did not find a window. if (newTouchedWindowHandle == NULL) { 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 #if DEBUG_FOCUS ALOGD("Waiting because there is no touched window but there is a " ALOGD("Waiting because there is no touched window but there is a " "focused application that may eventually add a new window: %s.", "focused application that may eventually add a new window: %s.", getApplicationWindowLabelLocked(mFocusedApplicationHandle, NULL).string()); getApplicationWindowLabelLocked( mFocusedApplicationHandle, NULL).string()); #endif #endif injectionResult = handleTargetsNotReadyLocked(currentTime, entry, injectionResult = handleTargetsNotReadyLocked(currentTime, entry, mFocusedApplicationHandle, NULL, nextWakeupTime); mFocusedApplicationHandle, NULL, nextWakeupTime); goto Unresponsive; goto Unresponsive; } } ALOGI("Dropping event because there is no touched window or focused application."); ALOGI("Dropping event because there is no touched window."); injectionResult = INPUT_EVENT_INJECTION_FAILED; injectionResult = INPUT_EVENT_INJECTION_FAILED; goto Failed; goto Failed; } } } // Set target flags. // Set target flags. int32_t targetFlags = InputTarget::FLAG_FOREGROUND | InputTarget::FLAG_DISPATCH_AS_IS; int32_t targetFlags = InputTarget::FLAG_FOREGROUND | InputTarget::FLAG_DISPATCH_AS_IS; Loading