Merge "Events for window's content change should be dispatched only for the active window." into jb-mr1-dev

This commit is contained in:
Svetoslav Ganov
2012-10-03 19:00:17 -07:00
committed by Android (Google) Code Review

View File

@@ -2134,9 +2134,30 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub {
private int mActiveWindowId;
private boolean canDispatchAccessibilityEvent(AccessibilityEvent event) {
// Send window changed event only for the retrieval allowing window.
return (event.getEventType() != AccessibilityEvent.TYPE_WINDOW_CONTENT_CHANGED
|| event.getWindowId() == mActiveWindowId);
final int eventType = event.getEventType();
switch (eventType) {
// All events that are for changes in a global window
// state should *always* be dispatched.
case AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED:
case AccessibilityEvent.TYPE_NOTIFICATION_STATE_CHANGED:
// All events generated by the user touching the
// screen should *always* be dispatched.
case AccessibilityEvent.TYPE_TOUCH_EXPLORATION_GESTURE_START:
case AccessibilityEvent.TYPE_TOUCH_EXPLORATION_GESTURE_END:
case AccessibilityEvent.TYPE_GESTURE_DETECTION_START:
case AccessibilityEvent.TYPE_GESTURE_DETECTION_END:
case AccessibilityEvent.TYPE_TOUCH_INTERACTION_START:
case AccessibilityEvent.TYPE_TOUCH_INTERACTION_END:
// These will change the active window, so dispatch.
case AccessibilityEvent.TYPE_VIEW_HOVER_ENTER:
case AccessibilityEvent.TYPE_VIEW_HOVER_EXIT: {
return true;
}
// All events for changes in window content should be
// dispatched *only* if this window is the active one.
default:
return event.getWindowId() == mActiveWindowId;
}
}
public void updateEventSourceLocked(AccessibilityEvent event) {