Update WriteWifiConfigToNfcDialog.

- Use the new WifiManager API to retrieve the WPS NFC token for the
current network.
- Add WifiManagerWrapper class to support testing because Robolectric
does not yet support testing Android O.

Bug: 35725168
Test: m RunSettingsRoboTests
Change-Id: I7805bdcbe02dc262083bcd371d4ad88d256f8089
This commit is contained in:
Amin Shaikh
2017-03-23 17:56:17 -07:00
parent 510a1a696a
commit bef3c6ddfd
4 changed files with 40 additions and 26 deletions

View File

@@ -0,0 +1,23 @@
package com.android.settings.wifi;
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;
}
/**
* {@link WifiManager#getCurrentNetworkWpsNfcConfigurationToken}
*/
public String getCurrentNetworkWpsNfcConfigurationToken() {
return mWifiManager.getCurrentNetworkWpsNfcConfigurationToken();
}
}