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

Commit ec79009d authored by Sridhar Dubbaka's avatar Sridhar Dubbaka Committed by Gerrit - the friendly Code Review server
Browse files

Add support for hashCode and equals API support in ETWSinfo

Adding hashCode() and equals() API support in ETWSinfo,
which are required in CellBroadcastAlertService to validate
duplicate detection of ETWS Cb messages.

Change-Id: Ib3853bd8d5de0d6873f09c7fe1de1a635f06580d
parent 30e06b2c
Loading
Loading
Loading
Loading
+22 −0
Original line number Diff line number Diff line
@@ -178,6 +178,28 @@ public class SmsCbEtwsInfo implements Parcelable {
        return Arrays.copyOfRange(mWarningSecurityInformation, 7, 50);
    }

    @Override
    public int hashCode() {
        int hash = mWarningType;
        hash += mEmergencyUserAlert ? 1 : 0;
        hash += mActivatePopup ? 1 : 0;
        return hash;
    }

    @Override
    public boolean equals(Object o) {
        if (o == this) {
            return true;
        }
        if (o == null || !(o instanceof SmsCbEtwsInfo)) {
            return false;
        }
        SmsCbEtwsInfo other = (SmsCbEtwsInfo) o;
        return mWarningType == other.mWarningType
                && mEmergencyUserAlert == other.mEmergencyUserAlert
                && mActivatePopup == other.mActivatePopup;
    }

    @Override
    public String toString() {
        return "SmsCbEtwsInfo{warningType=" + mWarningType + ", emergencyUserAlert="