use of android.net.NetworkState in project android_frameworks_base by AOSPA.
the class ConnectivityService method getActiveLinkProperties.
/**
* Return LinkProperties for the active (i.e., connected) default
* network interface. It is assumed that at most one default network
* is active at a time. If more than one is active, it is indeterminate
* which will be returned.
* @return the ip properties for the active network, or {@code null} if
* none is active
*/
@Override
public LinkProperties getActiveLinkProperties() {
enforceAccessPermission();
final int uid = Binder.getCallingUid();
NetworkState state = getUnfilteredActiveNetworkState(uid);
return state.linkProperties;
}
use of android.net.NetworkState in project android_frameworks_base by AOSPA.
the class ConnectivityService method getActiveNetworkInfo.
/**
* Return NetworkInfo for the active (i.e., connected) network interface.
* It is assumed that at most one network is active at a time. If more
* than one is active, it is indeterminate which will be returned.
* @return the info for the active network, or {@code null} if none is
* active
*/
@Override
public NetworkInfo getActiveNetworkInfo() {
enforceAccessPermission();
final int uid = Binder.getCallingUid();
final NetworkState state = getUnfilteredActiveNetworkState(uid);
filterNetworkStateForUid(state, uid, false);
maybeLogBlockedNetworkInfo(state.networkInfo, uid);
return state.networkInfo;
}
use of android.net.NetworkState in project android_frameworks_base by AOSPA.
the class ConnectivityService method getActiveNetworkQuotaInfo.
@Override
public NetworkQuotaInfo getActiveNetworkQuotaInfo() {
enforceAccessPermission();
final int uid = Binder.getCallingUid();
final long token = Binder.clearCallingIdentity();
try {
final NetworkState state = getUnfilteredActiveNetworkState(uid);
if (state.networkInfo != null) {
try {
return mPolicyManager.getNetworkQuotaInfo(state);
} catch (RemoteException e) {
}
}
return null;
} finally {
Binder.restoreCallingIdentity(token);
}
}
use of android.net.NetworkState in project android_frameworks_base by AOSPA.
the class ConnectivityService method getNetworkForType.
@Override
public Network getNetworkForType(int networkType) {
enforceAccessPermission();
final int uid = Binder.getCallingUid();
NetworkState state = getFilteredNetworkState(networkType, uid, false);
if (!isNetworkWithLinkPropertiesBlocked(state.linkProperties, uid, false)) {
return state.network;
}
return null;
}
use of android.net.NetworkState in project android_frameworks_base by AOSPA.
the class ConnectivityService method getNetworkInfoForUid.
@Override
public NetworkInfo getNetworkInfoForUid(Network network, int uid, boolean ignoreBlocked) {
enforceAccessPermission();
final NetworkAgentInfo nai = getNetworkAgentInfoForNetwork(network);
if (nai != null) {
final NetworkState state = nai.getNetworkState();
filterNetworkStateForUid(state, uid, ignoreBlocked);
return state.networkInfo;
} else {
return null;
}
}
Aggregations