New API for enhanced MAC randomization

New API for to specify more MAC randomization strategies.

Bug: 162801581
Test: atest android.net.wifi
Change-Id: Id7da89db701590ab59fc688ccbdaf4544c003be5
This commit is contained in:
xshu
2020-08-05 19:27:54 -07:00
parent 708294a7ad
commit 45b78f9a82
3 changed files with 26 additions and 4 deletions

View File

@@ -7141,6 +7141,8 @@ package android.net.wifi {
field @Deprecated public static final int METERED_OVERRIDE_METERED = 1; // 0x1
field @Deprecated public static final int METERED_OVERRIDE_NONE = 0; // 0x0
field @Deprecated public static final int METERED_OVERRIDE_NOT_METERED = 2; // 0x2
field @Deprecated public static final int RANDOMIZATION_AUTO = 3; // 0x3
field @Deprecated public static final int RANDOMIZATION_ENHANCED = 2; // 0x2
field @Deprecated public static final int RANDOMIZATION_NONE = 0; // 0x0
field @Deprecated public static final int RANDOMIZATION_PERSISTENT = 1; // 0x1
field @Deprecated public static final int RECENT_FAILURE_AP_UNABLE_TO_HANDLE_NEW_STA = 17; // 0x11

View File

@@ -326,6 +326,8 @@ package android.net.wifi {
field @Deprecated public static final int METERED_OVERRIDE_METERED = 1; // 0x1
field @Deprecated public static final int METERED_OVERRIDE_NONE = 0; // 0x0
field @Deprecated public static final int METERED_OVERRIDE_NOT_METERED = 2; // 0x2
field @Deprecated public static final int RANDOMIZATION_AUTO = 3; // 0x3
field @Deprecated public static final int RANDOMIZATION_ENHANCED = 2; // 0x2
field @Deprecated public static final int RANDOMIZATION_NONE = 0; // 0x0
field @Deprecated public static final int RANDOMIZATION_PERSISTENT = 1; // 0x1
field @Deprecated public static final int RECENT_FAILURE_AP_UNABLE_TO_HANDLE_NEW_STA = 17; // 0x11

View File

@@ -1130,7 +1130,9 @@ public class WifiConfiguration implements Parcelable {
@Retention(RetentionPolicy.SOURCE)
@IntDef(prefix = {"RANDOMIZATION_"}, value = {
RANDOMIZATION_NONE,
RANDOMIZATION_PERSISTENT})
RANDOMIZATION_PERSISTENT,
RANDOMIZATION_ENHANCED,
RANDOMIZATION_AUTO})
public @interface MacRandomizationSetting {}
/**
@@ -1146,15 +1148,31 @@ public class WifiConfiguration implements Parcelable {
@SystemApi
public static final int RANDOMIZATION_PERSISTENT = 1;
/**
* Use a randomly generated MAC address for connections to this network.
* This option does not persist the randomized MAC address.
* @hide
*/
@SystemApi
public static final int RANDOMIZATION_ENHANCED = 2;
/**
* Let the wifi framework automatically decide the MAC randomization strategy.
* @hide
*/
@SystemApi
public static final int RANDOMIZATION_AUTO = 3;
/**
* Level of MAC randomization for this network.
* One of {@link #RANDOMIZATION_NONE} or {@link #RANDOMIZATION_PERSISTENT}.
* By default this field is set to {@link #RANDOMIZATION_PERSISTENT}.
* One of {@link #RANDOMIZATION_NONE}, {@link #RANDOMIZATION_AUTO},
* {@link #RANDOMIZATION_PERSISTENT} or {@link #RANDOMIZATION_ENHANCED}.
* By default this field is set to {@link #RANDOMIZATION_AUTO}.
* @hide
*/
@SystemApi
@MacRandomizationSetting
public int macRandomizationSetting = RANDOMIZATION_PERSISTENT;
public int macRandomizationSetting = RANDOMIZATION_AUTO;
/**
* @hide