Files
packages_apps_Settings/src/com/android/settings/vpn2/AppVpnInfo.java
Sunny Shao 076ed573eb Revert^2 "Nullability Annotations replacement"
This reverts commit 19d1d3d15d.

Reason for revert: revert it because this is not the root cause.

bug: 316867690
Change-Id: I0f168dbb64044aa720202af7b1040afd4f028c9c
2024-01-10 07:34:01 +00:00

45 lines
1.1 KiB
Java

package com.android.settings.vpn2;
import androidx.annotation.NonNull;
import com.android.internal.util.Preconditions;
import java.util.Objects;
/**
* Holds packageName:userId pairs without any heavyweight fields.
* {@see ApplicationInfo}
*/
class AppVpnInfo implements Comparable<AppVpnInfo> {
public final int userId;
public final String packageName;
public AppVpnInfo(int userId, @NonNull String packageName) {
this.userId = userId;
this.packageName = Preconditions.checkNotNull(packageName);
}
@Override
public int compareTo(AppVpnInfo other) {
int result = packageName.compareTo(other.packageName);
if (result == 0) {
result = other.userId - userId;
}
return result;
}
@Override
public boolean equals(Object other) {
if (other instanceof AppVpnInfo) {
AppVpnInfo that = (AppVpnInfo) other;
return userId == that.userId && Objects.equals(packageName, that.packageName);
}
return false;
}
@Override
public int hashCode() {
return Objects.hash(packageName, userId);
}
}