Added hashcode for ApnSetting class

Without hashCode, ApnSetting can't be used as a key in the
map.

Fix: 162663245
Test: Manual
Merged-In: I9445ec854709996c80830e4c8c498e664f1e4f9c
Change-Id: I9445ec854709996c80830e4c8c498e664f1e4f9c
(cherry picked from commit fe59b7268f)
This commit is contained in:
Jack Yu
2020-08-01 19:15:44 -07:00
parent 4f2a849e25
commit 152e11a13d
2 changed files with 11 additions and 5 deletions

View File

@@ -1743,6 +1743,8 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub {
preciseState.getApnSetting());
PreciseDataConnectionState oldState = mPreciseDataConnectionStates.get(phoneId)
.remove(key);
log("Jack: oldState=" + oldState);
log("Jack: newState=" + preciseState);
if (!Objects.equals(oldState, preciseState)) {
for (Record r : mRecords) {
if (r.matchPhoneStateListenerEvent(

View File

@@ -1214,12 +1214,16 @@ public class ApnSetting implements Parcelable {
return false;
}
// TODO - if we have this function we should also have hashCode.
// Also should handle changes in type order and perhaps case-insensitivity.
@Override
public int hashCode() {
return Objects.hash(mApnName, mProxyAddress, mProxyPort, mMmsc, mMmsProxyAddress,
mMmsProxyPort, mUser, mPassword, mAuthType, mApnTypeBitmask, mId, mOperatorNumeric,
mProtocol, mRoamingProtocol, mMtu, mCarrierEnabled, mNetworkTypeBitmask, mProfileId,
mPersistent, mMaxConns, mWaitTime, mMaxConnsTime, mMvnoType, mMvnoMatchData,
mApnSetId, mCarrierId, mSkip464Xlat);
}
/**
* @hide
*/
@Override
public boolean equals(Object o) {
if (o instanceof ApnSetting == false) {
return false;