Merge "Added test cases for DataCallResponse parcel read/write"
diff --git a/telephony/java/android/telephony/data/DataCallResponse.java b/telephony/java/android/telephony/data/DataCallResponse.java
index 8cdad3f..da51c86 100644
--- a/telephony/java/android/telephony/data/DataCallResponse.java
+++ b/telephony/java/android/telephony/data/DataCallResponse.java
@@ -116,7 +116,6 @@
*/
public int getSuggestedRetryTime() { return mSuggestedRetryTime; }
-
/**
* @return The unique id of the data connection.
*/
@@ -183,16 +182,57 @@
.append(" active=").append(mActive)
.append(" type=").append(mType)
.append(" ifname=").append(mIfname)
- .append(" mtu=").append(mMtu)
.append(" addresses=").append(mAddresses)
.append(" dnses=").append(mDnses)
.append(" gateways=").append(mGateways)
.append(" pcscf=").append(mPcscfs)
+ .append(" mtu=").append(mMtu)
.append("}");
return sb.toString();
}
@Override
+ public boolean equals (Object o) {
+ if (this == o) return true;
+
+ if (o == null || !(o instanceof DataCallResponse)) {
+ return false;
+ }
+
+ DataCallResponse other = (DataCallResponse) o;
+ return this.mStatus == other.mStatus
+ && this.mSuggestedRetryTime == other.mSuggestedRetryTime
+ && this.mCid == other.mCid
+ && this.mActive == other.mActive
+ && this.mType.equals(other.mType)
+ && this.mIfname.equals(other.mIfname)
+ && mAddresses.size() == other.mAddresses.size()
+ && mAddresses.containsAll(other.mAddresses)
+ && mDnses.size() == other.mDnses.size()
+ && mDnses.containsAll(other.mDnses)
+ && mGateways.size() == other.mGateways.size()
+ && mGateways.containsAll(other.mGateways)
+ && mPcscfs.size() == other.mPcscfs.size()
+ && mPcscfs.containsAll(other.mPcscfs)
+ && mMtu == other.mMtu;
+ }
+
+ @Override
+ public int hashCode() {
+ return mStatus * 31
+ + mSuggestedRetryTime * 37
+ + mCid * 41
+ + mActive * 43
+ + mType.hashCode() * 47
+ + mIfname.hashCode() * 53
+ + mAddresses.hashCode() * 59
+ + mDnses.hashCode() * 61
+ + mGateways.hashCode() * 67
+ + mPcscfs.hashCode() * 71
+ + mMtu * 73;
+ }
+
+ @Override
public int describeContents() {
return 0;
}
diff --git a/telephony/java/android/telephony/data/InterfaceAddress.java b/telephony/java/android/telephony/data/InterfaceAddress.java
index 947d0ff..00d212a 100644
--- a/telephony/java/android/telephony/data/InterfaceAddress.java
+++ b/telephony/java/android/telephony/data/InterfaceAddress.java
@@ -78,6 +78,23 @@
*/
public int getNetworkPrefixLength() { return mPrefixLength; }
+ @Override
+ public boolean equals (Object o) {
+ if (this == o) return true;
+
+ if (o == null || !(o instanceof InterfaceAddress)) {
+ return false;
+ }
+
+ InterfaceAddress other = (InterfaceAddress) o;
+ return this.mInetAddress.equals(other.mInetAddress)
+ && this.mPrefixLength == other.mPrefixLength;
+ }
+
+ @Override
+ public int hashCode() {
+ return mInetAddress.hashCode() * 31 + mPrefixLength * 37;
+ }
@Override
public int describeContents() {