diff options
| author | lucaslin <lucaslin@google.com> | 2022-04-25 16:14:58 +0800 |
|---|---|---|
| committer | Lucas Lin <lucaslin@google.com> | 2022-05-12 11:24:03 +0000 |
| commit | 7e0ade67f703df307e90b5c008bacb6bcae22e8a (patch) | |
| tree | f067b723a0121367cf89e2aab82290029335507e /core/java | |
| parent | bf3953a627debcec5b28b32c7970e413bbce3b77 (diff) | |
Add equals() & hashCode() for VpnProfileState
Bug: 225010642
Test: atest FrameworksNetTests:VpnTest
Change-Id: I8711187e690385866fa681c3fe5fccdf353ac30b
(cherry picked from commit c867675e38437e01131d86871538326defac4cb9)
Merged-In: I8711187e690385866fa681c3fe5fccdf353ac30b
Diffstat (limited to 'core/java')
| -rw-r--r-- | core/java/android/net/VpnProfileState.java | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/core/java/android/net/VpnProfileState.java b/core/java/android/net/VpnProfileState.java index 0f21a9d7f471..552a2c171f21 100644 --- a/core/java/android/net/VpnProfileState.java +++ b/core/java/android/net/VpnProfileState.java @@ -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()); + } } |
