[Wi-Fi] Show not show Wi-Fi edit UI for never connected open Wi-Fi networks

When users click a Wi-Fi network and it's
WifiConfiguration.getNetworkSelectionStatus().hasEverConnected()
is false, WifiSettings2 will launch the Wi-Fi edit UI for users
to edit password again.
It's not necessary to show the Wi-Fi edit UI if the Wi-Fi network
is a open network.

Bug: 154548505
Test: manual
      Click a never connected secure Wi-Fi and edit UI shows.
      Click a never connected open Wi-Fi and edit UI does not show.
Change-Id: Ie8489aff001942f92fbfaafd772f84b1b4a09cf4
This commit is contained in:
Arc Wang
2020-04-21 12:10:30 +08:00
parent 90cce123e5
commit 205b585cf3

View File

@@ -539,9 +539,11 @@ public class WifiSettings2 extends RestrictedSettingsFragment
final WifiEntry selectedEntry = final WifiEntry selectedEntry =
((LongPressWifiEntryPreference) preference).getWifiEntry(); ((LongPressWifiEntryPreference) preference).getWifiEntry();
if (selectedEntry.getWifiConfiguration() != null) { // If the clicked WiFi entry is never connected, launch Wi-Fi edit UI to edit password.
if (!selectedEntry.getWifiConfiguration().getNetworkSelectionStatus() if (selectedEntry.getSecurity() != WifiEntry.SECURITY_NONE
.hasEverConnected()) { && selectedEntry.getSecurity() != WifiEntry.SECURITY_OWE) {
final WifiConfiguration config = selectedEntry.getWifiConfiguration();
if (config != null && !config.getNetworkSelectionStatus().hasEverConnected()) {
launchConfigNewNetworkFragment(selectedEntry); launchConfigNewNetworkFragment(selectedEntry);
return true; return true;
} }