blob: 77aee5ec6ff3b9c40908bcff9dcdea1ac9957af1 [file] [log] [blame]
Remi NGUYEN VANfbbccbc2021-01-15 18:08:24 +09001/**
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.ConnectionInfo;
21import android.net.ConnectivityDiagnosticsManager;
22import android.net.IConnectivityDiagnosticsCallback;
23import android.net.IQosCallback;
24import android.net.ISocketKeepaliveCallback;
25import android.net.LinkProperties;
26import android.net.Network;
27import android.net.NetworkAgentConfig;
28import android.net.NetworkCapabilities;
29import android.net.NetworkInfo;
30import android.net.NetworkRequest;
31import android.net.NetworkState;
James Mattis452c6ff2021-01-01 14:13:35 -080032import android.net.OemNetworkPreferences;
Remi NGUYEN VANfbbccbc2021-01-15 18:08:24 +090033import android.net.ProxyInfo;
34import android.net.UidRange;
35import android.net.QosSocketInfo;
36import android.os.Bundle;
37import android.os.IBinder;
38import android.os.INetworkActivityListener;
39import android.os.Messenger;
40import android.os.ParcelFileDescriptor;
41import android.os.PersistableBundle;
42import android.os.ResultReceiver;
43
44import com.android.connectivity.aidl.INetworkAgent;
Remi NGUYEN VANfbbccbc2021-01-15 18:08:24 +090045
46/**
47 * Interface that answers queries about, and allows changing, the
48 * state of network connectivity.
49 */
50/** {@hide} */
51interface IConnectivityManager
52{
53 Network getActiveNetwork();
54 Network getActiveNetworkForUid(int uid, boolean ignoreBlocked);
55 @UnsupportedAppUsage
56 NetworkInfo getActiveNetworkInfo();
57 NetworkInfo getActiveNetworkInfoForUid(int uid, boolean ignoreBlocked);
58 @UnsupportedAppUsage(maxTargetSdk = 28)
59 NetworkInfo getNetworkInfo(int networkType);
60 NetworkInfo getNetworkInfoForUid(in Network network, int uid, boolean ignoreBlocked);
61 @UnsupportedAppUsage
62 NetworkInfo[] getAllNetworkInfo();
63 Network getNetworkForType(int networkType);
64 Network[] getAllNetworks();
65 NetworkCapabilities[] getDefaultNetworkCapabilitiesForUser(
Roshan Piusa8a477b2020-12-17 14:53:09 -080066 int userId, String callingPackageName, String callingAttributionTag);
Remi NGUYEN VANfbbccbc2021-01-15 18:08:24 +090067
68 boolean isNetworkSupported(int networkType);
69
70 @UnsupportedAppUsage
71 LinkProperties getActiveLinkProperties();
72 LinkProperties getLinkPropertiesForType(int networkType);
73 LinkProperties getLinkProperties(in Network network);
74
Roshan Piusa8a477b2020-12-17 14:53:09 -080075 NetworkCapabilities getNetworkCapabilities(in Network network, String callingPackageName,
76 String callingAttributionTag);
Remi NGUYEN VANfbbccbc2021-01-15 18:08:24 +090077
78 @UnsupportedAppUsage(maxTargetSdk = 30, trackingBug = 170729553)
79 NetworkState[] getAllNetworkState();
80
81 boolean isActiveNetworkMetered();
82
83 boolean requestRouteToHostAddress(int networkType, in byte[] hostAddress,
84 String callingPackageName, String callingAttributionTag);
85
86 @UnsupportedAppUsage(maxTargetSdk = 29,
87 publicAlternatives = "Use {@code TetheringManager#getLastTetherError} as alternative")
88 int getLastTetherError(String iface);
89
90 @UnsupportedAppUsage(maxTargetSdk = 29,
91 publicAlternatives = "Use {@code TetheringManager#getTetherableIfaces} as alternative")
92 String[] getTetherableIfaces();
93
94 @UnsupportedAppUsage(maxTargetSdk = 29,
95 publicAlternatives = "Use {@code TetheringManager#getTetheredIfaces} as alternative")
96 String[] getTetheredIfaces();
97
98 @UnsupportedAppUsage(maxTargetSdk = 29,
99 publicAlternatives = "Use {@code TetheringManager#getTetheringErroredIfaces} "
100 + "as Alternative")
101 String[] getTetheringErroredIfaces();
102
103 @UnsupportedAppUsage(maxTargetSdk = 29,
104 publicAlternatives = "Use {@code TetheringManager#getTetherableUsbRegexs} as alternative")
105 String[] getTetherableUsbRegexs();
106
107 @UnsupportedAppUsage(maxTargetSdk = 29,
108 publicAlternatives = "Use {@code TetheringManager#getTetherableWifiRegexs} as alternative")
109 String[] getTetherableWifiRegexs();
110
111 @UnsupportedAppUsage(maxTargetSdk = 28)
112 void reportInetCondition(int networkType, int percentage);
113
114 void reportNetworkConnectivity(in Network network, boolean hasConnectivity);
115
116 ProxyInfo getGlobalProxy();
117
118 void setGlobalProxy(in ProxyInfo p);
119
120 ProxyInfo getProxyForNetwork(in Network nework);
121
Remi NGUYEN VANfbbccbc2021-01-15 18:08:24 +0900122 void setRequireVpnForUids(boolean requireVpn, in UidRange[] ranges);
Lorenzo Colittic71cff82021-01-15 01:29:01 +0900123 void setLegacyLockdownVpnEnabled(boolean enabled);
Remi NGUYEN VANfbbccbc2021-01-15 18:08:24 +0900124
125 void setProvisioningNotificationVisible(boolean visible, int networkType, in String action);
126
127 void setAirplaneMode(boolean enable);
128
129 boolean requestBandwidthUpdate(in Network network);
130
Remi NGUYEN VANfbbccbc2021-01-15 18:08:24 +0900131 int registerNetworkProvider(in Messenger messenger, in String name);
132 void unregisterNetworkProvider(in Messenger messenger);
133
134 void declareNetworkRequestUnfulfillable(in NetworkRequest request);
135
136 Network registerNetworkAgent(in INetworkAgent na, in NetworkInfo ni, in LinkProperties lp,
137 in NetworkCapabilities nc, int score, in NetworkAgentConfig config,
138 in int factorySerialNumber);
139
140 NetworkRequest requestNetwork(in NetworkCapabilities networkCapabilities, int reqType,
141 in Messenger messenger, int timeoutSec, in IBinder binder, int legacy,
142 String callingPackageName, String callingAttributionTag);
143
144 NetworkRequest pendingRequestForNetwork(in NetworkCapabilities networkCapabilities,
145 in PendingIntent operation, String callingPackageName, String callingAttributionTag);
146
147 void releasePendingNetworkRequest(in PendingIntent operation);
148
149 NetworkRequest listenForNetwork(in NetworkCapabilities networkCapabilities,
Roshan Piusa8a477b2020-12-17 14:53:09 -0800150 in Messenger messenger, in IBinder binder, String callingPackageName,
151 String callingAttributionTag);
Remi NGUYEN VANfbbccbc2021-01-15 18:08:24 +0900152
153 void pendingListenForNetwork(in NetworkCapabilities networkCapabilities,
Roshan Piusa8a477b2020-12-17 14:53:09 -0800154 in PendingIntent operation, String callingPackageName,
155 String callingAttributionTag);
Remi NGUYEN VANfbbccbc2021-01-15 18:08:24 +0900156
157 void releaseNetworkRequest(in NetworkRequest networkRequest);
158
159 void setAcceptUnvalidated(in Network network, boolean accept, boolean always);
160 void setAcceptPartialConnectivity(in Network network, boolean accept, boolean always);
161 void setAvoidUnvalidated(in Network network);
162 void startCaptivePortalApp(in Network network);
163 void startCaptivePortalAppInternal(in Network network, in Bundle appExtras);
164
165 boolean shouldAvoidBadWifi();
166 int getMultipathPreference(in Network Network);
167
168 NetworkRequest getDefaultRequest();
169
170 int getRestoreDefaultNetworkDelay(int networkType);
171
Remi NGUYEN VANfbbccbc2021-01-15 18:08:24 +0900172 void factoryReset();
173
174 void startNattKeepalive(in Network network, int intervalSeconds,
175 in ISocketKeepaliveCallback cb, String srcAddr, int srcPort, String dstAddr);
176
177 void startNattKeepaliveWithFd(in Network network, in ParcelFileDescriptor pfd, int resourceId,
178 int intervalSeconds, in ISocketKeepaliveCallback cb, String srcAddr,
179 String dstAddr);
180
181 void startTcpKeepalive(in Network network, in ParcelFileDescriptor pfd, int intervalSeconds,
182 in ISocketKeepaliveCallback cb);
183
184 void stopKeepalive(in Network network, int slot);
185
186 String getCaptivePortalServerUrl();
187
188 byte[] getNetworkWatchlistConfigHash();
189
190 int getConnectionOwnerUid(in ConnectionInfo connectionInfo);
Remi NGUYEN VANfbbccbc2021-01-15 18:08:24 +0900191
192 void registerConnectivityDiagnosticsCallback(in IConnectivityDiagnosticsCallback callback,
193 in NetworkRequest request, String callingPackageName);
194 void unregisterConnectivityDiagnosticsCallback(in IConnectivityDiagnosticsCallback callback);
195
196 IBinder startOrGetTestNetworkService();
197
198 void simulateDataStall(int detectionMethod, long timestampMillis, in Network network,
199 in PersistableBundle extras);
200
201 void systemReady();
202
203 void registerNetworkActivityListener(in INetworkActivityListener l);
204
205 void unregisterNetworkActivityListener(in INetworkActivityListener l);
206
207 boolean isDefaultNetworkActive();
208
209 void registerQosSocketCallback(in QosSocketInfo socketInfo, in IQosCallback callback);
210 void unregisterQosCallback(in IQosCallback callback);
James Mattis452c6ff2021-01-01 14:13:35 -0800211
212 void setOemNetworkPreference(in OemNetworkPreferences preference);
Remi NGUYEN VANfbbccbc2021-01-15 18:08:24 +0900213}