From 99ef1d40dce0a5b27f08e02e101485aeb48770fc Mon Sep 17 00:00:00 2001 From: Cody Kesting Date: Thu, 14 Mar 2019 10:35:23 -0700 Subject: [PATCH] Fix ServiceState.hashCode() bug. ServiceState currently overrides hashCode() incorrectly. It hashes an Array field without using Arrays.hashCode(), meaning that the default Object.hashCode() implementation is used (which is based on the address of the Array field). This allows equivalent ServiceState instances to produce different hashes. Bug: 128609620 Test: atest CtsTelephonyTestCases:ServiceStateTest Change-Id: I40a7d0b7ebab6d2a1be47ea63a6d223c4c13700b --- telephony/java/android/telephony/ServiceState.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/telephony/java/android/telephony/ServiceState.java b/telephony/java/android/telephony/ServiceState.java index 611812996b282..10fdb5a41277d 100644 --- a/telephony/java/android/telephony/ServiceState.java +++ b/telephony/java/android/telephony/ServiceState.java @@ -837,7 +837,7 @@ public class ServiceState implements Parcelable { mVoiceRegState, mDataRegState, mChannelNumber, - mCellBandwidths, + Arrays.hashCode(mCellBandwidths), mVoiceOperatorAlphaLong, mVoiceOperatorAlphaShort, mVoiceOperatorNumeric,