Merge "Addition of 'XorEqualsString' method for comparing String"

am: e750b5b659

Change-Id: Ia9bd50755df21d39ca9b3e2ef955f9a774a994ed
This commit is contained in:
Jack Yu
2019-10-29 15:28:36 -07:00
committed by android-build-merger

View File

@@ -1206,7 +1206,7 @@ public class ApnSetting implements Parcelable {
&& !other.canHandleType(TYPE_DUN)
&& Objects.equals(this.mApnName, other.mApnName)
&& !typeSameAny(this, other)
&& xorEquals(this.mProxyAddress, other.mProxyAddress)
&& xorEqualsString(this.mProxyAddress, other.mProxyAddress)
&& xorEqualsInt(this.mProxyPort, other.mProxyPort)
&& xorEquals(this.mProtocol, other.mProtocol)
&& xorEquals(this.mRoamingProtocol, other.mRoamingProtocol)
@@ -1215,7 +1215,7 @@ public class ApnSetting implements Parcelable {
&& Objects.equals(this.mMvnoType, other.mMvnoType)
&& Objects.equals(this.mMvnoMatchData, other.mMvnoMatchData)
&& xorEquals(this.mMmsc, other.mMmsc)
&& xorEquals(this.mMmsProxyAddress, other.mMmsProxyAddress)
&& xorEqualsString(this.mMmsProxyAddress, other.mMmsProxyAddress)
&& xorEqualsInt(this.mMmsProxyPort, other.mMmsProxyPort))
&& Objects.equals(this.mNetworkTypeBitmask, other.mNetworkTypeBitmask)
&& Objects.equals(mApnSetId, other.mApnSetId)
@@ -1228,6 +1228,11 @@ public class ApnSetting implements Parcelable {
return first == null || second == null || first.equals(second);
}
// Equal or one is null.
private boolean xorEqualsString(String first, String second) {
return TextUtils.isEmpty(first) || TextUtils.isEmpty(second) || first.equals(second);
}
// Equal or one is not specified.
private boolean xorEqualsInt(int first, int second) {
return first == UNSPECIFIED_INT || second == UNSPECIFIED_INT