From fc8aade1b089bec4fd92e99369e9680334aa2507 Mon Sep 17 00:00:00 2001 From: Eitan Isaacson Date: Tue, 26 Mar 2013 18:23:03 +0100 Subject: [PATCH] Bug 854006 - Don't cache a11y events that are directly emitted. r=kats,sriram; Additional tweaks by MarcoZ, r=eeejay,kats --- mobile/android/base/GeckoAccessibility.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/mobile/android/base/GeckoAccessibility.java b/mobile/android/base/GeckoAccessibility.java index 80602b8aa101..1d257ce8c78f 100644 --- a/mobile/android/base/GeckoAccessibility.java +++ b/mobile/android/base/GeckoAccessibility.java @@ -31,6 +31,7 @@ public class GeckoAccessibility { private static final int VIRTUAL_CURSOR_NEXT = 3; private static boolean sEnabled = false; + // Used to store the JSON message and populate the event later in the code path. private static JSONObject sEventMessage = null; private static AccessibilityNodeInfo sVirtualCursorNode = null; @@ -160,8 +161,6 @@ public class GeckoAccessibility { sVirtualCursorNode.setBoundsInScreen(screenBounds); } - // Store the JSON message and use it to populate the event later in the code path. - sEventMessage = message; ThreadUtils.postToUiThread(new Runnable() { @Override public void run() { @@ -169,16 +168,19 @@ public class GeckoAccessibility { // accessibility focus action on the view, and it in turn sends the right events. switch (eventType) { case AccessibilityEvent.TYPE_VIEW_ACCESSIBILITY_FOCUSED: + sEventMessage = message; view.performAccessibilityAction(AccessibilityNodeInfo.ACTION_ACCESSIBILITY_FOCUS, null); break; case AccessibilityEvent.TYPE_ANNOUNCEMENT: case AccessibilityEvent.TYPE_VIEW_SCROLLED: + sEventMessage = null; final AccessibilityEvent accEvent = AccessibilityEvent.obtain(eventType); view.onInitializeAccessibilityEvent(accEvent); populateEventFromJSON(accEvent, message); view.getParent().requestSendAccessibilityEvent(view, accEvent); break; default: + sEventMessage = message; view.sendAccessibilityEvent(eventType); break; }