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
This commit is contained in:
Svet Ganov
2014-10-16 09:18:34 -07:00
committed by Svetoslav Ganov
parent 70807ab128
commit d5b0842a1d

View File

@@ -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;