Fix divergent equals and hashCode behavior
Calling Objects.hash with a byte[] will call the identity hashCode on the
byte[] (data, data_mask) and this doesn't agree with the use of
Objects.deepEquals in equals.
Bug caught by error prone.
Bug: 27723540
Change-Id: Ic33f9a341165db6c9339321f81f7af63d627a2cb
diff --git a/android/app/src/com/android/bluetooth/gatt/ScanFilterQueue.java b/android/app/src/com/android/bluetooth/gatt/ScanFilterQueue.java
index 4b47753..3dab4af 100644
--- a/android/app/src/com/android/bluetooth/gatt/ScanFilterQueue.java
+++ b/android/app/src/com/android/bluetooth/gatt/ScanFilterQueue.java
@@ -61,8 +61,10 @@
@Override
public int hashCode() {
- return Objects.hash(address, addr_type, type, uuid, uuid_mask, name, company,
- company_mask, data, data_mask);
+ return Objects.hash(address, addr_type, type, uuid, uuid_mask,
+ name, company, company_mask,
+ Arrays.hashCode(data),
+ Arrays.hashCode(data_mask));
}
@Override