use of com.android.server.connectivity.NetworkAgentInfo in project platform_frameworks_base by android.
the class ConnectivityService method getUnfilteredActiveNetworkState.
private NetworkState getUnfilteredActiveNetworkState(int uid) {
NetworkAgentInfo nai = getDefaultNetwork();
final Network[] networks = getVpnUnderlyingNetworks(uid);
if (networks != null) {
// first one.
if (networks.length > 0) {
nai = getNetworkAgentInfoForNetwork(networks[0]);
} else {
nai = null;
}
}
if (nai != null) {
return nai.getNetworkState();
} else {
return NetworkState.EMPTY;
}
}
use of com.android.server.connectivity.NetworkAgentInfo in project platform_frameworks_base by android.
the class ConnectivityService method getLinkProperties.
// TODO - this should be ALL networks
@Override
public LinkProperties getLinkProperties(Network network) {
enforceAccessPermission();
NetworkAgentInfo nai = getNetworkAgentInfoForNetwork(network);
if (nai != null) {
synchronized (nai) {
return new LinkProperties(nai.linkProperties);
}
}
return null;
}
use of com.android.server.connectivity.NetworkAgentInfo in project platform_frameworks_base by android.
the class ConnectivityService method createVpnInfo.
/**
* @return VPN information for accounting, or null if we can't retrieve all required
* information, e.g primary underlying iface.
*/
@Nullable
private VpnInfo createVpnInfo(Vpn vpn) {
VpnInfo info = vpn.getVpnInfo();
if (info == null) {
return null;
}
Network[] underlyingNetworks = vpn.getUnderlyingNetworks();
// the underlyingNetworks list.
if (underlyingNetworks == null) {
NetworkAgentInfo defaultNetwork = getDefaultNetwork();
if (defaultNetwork != null && defaultNetwork.linkProperties != null) {
info.primaryUnderlyingIface = getDefaultNetwork().linkProperties.getInterfaceName();
}
} else if (underlyingNetworks.length > 0) {
LinkProperties linkProperties = getLinkProperties(underlyingNetworks[0]);
if (linkProperties != null) {
info.primaryUnderlyingIface = linkProperties.getInterfaceName();
}
}
return info.primaryUnderlyingIface == null ? null : info;
}
use of com.android.server.connectivity.NetworkAgentInfo in project platform_frameworks_base by android.
the class ConnectivityService method handleRegisterNetworkRequest.
private void handleRegisterNetworkRequest(NetworkRequestInfo nri) {
mNetworkRequests.put(nri.request, nri);
mNetworkRequestInfoLogs.log("REGISTER " + nri);
if (nri.request.isListen()) {
for (NetworkAgentInfo network : mNetworkAgentInfos.values()) {
if (nri.request.networkCapabilities.hasSignalStrength() && network.satisfiesImmutableCapabilitiesOf(nri.request)) {
updateSignalStrengthThresholds(network, "REGISTER", nri.request);
}
}
}
rematchAllNetworksAndRequests(null, 0);
if (nri.request.isRequest() && mNetworkForRequestId.get(nri.request.requestId) == null) {
sendUpdatedScoreToFactories(nri.request, 0);
}
}
use of com.android.server.connectivity.NetworkAgentInfo in project platform_frameworks_base by android.
the class ConnectivityService method getActiveNetworkForUidInternal.
private Network getActiveNetworkForUidInternal(final int uid, boolean ignoreBlocked) {
final int user = UserHandle.getUserId(uid);
int vpnNetId = NETID_UNSET;
synchronized (mVpns) {
final Vpn vpn = mVpns.get(user);
if (vpn != null && vpn.appliesToUid(uid))
vpnNetId = vpn.getNetId();
}
NetworkAgentInfo nai;
if (vpnNetId != NETID_UNSET) {
synchronized (mNetworkForNetId) {
nai = mNetworkForNetId.get(vpnNetId);
}
if (nai != null)
return nai.network;
}
nai = getDefaultNetwork();
if (nai != null && isNetworkWithLinkPropertiesBlocked(nai.linkProperties, uid, ignoreBlocked)) {
nai = null;
}
return nai != null ? nai.network : null;
}
Aggregations