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.LinkQualityInfo; 20 import android.net.LinkProperties; 21 import android.net.NetworkInfo; 22 import android.net.NetworkQuotaInfo; 23 import android.net.NetworkState; 24 import android.net.ProxyProperties; 25 import android.os.IBinder; 26 import android.os.Messenger; 27 import android.os.ParcelFileDescriptor; 28 import android.os.ResultReceiver; 29 30 import com.android.internal.net.LegacyVpnInfo; 31 import com.android.internal.net.VpnConfig; 32 import com.android.internal.net.VpnProfile; 33 34 /** 35 * Interface that answers queries about, and allows changing, the 36 * state of network connectivity. 37 */ 38 /** {@hide} */ 39 interface IConnectivityManager 40 { 41 // Keep this in sync with framework/native/services/connectivitymanager/ConnectivityManager.h markSocketAsUser(in ParcelFileDescriptor socket, int uid)42 void markSocketAsUser(in ParcelFileDescriptor socket, int uid); 43 setNetworkPreference(int pref)44 void setNetworkPreference(int pref); 45 getNetworkPreference()46 int getNetworkPreference(); 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(); getLinkProperties(int networkType)58 LinkProperties getLinkProperties(int networkType); 59 getAllNetworkState()60 NetworkState[] getAllNetworkState(); 61 getActiveNetworkQuotaInfo()62 NetworkQuotaInfo getActiveNetworkQuotaInfo(); isActiveNetworkMetered()63 boolean isActiveNetworkMetered(); 64 setRadios(boolean onOff)65 boolean setRadios(boolean onOff); 66 setRadio(int networkType, boolean turnOn)67 boolean setRadio(int networkType, boolean turnOn); 68 startUsingNetworkFeature(int networkType, in String feature, in IBinder binder)69 int startUsingNetworkFeature(int networkType, in String feature, 70 in IBinder binder); 71 stopUsingNetworkFeature(int networkType, in String feature)72 int stopUsingNetworkFeature(int networkType, in String feature); 73 requestRouteToHost(int networkType, int hostAddress, String packageName)74 boolean requestRouteToHost(int networkType, int hostAddress, String packageName); 75 requestRouteToHostAddress(int networkType, in byte[] hostAddress, String packageName)76 boolean requestRouteToHostAddress(int networkType, in byte[] hostAddress, String packageName); 77 getMobileDataEnabled()78 boolean getMobileDataEnabled(); setMobileDataEnabled(boolean enabled)79 void setMobileDataEnabled(boolean enabled); 80 81 /** Policy control over specific {@link NetworkStateTracker}. */ setPolicyDataEnable(int networkType, boolean enabled)82 void setPolicyDataEnable(int networkType, boolean enabled); 83 tether(String iface)84 int tether(String iface); 85 untether(String iface)86 int untether(String iface); 87 getLastTetherError(String iface)88 int getLastTetherError(String iface); 89 isTetheringSupported()90 boolean isTetheringSupported(); 91 getTetherableIfaces()92 String[] getTetherableIfaces(); 93 getTetheredIfaces()94 String[] getTetheredIfaces(); 95 getTetheringErroredIfaces()96 String[] getTetheringErroredIfaces(); 97 getTetherableUsbRegexs()98 String[] getTetherableUsbRegexs(); 99 getTetherableWifiRegexs()100 String[] getTetherableWifiRegexs(); 101 getTetherableBluetoothRegexs()102 String[] getTetherableBluetoothRegexs(); 103 setUsbTethering(boolean enable)104 int setUsbTethering(boolean enable); 105 requestNetworkTransitionWakelock(in String forWhom)106 void requestNetworkTransitionWakelock(in String forWhom); 107 reportInetCondition(int networkType, int percentage)108 void reportInetCondition(int networkType, int percentage); 109 getGlobalProxy()110 ProxyProperties getGlobalProxy(); 111 setGlobalProxy(in ProxyProperties p)112 void setGlobalProxy(in ProxyProperties p); 113 getProxy()114 ProxyProperties getProxy(); 115 setDataDependency(int networkType, boolean met)116 void setDataDependency(int networkType, boolean met); 117 protectVpn(in ParcelFileDescriptor socket)118 boolean protectVpn(in ParcelFileDescriptor socket); 119 prepareVpn(String oldPackage, String newPackage)120 boolean prepareVpn(String oldPackage, String newPackage); 121 establishVpn(in VpnConfig config)122 ParcelFileDescriptor establishVpn(in VpnConfig config); 123 getVpnConfig()124 VpnConfig getVpnConfig(); 125 startLegacyVpn(in VpnProfile profile)126 void startLegacyVpn(in VpnProfile profile); 127 getLegacyVpnInfo()128 LegacyVpnInfo getLegacyVpnInfo(); 129 updateLockdownVpn()130 boolean updateLockdownVpn(); 131 captivePortalCheckComplete(in NetworkInfo info)132 void captivePortalCheckComplete(in NetworkInfo info); 133 captivePortalCheckCompleted(in NetworkInfo info, boolean isCaptivePortal)134 void captivePortalCheckCompleted(in NetworkInfo info, boolean isCaptivePortal); 135 supplyMessenger(int networkType, in Messenger messenger)136 void supplyMessenger(int networkType, in Messenger messenger); 137 findConnectionTypeForIface(in String iface)138 int findConnectionTypeForIface(in String iface); 139 checkMobileProvisioning(int suggestedTimeOutMs)140 int checkMobileProvisioning(int suggestedTimeOutMs); 141 getMobileProvisioningUrl()142 String getMobileProvisioningUrl(); 143 getMobileRedirectedProvisioningUrl()144 String getMobileRedirectedProvisioningUrl(); 145 getLinkQualityInfo(int networkType)146 LinkQualityInfo getLinkQualityInfo(int networkType); 147 getActiveLinkQualityInfo()148 LinkQualityInfo getActiveLinkQualityInfo(); 149 getAllLinkQualityInfo()150 LinkQualityInfo[] getAllLinkQualityInfo(); 151 setProvisioningNotificationVisible(boolean visible, int networkType, in String extraInfo, in String url)152 void setProvisioningNotificationVisible(boolean visible, int networkType, in String extraInfo, in String url); 153 setAirplaneMode(boolean enable)154 void setAirplaneMode(boolean enable); 155 } 156