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.net.LinkProperties; 20 import android.net.NetworkInfo; 21 import android.net.NetworkQuotaInfo; 22 import android.net.NetworkState; 23 import android.net.ProxyProperties; 24 import android.os.IBinder; 25 import android.os.Messenger; 26 import android.os.ParcelFileDescriptor; 27 import android.os.ResultReceiver; 28 29 import com.android.internal.net.LegacyVpnInfo; 30 import com.android.internal.net.VpnConfig; 31 import com.android.internal.net.VpnProfile; 32 33 /** 34 * Interface that answers queries about, and allows changing, the 35 * state of network connectivity. 36 */ 37 /** {@hide} */ 38 interface IConnectivityManager 39 { 40 void setNetworkPreference(int pref); 41 42 int getNetworkPreference(); 43 44 NetworkInfo getActiveNetworkInfo(); 45 NetworkInfo getActiveNetworkInfoForUid(int uid); 46 NetworkInfo getNetworkInfo(int networkType); 47 NetworkInfo[] getAllNetworkInfo(); 48 49 boolean isNetworkSupported(int networkType); 50 51 LinkProperties getActiveLinkProperties(); 52 LinkProperties getLinkProperties(int networkType); 53 54 NetworkState[] getAllNetworkState(); 55 56 NetworkQuotaInfo getActiveNetworkQuotaInfo(); 57 boolean isActiveNetworkMetered(); 58 59 boolean setRadios(boolean onOff); 60 61 boolean setRadio(int networkType, boolean turnOn); 62 63 int startUsingNetworkFeature(int networkType, in String feature, 64 in IBinder binder); 65 66 int stopUsingNetworkFeature(int networkType, in String feature); 67 68 boolean requestRouteToHost(int networkType, int hostAddress); 69 70 boolean requestRouteToHostAddress(int networkType, in byte[] hostAddress); 71 72 boolean getMobileDataEnabled(); 73 void setMobileDataEnabled(boolean enabled); 74 75 /** Policy control over specific {@link NetworkStateTracker}. */ 76 void setPolicyDataEnable(int networkType, boolean enabled); 77 78 int tether(String iface); 79 80 int untether(String iface); 81 82 int getLastTetherError(String iface); 83 84 boolean isTetheringSupported(); 85 86 String[] getTetherableIfaces(); 87 88 String[] getTetheredIfaces(); 89 90 /** 91 * Return list of interface pairs that are actively tethered. Even indexes are 92 * remote interface, and odd indexes are corresponding local interfaces. 93 */ 94 String[] getTetheredIfacePairs(); 95 96 String[] getTetheringErroredIfaces(); 97 98 String[] getTetherableUsbRegexs(); 99 100 String[] getTetherableWifiRegexs(); 101 102 String[] getTetherableBluetoothRegexs(); 103 104 int setUsbTethering(boolean enable); 105 106 void requestNetworkTransitionWakelock(in String forWhom); 107 108 void reportInetCondition(int networkType, int percentage); 109 110 ProxyProperties getGlobalProxy(); 111 112 void setGlobalProxy(in ProxyProperties p); 113 114 ProxyProperties getProxy(); 115 116 void setDataDependency(int networkType, boolean met); 117 118 boolean protectVpn(in ParcelFileDescriptor socket); 119 120 boolean prepareVpn(String oldPackage, String newPackage); 121 122 ParcelFileDescriptor establishVpn(in VpnConfig config); 123 124 void startLegacyVpn(in VpnProfile profile); 125 126 LegacyVpnInfo getLegacyVpnInfo(); 127 128 boolean updateLockdownVpn(); 129 130 void captivePortalCheckComplete(in NetworkInfo info); 131 132 void supplyMessenger(int networkType, in Messenger messenger); 133 134 int findConnectionTypeForIface(in String iface); 135 136 int checkMobileProvisioning(boolean sendNotification, int suggestedTimeOutMs, in ResultReceiver resultReceiver); 137 138 String getMobileProvisioningUrl(); 139 } 140