Merge "Use structural equality for A11yNodeInfo#mChildNodeIds"
This commit is contained in:
committed by
Android (Google) Code Review
commit
f66699314c
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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++;
|
||||
|
||||
Reference in New Issue
Block a user