Connect to network while clicking open or saved networks on slice

Test: make RunSettingsRoboTests -j
Fixes: 121342770
Change-Id: I0ffb925628dd271d054f990b9b176eb10372e6a3
This commit is contained in:
Jason Chiu
2019-01-29 17:13:28 +08:00
parent e56df8877a
commit da2ca2f092
6 changed files with 237 additions and 18 deletions

View File

@@ -253,4 +253,33 @@ public class WifiUtils {
return AccessPoint.SECURITY_NONE;
}
public static final int CONNECT_TYPE_OTHERS = 0;
public static final int CONNECT_TYPE_OPEN_NETWORK = 1;
public static final int CONNECT_TYPE_SAVED_NETWORK = 2;
public static final int CONNECT_TYPE_OSU_PROVISION = 3;
/**
* Gets the connecting type of {@link AccessPoint}.
*/
public static int getConnectingType(AccessPoint accessPoint) {
final WifiConfiguration config = accessPoint.getConfig();
if (accessPoint.isOsuProvider()) {
return CONNECT_TYPE_OSU_PROVISION;
} else if ((accessPoint.getSecurity() == AccessPoint.SECURITY_NONE) ||
(accessPoint.getSecurity() == AccessPoint.SECURITY_OWE)) {
return CONNECT_TYPE_OPEN_NETWORK;
} else if (accessPoint.isSaved() && config != null
&& config.getNetworkSelectionStatus() != null
&& config.getNetworkSelectionStatus().getHasEverConnected()) {
return CONNECT_TYPE_SAVED_NETWORK;
} else if (accessPoint.isPasspoint()) {
// Access point provided by an installed Passpoint provider, connect using
// the associated config.
return CONNECT_TYPE_SAVED_NETWORK;
} else {
return CONNECT_TYPE_OTHERS;
}
}
}