From 34a7d13a65ab5734cd35c00863aa06ce54858ff0 Mon Sep 17 00:00:00 2001 From: Andreas Gampe Date: Sun, 15 Mar 2015 14:38:59 -0700 Subject: [PATCH] Frameworks/base: Fix a hashCode implementation Equals uses Arrays.equals. That means two responses are equal if the content of the data arrays is equal. By convention, the hash code of those objects should agree. In that case one cannot use hashCode on the array (which is the identity hash code). Change-Id: Icce8e2e71e9142421f5dac8a0ee8a211623fb704 --- wifi/java/android/net/wifi/p2p/nsd/WifiP2pServiceResponse.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wifi/java/android/net/wifi/p2p/nsd/WifiP2pServiceResponse.java b/wifi/java/android/net/wifi/p2p/nsd/WifiP2pServiceResponse.java index 194c982b870dd..0ddfa77e33ec7 100644 --- a/wifi/java/android/net/wifi/p2p/nsd/WifiP2pServiceResponse.java +++ b/wifi/java/android/net/wifi/p2p/nsd/WifiP2pServiceResponse.java @@ -334,7 +334,7 @@ public class WifiP2pServiceResponse implements Parcelable { result = 31 * result + mTransId; result = 31 * result + (mDevice.deviceAddress == null ? 0 : mDevice.deviceAddress.hashCode()); - result = 31 * result + (mData == null ? 0 : mData.hashCode()); + result = 31 * result + (mData == null ? 0 : Arrays.hashCode(mData)); return result; }