Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e750b5b6 authored by Jack Yu's avatar Jack Yu Committed by Gerrit Code Review
Browse files

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

parents c817b660 bc97964a
Loading
Loading
Loading
Loading
+7 −2
Original line number Diff line number Diff line
@@ -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