/**
* Delete the network in the supplicant config.
*
* This function is used instead of a sequence of removeNetwork()
* and saveConfiguration().
*
* @param config the set of variables that describe the configuration,
* contained in a {@link WifiConfiguration} object.
* @param listener for callbacks on success or failure. Can be null.
* @throws IllegalStateException if the WifiManager instance needs to be
* initialized again
* @hide
*/
public void forget(int netId, ActionListener listener) {
if (netId < 0) throw new IllegalArgumentException("Network id cannot be negative");
validateChannel();
sAsyncChannel.sendMessage(FORGET_NETWORK, netId, putListener(listener));
}
case WifiManager.FORGET_NETWORK:
if (isOwner(msg.sendingUid)) {
mWifiStateMachine.sendMessage(Message.obtain(msg));
} else {
Slog.e(TAG, "Forget is not authorized for user");
replyFailed(msg, WifiManager.FORGET_NETWORK_FAILED,
WifiManager.NOT_AUTHORIZED);
}
break;
case WifiManager.FORGET_NETWORK:
// Debug only, remember last configuration that was forgotten
WifiConfiguration toRemove
= mWifiConfigStore.getWifiConfiguration(message.arg1);
if (toRemove == null) {
lastForgetConfigurationAttempt = null;
} else {
lastForgetConfigurationAttempt = new WifiConfiguration(toRemove);
}
// check that the caller owns this network
netId = message.arg1;
if (!mWifiConfigStore.canModifyNetwork(message.sendingUid, netId,
/* onlyAnnotate */ false)) {
logw("Not authorized to forget network "
+ " cnid=" + netId
+ " uid=" + message.sendingUid);
replyToMessage(message, WifiManager.FORGET_NETWORK_FAILED,
WifiManager.NOT_AUTHORIZED);
break;
}
if (mWifiConfigStore.forgetNetwork(message.arg1)) {
replyToMessage(message, WifiManager.FORGET_NETWORK_SUCCEEDED);
broadcastWifiCredentialChanged(WifiManager.WIFI_CREDENTIAL_FORGOT,
(WifiConfiguration) message.obj);
} else {
loge("Failed to forget network");
replyToMessage(message, WifiManager.FORGET_NETWORK_FAILED,
WifiManager.ERROR);
}
break;
/**
* Forget the specified network and save config
*
* @param netId network to forget
* @return {@code true} if it succeeds, {@code false} otherwise
*/
boolean forgetNetwork(int netId) {
if (showNetworks) localLog("forgetNetwork", netId);
WifiConfiguration config = mConfiguredNetworks.get(netId);
boolean remove = removeConfigAndSendBroadcastIfNeeded(netId);
if (!remove) {
//success but we dont want to remove the network from supplicant conf file
return true;
}
if (mWifiNative.removeNetwork(netId)) {
if (config != null && config.isPasspoint()) {
writePasspointConfigs(config.FQDN, null);
}
mWifiNative.saveConfig();
writeKnownNetworkHistory(true);
return true;
} else {
loge("Failed to remove network " + netId);
return false;
}
}
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有