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.LinkProperties; 21 import android.net.Network; 22 import android.net.NetworkCapabilities; 23 import android.net.NetworkInfo; 24 import android.net.NetworkMisc; 25 import android.net.NetworkQuotaInfo; 26 import android.net.NetworkRequest; 27 import android.net.NetworkState; 28 import android.net.ProxyInfo; 29 import android.os.IBinder; 30 import android.os.Messenger; 31 import android.os.ParcelFileDescriptor; 32 import android.os.ResultReceiver; 33 34 import com.android.internal.net.LegacyVpnInfo; 35 import com.android.internal.net.VpnConfig; 36 import com.android.internal.net.VpnInfo; 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 { getActiveNetwork()46 Network getActiveNetwork(); getActiveNetworkForUid(int uid, boolean ignoreBlocked)47 Network getActiveNetworkForUid(int uid, boolean ignoreBlocked); getActiveNetworkInfo()48 NetworkInfo getActiveNetworkInfo(); getActiveNetworkInfoForUid(int uid, boolean ignoreBlocked)49 NetworkInfo getActiveNetworkInfoForUid(int uid, boolean ignoreBlocked); getNetworkInfo(int networkType)50 NetworkInfo getNetworkInfo(int networkType); getNetworkInfoForUid(in Network network, int uid, boolean ignoreBlocked)51 NetworkInfo getNetworkInfoForUid(in Network network, int uid, boolean ignoreBlocked); getAllNetworkInfo()52 NetworkInfo[] getAllNetworkInfo(); getNetworkForType(int networkType)53 Network getNetworkForType(int networkType); getAllNetworks()54 Network[] getAllNetworks(); getDefaultNetworkCapabilitiesForUser(int userId)55 NetworkCapabilities[] getDefaultNetworkCapabilitiesForUser(int userId); 56 isNetworkSupported(int networkType)57 boolean isNetworkSupported(int networkType); 58 getActiveLinkProperties()59 LinkProperties getActiveLinkProperties(); getLinkPropertiesForType(int networkType)60 LinkProperties getLinkPropertiesForType(int networkType); getLinkProperties(in Network network)61 LinkProperties getLinkProperties(in Network network); 62 getNetworkCapabilities(in Network network)63 NetworkCapabilities getNetworkCapabilities(in Network network); 64 getAllNetworkState()65 NetworkState[] getAllNetworkState(); 66 getActiveNetworkQuotaInfo()67 NetworkQuotaInfo getActiveNetworkQuotaInfo(); isActiveNetworkMetered()68 boolean isActiveNetworkMetered(); 69 requestRouteToHostAddress(int networkType, in byte[] hostAddress)70 boolean requestRouteToHostAddress(int networkType, in byte[] hostAddress); 71 tether(String iface)72 int tether(String iface); 73 untether(String iface)74 int untether(String iface); 75 getLastTetherError(String iface)76 int getLastTetherError(String iface); 77 isTetheringSupported()78 boolean isTetheringSupported(); 79 startTethering(int type, in ResultReceiver receiver, boolean showProvisioningUi)80 void startTethering(int type, in ResultReceiver receiver, boolean showProvisioningUi); 81 stopTethering(int type)82 void stopTethering(int type); 83 getTetherableIfaces()84 String[] getTetherableIfaces(); 85 getTetheredIfaces()86 String[] getTetheredIfaces(); 87 getTetheringErroredIfaces()88 String[] getTetheringErroredIfaces(); 89 getTetheredDhcpRanges()90 String[] getTetheredDhcpRanges(); 91 getTetherableUsbRegexs()92 String[] getTetherableUsbRegexs(); 93 getTetherableWifiRegexs()94 String[] getTetherableWifiRegexs(); 95 getTetherableBluetoothRegexs()96 String[] getTetherableBluetoothRegexs(); 97 setUsbTethering(boolean enable)98 int setUsbTethering(boolean enable); 99 reportInetCondition(int networkType, int percentage)100 void reportInetCondition(int networkType, int percentage); 101 reportNetworkConnectivity(in Network network, boolean hasConnectivity)102 void reportNetworkConnectivity(in Network network, boolean hasConnectivity); 103 getGlobalProxy()104 ProxyInfo getGlobalProxy(); 105 setGlobalProxy(in ProxyInfo p)106 void setGlobalProxy(in ProxyInfo p); 107 getProxyForNetwork(in Network nework)108 ProxyInfo getProxyForNetwork(in Network nework); 109 prepareVpn(String oldPackage, String newPackage, int userId)110 boolean prepareVpn(String oldPackage, String newPackage, int userId); 111 setVpnPackageAuthorization(String packageName, int userId, boolean authorized)112 void setVpnPackageAuthorization(String packageName, int userId, boolean authorized); 113 establishVpn(in VpnConfig config)114 ParcelFileDescriptor establishVpn(in VpnConfig config); 115 getVpnConfig(int userId)116 VpnConfig getVpnConfig(int userId); 117 startLegacyVpn(in VpnProfile profile)118 void startLegacyVpn(in VpnProfile profile); 119 getLegacyVpnInfo(int userId)120 LegacyVpnInfo getLegacyVpnInfo(int userId); 121 getAllVpnInfo()122 VpnInfo[] getAllVpnInfo(); 123 updateLockdownVpn()124 boolean updateLockdownVpn(); setAlwaysOnVpnPackage(int userId, String packageName, boolean lockdown)125 boolean setAlwaysOnVpnPackage(int userId, String packageName, boolean lockdown); getAlwaysOnVpnPackage(int userId)126 String getAlwaysOnVpnPackage(int userId); 127 checkMobileProvisioning(int suggestedTimeOutMs)128 int checkMobileProvisioning(int suggestedTimeOutMs); 129 getMobileProvisioningUrl()130 String getMobileProvisioningUrl(); 131 setProvisioningNotificationVisible(boolean visible, int networkType, in String action)132 void setProvisioningNotificationVisible(boolean visible, int networkType, in String action); 133 setAirplaneMode(boolean enable)134 void setAirplaneMode(boolean enable); 135 registerNetworkFactory(in Messenger messenger, in String name)136 void registerNetworkFactory(in Messenger messenger, in String name); 137 requestBandwidthUpdate(in Network network)138 boolean requestBandwidthUpdate(in Network network); 139 unregisterNetworkFactory(in Messenger messenger)140 void unregisterNetworkFactory(in Messenger messenger); 141 registerNetworkAgent(in Messenger messenger, in NetworkInfo ni, in LinkProperties lp, in NetworkCapabilities nc, int score, in NetworkMisc misc)142 int registerNetworkAgent(in Messenger messenger, in NetworkInfo ni, in LinkProperties lp, 143 in NetworkCapabilities nc, int score, in NetworkMisc misc); 144 requestNetwork(in NetworkCapabilities networkCapabilities, in Messenger messenger, int timeoutSec, in IBinder binder, int legacy)145 NetworkRequest requestNetwork(in NetworkCapabilities networkCapabilities, 146 in Messenger messenger, int timeoutSec, in IBinder binder, int legacy); 147 pendingRequestForNetwork(in NetworkCapabilities networkCapabilities, in PendingIntent operation)148 NetworkRequest pendingRequestForNetwork(in NetworkCapabilities networkCapabilities, 149 in PendingIntent operation); 150 releasePendingNetworkRequest(in PendingIntent operation)151 void releasePendingNetworkRequest(in PendingIntent operation); 152 listenForNetwork(in NetworkCapabilities networkCapabilities, in Messenger messenger, in IBinder binder)153 NetworkRequest listenForNetwork(in NetworkCapabilities networkCapabilities, 154 in Messenger messenger, in IBinder binder); 155 pendingListenForNetwork(in NetworkCapabilities networkCapabilities, in PendingIntent operation)156 void pendingListenForNetwork(in NetworkCapabilities networkCapabilities, 157 in PendingIntent operation); 158 requestLinkProperties(in NetworkRequest networkRequest)159 void requestLinkProperties(in NetworkRequest networkRequest); requestNetworkCapabilities(in NetworkRequest networkRequest)160 void requestNetworkCapabilities(in NetworkRequest networkRequest); releaseNetworkRequest(in NetworkRequest networkRequest)161 void releaseNetworkRequest(in NetworkRequest networkRequest); 162 setAcceptUnvalidated(in Network network, boolean accept, boolean always)163 void setAcceptUnvalidated(in Network network, boolean accept, boolean always); setAvoidUnvalidated(in Network network)164 void setAvoidUnvalidated(in Network network); 165 getRestoreDefaultNetworkDelay(int networkType)166 int getRestoreDefaultNetworkDelay(int networkType); 167 addVpnAddress(String address, int prefixLength)168 boolean addVpnAddress(String address, int prefixLength); removeVpnAddress(String address, int prefixLength)169 boolean removeVpnAddress(String address, int prefixLength); setUnderlyingNetworksForVpn(in Network[] networks)170 boolean setUnderlyingNetworksForVpn(in Network[] networks); 171 factoryReset()172 void factoryReset(); 173 startNattKeepalive(in Network network, int intervalSeconds, in Messenger messenger, in IBinder binder, String srcAddr, int srcPort, String dstAddr)174 void startNattKeepalive(in Network network, int intervalSeconds, in Messenger messenger, 175 in IBinder binder, String srcAddr, int srcPort, String dstAddr); 176 stopKeepalive(in Network network, int slot)177 void stopKeepalive(in Network network, int slot); 178 getCaptivePortalServerUrl()179 String getCaptivePortalServerUrl(); 180 } 181