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