Merge "Do not auto-downgrade WPA3->Transition mode if password too short" into main

This commit is contained in:
Quang Luong
2024-09-27 07:52:45 +00:00
committed by Android (Google) Code Review
2 changed files with 33 additions and 9 deletions

View File

@@ -356,10 +356,11 @@ public class WifiHotspotRepository {
log("setSpeedType(), setBand(BAND_2GHZ)");
configBuilder.setBand(BAND_2GHZ);
}
// Set the security type back to WPA2/WPA3 if we're moving from 6GHz to something else.
if ((config.getBand() & BAND_6GHZ) != 0) {
configBuilder.setPassphrase(
generatePassword(config), SECURITY_TYPE_WPA3_SAE_TRANSITION);
// Set the security type back to WPA2/WPA3 if the password is at least 8 characters and
// we're moving from 6GHz to something else.
String passphrase = generatePassword(config);
if ((passphrase.length() >= 8) && (config.getBand() & BAND_6GHZ) != 0) {
configBuilder.setPassphrase(passphrase, SECURITY_TYPE_WPA3_SAE_TRANSITION);
}
}
setSoftApConfiguration(configBuilder.build());