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.app.PendingIntent;
20import android.net.LinkProperties;
21import android.net.Network;
22import android.net.NetworkCapabilities;
23import android.net.NetworkInfo;
24import android.net.NetworkMisc;
25import android.net.NetworkQuotaInfo;
26import android.net.NetworkRequest;
27import android.net.NetworkState;
28import android.net.ProxyInfo;
29import android.os.IBinder;
30import android.os.Messenger;
31import android.os.ParcelFileDescriptor;
32import android.os.ResultReceiver;
33
34import com.android.internal.net.LegacyVpnInfo;
35import com.android.internal.net.VpnConfig;
36import com.android.internal.net.VpnInfo;
37import com.android.internal.net.VpnProfile;
38
39/**
40 * Interface that answers queries about, and allows changing, the
41 * state of network connectivity.
42 */
43/** {@hide} */
44interface IConnectivityManager
45{
46    Network getActiveNetwork();
47    NetworkInfo getActiveNetworkInfo();
48    NetworkInfo getActiveNetworkInfoForUid(int uid);
49    NetworkInfo getNetworkInfo(int networkType);
50    NetworkInfo getNetworkInfoForNetwork(in Network network);
51    NetworkInfo[] getAllNetworkInfo();
52    Network getNetworkForType(int networkType);
53    Network[] getAllNetworks();
54    NetworkCapabilities[] getDefaultNetworkCapabilitiesForUser(int userId);
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 reportNetworkConnectivity(in Network network, boolean hasConnectivity);
98
99    ProxyInfo getGlobalProxy();
100
101    void setGlobalProxy(in ProxyInfo p);
102
103    ProxyInfo getProxyForNetwork(in Network nework);
104
105    boolean prepareVpn(String oldPackage, String newPackage, int userId);
106
107    void setVpnPackageAuthorization(String packageName, int userId, boolean authorized);
108
109    ParcelFileDescriptor establishVpn(in VpnConfig config);
110
111    VpnConfig getVpnConfig(int userId);
112
113    void startLegacyVpn(in VpnProfile profile);
114
115    LegacyVpnInfo getLegacyVpnInfo(int userId);
116
117    VpnInfo[] getAllVpnInfo();
118
119    boolean updateLockdownVpn();
120
121    int checkMobileProvisioning(int suggestedTimeOutMs);
122
123    String getMobileProvisioningUrl();
124
125    void setProvisioningNotificationVisible(boolean visible, int networkType, in String action);
126
127    void setAirplaneMode(boolean enable);
128
129    void registerNetworkFactory(in Messenger messenger, in String name);
130
131    boolean requestBandwidthUpdate(in Network network);
132
133    void unregisterNetworkFactory(in Messenger messenger);
134
135    int registerNetworkAgent(in Messenger messenger, in NetworkInfo ni, in LinkProperties lp,
136            in NetworkCapabilities nc, int score, in NetworkMisc misc);
137
138    NetworkRequest requestNetwork(in NetworkCapabilities networkCapabilities,
139            in Messenger messenger, int timeoutSec, in IBinder binder, int legacy);
140
141    NetworkRequest pendingRequestForNetwork(in NetworkCapabilities networkCapabilities,
142            in PendingIntent operation);
143
144    void releasePendingNetworkRequest(in PendingIntent operation);
145
146    NetworkRequest listenForNetwork(in NetworkCapabilities networkCapabilities,
147            in Messenger messenger, in IBinder binder);
148
149    void pendingListenForNetwork(in NetworkCapabilities networkCapabilities,
150            in PendingIntent operation);
151
152    void releaseNetworkRequest(in NetworkRequest networkRequest);
153
154    void setAcceptUnvalidated(in Network network, boolean accept, boolean always);
155
156    int getRestoreDefaultNetworkDelay(int networkType);
157
158    boolean addVpnAddress(String address, int prefixLength);
159    boolean removeVpnAddress(String address, int prefixLength);
160    boolean setUnderlyingNetworksForVpn(in Network[] networks);
161
162    void factoryReset();
163}
164