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

Commit aef5b609 authored by Peter Qiu's avatar Peter Qiu
Browse files

hotspot2: update PasspointConfiguration APIs

Based on the API guideline, use of public variables are discouraged.
So update PasspointConfiguration and its associated classes to use
private variables with public accessor methods.

While there, cleanup unit tests to reduce code duplications.

Bug: 34627062
Test: frameworks/base/wifi/tests/runtests.sh
Change-Id: I6ea45bbcf03aec01c187425a66094fad6098d75d
parent c74d60a6
Loading
Loading
Loading
Loading
+5 −5
Original line number Original line Diff line number Diff line
@@ -175,7 +175,7 @@ public final class ConfigBuilder {
        }
        }


        // Credential is needed for storing the certificates and private client key.
        // Credential is needed for storing the certificates and private client key.
        if (config.credential == null) {
        if (config.getCredential() == null) {
            throw new IOException("Passpoint profile missing credential");
            throw new IOException("Passpoint profile missing credential");
        }
        }


@@ -183,7 +183,7 @@ public final class ConfigBuilder {
        byte[] caCertData = mimeParts.get(TYPE_CA_CERT);
        byte[] caCertData = mimeParts.get(TYPE_CA_CERT);
        if (caCertData != null) {
        if (caCertData != null) {
            try {
            try {
                config.credential.caCertificate = parseCACert(caCertData);
                config.getCredential().setCaCertificate(parseCACert(caCertData));
            } catch (CertificateException e) {
            } catch (CertificateException e) {
                throw new IOException("Failed to parse CA Certificate");
                throw new IOException("Failed to parse CA Certificate");
            }
            }
@@ -194,9 +194,9 @@ public final class ConfigBuilder {
        if (pkcs12Data != null) {
        if (pkcs12Data != null) {
            try {
            try {
                Pair<PrivateKey, List<X509Certificate>> clientKey = parsePkcs12(pkcs12Data);
                Pair<PrivateKey, List<X509Certificate>> clientKey = parsePkcs12(pkcs12Data);
                config.credential.clientPrivateKey = clientKey.first;
                config.getCredential().setClientPrivateKey(clientKey.first);
                config.credential.clientCertificateChain =
                config.getCredential().setClientCertificateChain(
                        clientKey.second.toArray(new X509Certificate[clientKey.second.size()]);
                        clientKey.second.toArray(new X509Certificate[clientKey.second.size()]));
            } catch(GeneralSecurityException | IOException e) {
            } catch(GeneralSecurityException | IOException e) {
                throw new IOException("Failed to parse PCKS12 string");
                throw new IOException("Failed to parse PCKS12 string");
            }
            }
+174 −84
Original line number Original line Diff line number Diff line
@@ -58,21 +58,58 @@ public final class PasspointConfiguration implements Parcelable {
     */
     */
    private static final int NULL_VALUE = -1;
    private static final int NULL_VALUE = -1;


    public HomeSP homeSp = null;
    /**
    public Credential credential = null;
     * Configurations under HomeSP subtree.
    public Policy policy = null;
     */
    private HomeSP mHomeSp = null;
    public void setHomeSp(HomeSP homeSp) { mHomeSp = homeSp; }
    public HomeSP getHomeSp() { return mHomeSp; }

    /**
     * Configurations under Credential subtree.
     */
    private Credential mCredential = null;
    public void setCredential(Credential credential) {
        mCredential = credential;
    }
    public Credential getCredential() {
        return mCredential;
    }

    /**
     * Configurations under Policy subtree.
     */
    private Policy mPolicy = null;
    public void setPolicy(Policy policy) {
        mPolicy = policy;
    }
    public Policy getPolicy() {
        return mPolicy;
    }


    /**
    /**
     * Meta data for performing subscription update.
     * Meta data for performing subscription update.
     */
     */
    public UpdateParameter subscriptionUpdate = null;
    private UpdateParameter mSubscriptionUpdate = null;
    public void setSubscriptionUpdate(UpdateParameter subscriptionUpdate) {
        mSubscriptionUpdate = subscriptionUpdate;
    }
    public UpdateParameter getSubscriptionUpdate() {
        return mSubscriptionUpdate;
    }


    /**
    /**
     * List of HTTPS URL for retrieving trust root certificate and the corresponding SHA-256
     * List of HTTPS URL for retrieving trust root certificate and the corresponding SHA-256
     * fingerprint of the certificate.  The certificates are used for verifying AAA server's
     * fingerprint of the certificate.  The certificates are used for verifying AAA server's
     * identity during EAP authentication.
     * identity during EAP authentication.
     */
     */
    public Map<String, byte[]> trustRootCertList = null;
    private Map<String, byte[]> mTrustRootCertList = null;
    public void setTrustRootCertList(Map<String, byte[]> trustRootCertList) {
        mTrustRootCertList = trustRootCertList;
    }
    public Map<String, byte[]> getTrustRootCertList() {
        return mTrustRootCertList;
    }


    /**
    /**
     * Set by the subscription server, updated every time the configuration is updated by
     * Set by the subscription server, updated every time the configuration is updated by
@@ -80,14 +117,26 @@ public final class PasspointConfiguration implements Parcelable {
     *
     *
     * Use Integer.MIN_VALUE to indicate unset value.
     * Use Integer.MIN_VALUE to indicate unset value.
     */
     */
    public int updateIdentifier = Integer.MIN_VALUE;
    private int mUpdateIdentifier = Integer.MIN_VALUE;
    public void setUpdateIdentifier(int updateIdentifier) {
        mUpdateIdentifier = updateIdentifier;
    }
    public int getUpdateIdentififer() {
        return mUpdateIdentifier;
    }


    /**
    /**
     * The priority of the credential.
     * The priority of the credential.
     *
     *
     * Use Integer.MIN_VALUE to indicate unset value.
     * Use Integer.MIN_VALUE to indicate unset value.
     */
     */
    public int credentialPriority = Integer.MIN_VALUE;
    private int mCredentialPriority = Integer.MIN_VALUE;
    public void setCredentialPriority(int credentialPriority) {
        mCredentialPriority = credentialPriority;
    }
    public int getCredentialPriority() {
        return mCredentialPriority;
    }


    /**
    /**
     * The time this subscription is created. It is in the format of number
     * The time this subscription is created. It is in the format of number
@@ -95,7 +144,13 @@ public final class PasspointConfiguration implements Parcelable {
     *
     *
     * Use Long.MIN_VALUE to indicate unset value.
     * Use Long.MIN_VALUE to indicate unset value.
     */
     */
    public long subscriptionCreationTimeInMs = Long.MIN_VALUE;
    private long mSubscriptionCreationTimeInMs = Long.MIN_VALUE;
    public void setSubscriptionCreationTimeInMs(long subscriptionCreationTimeInMs) {
        mSubscriptionCreationTimeInMs = subscriptionCreationTimeInMs;
    }
    public long getSubscriptionCreationTimeInMs() {
        return mSubscriptionCreationTimeInMs;
    }


    /**
    /**
     * The time this subscription will expire. It is in the format of number
     * The time this subscription will expire. It is in the format of number
@@ -103,20 +158,38 @@ public final class PasspointConfiguration implements Parcelable {
     *
     *
     * Use Long.MIN_VALUE to indicate unset value.
     * Use Long.MIN_VALUE to indicate unset value.
     */
     */
    public long subscriptionExpirationTimeInMs = Long.MIN_VALUE;
    private long mSubscriptionExpirationTimeInMs = Long.MIN_VALUE;
    public void setSubscriptionExpirationTimeInMs(long subscriptionExpirationTimeInMs) {
        mSubscriptionExpirationTimeInMs = subscriptionExpirationTimeInMs;
    }
    public long getSubscriptionExpirationTimeInMs() {
        return mSubscriptionExpirationTimeInMs;
    }


    /**
    /**
     * The type of the subscription.  This is defined by the provider and the value is provider
     * The type of the subscription.  This is defined by the provider and the value is provider
     * specific.
     * specific.
     */
     */
    public String subscriptionType = null;
    private String mSubscriptionType = null;
    public void setSubscriptionType(String subscriptionType) {
        mSubscriptionType = subscriptionType;
    }
    public String getSubscriptionType() {
        return mSubscriptionType;
    }


    /**
    /**
     * The time period for usage statistics accumulation. A value of zero means that usage
     * The time period for usage statistics accumulation. A value of zero means that usage
     * statistics are not accumulated on a periodic basis (e.g., a one-time limit for
     * statistics are not accumulated on a periodic basis (e.g., a one-time limit for
     * “pay as you go” - PAYG service). A non-zero value specifies the usage interval in minutes.
     * “pay as you go” - PAYG service). A non-zero value specifies the usage interval in minutes.
     */
     */
    public long usageLimitUsageTimePeriodInMinutes = Long.MIN_VALUE;
    private long mUsageLimitUsageTimePeriodInMinutes = Long.MIN_VALUE;
    public void setUsageLimitUsageTimePeriodInMinutes(long usageLimitUsageTimePeriodInMinutes) {
        mUsageLimitUsageTimePeriodInMinutes = usageLimitUsageTimePeriodInMinutes;
    }
    public long getUsageLimitUsageTimePeriodInMinutes() {
        return mUsageLimitUsageTimePeriodInMinutes;
    }


    /**
    /**
     * The time at which usage statistic accumulation  begins.  It is in the format of number
     * The time at which usage statistic accumulation  begins.  It is in the format of number
@@ -124,7 +197,13 @@ public final class PasspointConfiguration implements Parcelable {
     *
     *
     * Use Long.MIN_VALUE to indicate unset value.
     * Use Long.MIN_VALUE to indicate unset value.
     */
     */
    public long usageLimitStartTimeInMs = Long.MIN_VALUE;
    private long mUsageLimitStartTimeInMs = Long.MIN_VALUE;
    public void setUsageLimitStartTimeInMs(long usageLimitStartTimeInMs) {
        mUsageLimitStartTimeInMs = usageLimitStartTimeInMs;
    }
    public long getUsageLimitStartTimeInMs() {
        return mUsageLimitStartTimeInMs;
    }


    /**
    /**
     * The cumulative data limit in megabytes for the {@link #usageLimitUsageTimePeriodInMinutes}.
     * The cumulative data limit in megabytes for the {@link #usageLimitUsageTimePeriodInMinutes}.
@@ -132,14 +211,25 @@ public final class PasspointConfiguration implements Parcelable {
     *
     *
     * Use Long.MIN_VALUE to indicate unset value.
     * Use Long.MIN_VALUE to indicate unset value.
     */
     */
    public long usageLimitDataLimit = Long.MIN_VALUE;
    private long mUsageLimitDataLimit = Long.MIN_VALUE;
    public void setUsageLimitDataLimit(long usageLimitDataLimit) {
        mUsageLimitDataLimit = usageLimitDataLimit;
    }
    public long getUsageLimitDataLimit() {
        return mUsageLimitDataLimit;
    }


    /**
    /**
     * The cumulative time limit in minutes for the {@link #usageLimitUsageTimePeriodInMinutes}.
     * The cumulative time limit in minutes for the {@link #usageLimitUsageTimePeriodInMinutes}.
     * A value of zero indicate unlimited time usage.
     * A value of zero indicate unlimited time usage.
     */
     */
    public long usageLimitTimeLimitInMinutes = Long.MIN_VALUE;
    private long mUsageLimitTimeLimitInMinutes = Long.MIN_VALUE;

    public void setUsageLimitTimeLimitInMinutes(long usageLimitTimeLimitInMinutes) {
        mUsageLimitTimeLimitInMinutes = usageLimitTimeLimitInMinutes;
    }
    public long getUsageLimitTimeLimitInMinutes() {
        return mUsageLimitTimeLimitInMinutes;
    }


    /**
    /**
     * Constructor for creating PasspointConfiguration with default values.
     * Constructor for creating PasspointConfiguration with default values.
@@ -156,30 +246,30 @@ public final class PasspointConfiguration implements Parcelable {
            return;
            return;
        }
        }


        if (source.homeSp != null) {
        if (source.mHomeSp != null) {
            homeSp = new HomeSP(source.homeSp);
            mHomeSp = new HomeSP(source.mHomeSp);
        }
        }
        if (source.credential != null) {
        if (source.mCredential != null) {
            credential = new Credential(source.credential);
            mCredential = new Credential(source.mCredential);
        }
        }
        if (source.policy != null) {
        if (source.mPolicy != null) {
            policy = new Policy(source.policy);
            mPolicy = new Policy(source.mPolicy);
        }
        }
        if (source.trustRootCertList != null) {
        if (source.mTrustRootCertList != null) {
            trustRootCertList = Collections.unmodifiableMap(source.trustRootCertList);
            mTrustRootCertList = Collections.unmodifiableMap(source.mTrustRootCertList);
        }
        }
        if (source.subscriptionUpdate != null) {
        if (source.mSubscriptionUpdate != null) {
            subscriptionUpdate = new UpdateParameter(source.subscriptionUpdate);
            mSubscriptionUpdate = new UpdateParameter(source.mSubscriptionUpdate);
        }
        }
        updateIdentifier = source.updateIdentifier;
        mUpdateIdentifier = source.mUpdateIdentifier;
        credentialPriority = source.credentialPriority;
        mCredentialPriority = source.mCredentialPriority;
        subscriptionCreationTimeInMs = source.subscriptionCreationTimeInMs;
        mSubscriptionCreationTimeInMs = source.mSubscriptionCreationTimeInMs;
        subscriptionExpirationTimeInMs = source.subscriptionExpirationTimeInMs;
        mSubscriptionExpirationTimeInMs = source.mSubscriptionExpirationTimeInMs;
        subscriptionType = source.subscriptionType;
        mSubscriptionType = source.mSubscriptionType;
        usageLimitDataLimit = source.usageLimitDataLimit;
        mUsageLimitDataLimit = source.mUsageLimitDataLimit;
        usageLimitStartTimeInMs = source.usageLimitStartTimeInMs;
        mUsageLimitStartTimeInMs = source.mUsageLimitStartTimeInMs;
        usageLimitTimeLimitInMinutes = source.usageLimitTimeLimitInMinutes;
        mUsageLimitTimeLimitInMinutes = source.mUsageLimitTimeLimitInMinutes;
        usageLimitUsageTimePeriodInMinutes = source.usageLimitUsageTimePeriodInMinutes;
        mUsageLimitUsageTimePeriodInMinutes = source.mUsageLimitUsageTimePeriodInMinutes;
    }
    }


    @Override
    @Override
@@ -189,20 +279,20 @@ public final class PasspointConfiguration implements Parcelable {


    @Override
    @Override
    public void writeToParcel(Parcel dest, int flags) {
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeParcelable(homeSp, flags);
        dest.writeParcelable(mHomeSp, flags);
        dest.writeParcelable(credential, flags);
        dest.writeParcelable(mCredential, flags);
        dest.writeParcelable(policy, flags);
        dest.writeParcelable(mPolicy, flags);
        dest.writeParcelable(subscriptionUpdate, flags);
        dest.writeParcelable(mSubscriptionUpdate, flags);
        writeTrustRootCerts(dest, trustRootCertList);
        writeTrustRootCerts(dest, mTrustRootCertList);
        dest.writeInt(updateIdentifier);
        dest.writeInt(mUpdateIdentifier);
        dest.writeInt(credentialPriority);
        dest.writeInt(mCredentialPriority);
        dest.writeLong(subscriptionCreationTimeInMs);
        dest.writeLong(mSubscriptionCreationTimeInMs);
        dest.writeLong(subscriptionExpirationTimeInMs);
        dest.writeLong(mSubscriptionExpirationTimeInMs);
        dest.writeString(subscriptionType);
        dest.writeString(mSubscriptionType);
        dest.writeLong(usageLimitUsageTimePeriodInMinutes);
        dest.writeLong(mUsageLimitUsageTimePeriodInMinutes);
        dest.writeLong(usageLimitStartTimeInMs);
        dest.writeLong(mUsageLimitStartTimeInMs);
        dest.writeLong(usageLimitDataLimit);
        dest.writeLong(mUsageLimitDataLimit);
        dest.writeLong(usageLimitTimeLimitInMinutes);
        dest.writeLong(mUsageLimitTimeLimitInMinutes);
    }
    }


    @Override
    @Override
@@ -214,22 +304,22 @@ public final class PasspointConfiguration implements Parcelable {
            return false;
            return false;
        }
        }
        PasspointConfiguration that = (PasspointConfiguration) thatObject;
        PasspointConfiguration that = (PasspointConfiguration) thatObject;
        return (homeSp == null ? that.homeSp == null : homeSp.equals(that.homeSp))
        return (mHomeSp == null ? that.mHomeSp == null : mHomeSp.equals(that.mHomeSp))
                && (credential == null ? that.credential == null
                && (mCredential == null ? that.mCredential == null
                        : credential.equals(that.credential))
                        : mCredential.equals(that.mCredential))
                && (policy == null ? that.policy == null : policy.equals(that.policy))
                && (mPolicy == null ? that.mPolicy == null : mPolicy.equals(that.mPolicy))
                && (subscriptionUpdate == null ? that.subscriptionUpdate == null
                && (mSubscriptionUpdate == null ? that.mSubscriptionUpdate == null
                        : subscriptionUpdate.equals(that.subscriptionUpdate))
                        : mSubscriptionUpdate.equals(that.mSubscriptionUpdate))
                && isTrustRootCertListEquals(trustRootCertList, that.trustRootCertList)
                && isTrustRootCertListEquals(mTrustRootCertList, that.mTrustRootCertList)
                && updateIdentifier == that.updateIdentifier
                && mUpdateIdentifier == that.mUpdateIdentifier
                && credentialPriority == that.credentialPriority
                && mCredentialPriority == that.mCredentialPriority
                && subscriptionCreationTimeInMs == that.subscriptionCreationTimeInMs
                && mSubscriptionCreationTimeInMs == that.mSubscriptionCreationTimeInMs
                && subscriptionExpirationTimeInMs == that.subscriptionExpirationTimeInMs
                && mSubscriptionExpirationTimeInMs == that.mSubscriptionExpirationTimeInMs
                && TextUtils.equals(subscriptionType, that.subscriptionType)
                && TextUtils.equals(mSubscriptionType, that.mSubscriptionType)
                && usageLimitUsageTimePeriodInMinutes == that.usageLimitUsageTimePeriodInMinutes
                && mUsageLimitUsageTimePeriodInMinutes == that.mUsageLimitUsageTimePeriodInMinutes
                && usageLimitStartTimeInMs == that.usageLimitStartTimeInMs
                && mUsageLimitStartTimeInMs == that.mUsageLimitStartTimeInMs
                && usageLimitDataLimit == that.usageLimitDataLimit
                && mUsageLimitDataLimit == that.mUsageLimitDataLimit
                && usageLimitTimeLimitInMinutes == that .usageLimitTimeLimitInMinutes;
                && mUsageLimitTimeLimitInMinutes == that.mUsageLimitTimeLimitInMinutes;
    }
    }


    /**
    /**
@@ -238,20 +328,20 @@ public final class PasspointConfiguration implements Parcelable {
     * @return true on success or false on failure
     * @return true on success or false on failure
     */
     */
    public boolean validate() {
    public boolean validate() {
        if (homeSp == null || !homeSp.validate()) {
        if (mHomeSp == null || !mHomeSp.validate()) {
            return false;
            return false;
        }
        }
        if (credential == null || !credential.validate()) {
        if (mCredential == null || !mCredential.validate()) {
            return false;
            return false;
        }
        }
        if (policy != null && !policy.validate()) {
        if (mPolicy != null && !mPolicy.validate()) {
            return false;
            return false;
        }
        }
        if (subscriptionUpdate != null && !subscriptionUpdate.validate()) {
        if (mSubscriptionUpdate != null && !mSubscriptionUpdate.validate()) {
            return false;
            return false;
        }
        }
        if (trustRootCertList != null) {
        if (mTrustRootCertList != null) {
            for (Map.Entry<String, byte[]> entry : trustRootCertList.entrySet()) {
            for (Map.Entry<String, byte[]> entry : mTrustRootCertList.entrySet()) {
                String url = entry.getKey();
                String url = entry.getKey();
                byte[] certFingerprint = entry.getValue();
                byte[] certFingerprint = entry.getValue();
                if (TextUtils.isEmpty(url)) {
                if (TextUtils.isEmpty(url)) {
@@ -283,20 +373,20 @@ public final class PasspointConfiguration implements Parcelable {
            @Override
            @Override
            public PasspointConfiguration createFromParcel(Parcel in) {
            public PasspointConfiguration createFromParcel(Parcel in) {
                PasspointConfiguration config = new PasspointConfiguration();
                PasspointConfiguration config = new PasspointConfiguration();
                config.homeSp = in.readParcelable(null);
                config.setHomeSp(in.readParcelable(null));
                config.credential = in.readParcelable(null);
                config.setCredential(in.readParcelable(null));
                config.policy = in.readParcelable(null);
                config.setPolicy(in.readParcelable(null));
                config.subscriptionUpdate = in.readParcelable(null);
                config.setSubscriptionUpdate(in.readParcelable(null));
                config.trustRootCertList = readTrustRootCerts(in);
                config.setTrustRootCertList(readTrustRootCerts(in));
                config.updateIdentifier = in.readInt();
                config.setUpdateIdentifier(in.readInt());
                config.credentialPriority = in.readInt();
                config.setCredentialPriority(in.readInt());
                config.subscriptionCreationTimeInMs = in.readLong();
                config.setSubscriptionCreationTimeInMs(in.readLong());
                config.subscriptionExpirationTimeInMs = in.readLong();
                config.setSubscriptionExpirationTimeInMs(in.readLong());
                config.subscriptionType = in.readString();
                config.setSubscriptionType(in.readString());
                config.usageLimitUsageTimePeriodInMinutes = in.readLong();
                config.setUsageLimitUsageTimePeriodInMinutes(in.readLong());
                config.usageLimitStartTimeInMs = in.readLong();
                config.setUsageLimitStartTimeInMs(in.readLong());
                config.usageLimitDataLimit = in.readLong();
                config.setUsageLimitDataLimit(in.readLong());
                config.usageLimitTimeLimitInMinutes = in.readLong();
                config.setUsageLimitTimeLimitInMinutes(in.readLong());
                return config;
                return config;
            }
            }


+65 −65

File changed.

Preview size limit exceeded, changes collapsed.

+286 −160

File changed.

Preview size limit exceeded, changes collapsed.

+102 −54
Original line number Original line Diff line number Diff line
@@ -52,17 +52,35 @@ public final class HomeSP implements Parcelable {
    /**
    /**
     * FQDN (Fully Qualified Domain Name) of this home service provider.
     * FQDN (Fully Qualified Domain Name) of this home service provider.
     */
     */
    public String fqdn = null;
    private String mFqdn = null;
    public void setFqdn(String fqdn) {
        mFqdn = fqdn;
    }
    public String getFqdn() {
        return mFqdn;
    }


    /**
    /**
     * Friendly name of this home service provider.
     * Friendly name of this home service provider.
     */
     */
    public String friendlyName = null;
    private String mFriendlyName = null;
    public void setFriendlyName(String friendlyName) {
        mFriendlyName = friendlyName;
    }
    public String getFriendlyName() {
        return mFriendlyName;
    }


    /**
    /**
     * Icon URL of this home service provider.
     * Icon URL of this home service provider.
     */
     */
    public String iconUrl = null;
    private String mIconUrl = null;
    public void setIconUrl(String iconUrl) {
        mIconUrl = iconUrl;
    }
    public String getIconUrl() {
        return mIconUrl;
    }


    /**
    /**
     * <SSID, HESSID> duple of the networks that are consider home networks.
     * <SSID, HESSID> duple of the networks that are consider home networks.
@@ -71,7 +89,13 @@ public final class HomeSP implements Parcelable {
     * all nodes in the PSS MO are encoded using UTF-8 unless stated otherwise.  Thus, the SSID
     * all nodes in the PSS MO are encoded using UTF-8 unless stated otherwise.  Thus, the SSID
     * string is assumed to be encoded using UTF-8.
     * string is assumed to be encoded using UTF-8.
     */
     */
    public Map<String, Long> homeNetworkIds = null;
    private Map<String, Long> mHomeNetworkIds = null;
    public void setHomeNetworkIds(Map<String, Long> homeNetworkIds) {
        mHomeNetworkIds = homeNetworkIds;
    }
    public Map<String, Long> getHomeNetworkIds() {
        return mHomeNetworkIds;
    }


    /**
    /**
     * Used for determining if this provider is a member of a given Hotspot provider.
     * Used for determining if this provider is a member of a given Hotspot provider.
@@ -83,7 +107,13 @@ public final class HomeSP implements Parcelable {
     * Refer to HomeSP/HomeOIList subtree in PerProviderSubscription (PPS) Management Object
     * Refer to HomeSP/HomeOIList subtree in PerProviderSubscription (PPS) Management Object
     * (MO) tree for more detail.
     * (MO) tree for more detail.
     */
     */
    public long[] matchAllOIs = null;
    private long[] mMatchAllOIs = null;
    public void setMatchAllOIs(long[] matchAllOIs) {
        mMatchAllOIs = matchAllOIs;
    }
    public long[] getMatchAllOIs() {
        return mMatchAllOIs;
    }


    /**
    /**
     * Used for determining if this provider is a member of a given Hotspot provider.
     * Used for determining if this provider is a member of a given Hotspot provider.
@@ -92,13 +122,19 @@ public final class HomeSP implements Parcelable {
     * of that Hotspot provider (e.g. successful authentication with such Hotspot
     * of that Hotspot provider (e.g. successful authentication with such Hotspot
     * is possible).
     * is possible).
     *
     *
     * {@link #matchAllOIs} will have precedence over this one, meaning this list will
     * {@link #mMatchAllOIs} will have precedence over this one, meaning this list will
     * only be used for matching if {@link #matchAllOIs} is null or empty.
     * only be used for matching if {@link #mMatchAllOIs} is null or empty.
     *
     *
     * Refer to HomeSP/HomeOIList subtree in PerProviderSubscription (PPS) Management Object
     * Refer to HomeSP/HomeOIList subtree in PerProviderSubscription (PPS) Management Object
     * (MO) tree for more detail.
     * (MO) tree for more detail.
     */
     */
    public long[] matchAnyOIs = null;
    private long[] mMatchAnyOIs = null;
    public void setMatchAnyOIs(long[] matchAnyOIs) {
        mMatchAnyOIs = matchAnyOIs;
    }
    public long[] getMatchAnysOIs() {
        return mMatchAnyOIs;
    }


    /**
    /**
     * List of FQDN (Fully Qualified Domain Name) of partner providers.
     * List of FQDN (Fully Qualified Domain Name) of partner providers.
@@ -106,13 +142,25 @@ public final class HomeSP implements Parcelable {
     * This relationship is most likely achieved via a commercial agreement or
     * This relationship is most likely achieved via a commercial agreement or
     * operator merges between the providers.
     * operator merges between the providers.
     */
     */
    public String[] otherHomePartners = null;
    private String[] mOtherHomePartners = null;
    public void setOtherHomePartners(String[] otherHomePartners) {
        mOtherHomePartners = otherHomePartners;
    }
    public String[] getOtherHomePartners() {
        return mOtherHomePartners;
    }


    /**
    /**
     * List of Organization Identifiers (OIs) identifying a roaming consortium of
     * List of Organization Identifiers (OIs) identifying a roaming consortium of
     * which this provider is a member.
     * which this provider is a member.
     */
     */
    public long[] roamingConsortiumOIs = null;
    private long[] mRoamingConsortiumOIs = null;
    public void setRoamingConsortiumOIs(long[] roamingConsortiumOIs) {
        mRoamingConsortiumOIs = roamingConsortiumOIs;
    }
    public long[] getRoamingConsortiumOIs() {
        return mRoamingConsortiumOIs;
    }


    /**
    /**
     * Constructor for creating HomeSP with default values.
     * Constructor for creating HomeSP with default values.
@@ -128,25 +176,25 @@ public final class HomeSP implements Parcelable {
        if (source == null) {
        if (source == null) {
            return;
            return;
        }
        }
        fqdn = source.fqdn;
        mFqdn = source.mFqdn;
        friendlyName = source.friendlyName;
        mFriendlyName = source.mFriendlyName;
        iconUrl = source.iconUrl;
        mIconUrl = source.mIconUrl;
        if (source.homeNetworkIds != null) {
        if (source.mHomeNetworkIds != null) {
            homeNetworkIds = Collections.unmodifiableMap(source.homeNetworkIds);
            mHomeNetworkIds = Collections.unmodifiableMap(source.mHomeNetworkIds);
        }
        }
        if (source.matchAllOIs != null) {
        if (source.mMatchAllOIs != null) {
            matchAllOIs = Arrays.copyOf(source.matchAllOIs, source.matchAllOIs.length);
            mMatchAllOIs = Arrays.copyOf(source.mMatchAllOIs, source.mMatchAllOIs.length);
        }
        }
        if (source.matchAnyOIs != null) {
        if (source.mMatchAnyOIs != null) {
            matchAnyOIs = Arrays.copyOf(source.matchAnyOIs, source.matchAnyOIs.length);
            mMatchAnyOIs = Arrays.copyOf(source.mMatchAnyOIs, source.mMatchAnyOIs.length);
        }
        }
        if (source.otherHomePartners != null) {
        if (source.mOtherHomePartners != null) {
            otherHomePartners = Arrays.copyOf(source.otherHomePartners,
            mOtherHomePartners = Arrays.copyOf(source.mOtherHomePartners,
                    source.otherHomePartners.length);
                    source.mOtherHomePartners.length);
        }
        }
        if (source.roamingConsortiumOIs != null) {
        if (source.mRoamingConsortiumOIs != null) {
            roamingConsortiumOIs = Arrays.copyOf(source.roamingConsortiumOIs,
            mRoamingConsortiumOIs = Arrays.copyOf(source.mRoamingConsortiumOIs,
                    source.roamingConsortiumOIs.length);
                    source.mRoamingConsortiumOIs.length);
        }
        }
    }
    }


@@ -157,14 +205,14 @@ public final class HomeSP implements Parcelable {


    @Override
    @Override
    public void writeToParcel(Parcel dest, int flags) {
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeString(fqdn);
        dest.writeString(mFqdn);
        dest.writeString(friendlyName);
        dest.writeString(mFriendlyName);
        dest.writeString(iconUrl);
        dest.writeString(mIconUrl);
        writeHomeNetworkIds(dest, homeNetworkIds);
        writeHomeNetworkIds(dest, mHomeNetworkIds);
        dest.writeLongArray(matchAllOIs);
        dest.writeLongArray(mMatchAllOIs);
        dest.writeLongArray(matchAnyOIs);
        dest.writeLongArray(mMatchAnyOIs);
        dest.writeStringArray(otherHomePartners);
        dest.writeStringArray(mOtherHomePartners);
        dest.writeLongArray(roamingConsortiumOIs);
        dest.writeLongArray(mRoamingConsortiumOIs);
    }
    }


    @Override
    @Override
@@ -177,15 +225,15 @@ public final class HomeSP implements Parcelable {
        }
        }
        HomeSP that = (HomeSP) thatObject;
        HomeSP that = (HomeSP) thatObject;


        return TextUtils.equals(fqdn, that.fqdn)
        return TextUtils.equals(mFqdn, that.mFqdn)
                && TextUtils.equals(friendlyName, that.friendlyName)
                && TextUtils.equals(mFriendlyName, that.mFriendlyName)
                && TextUtils.equals(iconUrl, that.iconUrl)
                && TextUtils.equals(mIconUrl, that.mIconUrl)
                && (homeNetworkIds == null ? that.homeNetworkIds == null
                && (mHomeNetworkIds == null ? that.mHomeNetworkIds == null
                        : homeNetworkIds.equals(that.homeNetworkIds))
                        : mHomeNetworkIds.equals(that.mHomeNetworkIds))
                && Arrays.equals(matchAllOIs, that.matchAllOIs)
                && Arrays.equals(mMatchAllOIs, that.mMatchAllOIs)
                && Arrays.equals(matchAnyOIs, that.matchAnyOIs)
                && Arrays.equals(mMatchAnyOIs, that.mMatchAnyOIs)
                && Arrays.equals(otherHomePartners, that.otherHomePartners)
                && Arrays.equals(mOtherHomePartners, that.mOtherHomePartners)
                && Arrays.equals(roamingConsortiumOIs, that.roamingConsortiumOIs);
                && Arrays.equals(mRoamingConsortiumOIs, that.mRoamingConsortiumOIs);
    }
    }


    /**
    /**
@@ -194,17 +242,17 @@ public final class HomeSP implements Parcelable {
     * @return true on success or false on failure
     * @return true on success or false on failure
     */
     */
    public boolean validate() {
    public boolean validate() {
        if (TextUtils.isEmpty(fqdn)) {
        if (TextUtils.isEmpty(mFqdn)) {
            Log.d(TAG, "Missing FQDN");
            Log.d(TAG, "Missing FQDN");
            return false;
            return false;
        }
        }
        if (TextUtils.isEmpty(friendlyName)) {
        if (TextUtils.isEmpty(mFriendlyName)) {
            Log.d(TAG, "Missing friendly name");
            Log.d(TAG, "Missing friendly name");
            return false;
            return false;
        }
        }
        // Verify SSIDs specified in the NetworkID
        // Verify SSIDs specified in the NetworkID
        if (homeNetworkIds != null) {
        if (mHomeNetworkIds != null) {
            for (Map.Entry<String, Long> entry : homeNetworkIds.entrySet()) {
            for (Map.Entry<String, Long> entry : mHomeNetworkIds.entrySet()) {
                if (entry.getKey() == null ||
                if (entry.getKey() == null ||
                        entry.getKey().getBytes(StandardCharsets.UTF_8).length > MAX_SSID_BYTES) {
                        entry.getKey().getBytes(StandardCharsets.UTF_8).length > MAX_SSID_BYTES) {
                    Log.d(TAG, "Invalid SSID in HomeNetworkIDs");
                    Log.d(TAG, "Invalid SSID in HomeNetworkIDs");
@@ -220,14 +268,14 @@ public final class HomeSP implements Parcelable {
            @Override
            @Override
            public HomeSP createFromParcel(Parcel in) {
            public HomeSP createFromParcel(Parcel in) {
                HomeSP homeSp = new HomeSP();
                HomeSP homeSp = new HomeSP();
                homeSp.fqdn = in.readString();
                homeSp.setFqdn(in.readString());
                homeSp.friendlyName = in.readString();
                homeSp.setFriendlyName(in.readString());
                homeSp.iconUrl = in.readString();
                homeSp.setIconUrl(in.readString());
                homeSp.homeNetworkIds = readHomeNetworkIds(in);
                homeSp.setHomeNetworkIds(readHomeNetworkIds(in));
                homeSp.matchAllOIs = in.createLongArray();
                homeSp.setMatchAllOIs(in.createLongArray());
                homeSp.matchAnyOIs = in.createLongArray();
                homeSp.setMatchAnyOIs(in.createLongArray());
                homeSp.otherHomePartners = in.createStringArray();
                homeSp.setOtherHomePartners(in.createStringArray());
                homeSp.roamingConsortiumOIs = in.createLongArray();
                homeSp.setRoamingConsortiumOIs(in.createLongArray());
                return homeSp;
                return homeSp;
            }
            }


Loading