Search in sources :

Example 16 with LinkProperties

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

the class NetworkManagementService method initDataInterface.

private void initDataInterface() {
    if (!TextUtils.isEmpty(mDataInterfaceName)) {
        return;
    }
    ConnectivityManager cm = (ConnectivityManager) mContext.getSystemService(Context.CONNECTIVITY_SERVICE);
    LinkProperties linkProperties = cm.getLinkProperties(ConnectivityManager.TYPE_MOBILE);
    if (linkProperties != null) {
        mDataInterfaceName = linkProperties.getInterfaceName();
    }
}
Also used : ConnectivityManager(android.net.ConnectivityManager) LinkProperties(android.net.LinkProperties)

Example 17 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 18 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 19 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 20 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)

Aggregations

LinkProperties (android.net.LinkProperties)330 LinkAddress (android.net.LinkAddress)78 RouteInfo (android.net.RouteInfo)73 SmallTest (android.test.suitebuilder.annotation.SmallTest)68 InetAddress (java.net.InetAddress)56 Network (android.net.Network)43 NetworkInfo (android.net.NetworkInfo)40 NetworkAgentInfo (com.android.server.connectivity.NetworkAgentInfo)40 RemoteException (android.os.RemoteException)37 NetworkState (android.net.NetworkState)36 NetworkCapabilities (android.net.NetworkCapabilities)25 NetworkRequest (android.net.NetworkRequest)22 ArrayList (java.util.ArrayList)22 ProvisioningChange (android.net.LinkProperties.ProvisioningChange)20 Test (org.junit.Test)19 ConnectivityManager (android.net.ConnectivityManager)17 IpPrefix (android.net.IpPrefix)15 Inet6Address (java.net.Inet6Address)15 UnknownHostException (java.net.UnknownHostException)13 ApfFilter (android.net.apf.ApfFilter)12