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

Commit 57375308 authored by Peter Qiu's avatar Peter Qiu Committed by android-build-merger
Browse files

hotspot2: fix class/function/variable names to comply with API guideline am: da8a67e8

am: 7fec2496

Change-Id: Ib37832f30b5174f52e71ef2e3f796c669ba7bda9
parents 9bddb8cc 7fec2496
Loading
Loading
Loading
Loading
+6 −7
Original line number Original line Diff line number Diff line
@@ -16,7 +16,7 @@


package android.net.wifi.hotspot2;
package android.net.wifi.hotspot2;


import android.net.wifi.hotspot2.omadm.PPSMOParser;
import android.net.wifi.hotspot2.omadm.PpsMoParser;
import android.text.TextUtils;
import android.text.TextUtils;
import android.util.Base64;
import android.util.Base64;
import android.util.Log;
import android.util.Log;
@@ -44,8 +44,8 @@ import java.util.Map;
 *
 *
 * @hide
 * @hide
 */
 */
public final class ConfigBuilder {
public final class ConfigParser {
    private static final String TAG = "ConfigBuilder";
    private static final String TAG = "ConfigParser";


    // Header names.
    // Header names.
    private static final String CONTENT_TYPE = "Content-Type";
    private static final String CONTENT_TYPE = "Content-Type";
@@ -101,7 +101,6 @@ public final class ConfigBuilder {
        public String encodingType = null;
        public String encodingType = null;
    }
    }



    /**
    /**
     * Parse the Hotspot 2.0 Release 1 configuration data into a {@link PasspointConfiguration}
     * Parse the Hotspot 2.0 Release 1 configuration data into a {@link PasspointConfiguration}
     * object.  The configuration data is a base64 encoded MIME multipart data.  Below is
     * object.  The configuration data is a base64 encoded MIME multipart data.  Below is
@@ -133,7 +132,7 @@ public final class ConfigBuilder {
     *             certificate chain (optional).
     *             certificate chain (optional).
     * @return {@link PasspointConfiguration}
     * @return {@link PasspointConfiguration}
     */
     */
    public static PasspointConfiguration buildPasspointConfig(String mimeType, byte[] data) {
    public static PasspointConfiguration parsePasspointConfig(String mimeType, byte[] data) {
        // Verify MIME type.
        // Verify MIME type.
        if (!TextUtils.equals(mimeType, TYPE_WIFI_CONFIG)) {
        if (!TextUtils.equals(mimeType, TYPE_WIFI_CONFIG)) {
            Log.e(TAG, "Unexpected MIME type: " + mimeType);
            Log.e(TAG, "Unexpected MIME type: " + mimeType);
@@ -169,7 +168,7 @@ public final class ConfigBuilder {
            throw new IOException("Missing Passpoint Profile");
            throw new IOException("Missing Passpoint Profile");
        }
        }


        PasspointConfiguration config = PPSMOParser.parseMOText(new String(profileData));
        PasspointConfiguration config = PpsMoParser.parseMoText(new String(profileData));
        if (config == null) {
        if (config == null) {
            throw new IOException("Failed to parse Passpoint profile");
            throw new IOException("Failed to parse Passpoint profile");
        }
        }
+6 −6
Original line number Original line Diff line number Diff line
@@ -17,7 +17,7 @@
package android.net.wifi.hotspot2;
package android.net.wifi.hotspot2;


import android.net.wifi.hotspot2.pps.Credential;
import android.net.wifi.hotspot2.pps.Credential;
import android.net.wifi.hotspot2.pps.HomeSP;
import android.net.wifi.hotspot2.pps.HomeSp;
import android.net.wifi.hotspot2.pps.Policy;
import android.net.wifi.hotspot2.pps.Policy;
import android.net.wifi.hotspot2.pps.UpdateParameter;
import android.net.wifi.hotspot2.pps.UpdateParameter;
import android.os.Parcelable;
import android.os.Parcelable;
@@ -60,11 +60,11 @@ public final class PasspointConfiguration implements Parcelable {
    private static final int NULL_VALUE = -1;
    private static final int NULL_VALUE = -1;


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


    /**
    /**
     * Configurations under Credential subtree.
     * Configurations under Credential subtree.
@@ -248,7 +248,7 @@ public final class PasspointConfiguration implements Parcelable {
        }
        }


        if (source.mHomeSp != null) {
        if (source.mHomeSp != null) {
            mHomeSp = new HomeSP(source.mHomeSp);
            mHomeSp = new HomeSp(source.mHomeSp);
        }
        }
        if (source.mCredential != null) {
        if (source.mCredential != null) {
            mCredential = new Credential(source.mCredential);
            mCredential = new Credential(source.mCredential);
+10 −10
Original line number Original line Diff line number Diff line
@@ -18,7 +18,7 @@ package android.net.wifi.hotspot2.omadm;


import android.net.wifi.hotspot2.PasspointConfiguration;
import android.net.wifi.hotspot2.PasspointConfiguration;
import android.net.wifi.hotspot2.pps.Credential;
import android.net.wifi.hotspot2.pps.Credential;
import android.net.wifi.hotspot2.pps.HomeSP;
import android.net.wifi.hotspot2.pps.HomeSp;
import android.net.wifi.hotspot2.pps.Policy;
import android.net.wifi.hotspot2.pps.Policy;
import android.net.wifi.hotspot2.pps.UpdateParameter;
import android.net.wifi.hotspot2.pps.UpdateParameter;
import android.text.TextUtils;
import android.text.TextUtils;
@@ -112,8 +112,8 @@ import org.xml.sax.SAXException;
 *
 *
 * @hide
 * @hide
 */
 */
public final class PPSMOParser {
public final class PpsMoParser {
    private static final String TAG = "PPSMOParser";
    private static final String TAG = "PpsMoParser";


    /**
    /**
     * XML tags expected in the PPS MO (PerProviderSubscription Management Object) XML tree.
     * XML tags expected in the PPS MO (PerProviderSubscription Management Object) XML tree.
@@ -332,7 +332,7 @@ public final class PPSMOParser {
     * @param xmlString XML string representation of a PPS MO tree
     * @param xmlString XML string representation of a PPS MO tree
     * @return {@link PasspointConfiguration} or null
     * @return {@link PasspointConfiguration} or null
     */
     */
    public static PasspointConfiguration parseMOText(String xmlString) {
    public static PasspointConfiguration parseMoText(String xmlString) {
        // Convert the XML string to a XML tree.
        // Convert the XML string to a XML tree.
        XMLParser xmlParser = new XMLParser();
        XMLParser xmlParser = new XMLParser();
        XMLNode root = null;
        XMLNode root = null;
@@ -640,12 +640,12 @@ public final class PPSMOParser {
     * @return HomeSP
     * @return HomeSP
     * @throws ParsingException
     * @throws ParsingException
     */
     */
    private static HomeSP parseHomeSP(PPSNode node) throws ParsingException {
    private static HomeSp parseHomeSP(PPSNode node) throws ParsingException {
        if (node.isLeaf()) {
        if (node.isLeaf()) {
            throw new ParsingException("Leaf node not expected for HomeSP");
            throw new ParsingException("Leaf node not expected for HomeSP");
        }
        }


        HomeSP homeSp = new HomeSP();
        HomeSp homeSp = new HomeSp();
        for (PPSNode child : node.getChildren()) {
        for (PPSNode child : node.getChildren()) {
            switch (child.getName()) {
            switch (child.getName()) {
                case NODE_FQDN:
                case NODE_FQDN:
@@ -655,7 +655,7 @@ public final class PPSMOParser {
                    homeSp.setFriendlyName(getPpsNodeValue(child));
                    homeSp.setFriendlyName(getPpsNodeValue(child));
                    break;
                    break;
                case NODE_ROAMING_CONSORTIUM_OI:
                case NODE_ROAMING_CONSORTIUM_OI:
                    homeSp.setRoamingConsortiumOIs(
                    homeSp.setRoamingConsortiumOis(
                            parseRoamingConsortiumOI(getPpsNodeValue(child)));
                            parseRoamingConsortiumOI(getPpsNodeValue(child)));
                    break;
                    break;
                case NODE_ICON_URL:
                case NODE_ICON_URL:
@@ -666,8 +666,8 @@ public final class PPSMOParser {
                    break;
                    break;
                case NODE_HOME_OI_LIST:
                case NODE_HOME_OI_LIST:
                    Pair<List<Long>, List<Long>> homeOIs = parseHomeOIList(child);
                    Pair<List<Long>, List<Long>> homeOIs = parseHomeOIList(child);
                    homeSp.setMatchAllOIs(convertFromLongList(homeOIs.first));
                    homeSp.setMatchAllOis(convertFromLongList(homeOIs.first));
                    homeSp.setMatchAnyOIs(convertFromLongList(homeOIs.second));
                    homeSp.setMatchAnyOis(convertFromLongList(homeOIs.second));
                    break;
                    break;
                case NODE_OTHER_HOME_PARTNERS:
                case NODE_OTHER_HOME_PARTNERS:
                    homeSp.setOtherHomePartners(parseOtherHomePartners(child));
                    homeSp.setOtherHomePartners(parseOtherHomePartners(child));
@@ -909,7 +909,7 @@ public final class PPSMOParser {
                    credential.setRealm(getPpsNodeValue(child));
                    credential.setRealm(getPpsNodeValue(child));
                    break;
                    break;
                case NODE_CHECK_AAA_SERVER_CERT_STATUS:
                case NODE_CHECK_AAA_SERVER_CERT_STATUS:
                    credential.setCheckAAAServerCertStatus(
                    credential.setCheckAaaServerCertStatus(
                            Boolean.parseBoolean(getPpsNodeValue(child)));
                            Boolean.parseBoolean(getPpsNodeValue(child)));
                    break;
                    break;
                case NODE_SIM:
                case NODE_SIM:
+10 −10
Original line number Original line Diff line number Diff line
@@ -98,12 +98,12 @@ public final class Credential implements Parcelable {
     * and Accounting) server's certificate during EAP (Extensible Authentication
     * and Accounting) server's certificate during EAP (Extensible Authentication
     * Protocol) authentication.
     * Protocol) authentication.
     */
     */
    private boolean mCheckAAAServerCertStatus = false;
    private boolean mCheckAaaServerCertStatus = false;
    public void setCheckAAAServerCertStatus(boolean checkAAAServerCertStatus) {
    public void setCheckAaaServerCertStatus(boolean checkAaaServerCertStatus) {
        mCheckAAAServerCertStatus = checkAAAServerCertStatus;
        mCheckAaaServerCertStatus = checkAaaServerCertStatus;
    }
    }
    public boolean getCheckAAAServerStatus() {
    public boolean getCheckAaaServerStatus() {
        return mCheckAAAServerCertStatus;
        return mCheckAaaServerCertStatus;
    }
    }


    /**
    /**
@@ -685,7 +685,7 @@ public final class Credential implements Parcelable {
            mCreationTimeInMs = source.mCreationTimeInMs;
            mCreationTimeInMs = source.mCreationTimeInMs;
            mExpirationTimeInMs = source.mExpirationTimeInMs;
            mExpirationTimeInMs = source.mExpirationTimeInMs;
            mRealm = source.mRealm;
            mRealm = source.mRealm;
            mCheckAAAServerCertStatus = source.mCheckAAAServerCertStatus;
            mCheckAaaServerCertStatus = source.mCheckAaaServerCertStatus;
            if (source.mUserCredential != null) {
            if (source.mUserCredential != null) {
                mUserCredential = new UserCredential(source.mUserCredential);
                mUserCredential = new UserCredential(source.mUserCredential);
            }
            }
@@ -714,7 +714,7 @@ public final class Credential implements Parcelable {
        dest.writeLong(mCreationTimeInMs);
        dest.writeLong(mCreationTimeInMs);
        dest.writeLong(mExpirationTimeInMs);
        dest.writeLong(mExpirationTimeInMs);
        dest.writeString(mRealm);
        dest.writeString(mRealm);
        dest.writeInt(mCheckAAAServerCertStatus ? 1 : 0);
        dest.writeInt(mCheckAaaServerCertStatus ? 1 : 0);
        dest.writeParcelable(mUserCredential, flags);
        dest.writeParcelable(mUserCredential, flags);
        dest.writeParcelable(mCertCredential, flags);
        dest.writeParcelable(mCertCredential, flags);
        dest.writeParcelable(mSimCredential, flags);
        dest.writeParcelable(mSimCredential, flags);
@@ -736,7 +736,7 @@ public final class Credential implements Parcelable {
        return TextUtils.equals(mRealm, that.mRealm)
        return TextUtils.equals(mRealm, that.mRealm)
                && mCreationTimeInMs == that.mCreationTimeInMs
                && mCreationTimeInMs == that.mCreationTimeInMs
                && mExpirationTimeInMs == that.mExpirationTimeInMs
                && mExpirationTimeInMs == that.mExpirationTimeInMs
                && mCheckAAAServerCertStatus == that.mCheckAAAServerCertStatus
                && mCheckAaaServerCertStatus == that.mCheckAaaServerCertStatus
                && (mUserCredential == null ? that.mUserCredential == null
                && (mUserCredential == null ? that.mUserCredential == null
                    : mUserCredential.equals(that.mUserCredential))
                    : mUserCredential.equals(that.mUserCredential))
                && (mCertCredential == null ? that.mCertCredential == null
                && (mCertCredential == null ? that.mCertCredential == null
@@ -751,7 +751,7 @@ public final class Credential implements Parcelable {
    @Override
    @Override
    public int hashCode() {
    public int hashCode() {
        return Objects.hash(mRealm, mCreationTimeInMs, mExpirationTimeInMs,
        return Objects.hash(mRealm, mCreationTimeInMs, mExpirationTimeInMs,
                mCheckAAAServerCertStatus, mUserCredential, mCertCredential, mSimCredential,
                mCheckAaaServerCertStatus, mUserCredential, mCertCredential, mSimCredential,
                mCaCertificate, mClientCertificateChain, mClientPrivateKey);
                mCaCertificate, mClientCertificateChain, mClientPrivateKey);
    }
    }


@@ -800,7 +800,7 @@ public final class Credential implements Parcelable {
                credential.setCreationTimeInMs(in.readLong());
                credential.setCreationTimeInMs(in.readLong());
                credential.setExpirationTimeInMs(in.readLong());
                credential.setExpirationTimeInMs(in.readLong());
                credential.setRealm(in.readString());
                credential.setRealm(in.readString());
                credential.setCheckAAAServerCertStatus(in.readInt() != 0);
                credential.setCheckAaaServerCertStatus(in.readInt() != 0);
                credential.setUserCredential(in.readParcelable(null));
                credential.setUserCredential(in.readParcelable(null));
                credential.setCertCredential(in.readParcelable(null));
                credential.setCertCredential(in.readParcelable(null));
                credential.setSimCredential(in.readParcelable(null));
                credential.setSimCredential(in.readParcelable(null));
+1 −1
Original line number Original line Diff line number Diff line
@@ -16,4 +16,4 @@


package android.net.wifi.hotspot2.pps;
package android.net.wifi.hotspot2.pps;


parcelable HomeSP;
parcelable HomeSp;
Loading