Home | History | Annotate | Download | only in net
      1 /**
      2  * Copyright (c) 2008, The Android Open Source Project
      3  *
      4  * Licensed under the Apache License, Version 2.0 (the "License");
      5  * you may not use this file except in compliance with the License.
      6  * You may obtain a copy of the License at
      7  *
      8  *     http://www.apache.org/licenses/LICENSE-2.0
      9  *
     10  * Unless required by applicable law or agreed to in writing, software
     11  * distributed under the License is distributed on an "AS IS" BASIS,
     12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     13  * See the License for the specific language governing permissions and
     14  * limitations under the License.
     15  */
     16 
     17 package android.net;
     18 
     19 import android.app.PendingIntent;
     20 import android.net.LinkQualityInfo;
     21 import android.net.LinkProperties;
     22 import android.net.Network;
     23 import android.net.NetworkCapabilities;
     24 import android.net.NetworkInfo;
     25 import android.net.NetworkMisc;
     26 import android.net.NetworkQuotaInfo;
     27 import android.net.NetworkRequest;
     28 import android.net.NetworkState;
     29 import android.net.ProxyInfo;
     30 import android.os.IBinder;
     31 import android.os.Messenger;
     32 import android.os.ParcelFileDescriptor;
     33 import android.os.ResultReceiver;
     34 
     35 import com.android.internal.net.LegacyVpnInfo;
     36 import com.android.internal.net.VpnConfig;
     37 import com.android.internal.net.VpnProfile;
     38 
     39 /**
     40  * Interface that answers queries about, and allows changing, the
     41  * state of network connectivity.
     42  */
     43 /** {@hide} */
     44 interface IConnectivityManager
     45 {
     46     NetworkInfo getActiveNetworkInfo();
     47     NetworkInfo getActiveNetworkInfoForUid(int uid);
     48     NetworkInfo getNetworkInfo(int networkType);
     49     NetworkInfo getNetworkInfoForNetwork(in Network network);
     50     NetworkInfo[] getAllNetworkInfo();
     51     Network getNetworkForType(int networkType);
     52     Network[] getAllNetworks();
     53 
     54     NetworkInfo getProvisioningOrActiveNetworkInfo();
     55 
     56     boolean isNetworkSupported(int networkType);
     57 
     58     LinkProperties getActiveLinkProperties();
     59     LinkProperties getLinkPropertiesForType(int networkType);
     60     LinkProperties getLinkProperties(in Network network);
     61 
     62     NetworkCapabilities getNetworkCapabilities(in Network network);
     63 
     64     NetworkState[] getAllNetworkState();
     65 
     66     NetworkQuotaInfo getActiveNetworkQuotaInfo();
     67     boolean isActiveNetworkMetered();
     68 
     69     boolean requestRouteToHostAddress(int networkType, in byte[] hostAddress);
     70 
     71     /** Policy control over specific {@link NetworkStateTracker}. */
     72     void setPolicyDataEnable(int networkType, boolean enabled);
     73 
     74     int tether(String iface);
     75 
     76     int untether(String iface);
     77 
     78     int getLastTetherError(String iface);
     79 
     80     boolean isTetheringSupported();
     81 
     82     String[] getTetherableIfaces();
     83 
     84     String[] getTetheredIfaces();
     85 
     86     String[] getTetheringErroredIfaces();
     87 
     88     String[] getTetheredDhcpRanges();
     89 
     90     String[] getTetherableUsbRegexs();
     91 
     92     String[] getTetherableWifiRegexs();
     93 
     94     String[] getTetherableBluetoothRegexs();
     95 
     96     int setUsbTethering(boolean enable);
     97 
     98     void reportInetCondition(int networkType, int percentage);
     99 
    100     void reportBadNetwork(in Network network);
    101 
    102     ProxyInfo getGlobalProxy();
    103 
    104     void setGlobalProxy(in ProxyInfo p);
    105 
    106     ProxyInfo getProxy();
    107 
    108     void setDataDependency(int networkType, boolean met);
    109 
    110     boolean prepareVpn(String oldPackage, String newPackage);
    111 
    112     void setVpnPackageAuthorization(boolean authorized);
    113 
    114     ParcelFileDescriptor establishVpn(in VpnConfig config);
    115 
    116     VpnConfig getVpnConfig();
    117 
    118     void startLegacyVpn(in VpnProfile profile);
    119 
    120     LegacyVpnInfo getLegacyVpnInfo();
    121 
    122     boolean updateLockdownVpn();
    123 
    124     void captivePortalCheckCompleted(in NetworkInfo info, boolean isCaptivePortal);
    125 
    126     void supplyMessenger(int networkType, in Messenger messenger);
    127 
    128     int findConnectionTypeForIface(in String iface);
    129 
    130     int checkMobileProvisioning(int suggestedTimeOutMs);
    131 
    132     String getMobileProvisioningUrl();
    133 
    134     String getMobileRedirectedProvisioningUrl();
    135 
    136     LinkQualityInfo getLinkQualityInfo(int networkType);
    137 
    138     LinkQualityInfo getActiveLinkQualityInfo();
    139 
    140     LinkQualityInfo[] getAllLinkQualityInfo();
    141 
    142     void setProvisioningNotificationVisible(boolean visible, int networkType, in String action);
    143 
    144     void setAirplaneMode(boolean enable);
    145 
    146     void registerNetworkFactory(in Messenger messenger, in String name);
    147 
    148     void unregisterNetworkFactory(in Messenger messenger);
    149 
    150     void registerNetworkAgent(in Messenger messenger, in NetworkInfo ni, in LinkProperties lp,
    151             in NetworkCapabilities nc, int score, in NetworkMisc misc);
    152 
    153     NetworkRequest requestNetwork(in NetworkCapabilities networkCapabilities,
    154             in Messenger messenger, int timeoutSec, in IBinder binder, int legacy);
    155 
    156     NetworkRequest pendingRequestForNetwork(in NetworkCapabilities networkCapabilities,
    157             in PendingIntent operation);
    158 
    159     NetworkRequest listenForNetwork(in NetworkCapabilities networkCapabilities,
    160             in Messenger messenger, in IBinder binder);
    161 
    162     void pendingListenForNetwork(in NetworkCapabilities networkCapabilities,
    163             in PendingIntent operation);
    164 
    165     void releaseNetworkRequest(in NetworkRequest networkRequest);
    166 
    167     int getRestoreDefaultNetworkDelay(int networkType);
    168 
    169     boolean addVpnAddress(String address, int prefixLength);
    170     boolean removeVpnAddress(String address, int prefixLength);
    171 }
    172