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.LinkQualityInfo;
20import android.net.LinkProperties;
21import android.net.NetworkInfo;
22import android.net.NetworkQuotaInfo;
23import android.net.NetworkState;
24import android.net.ProxyProperties;
25import android.os.IBinder;
26import android.os.Messenger;
27import android.os.ParcelFileDescriptor;
28import android.os.ResultReceiver;
29
30import com.android.internal.net.LegacyVpnInfo;
31import com.android.internal.net.VpnConfig;
32import 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} */
39interface IConnectivityManager
40{
41    // Keep this in sync with framework/native/services/connectivitymanager/ConnectivityManager.h
42    void markSocketAsUser(in ParcelFileDescriptor socket, int uid);
43
44    void setNetworkPreference(int pref);
45
46    int getNetworkPreference();
47
48    NetworkInfo getActiveNetworkInfo();
49    NetworkInfo getActiveNetworkInfoForUid(int uid);
50    NetworkInfo getNetworkInfo(int networkType);
51    NetworkInfo[] getAllNetworkInfo();
52
53    NetworkInfo getProvisioningOrActiveNetworkInfo();
54
55    boolean isNetworkSupported(int networkType);
56
57    LinkProperties getActiveLinkProperties();
58    LinkProperties getLinkProperties(int networkType);
59
60    NetworkState[] getAllNetworkState();
61
62    NetworkQuotaInfo getActiveNetworkQuotaInfo();
63    boolean isActiveNetworkMetered();
64
65    boolean setRadios(boolean onOff);
66
67    boolean setRadio(int networkType, boolean turnOn);
68
69    int startUsingNetworkFeature(int networkType, in String feature,
70            in IBinder binder);
71
72    int stopUsingNetworkFeature(int networkType, in String feature);
73
74    boolean requestRouteToHost(int networkType, int hostAddress);
75
76    boolean requestRouteToHostAddress(int networkType, in byte[] hostAddress);
77
78    boolean getMobileDataEnabled();
79    void setMobileDataEnabled(boolean enabled);
80
81    /** Policy control over specific {@link NetworkStateTracker}. */
82    void setPolicyDataEnable(int networkType, boolean enabled);
83
84    int tether(String iface);
85
86    int untether(String iface);
87
88    int getLastTetherError(String iface);
89
90    boolean isTetheringSupported();
91
92    String[] getTetherableIfaces();
93
94    String[] getTetheredIfaces();
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    VpnConfig getVpnConfig();
125
126    void startLegacyVpn(in VpnProfile profile);
127
128    LegacyVpnInfo getLegacyVpnInfo();
129
130    boolean updateLockdownVpn();
131
132    void captivePortalCheckComplete(in NetworkInfo info);
133
134    void captivePortalCheckCompleted(in NetworkInfo info, boolean isCaptivePortal);
135
136    void supplyMessenger(int networkType, in Messenger messenger);
137
138    int findConnectionTypeForIface(in String iface);
139
140    int checkMobileProvisioning(int suggestedTimeOutMs);
141
142    String getMobileProvisioningUrl();
143
144    String getMobileRedirectedProvisioningUrl();
145
146    LinkQualityInfo getLinkQualityInfo(int networkType);
147
148    LinkQualityInfo getActiveLinkQualityInfo();
149
150    LinkQualityInfo[] getAllLinkQualityInfo();
151
152    void setProvisioningNotificationVisible(boolean visible, int networkType, in String extraInfo, in String url);
153
154    void setAirplaneMode(boolean enable);
155}
156