From e5850517c493b24982cff8c32c7fb32a8203f5b6 Mon Sep 17 00:00:00 2001 From: Peter Qiu Date: Wed, 3 May 2017 10:23:22 -0700 Subject: [PATCH] hotspot2: add/update javadoc for Passpoint APIs Add javadoc for getter/setter methods configuration classes. Document exceptions with @throws tag. Bug: 37907515 Test: build Change-Id: Ied1842912f6710530bf77db4df5ef5d30a44b2a7 --- wifi/java/android/net/wifi/WifiManager.java | 20 +-- .../wifi/hotspot2/PasspointConfiguration.java | 20 +++ .../net/wifi/hotspot2/pps/Credential.java | 164 +++++++++++++++++- .../android/net/wifi/hotspot2/pps/HomeSp.java | 32 ++++ 4 files changed, 220 insertions(+), 16 deletions(-) diff --git a/wifi/java/android/net/wifi/WifiManager.java b/wifi/java/android/net/wifi/WifiManager.java index 164b7b059183f..58df4ee227f23 100644 --- a/wifi/java/android/net/wifi/WifiManager.java +++ b/wifi/java/android/net/wifi/WifiManager.java @@ -1080,11 +1080,9 @@ public class WifiManager { * Name). In the case when there is an existing configuration with the same * FQDN, the new configuration will replace the existing configuration. * - * An {@link IllegalArgumentException} will be thrown on failure. - * An {@link UnsupportedOperationException} will be thrown if Passpoint is not enabled - * on the device. - * * @param config The Passpoint configuration to be added + * @throws IllegalArgumentException if configuration is invalid + * @throws UnsupportedOperationException if Passpoint is not enabled on the device. */ public void addOrUpdatePasspointConfiguration(PasspointConfiguration config) { try { @@ -1099,11 +1097,9 @@ public class WifiManager { /** * Remove the Passpoint configuration identified by its FQDN (Fully Qualified Domain Name). * - * An {@link IllegalArgumentException} will be thrown on failure. - * An {@link UnsupportedOperationException} will be thrown if Passpoint is not enabled - * on the device. - * * @param fqdn The FQDN of the Passpoint configuration to be removed + * @throws IllegalArgumentException if no configuration is associated with the given FQDN. + * @throws UnsupportedOperationException if Passpoint is not enabled on the device. */ public void removePasspointConfiguration(String fqdn) { try { @@ -1120,10 +1116,8 @@ public class WifiManager { * * An empty list will be returned when no configurations are installed. * - * An {@link UnsupportedOperationException} will be thrown if Passpoint is not enabled - * on the device. - * * @return A list of {@link PasspointConfiguration} + * @throws UnsupportedOperationException if Passpoint is not enabled on the device. */ public List getPasspointConfigurations() { try { @@ -1139,12 +1133,10 @@ public class WifiManager { * {@link #EXTRA_ICON} will indicate the result of the request. * A missing intent extra {@link #EXTRA_ICON} will indicate a failure. * - * An {@link UnsupportedOperationException} will be thrown if Passpoint is not enabled - * on the device. - * * @param bssid The BSSID of the AP * @param fileName Name of the icon file (remote file) to query from the AP * + * @throws UnsupportedOperationException if Passpoint is not enabled on the device. * @hide */ public void queryPasspointIcon(long bssid, String fileName) { diff --git a/wifi/java/android/net/wifi/hotspot2/PasspointConfiguration.java b/wifi/java/android/net/wifi/hotspot2/PasspointConfiguration.java index f892bb0a38849..71d4173a389c1 100644 --- a/wifi/java/android/net/wifi/hotspot2/PasspointConfiguration.java +++ b/wifi/java/android/net/wifi/hotspot2/PasspointConfiguration.java @@ -62,16 +62,36 @@ public final class PasspointConfiguration implements Parcelable { * Configurations under HomeSp subtree. */ private HomeSp mHomeSp = null; + /** + * Set the Home SP (Service Provider) information. + * + * @param homeSp The Home SP information to set to + */ public void setHomeSp(HomeSp homeSp) { mHomeSp = homeSp; } + /** + * Get the Home SP (Service Provider) information. + * + * @return Home SP information + */ public HomeSp getHomeSp() { return mHomeSp; } /** * Configurations under Credential subtree. */ private Credential mCredential = null; + /** + * Set the credential information. + * + * @param credential The credential information to set to + */ public void setCredential(Credential credential) { mCredential = credential; } + /** + * Get the credential information. + * + * @return credential information + */ public Credential getCredential() { return mCredential; } diff --git a/wifi/java/android/net/wifi/hotspot2/pps/Credential.java b/wifi/java/android/net/wifi/hotspot2/pps/Credential.java index d712feb7c6d2e..e8fcbfd6731e8 100644 --- a/wifi/java/android/net/wifi/hotspot2/pps/Credential.java +++ b/wifi/java/android/net/wifi/hotspot2/pps/Credential.java @@ -97,9 +97,19 @@ public final class Credential implements Parcelable { * comparing the realm specified in that hotspot's ANQP element. */ private String mRealm = null; + /** + * Set the realm associated with this credential. + * + * @param realm The realm to set to + */ public void setRealm(String realm) { mRealm = realm; } + /** + * Get the realm associated with this credential. + * + * @return the realm associated with this credential + */ public String getRealm() { return mRealm; } @@ -162,9 +172,19 @@ public final class Credential implements Parcelable { * Username of the credential. */ private String mUsername = null; + /** + * Set the username associated with this user credential. + * + * @param username The username to set to + */ public void setUsername(String username) { mUsername = username; } + /** + * Get the username associated with this user credential. + * + * @return the username associated with this user credential + */ public String getUsername() { return mUsername; } @@ -173,9 +193,19 @@ public final class Credential implements Parcelable { * Base64-encoded password. */ private String mPassword = null; + /** + * Set the Base64-encoded password associated with this user credential. + * + * @param password The password to set to + */ public void setPassword(String password) { mPassword = password; } + /** + * Get the Base64-encoded password associated with this user credential. + * + * @return the Base64-encoded password associated with this user credential + */ public String getPassword() { return mPassword; } @@ -233,14 +263,30 @@ public final class Credential implements Parcelable { /** * EAP (Extensible Authentication Protocol) method type. - * Refer to http://www.iana.org/assignments/eap-numbers/eap-numbers.xml#eap-numbers-4 - * for valid values. + * Refer to + * + * EAP Numbers for valid values. * Using Integer.MIN_VALUE to indicate unset value. */ private int mEapType = Integer.MIN_VALUE; + /** + * Set the EAP (Extensible Authentication Protocol) method type associated with this + * user credential. + * Refer to + * + * EAP Numbers for valid values. + * + * @param eapType The EAP method type associated with this user credential + */ public void setEapType(int eapType) { mEapType = eapType; } + /** + * Get the EAP (Extensible Authentication Protocol) method type associated with this + * user credential. + * + * @return EAP method type + */ public int getEapType() { return mEapType; } @@ -249,9 +295,19 @@ public final class Credential implements Parcelable { * Non-EAP inner authentication method. */ private String mNonEapInnerMethod = null; + /** + * Set the inner non-EAP method associated with this user credential. + * + * @param nonEapInnerMethod The non-EAP inner method to set to + */ public void setNonEapInnerMethod(String nonEapInnerMethod) { mNonEapInnerMethod = nonEapInnerMethod; } + /** + * Get the inner non-EAP method associated with this user credential. + * + * @return Non-EAP inner method associated with this user credential + */ public String getNonEapInnerMethod() { return mNonEapInnerMethod; } @@ -394,9 +450,19 @@ public final class Credential implements Parcelable { }; } private UserCredential mUserCredential = null; + /** + * Set the user credential information. + * + * @param userCredential The user credential to set to + */ public void setUserCredential(UserCredential userCredential) { mUserCredential = userCredential; } + /** + * Get the user credential information. + * + * @return user credential information + */ public UserCredential getUserCredential() { return mUserCredential; } @@ -421,9 +487,19 @@ public final class Credential implements Parcelable { * Certificate type. */ private String mCertType = null; + /** + * Set the certificate type associated with this certificate credential. + * + * @param certType The certificate type to set to + */ public void setCertType(String certType) { mCertType = certType; } + /** + * Get the certificate type associated with this certificate credential. + * + * @return certificate type + */ public String getCertType() { return mCertType; } @@ -432,9 +508,19 @@ public final class Credential implements Parcelable { * The SHA-256 fingerprint of the certificate. */ private byte[] mCertSha256Fingerprint = null; + /** + * Set the certificate SHA-256 fingerprint associated with this certificate credential. + * + * @param certSha256Fingerprint The certificate fingerprint to set to + */ public void setCertSha256Fingerprint(byte[] certSha256Fingerprint) { mCertSha256Fingerprint = certSha256Fingerprint; } + /** + * Get the certificate SHA-256 fingerprint associated with this certificate credential. + * + * @return certificate SHA-256 fingerprint + */ public byte[] getCertSha256Fingerprint() { return mCertSha256Fingerprint; } @@ -530,9 +616,19 @@ public final class Credential implements Parcelable { }; } private CertificateCredential mCertCredential = null; + /** + * Set the certificate credential information. + * + * @param certCredential The certificate credential to set to + */ public void setCertCredential(CertificateCredential certCredential) { mCertCredential = certCredential; } + /** + * Get the certificate credential information. + * + * @return certificate credential information + */ public CertificateCredential getCertCredential() { return mCertCredential; } @@ -553,9 +649,21 @@ public final class Credential implements Parcelable { * cellular networks */ private String mImsi = null; + /** + * Set the IMSI (International Mobile Subscriber Identity) associated with this SIM + * credential. + * + * @param imsi The IMSI to set to + */ public void setImsi(String imsi) { mImsi = imsi; } + /** + * Get the IMSI (International Mobile Subscriber Identity) associated with this SIM + * credential. + * + * @return IMSI associated with this SIM credential + */ public String getImsi() { return mImsi; } @@ -567,9 +675,21 @@ public final class Credential implements Parcelable { * Using Integer.MIN_VALUE to indicate unset value. */ private int mEapType = Integer.MIN_VALUE; + /** + * Set the EAP (Extensible Authentication Protocol) method type associated with this + * SIM credential. + * + * @param eapType The EAP method type to set to + */ public void setEapType(int eapType) { mEapType = eapType; } + /** + * Get the EAP (Extensible Authentication Protocol) method type associated with this + * SIM credential. + * + * @return EAP method type associated with this SIM credential + */ public int getEapType() { return mEapType; } @@ -704,9 +824,19 @@ public final class Credential implements Parcelable { } } private SimCredential mSimCredential = null; + /** + * Set the SIM credential information. + * + * @param simCredential The SIM credential to set to + */ public void setSimCredential(SimCredential simCredential) { mSimCredential = simCredential; } + /** + * Get the SIM credential information. + * + * @return SIM credential information + */ public SimCredential getSimCredential() { return mSimCredential; } @@ -715,9 +845,19 @@ public final class Credential implements Parcelable { * CA (Certificate Authority) X509 certificate. */ private X509Certificate mCaCertificate = null; + /** + * Set the CA (Certification Authority) certificate associated with this credential. + * + * @param caCertificate The CA certificate to set to + */ public void setCaCertificate(X509Certificate caCertificate) { mCaCertificate = caCertificate; } + /** + * Get the CA (Certification Authority) certificate associated with this credential. + * + * @return CA certificate associated with this credential + */ public X509Certificate getCaCertificate() { return mCaCertificate; } @@ -726,9 +866,19 @@ public final class Credential implements Parcelable { * Client side X509 certificate chain. */ private X509Certificate[] mClientCertificateChain = null; + /** + * Set the client certificate chain associated with this credential. + * + * @param certificateChain The client certificate chain to set to + */ public void setClientCertificateChain(X509Certificate[] certificateChain) { mClientCertificateChain = certificateChain; } + /** + * Get the client certificate chain associated with this credential. + * + * @return client certificate chain associated with this credential + */ public X509Certificate[] getClientCertificateChain() { return mClientCertificateChain; } @@ -737,9 +887,19 @@ public final class Credential implements Parcelable { * Client side private key. */ private PrivateKey mClientPrivateKey = null; + /** + * Set the client private key associated with this credential. + * + * @param clientPrivateKey the client private key to set to + */ public void setClientPrivateKey(PrivateKey clientPrivateKey) { mClientPrivateKey = clientPrivateKey; } + /** + * Get the client private key associated with this credential. + * + * @return client private key associated with this credential. + */ public PrivateKey getClientPrivateKey() { return mClientPrivateKey; } diff --git a/wifi/java/android/net/wifi/hotspot2/pps/HomeSp.java b/wifi/java/android/net/wifi/hotspot2/pps/HomeSp.java index 2247860d23a59..d829ea81ed562 100644 --- a/wifi/java/android/net/wifi/hotspot2/pps/HomeSp.java +++ b/wifi/java/android/net/wifi/hotspot2/pps/HomeSp.java @@ -52,9 +52,19 @@ public final class HomeSp implements Parcelable { * FQDN (Fully Qualified Domain Name) of this home service provider. */ private String mFqdn = null; + /** + * Set the FQDN (Fully Qualified Domain Name) associated with this home service provider. + * + * @param fqdn The FQDN to set to + */ public void setFqdn(String fqdn) { mFqdn = fqdn; } + /** + * Get the FQDN (Fully Qualified Domain Name) associated with this home service provider. + * + * @return the FQDN associated with this home service provider + */ public String getFqdn() { return mFqdn; } @@ -63,9 +73,19 @@ public final class HomeSp implements Parcelable { * Friendly name of this home service provider. */ private String mFriendlyName = null; + /** + * Set the friendly name associated with this home service provider. + * + * @param friendlyName The friendly name to set to + */ public void setFriendlyName(String friendlyName) { mFriendlyName = friendlyName; } + /** + * Get the friendly name associated with this home service provider. + * + * @return the friendly name associated with this home service provider + */ public String getFriendlyName() { return mFriendlyName; } @@ -184,9 +204,21 @@ public final class HomeSp implements Parcelable { * which this provider is a member. */ private long[] mRoamingConsortiumOis = null; + /** + * Set the Organization Identifiers (OIs) identifying a roaming consortium of which this + * provider is a member. + * + * @param roamingConsortiumOis Array of roaming consortium OIs + */ public void setRoamingConsortiumOis(long[] roamingConsortiumOis) { mRoamingConsortiumOis = roamingConsortiumOis; } + /** + * Get the Organization Identifiers (OIs) identifying a roaming consortium of which this + * provider is a member. + * + * @return array of roaming consortium OIs + */ public long[] getRoamingConsortiumOis() { return mRoamingConsortiumOis; }