Merge "Add equals() & hashCode() for VpnProfileState" into tm-dev am: 7f4e0c5897 am: 8f595435b1

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/18108519

Change-Id: I42108df3148e1f5a1a9ce84d35754e5de59ebc06
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Lucas Lin
2022-05-12 17:59:33 +00:00
committed by Automerger Merge Worker

View File

@@ -24,6 +24,7 @@ import android.os.Parcelable;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.util.Objects;
import java.util.StringJoiner;
/**
@@ -176,4 +177,19 @@ public final class VpnProfileState implements Parcelable {
resultJoiner.add("Lockdown: " + isLockdownEnabled());
return resultJoiner.toString();
}
@Override
public boolean equals(@Nullable Object obj) {
if (!(obj instanceof VpnProfileState)) return false;
final VpnProfileState that = (VpnProfileState) obj;
return (getState() == that.getState()
&& Objects.equals(getSessionId(), that.getSessionId())
&& isAlwaysOn() == that.isAlwaysOn()
&& isLockdownEnabled() == that.isLockdownEnabled());
}
@Override
public int hashCode() {
return Objects.hash(getState(), getSessionId(), isAlwaysOn(), isLockdownEnabled());
}
}