Files
packages_apps_Settings/src/com/android/settings/wrapper/WifiManagerWrapper.java
Doris Ling e76df1ca34 Put code that updates the access points lists inside a Handler.
When access point is forgot, we got callbacks from WifiManager to tell
us if the forget action is successful or not. We will refresh the access
point list in both cases. However, these callbacks happens on a
different thread and updating preferences should only be done on the
main thread. Creating a handler to handler all updates in the main
thread.

Change-Id: I7593befb20e46391ad69a284375693351a2cc794
Fixes: 65745404
Test: make RunSettingsRoboTests
2017-09-20 15:04:51 -07:00

46 lines
1.2 KiB
Java

package com.android.settings.wrapper;
import android.net.wifi.WifiManager;
/**
* Wrapper around {@link WifiManager} to facilitate unit testing.
*
* TODO: delete this class once robolectric supports Android O
*/
public class WifiManagerWrapper {
private final WifiManager mWifiManager;
public WifiManagerWrapper(WifiManager wifiManager) {
mWifiManager = wifiManager;
}
/**
* Gets the real WifiManager
* @return the real WifiManager
*/
public WifiManager getWifiManager() {
return mWifiManager;
}
/**
* {@link WifiManager#getCurrentNetworkWpsNfcConfigurationToken}
*/
public String getCurrentNetworkWpsNfcConfigurationToken() {
return mWifiManager.getCurrentNetworkWpsNfcConfigurationToken();
}
/**
* {@link WifiManager#removePasspointConfiguration}
*/
public void removePasspointConfiguration(String fqdn) {
mWifiManager.removePasspointConfiguration(fqdn);
}
/**
* {@link WifiManager#removePasspointConfiguration}
*/
public void forget(int netId, WifiManager.ActionListener listener) {
mWifiManager.forget(netId, listener);
}
}