summaryrefslogtreecommitdiff
path: root/core/java
diff options
context:
space:
mode:
authorTreeHugger Robot <treehugger-gerrit@google.com>2018-02-21 20:59:21 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2018-02-21 20:59:21 +0000
commitf66699314c762ea8ee3bcfbd6654b02e4e6b7c98 (patch)
tree69141168bfc376e8461304de0e9ba877435e6510 /core/java
parentfa0ddd1071b1c3c4b514ce985b07697f07abdede (diff)
parent9669e3af6500ffd1041df7c4197865a001cdc055 (diff)
Merge "Use structural equality for A11yNodeInfo#mChildNodeIds"
Diffstat (limited to 'core/java')
-rw-r--r--core/java/android/util/LongArray.java20
-rw-r--r--core/java/android/view/accessibility/AccessibilityNodeInfo.java2
2 files changed, 20 insertions, 2 deletions
diff --git a/core/java/android/util/LongArray.java b/core/java/android/util/LongArray.java
index 9b0489ca5c6e..fa980966802f 100644
--- a/core/java/android/util/LongArray.java
+++ b/core/java/android/util/LongArray.java
@@ -16,11 +16,15 @@
package android.util;
+import android.annotation.Nullable;
+
import com.android.internal.util.ArrayUtils;
import com.android.internal.util.Preconditions;
-import java.util.Arrays;
+
import libcore.util.EmptyArray;
+import java.util.Arrays;
+
/**
* Implements a growing array of long primitives.
*
@@ -216,4 +220,18 @@ public class LongArray implements Cloneable {
throw new ArrayIndexOutOfBoundsException(mSize, index);
}
}
+
+ /**
+ * Test if each element of {@code a} equals corresponding element from {@code b}
+ */
+ public static boolean elementsEqual(@Nullable LongArray a, @Nullable LongArray b) {
+ if (a == null || b == null) return a == b;
+ if (a.mSize != b.mSize) return false;
+ for (int i = 0; i < a.mSize; i++) {
+ if (a.get(i) != b.get(i)) {
+ return false;
+ }
+ }
+ return true;
+ }
}
diff --git a/core/java/android/view/accessibility/AccessibilityNodeInfo.java b/core/java/android/view/accessibility/AccessibilityNodeInfo.java
index 417a72530b72..5b1dd5c88cae 100644
--- a/core/java/android/view/accessibility/AccessibilityNodeInfo.java
+++ b/core/java/android/view/accessibility/AccessibilityNodeInfo.java
@@ -3203,7 +3203,7 @@ public class AccessibilityNodeInfo implements Parcelable {
fieldIndex++;
if (mConnectionId != DEFAULT.mConnectionId) nonDefaultFields |= bitAt(fieldIndex);
fieldIndex++;
- if (!Objects.equals(mChildNodeIds, DEFAULT.mChildNodeIds)) {
+ if (!LongArray.elementsEqual(mChildNodeIds, DEFAULT.mChildNodeIds)) {
nonDefaultFields |= bitAt(fieldIndex);
}
fieldIndex++;