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
This commit is contained in:
Andreas Gampe
2015-03-15 14:38:59 -07:00
parent 30fcd2aa8a
commit 34a7d13a65

View File

@@ -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;
}