Bug 1454310 - Only call AccessibilityNodeInfo.getExtras on API >= 19. r=jchen
authorEitan Isaacson <eitan@monotonous.org>
Mon, 16 Apr 2018 13:26:00 -0400
changeset 414066 6cc3fb847d2f3b90dc6598eb4fae9bd2a36f7d1f
parent 413998 ba5089a967b993f911896e1f787fb9c7c9b406c3
child 414067 34ebcf9dcd6e0bdc991d4b445321ae9d5f6acc16
push id33858
push userncsoregi@mozilla.com
push dateTue, 17 Apr 2018 21:55:44 +0000
treeherdermozilla-central@d6eb5597d744 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjchen
bugs1454310
milestone61.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1454310 - Only call AccessibilityNodeInfo.getExtras on API >= 19. r=jchen
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
@@ -102,20 +102,26 @@ public class SessionAccessibility {
                         case View.NO_ID:
                             // This is the parent View node.
                             // We intentionally don't add VIRTUAL_CONTENT_ID
                             // as a child. It is a source for events,
                             // but not a member of the tree you
                             // can get to by traversing down.
                             onInitializeAccessibilityNodeInfo(mView, info);
                             info.setClassName("android.webkit.WebView"); // TODO: WTF
-                            Bundle bundle = info.getExtras();
-                            bundle.putCharSequence(
-                                "ACTION_ARGUMENT_HTML_ELEMENT_STRING_VALUES",
-                                "ARTICLE,BUTTON,CHECKBOX,COMBOBOX,CONTROL,FOCUSABLE,FRAME,GRAPHIC,H1,H2,H3,H4,H5,H6,HEADING,LANDMARK,LINK,LIST,LIST_ITEM,MAIN,MEDIA,RADIO,SECTION,TABLE,TEXT_FIELD,UNVISITED_LINK,VISITED_LINK");
+                            if (Build.VERSION.SDK_INT >= 19) {
+                                Bundle bundle = info.getExtras();
+                                bundle.putCharSequence(
+                                    "ACTION_ARGUMENT_HTML_ELEMENT_STRING_VALUES",
+                                    "ARTICLE,BUTTON,CHECKBOX,COMBOBOX,CONTROL," +
+                                    "FOCUSABLE,FRAME,GRAPHIC,H1,H2,H3,H4,H5,H6," +
+                                    "HEADING,LANDMARK,LINK,LIST,LIST_ITEM,MAIN," +
+                                    "MEDIA,RADIO,SECTION,TABLE,TEXT_FIELD," +
+                                    "UNVISITED_LINK,VISITED_LINK");
+                            }
                             info.addAction(AccessibilityNodeInfo.ACTION_NEXT_HTML_ELEMENT);
                             info.addChild(hostView, VIRTUAL_CONTENT_ID);
                             break;
                         default:
                             info.setParent(mView);
                             info.setSource(mView, virtualDescendantId);
                             info.setVisibleToUser(mView.isShown());
                             info.setPackageName(GeckoAppShell.getApplicationContext().getPackageName());