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

@@ -19,6 +19,7 @@ import android.content.Context;
import android.net.wifi.WifiInfo;
import android.net.wifi.WifiManager;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import com.android.internal.logging.nano.MetricsProto;
@@ -69,17 +70,9 @@ public class WifiNetworkDetailsFragment extends DashboardFragment {
}
private void forgetNetwork() {
WifiInfo info = mWifiDetailPreferenceController.getWifiInfo();
mMetricsFeatureProvider.action(getActivity(), MetricsProto.MetricsEvent.ACTION_WIFI_FORGET);
if (!info.isEphemeral()) {
// Network is active but has no network ID - must be ephemeral.
mWifiManager.disableEphemeralNetwork(
AccessPoint.convertToQuotedString(info.getSSID()));
} else if (mAccessPoint.getConfig().isPasspoint()) {
mWifiManager.removePasspointConfiguration(mAccessPoint.getConfig().FQDN);
} else {
mWifiManager.forget(info.getNetworkId(), null /* action listener */);
}
mWifiDetailPreferenceController.forgetNetwork();
mForgetButton.setEnabled(false);
}
@Override