Do not auto-downgrade WPA3->Transition mode if password too short

Hotspot security is auto-downgraded from WPA3->Transition mode if the
band is changed from 6Ghz -> 2.4/5GHz. However, Transition mode requires
a password of 8 chars or more, but WPA3 SAE does not. Avoid changing the
security type if the current password is less than 8 chars.

Flag: EXEMPT minor bugfix

Bug: 366452667
Test: atest WifiHotspotRepositoryTest
Change-Id: I1abadd59966e170b51899782746b9f14e33e6186
This commit is contained in:
Quang Anh Luong
2024-09-26 11:52:58 +09:00
committed by Quang Luong
parent a4b2757458
commit 5aa95553cd
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());