Skip to content

Commit a6cab32

Browse files
sganovAndroid (Google) Code Review
authored andcommitted
Merge "Events for window's content change should be dispatched only for the active window." into jb-mr1-dev
2 parents 1a2fac3 + 58fd9f8 commit a6cab32

File tree

1 file changed

+24
-3
lines changed

1 file changed

+24
-3
lines changed

services/java/com/android/server/accessibility/AccessibilityManagerService.java

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2134,9 +2134,30 @@ final class SecurityPolicy {
21342134
private int mActiveWindowId;
21352135

21362136
private boolean canDispatchAccessibilityEvent(AccessibilityEvent event) {
2137-
// Send window changed event only for the retrieval allowing window.
2138-
return (event.getEventType() != AccessibilityEvent.TYPE_WINDOW_CONTENT_CHANGED
2139-
|| event.getWindowId() == mActiveWindowId);
2137+
final int eventType = event.getEventType();
2138+
switch (eventType) {
2139+
// All events that are for changes in a global window
2140+
// state should *always* be dispatched.
2141+
case AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED:
2142+
case AccessibilityEvent.TYPE_NOTIFICATION_STATE_CHANGED:
2143+
// All events generated by the user touching the
2144+
// screen should *always* be dispatched.
2145+
case AccessibilityEvent.TYPE_TOUCH_EXPLORATION_GESTURE_START:
2146+
case AccessibilityEvent.TYPE_TOUCH_EXPLORATION_GESTURE_END:
2147+
case AccessibilityEvent.TYPE_GESTURE_DETECTION_START:
2148+
case AccessibilityEvent.TYPE_GESTURE_DETECTION_END:
2149+
case AccessibilityEvent.TYPE_TOUCH_INTERACTION_START:
2150+
case AccessibilityEvent.TYPE_TOUCH_INTERACTION_END:
2151+
// These will change the active window, so dispatch.
2152+
case AccessibilityEvent.TYPE_VIEW_HOVER_ENTER:
2153+
case AccessibilityEvent.TYPE_VIEW_HOVER_EXIT: {
2154+
return true;
2155+
}
2156+
// All events for changes in window content should be
2157+
// dispatched *only* if this window is the active one.
2158+
default:
2159+
return event.getWindowId() == mActiveWindowId;
2160+
}
21402161
}
21412162

21422163
public void updateEventSourceLocked(AccessibilityEvent event) {

0 commit comments

Comments
 (0)