1/*
2 * Copyright (C) 2017 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 *      http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17package com.android.server.wifi.hotspot2;
18
19import android.text.TextUtils;
20
21import java.util.Arrays;
22import java.util.Objects;
23
24/**
25 * Class representing the relevant configurations in the legacy Passpoint (N and older)
26 * configuration file (/data/misc/wifi/PerProviderSubscription.conf).  Most of the configurations
27 * (e.g. user credential) are saved elsewhere, the relevant configurations in this file are:
28 * - FQDN
29 * - Friendly Name
30 * - Roaming Consortium
31 * - Realm
32 * - IMSI (for SIM credential)
33 */
34public class LegacyPasspointConfig {
35    public String mFqdn;
36    public String mFriendlyName;
37    public long[] mRoamingConsortiumOis;
38    public String mRealm;
39    public String mImsi;
40
41    @Override
42    public boolean equals(Object thatObject) {
43        if (this == thatObject) {
44            return true;
45        }
46        if (!(thatObject instanceof LegacyPasspointConfig)) {
47            return false;
48        }
49        LegacyPasspointConfig that = (LegacyPasspointConfig) thatObject;
50        return TextUtils.equals(mFqdn, that.mFqdn)
51                && TextUtils.equals(mFriendlyName, that.mFriendlyName)
52                && Arrays.equals(mRoamingConsortiumOis, that.mRoamingConsortiumOis)
53                && TextUtils.equals(mRealm, that.mRealm)
54                && TextUtils.equals(mImsi, that.mImsi);
55    }
56
57    @Override
58    public int hashCode() {
59        return Objects.hash(mFqdn, mFriendlyName, mRoamingConsortiumOis, mRealm, mImsi);
60    }
61}
62