Fix mac randomization value mismatch

WifiConfigController2 passes in
WifiConfiguration.MacRandomizationSetting to methods that expect
WifiEntry.Privacy enums, resulting in the wrong values being saved and
displayed for the edit dialog. Fix this by making sure the correct
WifiEntry values are used.

Note that the Network Details Page uses
WifiPrivacyPreferenceController2, which uses the correct values.

Flag: EXEMPT bugfix
Bug: 284230986
Test: atest WifiPrivacyPreferenceController2Test, atest
WifiConfigController2Test, manually verify adding a new network saves
the config with RANDOMIZATION_AUTO by default and changing the value
works correctly.

Change-Id: I84dc7cc50d04360aca611ca80ee400a97b693722
This commit is contained in:
Quang Anh Luong
2024-07-18 14:25:15 +09:00
committed by Quang Luong
parent 5751c90a3a
commit 47a83c7ed7
4 changed files with 26 additions and 26 deletions

View File

@@ -344,7 +344,7 @@ public class WifiConfigController2 implements TextWatcher,
if (mPrivacySettingsSpinner != null) {
final int prefMacValue = WifiPrivacyPreferenceController2
.translateMacRandomizedValueToPrefValue(config.macRandomizationSetting);
.translateWifiEntryPrivacyToPrefValue(mWifiEntry.getPrivacy());
mPrivacySettingsSpinner.setSelection(prefMacValue);
}
@@ -863,7 +863,7 @@ public class WifiConfigController2 implements TextWatcher,
if (mPrivacySettingsSpinner != null) {
config.macRandomizationSetting = WifiPrivacyPreferenceController2
.translatePrefValueToMacRandomizedValue(mPrivacySettingsSpinner
.translatePrefValueToWifiConfigSetting(mPrivacySettingsSpinner
.getSelectedItemPosition());
}