Bug 1472996 - Use a new accessible node for each a11y focus event. r=jchen, a=RyanVM
authorEitan Isaacson <eitan@monotonous.org>
Mon, 06 Aug 2018 09:37:58 -0400
changeset 473817 88d84c16e254
parent 473816 ad93c4fae965
child 473818 b5d39c025741
push id1749
push userryanvm@gmail.com
push dateMon, 06 Aug 2018 13:40:05 +0000
treeherdermozilla-release@b5d39c025741 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjchen, RyanVM
bugs1472996
milestone61.0.2
Bug 1472996 - Use a new accessible node for each a11y focus event. r=jchen, a=RyanVM This allows us to avoid using removeAction which needs a higher API version.
mobile/android/geckoview/src/main/java/org/mozilla/geckoview/SessionAccessibility.java
--- a/mobile/android/geckoview/src/main/java/org/mozilla/geckoview/SessionAccessibility.java
+++ b/mobile/android/geckoview/src/main/java/org/mozilla/geckoview/SessionAccessibility.java
@@ -365,19 +365,16 @@ public class SessionAccessibility {
             }
             node.setText(sb.toString());
         }
         node.setContentDescription(message.getString("description", ""));
 
         if (message.getBoolean("clickable")) {
             node.setClickable(true);
             node.addAction(AccessibilityNodeInfo.ACTION_CLICK);
-        } else {
-            node.setClickable(false);
-            node.removeAction(AccessibilityNodeInfo.ACTION_CLICK);
         }
 
         final GeckoBundle bounds = message.getBundle("bounds");
         if (bounds != null) {
             Rect screenBounds = new Rect(bounds.getInt("left"), bounds.getInt("top"),
                                          bounds.getInt("right"), bounds.getInt("bottom"));
             node.setBoundsInScreen(screenBounds);
 
@@ -415,19 +412,20 @@ public class SessionAccessibility {
             if (exitView.equals("movePrevious")) {
                 eventSource = View.NO_ID;
             }
         }
 
         if (eventSource != View.NO_ID) {
             // In Jelly Bean we populate an AccessibilityNodeInfo with the minimal amount of data to have
             // it work with TalkBack.
-            if (mVirtualContentNode == null) {
-                mVirtualContentNode = AccessibilityNodeInfo.obtain(mView, eventSource);
+            if (mVirtualContentNode != null) {
+                mVirtualContentNode.recycle();
             }
+            mVirtualContentNode = AccessibilityNodeInfo.obtain(mView, eventSource);
             populateNodeInfoFromJSON(mVirtualContentNode, message);
         }
 
         final AccessibilityEvent accessibilityEvent = obtainEvent(eventType, eventSource);
         populateEventFromJSON(accessibilityEvent, message);
         ((ViewParent) mView).requestSendAccessibilityEvent(mView, accessibilityEvent);
     }