From 3a0d878ab56475276c61d574af7651820a5cea5a Mon Sep 17 00:00:00 2001 From: Svetoslav Date: Thu, 4 Dec 2014 12:50:11 -0800 Subject: Ensure all events from a showing window are dispatched. Accessibility services may opt-in to introspect the interactive windows on the screen. If window introspection is enabled there is a case where some events from a showing window are received before the updated window state from the window manager. Now the window manager sends over the windows before notifying the app for the focus change. bug:18625996 Change-Id: Ic481e01efbe12dc92f090f799feeb236672fc7b3 --- .../accessibility/AccessibilityManagerService.java | 27 ---------------------- 1 file changed, 27 deletions(-) (limited to 'services/accessibility/java/com/android') diff --git a/services/accessibility/java/com/android/server/accessibility/AccessibilityManagerService.java b/services/accessibility/java/com/android/server/accessibility/AccessibilityManagerService.java index 2781890..89aebe8 100644 --- a/services/accessibility/java/com/android/server/accessibility/AccessibilityManagerService.java +++ b/services/accessibility/java/com/android/server/accessibility/AccessibilityManagerService.java @@ -3314,8 +3314,6 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub { public int mAccessibilityFocusedWindowId = INVALID_WINDOW_ID; public long mAccessibilityFocusNodeId = AccessibilityNodeInfo.UNDEFINED_ITEM_ID; - public AccessibilityEvent mShowingFocusedWindowEvent; - private boolean mTouchInteractionInProgress; private boolean canDispatchAccessibilityEventLocked(AccessibilityEvent event) { @@ -3324,19 +3322,6 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub { // All events that are for changes in a global window // state should *always* be dispatched. case AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED: - if (mWindowsForAccessibilityCallback != null) { - // OK, this is fun. Sometimes the focused window is notified - // it has focus before being shown. Historically this event - // means that the window is focused and can be introspected. - // But we still have not gotten the window state from the - // window manager, so delay the notification until then. - AccessibilityWindowInfo window = findWindowById(event.getWindowId()); - if (window == null) { - mShowingFocusedWindowEvent = AccessibilityEvent.obtain(event); - return false; - } - } - // $fall-through$ case AccessibilityEvent.TYPE_NOTIFICATION_STATE_CHANGED: case AccessibilityEvent.TYPE_ANNOUNCEMENT: // All events generated by the user touching the @@ -3428,18 +3413,6 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub { } notifyWindowsChanged(); - - // If we are delaying a window state change event as the window - // source was showing when it was fired, now is the time to send. - if (mShowingFocusedWindowEvent != null) { - final int windowId = mShowingFocusedWindowEvent.getWindowId(); - AccessibilityWindowInfo window = findWindowById(windowId); - if (window != null) { - // Sending does the recycle. - sendAccessibilityEvent(mShowingFocusedWindowEvent, mCurrentUserId); - } - mShowingFocusedWindowEvent = null; - } } public boolean computePartialInteractiveRegionForWindowLocked(int windowId, -- cgit v1.1