diff options
| author | 2018-01-05 18:40:25 -0800 | |
|---|---|---|
| committer | 2018-01-22 18:13:40 -0800 | |
| commit | 0a20eda58d9cd9da3d005577ee175288cf4eef0c (patch) | |
| tree | 560cb1f893c760d2294e5d0c93135385cf13d814 | |
| parent | dbe2852e155173f3c65e5875166943dd3285e068 (diff) | |
Wifi MAC Randomization: Developer option change global settings
Enabling/disabling the connected mac randomization toggle in developer options will change Settings.Global.WIFI_CONNECTED_MAC_RANDOMIZATION_ENABLE, which the wifi framework can look at to decide whether or not to randomized mac addresses. Also added descriptions for the toggle in developer options.
Bug: 67908229
Bug: 71548421
Test: manual testing of checking that the option correctly displays and
logs to check that the toggle correctly changes values.
Change-Id: I48a2dc34d772b0e4ce7637df904b274c9fe1218f
5 files changed, 18 insertions, 1 deletions
diff --git a/core/java/android/provider/Settings.java b/core/java/android/provider/Settings.java index b2cc18b94641..68e4b4e1ffc6 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 8d6df12d56dd..95eb889a3f3a 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 ec3a6ce18cce..6d038f32772f 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 b13de2ec5ce1..5acedd2085c9 100644 --- a/packages/SettingsLib/res/values/strings.xml +++ b/packages/SettingsLib/res/values/strings.xml @@ -498,6 +498,8 @@ <string name="wifi_display_certification">Wireless display certification</string> <!-- Setting Checkbox title whether to enable WiFi Verbose Logging. [CHAR LIMIT=40] --> <string name="wifi_verbose_logging">Enable Wi\u2011Fi Verbose Logging</string> + <!-- Setting Checkbox title whether to enable connected MAC randomization --> + <string name="wifi_connected_mac_randomization">Connected MAC Randomization</string> <!-- Setting Checkbox title whether to always keep mobile data active. [CHAR LIMIT=80] --> <string name="mobile_data_always_on">Mobile data always active</string> <!-- Setting Checkbox title whether to enable hardware acceleration for tethering. [CHAR LIMIT=80] --> @@ -552,6 +554,8 @@ <string name="wifi_display_certification_summary">Show options for wireless display certification</string> <!-- Setting Checkbox summary whether to enable Wifi verbose Logging [CHAR LIMIT=80] --> <string name="wifi_verbose_logging_summary">Increase Wi\u2011Fi logging level, show per SSID RSSI in Wi\u2011Fi Picker</string> + <!-- Setting Checkbox title whether to enable connected MAC randomization --> + <string name="wifi_connected_mac_randomization_summary">Randomize MAC address when connecting to Wi\u2011Fi networks</string> <!-- UI debug setting: limit size of Android logger buffers --> <string name="select_logd_size_title">Logger buffer sizes</string> <!-- UI debug setting: limit size of Android logger buffers [CHAR LIMIT=59] --> diff --git a/packages/SettingsProvider/src/com/android/providers/settings/SettingsProtoDumpUtil.java b/packages/SettingsProvider/src/com/android/providers/settings/SettingsProtoDumpUtil.java index 87ed7eb705e9..5a75681f43c4 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 */ |