Merge "Added test cases for DataCallResponse parcel read/write"

am: 125d736bbe

Change-Id: I9b2bd725ddaa40513747e368553c918899987d2f
This commit is contained in:
Jack Yu
2017-12-13 09:42:49 +00:00
committed by android-build-merger
2 changed files with 59 additions and 2 deletions

View File

@@ -116,7 +116,6 @@ public final class DataCallResponse implements Parcelable {
*/
public int getSuggestedRetryTime() { return mSuggestedRetryTime; }
/**
* @return The unique id of the data connection.
*/
@@ -183,15 +182,56 @@ public final class DataCallResponse implements Parcelable {
.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;

View File

@@ -78,6 +78,23 @@ public final class InterfaceAddress implements Parcelable {
*/
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() {