summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndreas Gampe <agampe@google.com>2015-03-15 14:38:59 -0700
committerAndreas Gampe <agampe@google.com>2015-03-15 14:38:59 -0700
commit34a7d13a65ab5734cd35c00863aa06ce54858ff0 (patch)
tree3a22adb534b224b99910075d1fb17d865b72a2a8
parent30fcd2aa8a87ca97e1d6dbc3203c3a485a56dac9 (diff)
downloadframeworks_base-34a7d13a65ab5734cd35c00863aa06ce54858ff0.zip
frameworks_base-34a7d13a65ab5734cd35c00863aa06ce54858ff0.tar.gz
frameworks_base-34a7d13a65ab5734cd35c00863aa06ce54858ff0.tar.bz2
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
-rw-r--r--wifi/java/android/net/wifi/p2p/nsd/WifiP2pServiceResponse.java2
1 files changed, 1 insertions, 1 deletions
diff --git a/wifi/java/android/net/wifi/p2p/nsd/WifiP2pServiceResponse.java b/wifi/java/android/net/wifi/p2p/nsd/WifiP2pServiceResponse.java
index 194c982..0ddfa77 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;
}