Merge "Factorize custom asserts." am: 6c176efa3d
am: 99fbb40990 Change-Id: I65ea7497abb8b77ebd10ba622075ef3b6c49b2a8
This commit is contained in:
@@ -15,6 +15,7 @@
|
||||
*/
|
||||
package android.net;
|
||||
|
||||
import android.annotation.Nullable;
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
|
||||
@@ -333,25 +334,25 @@ public final class IpSecConfig implements Parcelable {
|
||||
}
|
||||
};
|
||||
|
||||
@VisibleForTesting
|
||||
/** Equals method used for testing */
|
||||
public static boolean equals(IpSecConfig lhs, IpSecConfig rhs) {
|
||||
if (lhs == null || rhs == null) return (lhs == rhs);
|
||||
return (lhs.mMode == rhs.mMode
|
||||
&& lhs.mSourceAddress.equals(rhs.mSourceAddress)
|
||||
&& lhs.mDestinationAddress.equals(rhs.mDestinationAddress)
|
||||
&& ((lhs.mNetwork != null && lhs.mNetwork.equals(rhs.mNetwork))
|
||||
|| (lhs.mNetwork == rhs.mNetwork))
|
||||
&& lhs.mEncapType == rhs.mEncapType
|
||||
&& lhs.mEncapSocketResourceId == rhs.mEncapSocketResourceId
|
||||
&& lhs.mEncapRemotePort == rhs.mEncapRemotePort
|
||||
&& lhs.mNattKeepaliveInterval == rhs.mNattKeepaliveInterval
|
||||
&& lhs.mSpiResourceId == rhs.mSpiResourceId
|
||||
&& IpSecAlgorithm.equals(lhs.mEncryption, rhs.mEncryption)
|
||||
&& IpSecAlgorithm.equals(lhs.mAuthenticatedEncryption, rhs.mAuthenticatedEncryption)
|
||||
&& IpSecAlgorithm.equals(lhs.mAuthentication, rhs.mAuthentication)
|
||||
&& lhs.mMarkValue == rhs.mMarkValue
|
||||
&& lhs.mMarkMask == rhs.mMarkMask
|
||||
&& lhs.mXfrmInterfaceId == rhs.mXfrmInterfaceId);
|
||||
@Override
|
||||
public boolean equals(@Nullable Object other) {
|
||||
if (!(other instanceof IpSecConfig)) return false;
|
||||
final IpSecConfig rhs = (IpSecConfig) other;
|
||||
return (mMode == rhs.mMode
|
||||
&& mSourceAddress.equals(rhs.mSourceAddress)
|
||||
&& mDestinationAddress.equals(rhs.mDestinationAddress)
|
||||
&& ((mNetwork != null && mNetwork.equals(rhs.mNetwork))
|
||||
|| (mNetwork == rhs.mNetwork))
|
||||
&& mEncapType == rhs.mEncapType
|
||||
&& mEncapSocketResourceId == rhs.mEncapSocketResourceId
|
||||
&& mEncapRemotePort == rhs.mEncapRemotePort
|
||||
&& mNattKeepaliveInterval == rhs.mNattKeepaliveInterval
|
||||
&& mSpiResourceId == rhs.mSpiResourceId
|
||||
&& IpSecAlgorithm.equals(mEncryption, rhs.mEncryption)
|
||||
&& IpSecAlgorithm.equals(mAuthenticatedEncryption, rhs.mAuthenticatedEncryption)
|
||||
&& IpSecAlgorithm.equals(mAuthentication, rhs.mAuthentication)
|
||||
&& mMarkValue == rhs.mMarkValue
|
||||
&& mMarkMask == rhs.mMarkMask
|
||||
&& mXfrmInterfaceId == rhs.mXfrmInterfaceId);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -151,15 +151,13 @@ public final class IpSecTransform implements AutoCloseable {
|
||||
}
|
||||
|
||||
/**
|
||||
* Equals method used for testing
|
||||
*
|
||||
* @hide
|
||||
* Standard equals.
|
||||
*/
|
||||
@VisibleForTesting
|
||||
public static boolean equals(IpSecTransform lhs, IpSecTransform rhs) {
|
||||
if (lhs == null || rhs == null) return (lhs == rhs);
|
||||
return IpSecConfig.equals(lhs.getConfig(), rhs.getConfig())
|
||||
&& lhs.mResourceId == rhs.mResourceId;
|
||||
public boolean equals(Object other) {
|
||||
if (this == other) return true;
|
||||
if (!(other instanceof IpSecTransform)) return false;
|
||||
final IpSecTransform rhs = (IpSecTransform) other;
|
||||
return getConfig().equals(rhs.getConfig()) && mResourceId == rhs.mResourceId;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user