Fix unexpected Wi-Fi hotspot shutdown

- Filter out unnecessary onSwitchChanged callbacks when the switch is
  disabled, which should not be triggered by user input.

- Refine the state handling function to avoid unnecessary
  onSwitchChanged callback.

- Refine the error handling of isHotspotPasswordValid function.

Bug: 227719584
Test: manual test
make RunSettingsRoboTests \
  ROBOTEST_FILTER=WifiTetherSwitchBarControllerTest

Change-Id: If62aaadc8ddb214769b1367d7801b6125bb5377c
This commit is contained in:
Weng Su
2022-04-08 05:35:14 +08:00
parent e0f6939c4c
commit 6c42636cb8
3 changed files with 109 additions and 48 deletions

View File

@@ -72,7 +72,7 @@ public class WifiUtils extends com.android.settingslib.wifi.WifiUtils {
}
}
configBuilder.setPassphrase(password, securityType);
} catch (IllegalArgumentException e) {
} catch (Exception e) {
return false;
}
return true;