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.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.VpnProfile; 37 38 /** 39 * Interface that answers queries about, and allows changing, the 40 * state of network connectivity. 41 */ 42 /** {@hide} */ 43 interface IConnectivityManager 44 { 45 // Keep this in sync with framework/native/services/connectivitymanager/ConnectivityManager.h markSocketAsUser(in ParcelFileDescriptor socket, int uid)46 void markSocketAsUser(in ParcelFileDescriptor socket, int uid); 47 getActiveNetworkInfo()48 NetworkInfo getActiveNetworkInfo(); getActiveNetworkInfoForUid(int uid)49 NetworkInfo getActiveNetworkInfoForUid(int uid); getNetworkInfo(int networkType)50 NetworkInfo getNetworkInfo(int networkType); getAllNetworkInfo()51 NetworkInfo[] getAllNetworkInfo(); 52 getProvisioningOrActiveNetworkInfo()53 NetworkInfo getProvisioningOrActiveNetworkInfo(); 54 isNetworkSupported(int networkType)55 boolean isNetworkSupported(int networkType); 56 getActiveLinkProperties()57 LinkProperties getActiveLinkProperties(); getLinkPropertiesForType(int networkType)58 LinkProperties getLinkPropertiesForType(int networkType); getLinkProperties(in Network network)59 LinkProperties getLinkProperties(in Network network); 60 getNetworkCapabilities(in Network network)61 NetworkCapabilities getNetworkCapabilities(in Network network); 62 getAllNetworkState()63 NetworkState[] getAllNetworkState(); 64 getActiveNetworkQuotaInfo()65 NetworkQuotaInfo getActiveNetworkQuotaInfo(); isActiveNetworkMetered()66 boolean isActiveNetworkMetered(); 67 startUsingNetworkFeature(int networkType, in String feature, in IBinder binder)68 int startUsingNetworkFeature(int networkType, in String feature, 69 in IBinder binder); 70 stopUsingNetworkFeature(int networkType, in String feature)71 int stopUsingNetworkFeature(int networkType, in String feature); 72 requestRouteToHost(int networkType, int hostAddress, String packageName)73 boolean requestRouteToHost(int networkType, int hostAddress, String packageName); 74 requestRouteToHostAddress(int networkType, in byte[] hostAddress, String packageName)75 boolean requestRouteToHostAddress(int networkType, in byte[] hostAddress, String packageName); 76 77 /** Policy control over specific {@link NetworkStateTracker}. */ setPolicyDataEnable(int networkType, boolean enabled)78 void setPolicyDataEnable(int networkType, boolean enabled); 79 tether(String iface)80 int tether(String iface); 81 untether(String iface)82 int untether(String iface); 83 getLastTetherError(String iface)84 int getLastTetherError(String iface); 85 isTetheringSupported()86 boolean isTetheringSupported(); 87 getTetherableIfaces()88 String[] getTetherableIfaces(); 89 getTetheredIfaces()90 String[] getTetheredIfaces(); 91 getTetheringErroredIfaces()92 String[] getTetheringErroredIfaces(); 93 getTetherableUsbRegexs()94 String[] getTetherableUsbRegexs(); 95 getTetherableWifiRegexs()96 String[] getTetherableWifiRegexs(); 97 getTetherableBluetoothRegexs()98 String[] getTetherableBluetoothRegexs(); 99 setUsbTethering(boolean enable)100 int setUsbTethering(boolean enable); 101 requestNetworkTransitionWakelock(in String forWhom)102 void requestNetworkTransitionWakelock(in String forWhom); 103 reportInetCondition(int networkType, int percentage)104 void reportInetCondition(int networkType, int percentage); 105 reportBadNetwork(in Network network)106 void reportBadNetwork(in Network network); 107 getGlobalProxy()108 ProxyInfo getGlobalProxy(); 109 setGlobalProxy(in ProxyInfo p)110 void setGlobalProxy(in ProxyInfo p); 111 getProxy()112 ProxyInfo getProxy(); 113 setDataDependency(int networkType, boolean met)114 void setDataDependency(int networkType, boolean met); 115 protectVpn(in ParcelFileDescriptor socket)116 boolean protectVpn(in ParcelFileDescriptor socket); 117 prepareVpn(String oldPackage, String newPackage)118 boolean prepareVpn(String oldPackage, String newPackage); 119 establishVpn(in VpnConfig config)120 ParcelFileDescriptor establishVpn(in VpnConfig config); 121 getVpnConfig()122 VpnConfig getVpnConfig(); 123 startLegacyVpn(in VpnProfile profile)124 void startLegacyVpn(in VpnProfile profile); 125 getLegacyVpnInfo()126 LegacyVpnInfo getLegacyVpnInfo(); 127 updateLockdownVpn()128 boolean updateLockdownVpn(); 129 captivePortalCheckCompleted(in NetworkInfo info, boolean isCaptivePortal)130 void captivePortalCheckCompleted(in NetworkInfo info, boolean isCaptivePortal); 131 supplyMessenger(int networkType, in Messenger messenger)132 void supplyMessenger(int networkType, in Messenger messenger); 133 findConnectionTypeForIface(in String iface)134 int findConnectionTypeForIface(in String iface); 135 checkMobileProvisioning(int suggestedTimeOutMs)136 int checkMobileProvisioning(int suggestedTimeOutMs); 137 getMobileProvisioningUrl()138 String getMobileProvisioningUrl(); 139 getMobileRedirectedProvisioningUrl()140 String getMobileRedirectedProvisioningUrl(); 141 getLinkQualityInfo(int networkType)142 LinkQualityInfo getLinkQualityInfo(int networkType); 143 getActiveLinkQualityInfo()144 LinkQualityInfo getActiveLinkQualityInfo(); 145 getAllLinkQualityInfo()146 LinkQualityInfo[] getAllLinkQualityInfo(); 147 setProvisioningNotificationVisible(boolean visible, int networkType, in String extraInfo, in String url)148 void setProvisioningNotificationVisible(boolean visible, int networkType, in String extraInfo, 149 in String url); 150 setAirplaneMode(boolean enable)151 void setAirplaneMode(boolean enable); 152 registerNetworkFactory(in Messenger messenger, in String name)153 void registerNetworkFactory(in Messenger messenger, in String name); 154 unregisterNetworkFactory(in Messenger messenger)155 void unregisterNetworkFactory(in Messenger messenger); 156 registerNetworkAgent(in Messenger messenger, in NetworkInfo ni, in LinkProperties lp, in NetworkCapabilities nc, int score)157 void registerNetworkAgent(in Messenger messenger, in NetworkInfo ni, in LinkProperties lp, 158 in NetworkCapabilities nc, int score); 159 requestNetwork(in NetworkCapabilities networkCapabilities, in Messenger messenger, int timeoutSec, in IBinder binder, int legacy)160 NetworkRequest requestNetwork(in NetworkCapabilities networkCapabilities, 161 in Messenger messenger, int timeoutSec, in IBinder binder, int legacy); 162 pendingRequestForNetwork(in NetworkCapabilities networkCapabilities, in PendingIntent operation)163 NetworkRequest pendingRequestForNetwork(in NetworkCapabilities networkCapabilities, 164 in PendingIntent operation); 165 listenForNetwork(in NetworkCapabilities networkCapabilities, in Messenger messenger, in IBinder binder)166 NetworkRequest listenForNetwork(in NetworkCapabilities networkCapabilities, 167 in Messenger messenger, in IBinder binder); 168 pendingListenForNetwork(in NetworkCapabilities networkCapabilities, in PendingIntent operation)169 void pendingListenForNetwork(in NetworkCapabilities networkCapabilities, 170 in PendingIntent operation); 171 releaseNetworkRequest(in NetworkRequest networkRequest)172 void releaseNetworkRequest(in NetworkRequest networkRequest); 173 getRestoreDefaultNetworkDelay(int networkType)174 int getRestoreDefaultNetworkDelay(int networkType); 175 } 176