Implement getConfig() method to get WifiConfiguration

Make a duplicated function of WifiConfigController.getConfig(). This
function could get a new WifiConfiguration from input AccessPoint or
ScanResult.
Should be removed if there is standard one in framework.

Bug: 120827021
Test: RunSettingsRoboTests

Change-Id: Ia5981e8d41f434c097b464a2bfe18e1356f7b087
This commit is contained in:
cosmohsieh
2018-12-12 10:14:54 +08:00
committed by Cosmo Hsieh
parent 3f80d1b64b
commit 64b894f81d
4 changed files with 186 additions and 3 deletions

View File

@@ -129,8 +129,16 @@ public class NetworkRequestDialogFragment extends InstrumentedDialogFragment imp
}
if (which < accessPointList.size()) {
WifiConfiguration wifiConfig = accessPointList.get(which).getConfig();
mUserSelectionCallback.select(wifiConfig);
final AccessPoint selectedAccessPoint = accessPointList.get(which);
WifiConfiguration wifiConfig = selectedAccessPoint.getConfig();
if (wifiConfig == null) {
wifiConfig = WifiUtils.getWifiConfig(selectedAccessPoint, /* scanResult */
null, /* password */ null);
}
if (wifiConfig != null) {
mUserSelectionCallback.select(wifiConfig);
}
}
}