[Wi-Fi] Fix crash after editing invalid hotspot password

From Android 11, Wi-Fi framework only supports ASCII encoding
for hotspot password, APP should check if password character is
valid.

This change checks if SoftApConfiguration accepts the password
and disable the OK button if the password is invalid.

Bug: 163353576
Test: make RunSettingsRoboTests ROBOTEST_FILTER=WifiUtilsTest
Change-Id: Icf3b5c85856906e4cbe2f0ad79583c1b7182b8c7
Merged-In: Ief3c6c1f08f8fcdf128768cde3ab8eef91f19fbe
This commit is contained in:
Arc Wang
2020-08-12 13:59:27 +08:00
parent 88558e8940
commit b432cf293c
3 changed files with 21 additions and 18 deletions

View File

@@ -118,7 +118,7 @@ public class WifiTetherPasswordPreferenceController extends WifiTetherBasePrefer
@Override
public boolean isTextValid(String value) {
return WifiUtils.isHotspotPasswordValid(value);
return WifiUtils.isHotspotWpa2PasswordValid(value);
}
private static String generateRandomPassword() {