Fix forget button on wifi details page.

- Corrected logic for forgetting the current network in the network
details page
- After a user has forgotten a network, the button becomes disabled
(TODO final UX on this - go/remaining-wifi-picker-work tracks this)
- Added unit tests for forgetting network flow
- Fixed bug where the current tethering WifiConfiguration was associated
with the currrent network

Bug: 36458941
Test: m RunSettingsRoboTests
Change-Id: Ie3c4bae8b295908b17179e60359c8bc599519744
This commit is contained in:
Amin Shaikh
2017-03-27 10:24:49 -07:00
parent b26ce1e13b
commit ffd3197510
3 changed files with 45 additions and 16 deletions

View File

@@ -149,7 +149,6 @@ public class WifiDetailPreferenceController extends PreferenceController impleme
@Override
public void onResume() {
mWifiInfo = mWifiManager.getConnectionInfo();
mWifiConfig = mWifiManager.getWifiApConfiguration();
refreshFromWifiInfo();
setIpText();
@@ -257,4 +256,17 @@ public class WifiDetailPreferenceController extends PreferenceController impleme
}
mDnsPref.setDetailText(builder.toString());
}
/**
* Forgets the wifi network associated with this preference.
*/
public void forgetNetwork() {
if (mWifiConfig.ephemeral) {
mWifiManager.disableEphemeralNetwork(mWifiConfig.SSID);
} else if (mWifiConfig.isPasspoint()) {
mWifiManager.removePasspointConfiguration(mWifiConfig.FQDN);
} else {
mWifiManager.forget(mWifiConfig.networkId, null /* action listener */);
}
}
}