Bug 1498849 - Check for SDK compatibility on CollectionInfo.obtain(). r=jchen
authorEitan Isaacson <eitan@monotonous.org>
Tue, 16 Oct 2018 16:00:15 +0000
changeset 497240 8eaeb557ba9f438afb0d6a7bd3bfc19f7b6df098
parent 497239 6fc4224069b26bb408ee1b835a74fe1df9c676ed
child 497242 6fa9b4e512fa5fadcf300634e5da2ae8b1d12ed2
push id9996
push userarchaeopteryx@coole-files.de
push dateThu, 18 Oct 2018 18:37:15 +0000
treeherdermozilla-beta@8efe26839243 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjchen
bugs1498849
milestone64.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 1498849 - Check for SDK compatibility on CollectionInfo.obtain(). r=jchen One method signature was introduced in API 19, and another, with selectionMode was introduced in 21. Differential Revision: https://phabricator.services.mozilla.com/D8788
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
@@ -333,21 +333,27 @@ public class SessionAccessibility {
                             collectionItemBundle.getInt("columnIndex"),
                             collectionItemBundle.getInt("columnSpan"), false);
                     node.setCollectionItemInfo(collectionItemInfo);
                 }
 
                 // Set CollectionInfo
                 GeckoBundle collectionBundle = nodeInfo.getBundle("collectionInfo");
                 if (collectionBundle != null) {
-                    final CollectionInfo collectionInfo = CollectionInfo.obtain(
-                            collectionBundle.getInt("rowCount"),
-                            collectionBundle.getInt("columnCount"),
-                            collectionBundle.getBoolean("isHierarchical", false),
-                            collectionBundle.getInt("selectionMode", 0));
+                    // selectionMode is only supported in SDK >= 21.
+                    final CollectionInfo collectionInfo = Build.VERSION.SDK_INT >= 21
+                            ? CollectionInfo.obtain(
+                                collectionBundle.getInt("rowCount"),
+                                collectionBundle.getInt("columnCount"),
+                                collectionBundle.getBoolean("isHierarchical", false),
+                                collectionBundle.getInt("selectionMode", 0))
+                            : CollectionInfo.obtain(
+                                collectionBundle.getInt("rowCount"),
+                                collectionBundle.getInt("columnCount"),
+                                collectionBundle.getBoolean("isHierarchical", false));
                     node.setCollectionInfo(collectionInfo);
                 }
 
                 // Set inputType
                 switch (nodeInfo.getString("inputType", "").toLowerCase()) {
                     case "email":
                         node.setInputType(InputType.TYPE_CLASS_TEXT |
                                 InputType.TYPE_TEXT_VARIATION_WEB_EMAIL_ADDRESS);