Search in sources :

Example 51 with LinkProperties

use of android.net.LinkProperties in project android_frameworks_base by ResurrectionRemix.

the class ConnectivityService method registerNetworkAgent.

public int registerNetworkAgent(Messenger messenger, NetworkInfo networkInfo, LinkProperties linkProperties, NetworkCapabilities networkCapabilities, int currentScore, NetworkMisc networkMisc) {
    enforceConnectivityInternalPermission();
    // TODO: Instead of passing mDefaultRequest, provide an API to determine whether a Network
    // satisfies mDefaultRequest.
    final NetworkAgentInfo nai = new NetworkAgentInfo(messenger, new AsyncChannel(), new Network(reserveNetId()), new NetworkInfo(networkInfo), new LinkProperties(linkProperties), new NetworkCapabilities(networkCapabilities), currentScore, mContext, mTrackerHandler, new NetworkMisc(networkMisc), mDefaultRequest, this);
    synchronized (this) {
        nai.networkMonitor.systemReady = mSystemReady;
    }
    addValidationLogs(nai.networkMonitor.getValidationLogs(), nai.network, networkInfo.getExtraInfo());
    if (DBG)
        log("registerNetworkAgent " + nai);
    mHandler.sendMessage(mHandler.obtainMessage(EVENT_REGISTER_NETWORK_AGENT, nai));
    return nai.network.netId;
}
Also used : NetworkMisc(android.net.NetworkMisc) NetworkInfo(android.net.NetworkInfo) NetworkAgentInfo(com.android.server.connectivity.NetworkAgentInfo) Network(android.net.Network) AsyncChannel(com.android.internal.util.AsyncChannel) LinkProperties(android.net.LinkProperties) NetworkCapabilities(android.net.NetworkCapabilities)

Example 52 with LinkProperties

use of android.net.LinkProperties in project android_frameworks_base by ResurrectionRemix.

the class ConnectivityService method dumpNetworkDiagnostics.

private void dumpNetworkDiagnostics(IndentingPrintWriter pw) {
    final List<NetworkDiagnostics> netDiags = new ArrayList<NetworkDiagnostics>();
    final long DIAG_TIME_MS = 5000;
    for (NetworkAgentInfo nai : mNetworkAgentInfos.values()) {
        // Start gathering diagnostic information.
        netDiags.add(new NetworkDiagnostics(nai.network, // Must be a copy.
        new LinkProperties(nai.linkProperties), DIAG_TIME_MS));
    }
    for (NetworkDiagnostics netDiag : netDiags) {
        pw.println();
        netDiag.waitForMeasurements();
        netDiag.dump(pw);
    }
}
Also used : NetworkDiagnostics(com.android.server.connectivity.NetworkDiagnostics) NetworkAgentInfo(com.android.server.connectivity.NetworkAgentInfo) ArrayList(java.util.ArrayList) LinkProperties(android.net.LinkProperties)

Example 53 with LinkProperties

use of android.net.LinkProperties in project android_frameworks_base by ResurrectionRemix.

the class ConnectivityService method startLegacyVpn.

/**
     * Start legacy VPN, controlling native daemons as needed. Creates a
     * secondary thread to perform connection work, returning quickly.
     */
@Override
public void startLegacyVpn(VpnProfile profile) {
    throwIfLockdownEnabled();
    final LinkProperties egress = getActiveLinkProperties();
    if (egress == null) {
        throw new IllegalStateException("Missing active network connection");
    }
    int user = UserHandle.getUserId(Binder.getCallingUid());
    synchronized (mVpns) {
        mVpns.get(user).startLegacyVpn(profile, mKeyStore, egress);
    }
}
Also used : LinkProperties(android.net.LinkProperties)

Example 54 with LinkProperties

use of android.net.LinkProperties in project android_frameworks_base by ResurrectionRemix.

the class NetworkPolicyManagerServiceTest method buildWifi.

private static NetworkState buildWifi() {
    final NetworkInfo info = new NetworkInfo(TYPE_WIFI, 0, null, null);
    info.setDetailedState(DetailedState.CONNECTED, null, null);
    final LinkProperties prop = new LinkProperties();
    prop.setInterfaceName(TEST_IFACE);
    return new NetworkState(info, prop, null, null, null, TEST_SSID);
}
Also used : NetworkInfo(android.net.NetworkInfo) NetworkState(android.net.NetworkState) LinkProperties(android.net.LinkProperties)

Example 55 with LinkProperties

use of android.net.LinkProperties in project android_frameworks_base by ResurrectionRemix.

the class NetworkStatsServiceTest method buildMobile3gState.

private static NetworkState buildMobile3gState(String subscriberId, boolean isRoaming) {
    final NetworkInfo info = new NetworkInfo(TYPE_MOBILE, TelephonyManager.NETWORK_TYPE_UMTS, null, null);
    info.setDetailedState(DetailedState.CONNECTED, null, null);
    info.setRoaming(isRoaming);
    final LinkProperties prop = new LinkProperties();
    prop.setInterfaceName(TEST_IFACE);
    return new NetworkState(info, prop, null, null, subscriberId, null);
}
Also used : NetworkInfo(android.net.NetworkInfo) NetworkState(android.net.NetworkState) LinkProperties(android.net.LinkProperties)

Aggregations

LinkProperties (android.net.LinkProperties)283 RouteInfo (android.net.RouteInfo)72 LinkAddress (android.net.LinkAddress)70 SmallTest (android.test.suitebuilder.annotation.SmallTest)66 InetAddress (java.net.InetAddress)52 NetworkAgentInfo (com.android.server.connectivity.NetworkAgentInfo)40 NetworkInfo (android.net.NetworkInfo)38 NetworkState (android.net.NetworkState)36 RemoteException (android.os.RemoteException)36 NetworkCapabilities (android.net.NetworkCapabilities)23 Network (android.net.Network)21 ProvisioningChange (android.net.LinkProperties.ProvisioningChange)20 ArrayList (java.util.ArrayList)17 IpPrefix (android.net.IpPrefix)15 Inet6Address (java.net.Inet6Address)15 NetworkRequest (android.net.NetworkRequest)14 ApfFilter (android.net.apf.ApfFilter)12 LargeTest (android.test.suitebuilder.annotation.LargeTest)12 UnknownHostException (java.net.UnknownHostException)12 NetworkMisc (android.net.NetworkMisc)10