diff options
author | Jayachandran C <jayachandranc@google.com> | 2021-06-03 00:40:55 -0700 |
---|---|---|
committer | Jayachandran C <jayachandranc@google.com> | 2021-06-03 00:40:55 -0700 |
commit | 3d749d67ae4ff2430b3ef36af840e70d63b12d30 (patch) | |
tree | 27d939bc607ea72dfde4728db8ae0c2994cf68d2 /telephony/java/android | |
parent | b84e5cda8828449688ed05fce8a49adbd8a9a19d (diff) |
Override equals and hashCode methods for EpsBearerQosSessionAttributes and NrQosSessionAttributes
Added equals and hashCode methods to simplify CTS tests
Bug: 183239573
Bug: 184396753
Test: atest android.telephony.cts
Change-Id: I545d940b3e77b40ef13e7ca0e5e7169b97e17f1e
Diffstat (limited to 'telephony/java/android')
-rw-r--r-- | telephony/java/android/telephony/data/EpsBearerQosSessionAttributes.java | 20 | ||||
-rw-r--r-- | telephony/java/android/telephony/data/NrQosSessionAttributes.java | 24 |
2 files changed, 44 insertions, 0 deletions
diff --git a/telephony/java/android/telephony/data/EpsBearerQosSessionAttributes.java b/telephony/java/android/telephony/data/EpsBearerQosSessionAttributes.java index 9bc7a5c6cf96..fe4453081362 100644 --- a/telephony/java/android/telephony/data/EpsBearerQosSessionAttributes.java +++ b/telephony/java/android/telephony/data/EpsBearerQosSessionAttributes.java @@ -206,6 +206,26 @@ public final class EpsBearerQosSessionAttributes implements Parcelable, QosSessi } } + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + EpsBearerQosSessionAttributes epsBearerAttr = (EpsBearerQosSessionAttributes) o; + return mQci == epsBearerAttr.mQci + && mMaxUplinkBitRate == epsBearerAttr.mMaxUplinkBitRate + && mMaxDownlinkBitRate == epsBearerAttr.mMaxDownlinkBitRate + && mGuaranteedUplinkBitRate == epsBearerAttr.mGuaranteedUplinkBitRate + && mGuaranteedDownlinkBitRate == epsBearerAttr.mGuaranteedDownlinkBitRate + && mRemoteAddresses.size() == epsBearerAttr.mRemoteAddresses.size() + && mRemoteAddresses.containsAll(epsBearerAttr.mRemoteAddresses); + } + + @Override + public int hashCode() { + return Objects.hash(mQci, mMaxUplinkBitRate, mMaxDownlinkBitRate, + mGuaranteedUplinkBitRate, mGuaranteedDownlinkBitRate, mRemoteAddresses); + } + @NonNull public static final Creator<EpsBearerQosSessionAttributes> CREATOR = new Creator<EpsBearerQosSessionAttributes>() { diff --git a/telephony/java/android/telephony/data/NrQosSessionAttributes.java b/telephony/java/android/telephony/data/NrQosSessionAttributes.java index 4c37687910a1..c3a0eedf3d7d 100644 --- a/telephony/java/android/telephony/data/NrQosSessionAttributes.java +++ b/telephony/java/android/telephony/data/NrQosSessionAttributes.java @@ -241,6 +241,30 @@ public final class NrQosSessionAttributes implements Parcelable, QosSessionAttri } } + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + NrQosSessionAttributes nrQosAttr = (NrQosSessionAttributes) o; + return m5Qi == nrQosAttr.m5Qi + && mQfi == nrQosAttr.mQfi + && mMaxUplinkBitRate == nrQosAttr.mMaxUplinkBitRate + && mMaxDownlinkBitRate == nrQosAttr.mMaxDownlinkBitRate + && mGuaranteedUplinkBitRate == nrQosAttr.mGuaranteedUplinkBitRate + && mGuaranteedDownlinkBitRate == nrQosAttr.mGuaranteedDownlinkBitRate + && mAveragingWindow == nrQosAttr.mAveragingWindow + && mRemoteAddresses.size() == nrQosAttr.mRemoteAddresses.size() + && mRemoteAddresses.containsAll(nrQosAttr.mRemoteAddresses); + } + + @Override + public int hashCode() { + return Objects.hash(m5Qi, mQfi, mMaxUplinkBitRate, + mMaxDownlinkBitRate, mGuaranteedUplinkBitRate, + mGuaranteedDownlinkBitRate, mAveragingWindow, mRemoteAddresses); + } + + @NonNull public static final Creator<NrQosSessionAttributes> CREATOR = new Creator<NrQosSessionAttributes>() { |