use of android.net.wifi.WifiManager in project android_frameworks_base by AOSPA.
the class WifiNetworkAdapter method addSP.
public HomeSP addSP(MOTree instanceTree) throws IOException, SAXException {
WifiManager wifiManager = (WifiManager) mContext.getSystemService(Context.WIFI_SERVICE);
String xml = instanceTree.toXml();
wifiManager.addPasspointManagementObject(xml);
return MOManager.buildSP(xml);
}
use of android.net.wifi.WifiManager in project android_frameworks_base by AOSPA.
the class WifiNetworkAdapter method matchProviderWithCurrentNetwork.
public PasspointMatch matchProviderWithCurrentNetwork(String fqdn) {
WifiManager wifiManager = (WifiManager) mContext.getSystemService(Context.WIFI_SERVICE);
int ordinal = wifiManager.matchProviderWithCurrentNetwork(fqdn);
return ordinal >= 0 && ordinal < PasspointMatch.values().length ? PasspointMatch.values()[ordinal] : null;
}
use of android.net.wifi.WifiManager in project android_frameworks_base by AOSPA.
the class WifiNetworkAdapter method loadAllSps.
private void loadAllSps() {
Log.d(OSUManager.TAG, "Loading all SPs");
WifiManager wifiManager = (WifiManager) mContext.getSystemService(Context.WIFI_SERVICE);
for (WifiConfiguration config : wifiManager.getPrivilegedConfiguredNetworks()) {
String moTree = config.getMoTree();
if (moTree != null) {
try {
mPasspointConfigs.put(config.FQDN, new PasspointConfig(config));
} catch (IOException | SAXException e) {
Log.w(OSUManager.TAG, "Failed to parse MO: " + e);
}
}
}
}
use of android.net.wifi.WifiManager in project qksms by moezbhatti.
the class NetworkIdentity method buildNetworkIdentity.
/**
* Build a {@link android.net.NetworkIdentity} from the given {@link NetworkState},
* assuming that any mobile networks are using the current IMSI.
*/
public static NetworkIdentity buildNetworkIdentity(Context context, NetworkState state) {
final int type = state.networkInfo.getType();
final int subType = state.networkInfo.getSubtype();
// TODO: consider moving subscriberId over to LinkCapabilities, so it
// comes from an authoritative source.
String subscriberId = null;
String networkId = null;
boolean roaming = false;
if (isNetworkTypeMobile(type)) {
final TelephonyManager telephony = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
roaming = telephony.isNetworkRoaming();
if (state.subscriberId != null) {
subscriberId = state.subscriberId;
} else {
subscriberId = telephony.getSubscriberId();
}
} else if (type == TYPE_WIFI) {
if (state.networkId != null) {
networkId = state.networkId;
} else {
final WifiManager wifi = (WifiManager) context.getSystemService(Context.WIFI_SERVICE);
final WifiInfo info = wifi.getConnectionInfo();
networkId = info != null ? info.getSSID() : null;
}
}
return new NetworkIdentity(type, subType, subscriberId, networkId, roaming);
}
use of android.net.wifi.WifiManager in project qksms by moezbhatti.
the class Transaction method revokeWifi.
/**
* @deprecated
*/
private void revokeWifi(boolean saveState) {
WifiManager wifi = (WifiManager) context.getSystemService(Context.WIFI_SERVICE);
if (saveState) {
settings.currentWifi = wifi.getConnectionInfo();
settings.currentWifiState = wifi.isWifiEnabled();
wifi.disconnect();
settings.discon = new DisconnectWifi();
context.registerReceiver(settings.discon, new IntentFilter(WifiManager.SUPPLICANT_STATE_CHANGED_ACTION));
settings.currentDataState = Utils.isMobileDataEnabled(context);
Utils.setMobileDataEnabled(context, true);
} else {
wifi.disconnect();
wifi.disconnect();
settings.discon = new DisconnectWifi();
context.registerReceiver(settings.discon, new IntentFilter(WifiManager.SUPPLICANT_STATE_CHANGED_ACTION));
Utils.setMobileDataEnabled(context, true);
}
}
Aggregations