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