diff --git a/api/system-current.txt b/api/system-current.txt index 0b95c6d5bd914..87f3f4c655202 100644 --- a/api/system-current.txt +++ b/api/system-current.txt @@ -7494,6 +7494,7 @@ package android.net.wifi { field @NonNull public static final android.os.Parcelable.Creator CREATOR; field public static final long SOFTAP_FEATURE_ACS_OFFLOAD = 1L; // 0x1L field public static final long SOFTAP_FEATURE_CLIENT_FORCE_DISCONNECT = 2L; // 0x2L + field public static final long SOFTAP_FEATURE_MAC_ADDRESS_CUSTOMIZATION = 8L; // 0x8L field public static final long SOFTAP_FEATURE_WPA3_SAE = 4L; // 0x4L } diff --git a/wifi/api/system-current.txt b/wifi/api/system-current.txt index 7c592f0aec9fa..fa99da786ae5c 100644 --- a/wifi/api/system-current.txt +++ b/wifi/api/system-current.txt @@ -246,6 +246,7 @@ package android.net.wifi { field @NonNull public static final android.os.Parcelable.Creator CREATOR; field public static final long SOFTAP_FEATURE_ACS_OFFLOAD = 1L; // 0x1L field public static final long SOFTAP_FEATURE_CLIENT_FORCE_DISCONNECT = 2L; // 0x2L + field public static final long SOFTAP_FEATURE_MAC_ADDRESS_CUSTOMIZATION = 8L; // 0x8L field public static final long SOFTAP_FEATURE_WPA3_SAE = 4L; // 0x4L } diff --git a/wifi/java/android/net/wifi/SoftApCapability.java b/wifi/java/android/net/wifi/SoftApCapability.java index 6bd4211d82148..d570b7e8afa97 100644 --- a/wifi/java/android/net/wifi/SoftApCapability.java +++ b/wifi/java/android/net/wifi/SoftApCapability.java @@ -46,7 +46,7 @@ public final class SoftApCapability implements Parcelable { * Support for automatic channel selection in driver (ACS). * Driver will auto select best channel based on interference to optimize performance. * - * flag when {@link R.bool.config_wifi_softap_acs_supported)} is true. + * flag when {@link R.bool.config_wifi_softap_acs_supported} is true. * *

* Use {@link WifiManager.SoftApCallback#onInfoChanged(SoftApInfo)} and @@ -57,7 +57,7 @@ public final class SoftApCapability implements Parcelable { /** * Support for client force disconnect. - * flag when {@link R.bool.config_wifi_sofap_client_force_disconnect_supported)} is true + * flag when {@link R.bool.config_wifiSofapClientForceDisconnectSupported} is true * *

* Several Soft AP client control features, e.g. specifying the maximum number of @@ -67,20 +67,32 @@ public final class SoftApCapability implements Parcelable { */ public static final long SOFTAP_FEATURE_CLIENT_FORCE_DISCONNECT = 1 << 1; - /** * Support for WPA3 Simultaneous Authentication of Equals (WPA3-SAE). * - * flag when {@link config_wifi_softap_sae_supported)} is true. + * flag when {@link config_wifi_softap_sae_supported} is true. */ public static final long SOFTAP_FEATURE_WPA3_SAE = 1 << 2; + /** + * Support for MAC address customization. + * flag when {@link R.bool.config_wifiSoftapMacAddressCustomizationSupported} is true + * + *

+ * Check feature support before invoking + * {@link SoftApConfiguration.Builder#setBssid(MadAddress)} or + * {@link SoftApConfiguration.Builder#setMacRandomizationSetting(int)} with + * {@link SoftApConfiguration.RANDOMIZATION_PERSISTENT} + */ + public static final long SOFTAP_FEATURE_MAC_ADDRESS_CUSTOMIZATION = 1 << 3; + /** @hide */ @Retention(RetentionPolicy.SOURCE) @LongDef(flag = true, prefix = { "SOFTAP_FEATURE_" }, value = { SOFTAP_FEATURE_ACS_OFFLOAD, SOFTAP_FEATURE_CLIENT_FORCE_DISCONNECT, SOFTAP_FEATURE_WPA3_SAE, + SOFTAP_FEATURE_MAC_ADDRESS_CUSTOMIZATION, }) public @interface HotspotFeatures {} diff --git a/wifi/java/android/net/wifi/SoftApConfiguration.java b/wifi/java/android/net/wifi/SoftApConfiguration.java index 2c53daaf55a7d..c0f6e7a20f954 100644 --- a/wifi/java/android/net/wifi/SoftApConfiguration.java +++ b/wifi/java/android/net/wifi/SoftApConfiguration.java @@ -819,6 +819,11 @@ public final class SoftApConfiguration implements Parcelable { * Derived MAC address 1: e2:c7:60:c4:0e:b7 * Derived MAC address 2: e2:38:9f:c4:0e:b7 * + *

+ * Use {@link WifiManager.SoftApCallback#onCapabilityChanged(SoftApCapability)} and + * {@link SoftApCapability#areFeaturesSupported(long)} + * with {@link SoftApCapability.SOFTAP_FEATURE_MAC_ADDRESS_CUSTOMIZATION} to determine + * whether or not this feature is supported. * * @param bssid BSSID, or null to have the BSSID chosen by the framework. The caller is * responsible for avoiding collisions. @@ -957,9 +962,9 @@ public final class SoftApConfiguration implements Parcelable { * {@link #setBand(int)}. * * The channel auto selection will be offloaded to driver when - * {@link SoftApCapability#areFeaturesSupported( - * SoftApCapability.SOFTAP_FEATURE_ACS_OFFLOAD)} - * returns true. The driver will auto select the best channel (e.g. best performance) + * {@link SoftApCapability#areFeaturesSupported(long)} + * with {@link SoftApCapability.SOFTAP_FEATURE_ACS_OFFLOAD} + * return true. The driver will auto select the best channel (e.g. best performance) * based on environment interference. Check {@link SoftApCapability} for more detail. * * The API contains (band, channel) input since the 6GHz band uses the same channel @@ -998,8 +1003,8 @@ public final class SoftApConfiguration implements Parcelable { * auto-select a valid channel from the band configured with {@link #setBands(int[])}. * * The channel auto selection will be offloaded to driver when - * {@link SoftApCapability#areFeaturesSupported( - * SoftApCapability.SOFTAP_FEATURE_ACS_OFFLOAD)} + * {@link SoftApCapability#areFeaturesSupported(long)} + * with {@link SoftApCapability.SOFTAP_FEATURE_ACS_OFFLOAD} * returns true. The driver will auto select the best channel (e.g. best performance) * based on environment interference. Check {@link SoftApCapability} for more detail. * @@ -1046,14 +1051,14 @@ public final class SoftApConfiguration implements Parcelable { *

*

  • If not set, defaults to 0.
  • * - * This method requires hardware support. If the method is used to set a + * This method requires HAL support. If the method is used to set a * non-zero {@code maxNumberOfClients} value then * {@link WifiManager#startTetheredHotspot} will report error code * {@link WifiManager#SAP_START_FAILURE_UNSUPPORTED_CONFIGURATION}. * *

    * Use {@link WifiManager.SoftApCallback#onCapabilityChanged(SoftApCapability)} and - * {@link SoftApCapability#areFeaturesSupported(int)} + * {@link SoftApCapability#areFeaturesSupported(long)} * with {@link SoftApCapability.SOFTAP_FEATURE_CLIENT_FORCE_DISCONNECT} to determine whether * or not this feature is supported. * @@ -1127,13 +1132,13 @@ public final class SoftApConfiguration implements Parcelable { * {@link #setBlockedClientList(List)} and {@link #setAllowedClientList(List)}. * *

    - * This method requires hardware support. Hardware support can be determined using + * This method requires HAL support. HAL support can be determined using * {@link WifiManager.SoftApCallback#onCapabilityChanged(SoftApCapability)} and - * {@link SoftApCapability#areFeaturesSupported(int)} + * {@link SoftApCapability#areFeaturesSupported(long)} * with {@link SoftApCapability.SOFTAP_FEATURE_CLIENT_FORCE_DISCONNECT} * *

    - * If the method is called on a device without hardware support then starting the soft AP + * If the method is called on a device without HAL support then starting the soft AP * using {@link WifiManager#startTetheredHotspot(SoftApConfiguration)} will fail with * {@link WifiManager#SAP_START_FAILURE_UNSUPPORTED_CONFIGURATION}. * @@ -1182,13 +1187,13 @@ public final class SoftApConfiguration implements Parcelable { * to the Soft AP. * *

    - * This method requires hardware support. Hardware support can be determined using + * This method requires HAL support. HAL support can be determined using * {@link WifiManager.SoftApCallback#onCapabilityChanged(SoftApCapability)} and - * {@link SoftApCapability#areFeaturesSupported(int)} + * {@link SoftApCapability#areFeaturesSupported(long)} * with {@link SoftApCapability.SOFTAP_FEATURE_CLIENT_FORCE_DISCONNECT} * *

    - * If the method is called on a device without hardware support then starting the soft AP + * If the method is called on a device without HAL support then starting the soft AP * using {@link WifiManager#startTetheredHotspot(SoftApConfiguration)} will fail with * {@link WifiManager#SAP_START_FAILURE_UNSUPPORTED_CONFIGURATION}. * @@ -1210,7 +1215,14 @@ public final class SoftApConfiguration implements Parcelable { *

    *

  • If not set, defaults to {@link #RANDOMIZATION_PERSISTENT}
  • * - * @param macRandomizationSetting One of the following setting:. + *

    + * Requires HAL support when set to {@link #RANDOMIZATION_PERSISTENT}. + * Use {@link WifiManager.SoftApCallback#onCapabilityChanged(SoftApCapability)} and + * {@link SoftApCapability#areFeaturesSupported(long)} + * with {@link SoftApCapability.SOFTAP_FEATURE_MAC_ADDRESS_CUSTOMIZATION} to determine + * whether or not this feature is supported. + * + * @param macRandomizationSetting One of the following setting: * {@link #RANDOMIZATION_NONE} or {@link #RANDOMIZATION_PERSISTENT}. * @return Builder for chaining. *