am 5bc1ea4e: Merge "Drop touch events when no window was touched." into klp-dev
* commit '5bc1ea4e4ae0133d4d5eaa4ac98cf4719effd032': Drop touch events when no window was touched.
This commit is contained in:
@@ -1275,21 +1275,7 @@ int32_t InputDispatcher::findTouchedWindowTargetsLocked(nsecs_t currentTime,
|
|||||||
// Try to assign the pointer to the first foreground window we find, if there is one.
|
// Try to assign the pointer to the first foreground window we find, if there is one.
|
||||||
newTouchedWindowHandle = mTempTouchState.getFirstForegroundWindowHandle();
|
newTouchedWindowHandle = mTempTouchState.getFirstForegroundWindowHandle();
|
||||||
if (newTouchedWindowHandle == NULL) {
|
if (newTouchedWindowHandle == NULL) {
|
||||||
// There is no touched window. If this is an initial down event
|
ALOGI("Dropping event because there is no touchable window at (%d, %d).", x, y);
|
||||||
// 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) {
|
|
||||||
injectionResult = handleTargetsNotReadyLocked(currentTime, entry,
|
|
||||||
mFocusedApplicationHandle, NULL, nextWakeupTime,
|
|
||||||
"Waiting because there is no touchable window that can "
|
|
||||||
"handle the event but there is focused application that may "
|
|
||||||
"eventually add a new window when it finishes starting up.");
|
|
||||||
goto Unresponsive;
|
|
||||||
}
|
|
||||||
|
|
||||||
ALOGI("Dropping event because there is no touched window.");
|
|
||||||
injectionResult = INPUT_EVENT_INJECTION_FAILED;
|
injectionResult = INPUT_EVENT_INJECTION_FAILED;
|
||||||
goto Failed;
|
goto Failed;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -312,6 +312,7 @@ final class InputMonitor implements InputManagerService.WindowManagerCallbacks {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Notifies that the input device configuration has changed. */
|
/* Notifies that the input device configuration has changed. */
|
||||||
|
@Override
|
||||||
public void notifyConfigurationChanged() {
|
public void notifyConfigurationChanged() {
|
||||||
mService.sendNewConfiguration();
|
mService.sendNewConfiguration();
|
||||||
|
|
||||||
@@ -337,12 +338,14 @@ final class InputMonitor implements InputManagerService.WindowManagerCallbacks {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Notifies that the lid switch changed state. */
|
/* Notifies that the lid switch changed state. */
|
||||||
|
@Override
|
||||||
public void notifyLidSwitchChanged(long whenNanos, boolean lidOpen) {
|
public void notifyLidSwitchChanged(long whenNanos, boolean lidOpen) {
|
||||||
mService.mPolicy.notifyLidSwitchChanged(whenNanos, lidOpen);
|
mService.mPolicy.notifyLidSwitchChanged(whenNanos, lidOpen);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Provides an opportunity for the window manager policy to intercept early key
|
/* Provides an opportunity for the window manager policy to intercept early key
|
||||||
* processing as soon as the key has been read from the device. */
|
* processing as soon as the key has been read from the device. */
|
||||||
|
@Override
|
||||||
public int interceptKeyBeforeQueueing(
|
public int interceptKeyBeforeQueueing(
|
||||||
KeyEvent event, int policyFlags, boolean isScreenOn) {
|
KeyEvent event, int policyFlags, boolean isScreenOn) {
|
||||||
return mService.mPolicy.interceptKeyBeforeQueueing(event, policyFlags, isScreenOn);
|
return mService.mPolicy.interceptKeyBeforeQueueing(event, policyFlags, isScreenOn);
|
||||||
@@ -351,12 +354,14 @@ final class InputMonitor implements InputManagerService.WindowManagerCallbacks {
|
|||||||
/* Provides an opportunity for the window manager policy to intercept early
|
/* Provides an opportunity for the window manager policy to intercept early
|
||||||
* motion event processing when the screen is off since these events are normally
|
* motion event processing when the screen is off since these events are normally
|
||||||
* dropped. */
|
* dropped. */
|
||||||
|
@Override
|
||||||
public int interceptMotionBeforeQueueingWhenScreenOff(int policyFlags) {
|
public int interceptMotionBeforeQueueingWhenScreenOff(int policyFlags) {
|
||||||
return mService.mPolicy.interceptMotionBeforeQueueingWhenScreenOff(policyFlags);
|
return mService.mPolicy.interceptMotionBeforeQueueingWhenScreenOff(policyFlags);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Provides an opportunity for the window manager policy to process a key before
|
/* Provides an opportunity for the window manager policy to process a key before
|
||||||
* ordinary dispatch. */
|
* ordinary dispatch. */
|
||||||
|
@Override
|
||||||
public long interceptKeyBeforeDispatching(
|
public long interceptKeyBeforeDispatching(
|
||||||
InputWindowHandle focus, KeyEvent event, int policyFlags) {
|
InputWindowHandle focus, KeyEvent event, int policyFlags) {
|
||||||
WindowState windowState = focus != null ? (WindowState) focus.windowState : null;
|
WindowState windowState = focus != null ? (WindowState) focus.windowState : null;
|
||||||
@@ -365,6 +370,7 @@ final class InputMonitor implements InputManagerService.WindowManagerCallbacks {
|
|||||||
|
|
||||||
/* Provides an opportunity for the window manager policy to process a key that
|
/* Provides an opportunity for the window manager policy to process a key that
|
||||||
* the application did not handle. */
|
* the application did not handle. */
|
||||||
|
@Override
|
||||||
public KeyEvent dispatchUnhandledKey(
|
public KeyEvent dispatchUnhandledKey(
|
||||||
InputWindowHandle focus, KeyEvent event, int policyFlags) {
|
InputWindowHandle focus, KeyEvent event, int policyFlags) {
|
||||||
WindowState windowState = focus != null ? (WindowState) focus.windowState : null;
|
WindowState windowState = focus != null ? (WindowState) focus.windowState : null;
|
||||||
@@ -372,6 +378,7 @@ final class InputMonitor implements InputManagerService.WindowManagerCallbacks {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Callback to get pointer layer. */
|
/* Callback to get pointer layer. */
|
||||||
|
@Override
|
||||||
public int getPointerLayer() {
|
public int getPointerLayer() {
|
||||||
return mService.mPolicy.windowTypeToLayerLw(WindowManager.LayoutParams.TYPE_POINTER)
|
return mService.mPolicy.windowTypeToLayerLw(WindowManager.LayoutParams.TYPE_POINTER)
|
||||||
* WindowManagerService.TYPE_LAYER_MULTIPLIER
|
* WindowManagerService.TYPE_LAYER_MULTIPLIER
|
||||||
|
|||||||
Reference in New Issue
Block a user