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.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 NetworkInfo getActiveNetworkInfo(); 46 NetworkInfo getActiveNetworkInfoForUid(int uid); 47 NetworkInfo getNetworkInfo(int networkType); 48 NetworkInfo getNetworkInfoForNetwork(in Network network); 49 NetworkInfo[] getAllNetworkInfo(); 50 Network getNetworkForType(int networkType); 51 Network[] getAllNetworks(); 52 NetworkCapabilities[] getDefaultNetworkCapabilitiesForUser(int userId); 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 int tether(String iface); 72 73 int untether(String iface); 74 75 int getLastTetherError(String iface); 76 77 boolean isTetheringSupported(); 78 79 String[] getTetherableIfaces(); 80 81 String[] getTetheredIfaces(); 82 83 String[] getTetheringErroredIfaces(); 84 85 String[] getTetheredDhcpRanges(); 86 87 String[] getTetherableUsbRegexs(); 88 89 String[] getTetherableWifiRegexs(); 90 91 String[] getTetherableBluetoothRegexs(); 92 93 int setUsbTethering(boolean enable); 94 95 void reportInetCondition(int networkType, int percentage); 96 97 void reportBadNetwork(in Network network); 98 99 ProxyInfo getGlobalProxy(); 100 101 void setGlobalProxy(in ProxyInfo p); 102 103 ProxyInfo getDefaultProxy(); 104 105 void setDataDependency(int networkType, boolean met); 106 107 boolean prepareVpn(String oldPackage, String newPackage); 108 109 void setVpnPackageAuthorization(boolean authorized); 110 111 ParcelFileDescriptor establishVpn(in VpnConfig config); 112 113 VpnConfig getVpnConfig(); 114 115 void startLegacyVpn(in VpnProfile profile); 116 117 LegacyVpnInfo getLegacyVpnInfo(); 118 119 boolean updateLockdownVpn(); 120 121 void captivePortalCheckCompleted(in NetworkInfo info, boolean isCaptivePortal); 122 123 void supplyMessenger(int networkType, in Messenger messenger); 124 125 int findConnectionTypeForIface(in String iface); 126 127 int checkMobileProvisioning(int suggestedTimeOutMs); 128 129 String getMobileProvisioningUrl(); 130 131 String getMobileRedirectedProvisioningUrl(); 132 133 void setProvisioningNotificationVisible(boolean visible, int networkType, in String action); 134 135 void setAirplaneMode(boolean enable); 136 137 void registerNetworkFactory(in Messenger messenger, in String name); 138 139 void unregisterNetworkFactory(in Messenger messenger); 140 141 void registerNetworkAgent(in Messenger messenger, in NetworkInfo ni, in LinkProperties lp, 142 in NetworkCapabilities nc, int score, in NetworkMisc misc); 143 144 NetworkRequest requestNetwork(in NetworkCapabilities networkCapabilities, 145 in Messenger messenger, int timeoutSec, in IBinder binder, int legacy); 146 147 NetworkRequest pendingRequestForNetwork(in NetworkCapabilities networkCapabilities, 148 in PendingIntent operation); 149 150 void releasePendingNetworkRequest(in PendingIntent operation); 151 152 NetworkRequest listenForNetwork(in NetworkCapabilities networkCapabilities, 153 in Messenger messenger, in IBinder binder); 154 155 void pendingListenForNetwork(in NetworkCapabilities networkCapabilities, 156 in PendingIntent operation); 157 158 void releaseNetworkRequest(in NetworkRequest networkRequest); 159 160 int getRestoreDefaultNetworkDelay(int networkType); 161 162 boolean addVpnAddress(String address, int prefixLength); 163 boolean removeVpnAddress(String address, int prefixLength); 164 boolean setUnderlyingNetworksForVpn(in Network[] networks); 165 } 166