diff --git a/core/java/android/provider/Settings.java b/core/java/android/provider/Settings.java index b2cc18b946418..68e4b4e1ffc68 100644 --- a/core/java/android/provider/Settings.java +++ b/core/java/android/provider/Settings.java @@ -9424,6 +9424,14 @@ public final class Settings { public static final String WIFI_VERBOSE_LOGGING_ENABLED = "wifi_verbose_logging_enabled"; + /** + * Setting to enable connected MAC randomization in Wi-Fi; disabled by default, and + * setting to 1 will enable it. In the future, additional values may be supported. + * @hide + */ + public static final String WIFI_CONNECTED_MAC_RANDOMIZATION_ENABLED = + "wifi_connected_mac_randomization_enabled"; + /** * The maximum number of times we will retry a connection to an access * point for which we have failed in acquiring an IP address from DHCP. diff --git a/core/proto/android/providers/settings.proto b/core/proto/android/providers/settings.proto index 8d6df12d56dd9..95eb889a3f3a1 100644 --- a/core/proto/android/providers/settings.proto +++ b/core/proto/android/providers/settings.proto @@ -391,8 +391,9 @@ message GlobalSettingsProto { optional SettingProto zram_enabled = 347; optional SettingProto enable_smart_replies_in_notifications = 348; optional SettingProto show_first_crash_dialog = 349; + optional SettingProto wifi_connected_mac_randomization_enabled = 350; - // Next tag = 350; + // Next tag = 351; } message SecureSettingsProto { diff --git a/core/tests/coretests/src/android/provider/SettingsBackupTest.java b/core/tests/coretests/src/android/provider/SettingsBackupTest.java index ec3a6ce18cce1..6d038f32772fa 100644 --- a/core/tests/coretests/src/android/provider/SettingsBackupTest.java +++ b/core/tests/coretests/src/android/provider/SettingsBackupTest.java @@ -390,6 +390,7 @@ public class SettingsBackupTest { Settings.Global.WFC_IMS_ROAMING_MODE, Settings.Global.WIFI_BADGING_THRESHOLDS, Settings.Global.WIFI_BOUNCE_DELAY_OVERRIDE_MS, + Settings.Global.WIFI_CONNECTED_MAC_RANDOMIZATION_ENABLED, Settings.Global.WIFI_COUNTRY_CODE, Settings.Global.WIFI_DEVICE_OWNER_CONFIGS_LOCKDOWN, Settings.Global.WIFI_DISPLAY_CERTIFICATION_ON, diff --git a/packages/SettingsLib/res/values/strings.xml b/packages/SettingsLib/res/values/strings.xml index b13de2ec5ce1e..5acedd2085c94 100644 --- a/packages/SettingsLib/res/values/strings.xml +++ b/packages/SettingsLib/res/values/strings.xml @@ -498,6 +498,8 @@ Wireless display certification Enable Wi\u2011Fi Verbose Logging + + Connected MAC Randomization Mobile data always active @@ -552,6 +554,8 @@ Show options for wireless display certification Increase Wi\u2011Fi logging level, show per SSID RSSI in Wi\u2011Fi Picker + + Randomize MAC address when connecting to Wi\u2011Fi networks Logger buffer sizes diff --git a/packages/SettingsProvider/src/com/android/providers/settings/SettingsProtoDumpUtil.java b/packages/SettingsProvider/src/com/android/providers/settings/SettingsProtoDumpUtil.java index 87ed7eb705e90..5a75681f43c46 100644 --- a/packages/SettingsProvider/src/com/android/providers/settings/SettingsProtoDumpUtil.java +++ b/packages/SettingsProvider/src/com/android/providers/settings/SettingsProtoDumpUtil.java @@ -1128,6 +1128,9 @@ class SettingsProtoDumpUtil { dumpSetting(s, p, Settings.Global.SHOW_FIRST_CRASH_DIALOG, GlobalSettingsProto.SHOW_FIRST_CRASH_DIALOG); + dumpSetting(s, p, + Settings.Global.WIFI_CONNECTED_MAC_RANDOMIZATION_ENABLED, + GlobalSettingsProto.WIFI_CONNECTED_MAC_RANDOMIZATION_ENABLED); } /** Dump a single {@link SettingsState.Setting} to a proto buf */