From 592f8d52aca3736b9992528feecab10945efa110 Mon Sep 17 00:00:00 2001 From: David Su Date: Tue, 21 Jan 2020 14:15:42 -0800 Subject: [PATCH] Expose WifiConfig.setSecurityParams as public API Also expose associated SECURITY_TYPE_* constants. Bug: 143614759 Test: compiles Change-Id: I39419052791942ed86d3156a5cba1e0e2003098a --- api/current.txt | 10 +++++ .../android/net/wifi/WifiConfiguration.java | 41 +++++++++++-------- 2 files changed, 35 insertions(+), 16 deletions(-) diff --git a/api/current.txt b/api/current.txt index d9a89b1982a81..203bc1e7314d7 100644 --- a/api/current.txt +++ b/api/current.txt @@ -30728,9 +30728,19 @@ package android.net.wifi { method @Deprecated @NonNull public android.net.MacAddress getRandomizedMacAddress(); method @Deprecated public boolean isPasspoint(); method @Deprecated public void setHttpProxy(android.net.ProxyInfo); + method @Deprecated public void setSecurityParams(int); method public void writeToParcel(android.os.Parcel, int); field @Deprecated public String BSSID; field @Deprecated public String FQDN; + field @Deprecated public static final int SECURITY_TYPE_EAP = 3; // 0x3 + field @Deprecated public static final int SECURITY_TYPE_EAP_SUITE_B = 5; // 0x5 + field @Deprecated public static final int SECURITY_TYPE_OPEN = 0; // 0x0 + field @Deprecated public static final int SECURITY_TYPE_OWE = 6; // 0x6 + field @Deprecated public static final int SECURITY_TYPE_PSK = 2; // 0x2 + field @Deprecated public static final int SECURITY_TYPE_SAE = 4; // 0x4 + field @Deprecated public static final int SECURITY_TYPE_WAPI_CERT = 8; // 0x8 + field @Deprecated public static final int SECURITY_TYPE_WAPI_PSK = 7; // 0x7 + field @Deprecated public static final int SECURITY_TYPE_WEP = 1; // 0x1 field @Deprecated public String SSID; field @Deprecated @NonNull public java.util.BitSet allowedAuthAlgorithms; field @Deprecated @NonNull public java.util.BitSet allowedGroupCiphers; diff --git a/wifi/java/android/net/wifi/WifiConfiguration.java b/wifi/java/android/net/wifi/WifiConfiguration.java index e84369fb7ba1c..e2befeb29004a 100644 --- a/wifi/java/android/net/wifi/WifiConfiguration.java +++ b/wifi/java/android/net/wifi/WifiConfiguration.java @@ -402,29 +402,29 @@ public class WifiConfiguration implements Parcelable { public static final String[] strings = { "current", "disabled", "enabled" }; } - /** - * Security types we support. - */ - /** @hide */ + /** Security type for an open network. */ public static final int SECURITY_TYPE_OPEN = 0; - /** @hide */ + /** Security type for a WEP network. */ public static final int SECURITY_TYPE_WEP = 1; - /** @hide */ + /** Security type for a PSK network. */ public static final int SECURITY_TYPE_PSK = 2; - /** @hide */ + /** Security type for an EAP network. */ public static final int SECURITY_TYPE_EAP = 3; - /** @hide */ + /** Security type for an SAE network. */ public static final int SECURITY_TYPE_SAE = 4; - /** @hide */ + /** Security type for an EAP Suite B network. */ public static final int SECURITY_TYPE_EAP_SUITE_B = 5; - /** @hide */ + /** Security type for an OWE network. */ public static final int SECURITY_TYPE_OWE = 6; - /** @hide */ + /** Security type for a WAPI PSK network. */ public static final int SECURITY_TYPE_WAPI_PSK = 7; - /** @hide */ + /** Security type for a WAPI Certificate network. */ public static final int SECURITY_TYPE_WAPI_CERT = 8; - /** @hide */ + /** + * Security types we support. + * @hide + */ @Retention(RetentionPolicy.SOURCE) @IntDef(prefix = { "SECURITY_TYPE_" }, value = { SECURITY_TYPE_OPEN, @@ -440,10 +440,19 @@ public class WifiConfiguration implements Parcelable { public @interface SecurityType {} /** - * @hide - * Set security params (sets the various bitsets exposed in WifiConfiguration). + * Set the various security params to correspond to the provided security type. + * This is accomplished by setting the various BitSets exposed in WifiConfiguration. * - * @param securityType One of the security types from {@link SecurityType}. + * @param securityType One of the following security types: + * {@link #SECURITY_TYPE_OPEN}, + * {@link #SECURITY_TYPE_WEP}, + * {@link #SECURITY_TYPE_PSK}, + * {@link #SECURITY_TYPE_EAP}, + * {@link #SECURITY_TYPE_SAE}, + * {@link #SECURITY_TYPE_EAP_SUITE_B}, + * {@link #SECURITY_TYPE_OWE}, + * {@link #SECURITY_TYPE_WAPI_PSK}, or + * {@link #SECURITY_TYPE_WAPI_CERT} */ public void setSecurityParams(@SecurityType int securityType) { // Clear all the bitsets.