From d5b0842a1ddbfc2ea5335854fe2834b6e9b965de Mon Sep 17 00:00:00 2001 From: Svet Ganov Date: Thu, 16 Oct 2014 09:18:34 -0700 Subject: [PATCH] Send accessibility events with no window. An app can send an accessibility event by calling the send methods on view or directly asking the accessibility manager to do that. While the recommened way to send such events is calling the methods on view a legacy app or app whose developer did not read the docs carefully may be calling the accessibility manager APIs directly. In such a case the event does not have assigned window id and does not get send. Since events fired by using the accessibility manager directly lack context to determine whether thier source is important for accessibility we assume they come from an important view to avoid breaking backwards compatibility. bug:18001711 Change-Id: Ie1c298fa5a0670cbeaedfcd64f820961c296b6ca --- .../server/accessibility/AccessibilityManagerService.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/services/accessibility/java/com/android/server/accessibility/AccessibilityManagerService.java b/services/accessibility/java/com/android/server/accessibility/AccessibilityManagerService.java index aff64e3cd0151..8ef5b049438fa 100644 --- a/services/accessibility/java/com/android/server/accessibility/AccessibilityManagerService.java +++ b/services/accessibility/java/com/android/server/accessibility/AccessibilityManagerService.java @@ -148,6 +148,8 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub { private static final int MAX_POOL_SIZE = 10; + private static final int WINDOW_ID_UNKNOWN = -1; + private static int sIdCounter = 0; private static int sNextWindowId; @@ -1079,7 +1081,7 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub { return false; } - if (!event.isImportantForAccessibility() + if (event.getWindowId() != WINDOW_ID_UNKNOWN && !event.isImportantForAccessibility() && (service.mFetchFlags & AccessibilityNodeInfo.FLAG_INCLUDE_NOT_IMPORTANT_VIEWS) == 0) { return false;