blob: a425a91ef39f0f822b31c2873d9f2377fe452211 [file] [log] [blame]
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001/**
2 * Copyright (c) 2008, The Android Open Source Project
3 *
Danica Chang6fdd0c62010-08-11 14:54:43 -07004 * 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
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08007 *
Danica Chang6fdd0c62010-08-11 14:54:43 -07008 * http://www.apache.org/licenses/LICENSE-2.0
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08009 *
Danica Chang6fdd0c62010-08-11 14:54:43 -070010 * 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
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080014 * limitations under the License.
15 */
16
17package android.net;
18
Robert Greenwalt9258c642014-03-26 16:47:06 -070019import android.app.PendingIntent;
Jeff Vander Stoep0ac2c092018-07-23 10:57:53 -070020import android.net.ConnectionInfo;
Robert Greenwaltd192dad2010-09-14 09:18:02 -070021import android.net.LinkProperties;
markchien6ea34542019-02-27 14:56:11 +080022import android.net.ITetheringEventCallback;
Robert Greenwalt9258c642014-03-26 16:47:06 -070023import android.net.Network;
Robert Greenwalt7b816022014-04-18 15:25:25 -070024import android.net.NetworkCapabilities;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080025import android.net.NetworkInfo;
Sreeram Ramachandran8cd33ed2014-07-23 15:23:15 -070026import android.net.NetworkMisc;
Jeff Sharkeyf0ceede2011-08-02 17:22:34 -070027import android.net.NetworkQuotaInfo;
Robert Greenwalt9258c642014-03-26 16:47:06 -070028import android.net.NetworkRequest;
Jeff Sharkeyd2a45872011-05-28 20:56:34 -070029import android.net.NetworkState;
Jason Monk207900c2014-04-25 15:00:09 -040030import android.net.ProxyInfo;
Remi NGUYEN VANdc483562019-02-04 11:32:20 +090031import android.os.Bundle;
Robert Greenwalt42acef32009-08-12 16:08:25 -070032import android.os.IBinder;
Robert Greenwalt665e1ae2012-08-21 19:27:00 -070033import android.os.Messenger;
Chia-chi Yehff3bdca2011-05-23 17:26:46 -070034import android.os.ParcelFileDescriptor;
Wink Savilleab9321d2013-06-29 21:10:57 -070035import android.os.ResultReceiver;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080036
Chia-chi Yeh2e467642011-07-04 03:23:12 -070037import com.android.internal.net.LegacyVpnInfo;
Chia-chi Yeh04ba25c2011-06-15 17:07:27 -070038import com.android.internal.net.VpnConfig;
Wenchao Tongf5ea3402015-03-04 13:26:38 -080039import com.android.internal.net.VpnInfo;
Jeff Sharkey82f85212012-08-24 11:17:25 -070040import com.android.internal.net.VpnProfile;
Chia-chi Yeh04ba25c2011-06-15 17:07:27 -070041
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080042/**
43 * Interface that answers queries about, and allows changing, the
44 * state of network connectivity.
45 */
46/** {@hide} */
47interface IConnectivityManager
48{
Paul Jensen31a94f42015-02-13 14:18:39 -050049 Network getActiveNetwork();
Jeff Sharkey1b6519b2016-04-28 15:33:18 -060050 Network getActiveNetworkForUid(int uid, boolean ignoreBlocked);
Andrei Onea9a8b6bf2019-02-25 13:25:32 +000051 @UnsupportedAppUsage
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080052 NetworkInfo getActiveNetworkInfo();
Jeff Sharkey1b6519b2016-04-28 15:33:18 -060053 NetworkInfo getActiveNetworkInfoForUid(int uid, boolean ignoreBlocked);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080054 NetworkInfo getNetworkInfo(int networkType);
Jeff Sharkey1b6519b2016-04-28 15:33:18 -060055 NetworkInfo getNetworkInfoForUid(in Network network, int uid, boolean ignoreBlocked);
Andrei Onea9a8b6bf2019-02-25 13:25:32 +000056 @UnsupportedAppUsage
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080057 NetworkInfo[] getAllNetworkInfo();
Lorenzo Colittib57edc52014-08-22 17:10:50 -070058 Network getNetworkForType(int networkType);
Robert Greenwalt73b6cbae2014-06-23 11:40:00 -070059 Network[] getAllNetworks();
Lorenzo Colitti403aa262014-11-28 11:21:30 +090060 NetworkCapabilities[] getDefaultNetworkCapabilitiesForUser(int userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080061
Robert Greenwalt9b2886e2011-08-31 11:46:42 -070062 boolean isNetworkSupported(int networkType);
63
Andrei Onea9a8b6bf2019-02-25 13:25:32 +000064 @UnsupportedAppUsage
Robert Greenwaltd192dad2010-09-14 09:18:02 -070065 LinkProperties getActiveLinkProperties();
Robert Greenwalt9258c642014-03-26 16:47:06 -070066 LinkProperties getLinkPropertiesForType(int networkType);
67 LinkProperties getLinkProperties(in Network network);
68
69 NetworkCapabilities getNetworkCapabilities(in Network network);
Robert Greenwaltd192dad2010-09-14 09:18:02 -070070
Andrei Onea9a8b6bf2019-02-25 13:25:32 +000071 @UnsupportedAppUsage
Jeff Sharkeyd2a45872011-05-28 20:56:34 -070072 NetworkState[] getAllNetworkState();
73
Jeff Sharkeyf0ceede2011-08-02 17:22:34 -070074 NetworkQuotaInfo getActiveNetworkQuotaInfo();
Jeff Sharkey9f7cbf02012-04-12 18:34:54 -070075 boolean isActiveNetworkMetered();
Jeff Sharkeyf0ceede2011-08-02 17:22:34 -070076
Sreeram Ramachandran03666c72014-07-19 23:21:46 -070077 boolean requestRouteToHostAddress(int networkType, in byte[] hostAddress);
Robert Greenwalt585ac0f2010-08-27 09:24:29 -070078
Tetsutoki Shiozawa335d2ed2016-03-16 23:30:57 +090079 int tether(String iface, String callerPkg);
Robert Greenwaltd0e18ff2010-01-26 11:40:34 -080080
Tetsutoki Shiozawa335d2ed2016-03-16 23:30:57 +090081 int untether(String iface, String callerPkg);
Robert Greenwalt5a735062010-03-02 17:25:02 -080082
Andrei Onea9a8b6bf2019-02-25 13:25:32 +000083 @UnsupportedAppUsage
Robert Greenwalt5a735062010-03-02 17:25:02 -080084 int getLastTetherError(String iface);
Robert Greenwaltd0e18ff2010-01-26 11:40:34 -080085
Udam Saini0e94c362017-06-07 12:06:28 -070086 boolean isTetheringSupported(String callerPkg);
Robert Greenwalt2a091d72010-02-11 18:18:40 -080087
Tetsutoki Shiozawa335d2ed2016-03-16 23:30:57 +090088 void startTethering(int type, in ResultReceiver receiver, boolean showProvisioningUi,
89 String callerPkg);
Jeremy Klein36c7aa02016-01-22 14:11:45 -080090
Tetsutoki Shiozawa335d2ed2016-03-16 23:30:57 +090091 void stopTethering(int type, String callerPkg);
Jeremy Klein36c7aa02016-01-22 14:11:45 -080092
Andrei Onea9a8b6bf2019-02-25 13:25:32 +000093 @UnsupportedAppUsage
Robert Greenwaltd0e18ff2010-01-26 11:40:34 -080094 String[] getTetherableIfaces();
95
Andrei Onea9a8b6bf2019-02-25 13:25:32 +000096 @UnsupportedAppUsage
Robert Greenwaltd0e18ff2010-01-26 11:40:34 -080097 String[] getTetheredIfaces();
Robert Greenwalt2a091d72010-02-11 18:18:40 -080098
Andrei Onea9a8b6bf2019-02-25 13:25:32 +000099 @UnsupportedAppUsage
Robert Greenwalt5a735062010-03-02 17:25:02 -0800100 String[] getTetheringErroredIfaces();
101
Robert Greenwalt9c7e2c22014-06-23 14:53:42 -0700102 String[] getTetheredDhcpRanges();
103
Andrei Onea9a8b6bf2019-02-25 13:25:32 +0000104 @UnsupportedAppUsage
Robert Greenwalt2a091d72010-02-11 18:18:40 -0800105 String[] getTetherableUsbRegexs();
106
Andrei Onea9a8b6bf2019-02-25 13:25:32 +0000107 @UnsupportedAppUsage
Robert Greenwalt2a091d72010-02-11 18:18:40 -0800108 String[] getTetherableWifiRegexs();
Robert Greenwalt14f2ef42010-06-15 12:19:37 -0700109
Danica Chang6fdd0c62010-08-11 14:54:43 -0700110 String[] getTetherableBluetoothRegexs();
111
Tetsutoki Shiozawa335d2ed2016-03-16 23:30:57 +0900112 int setUsbTethering(boolean enable, String callerPkg);
Mike Lockwood6c2260b2011-07-19 13:04:47 -0700113
Robert Greenwaltd7085fc2010-09-08 15:24:47 -0700114 void reportInetCondition(int networkType, int percentage);
Robert Greenwalt434203a2010-10-11 16:00:27 -0700115
Paul Jensenbfd17b72015-04-07 12:43:13 -0400116 void reportNetworkConnectivity(in Network network, boolean hasConnectivity);
Robert Greenwalt9258c642014-03-26 16:47:06 -0700117
Jason Monk207900c2014-04-25 15:00:09 -0400118 ProxyInfo getGlobalProxy();
Robert Greenwalt434203a2010-10-11 16:00:27 -0700119
Jason Monk207900c2014-04-25 15:00:09 -0400120 void setGlobalProxy(in ProxyInfo p);
Robert Greenwalt434203a2010-10-11 16:00:27 -0700121
Paul Jensencee9b512015-05-06 07:32:40 -0400122 ProxyInfo getProxyForNetwork(in Network nework);
Robert Greenwaltd55a6b42011-03-25 13:09:25 -0700123
Robin Lee3b3dd942015-05-12 18:14:58 +0100124 boolean prepareVpn(String oldPackage, String newPackage, int userId);
Chia-chi Yehff3bdca2011-05-23 17:26:46 -0700125
Robin Lee3b3dd942015-05-12 18:14:58 +0100126 void setVpnPackageAuthorization(String packageName, int userId, boolean authorized);
Jeff Davidson05542602014-08-11 14:07:27 -0700127
Chia-chi Yeh04ba25c2011-06-15 17:07:27 -0700128 ParcelFileDescriptor establishVpn(in VpnConfig config);
Chia-chi Yeh77fd4852011-07-02 17:15:00 -0700129
Robin Lee3b3dd942015-05-12 18:14:58 +0100130 VpnConfig getVpnConfig(int userId);
Chad Brubakerbf6ff2c2013-07-16 18:59:12 -0700131
Andrei Onea9a8b6bf2019-02-25 13:25:32 +0000132 @UnsupportedAppUsage
Jeff Sharkey82f85212012-08-24 11:17:25 -0700133 void startLegacyVpn(in VpnProfile profile);
Chia-chi Yeh2e467642011-07-04 03:23:12 -0700134
Robin Lee3eed5ec2015-07-07 12:28:13 -0700135 LegacyVpnInfo getLegacyVpnInfo(int userId);
Jeff Sharkey69ddab42012-08-25 00:05:46 -0700136
137 boolean updateLockdownVpn();
Charles He36738632017-05-15 17:07:18 +0100138 boolean isAlwaysOnVpnPackageSupported(int userId, String packageName);
Pavel Grafova462bcb2019-01-25 08:50:06 +0000139 boolean setAlwaysOnVpnPackage(int userId, String packageName, boolean lockdown,
140 in List<String> lockdownWhitelist);
Robin Lee244ce8e2016-01-05 18:03:46 +0000141 String getAlwaysOnVpnPackage(int userId);
Pavel Grafova462bcb2019-01-25 08:50:06 +0000142 boolean isVpnLockdownEnabled(int userId);
143 List<String> getVpnLockdownWhitelist(int userId);
Irfan Sheriffda6da092012-08-16 12:49:23 -0700144
Wink Saville948282b2013-08-29 08:55:16 -0700145 int checkMobileProvisioning(int suggestedTimeOutMs);
Robert Greenwalte182bfe2013-07-16 12:06:09 -0700146
147 String getMobileProvisioningUrl();
Wink Saville42d4f082013-07-20 20:31:59 -0700148
Paul Jensen89e0f092014-09-15 15:59:36 -0400149 void setProvisioningNotificationVisible(boolean visible, int networkType, in String action);
Yuhao Zheng5cd1a0e2013-09-09 17:00:04 -0700150
151 void setAirplaneMode(boolean enable);
Robert Greenwalte049c232014-04-11 15:53:27 -0700152
Chalard Jean08577fc2018-05-02 21:14:54 +0900153 int registerNetworkFactory(in Messenger messenger, in String name);
Robert Greenwalta67be032014-05-16 15:49:14 -0700154
fengludb571472015-04-21 17:12:05 -0700155 boolean requestBandwidthUpdate(in Network network);
fenglub15e72b2015-03-20 11:29:56 -0700156
Robert Greenwalta67be032014-05-16 15:49:14 -0700157 void unregisterNetworkFactory(in Messenger messenger);
Robert Greenwalt7b816022014-04-18 15:25:25 -0700158
Paul Jensen31a94f42015-02-13 14:18:39 -0500159 int registerNetworkAgent(in Messenger messenger, in NetworkInfo ni, in LinkProperties lp,
Chalard Jean08577fc2018-05-02 21:14:54 +0900160 in NetworkCapabilities nc, int score, in NetworkMisc misc, in int factorySerialNumber);
Robert Greenwalt9258c642014-03-26 16:47:06 -0700161
162 NetworkRequest requestNetwork(in NetworkCapabilities networkCapabilities,
Robert Greenwaltb90b20b2014-06-02 15:32:02 -0700163 in Messenger messenger, int timeoutSec, in IBinder binder, int legacy);
Robert Greenwalt9258c642014-03-26 16:47:06 -0700164
165 NetworkRequest pendingRequestForNetwork(in NetworkCapabilities networkCapabilities,
166 in PendingIntent operation);
167
Jeremy Joslin46e3ac82014-11-05 10:32:09 -0800168 void releasePendingNetworkRequest(in PendingIntent operation);
169
Robert Greenwalt9258c642014-03-26 16:47:06 -0700170 NetworkRequest listenForNetwork(in NetworkCapabilities networkCapabilities,
171 in Messenger messenger, in IBinder binder);
172
173 void pendingListenForNetwork(in NetworkCapabilities networkCapabilities,
174 in PendingIntent operation);
175
176 void releaseNetworkRequest(in NetworkRequest networkRequest);
Robert Greenwalt71bf33a2014-05-15 18:07:26 -0700177
Lorenzo Colittie03c3c72015-04-03 16:38:52 +0900178 void setAcceptUnvalidated(in Network network, boolean accept, boolean always);
Lorenzo Colitti165c51c2016-09-19 01:00:19 +0900179 void setAvoidUnvalidated(in Network network);
Lorenzo Colitti4734cdb2017-04-27 14:30:21 +0900180 void startCaptivePortalApp(in Network network);
Remi NGUYEN VAN5a1b74b2019-02-13 20:58:59 +0900181 void startCaptivePortalAppInternal(in Network network, in Bundle appExtras);
Lorenzo Colittie03c3c72015-04-03 16:38:52 +0900182
Remi NGUYEN VAN97f69c22019-01-20 20:35:06 +0900183 boolean getAvoidBadWifi();
Lorenzo Colitti46aa9c02017-01-24 18:08:41 +0900184 int getMultipathPreference(in Network Network);
185
Remi NGUYEN VANe67b0c32018-12-27 16:43:56 +0900186 NetworkRequest getDefaultRequest();
187
Robert Greenwalt71bf33a2014-05-15 18:07:26 -0700188 int getRestoreDefaultNetworkDelay(int networkType);
Sreeram Ramachandranf4e0c0c2014-07-27 14:18:26 -0700189
190 boolean addVpnAddress(String address, int prefixLength);
191 boolean removeVpnAddress(String address, int prefixLength);
Sreeram Ramachandranc2c0bea2014-11-11 16:09:21 -0800192 boolean setUnderlyingNetworksForVpn(in Network[] networks);
Stuart Scottf1fb3972015-04-02 18:00:02 -0700193
194 void factoryReset();
Lorenzo Colitti8bf977d2015-06-15 14:29:22 +0900195
196 void startNattKeepalive(in Network network, int intervalSeconds, in Messenger messenger,
197 in IBinder binder, String srcAddr, int srcPort, String dstAddr);
198
junyulai215b8772019-01-15 11:32:44 +0800199 void startNattKeepaliveWithFd(in Network network, in FileDescriptor fd, int resourceId,
200 int intervalSeconds, in Messenger messenger, in IBinder binder, String srcAddr,
201 String dstAddr);
202
junyulai352dc2f2019-01-08 20:04:33 +0800203 void startTcpKeepalive(in Network network, in FileDescriptor fd, int intervalSeconds,
204 in Messenger messenger, in IBinder binder);
205
Lorenzo Colitti8bf977d2015-06-15 14:29:22 +0900206 void stopKeepalive(in Network network, int slot);
Udam Sainib7c24872016-01-04 12:16:14 -0800207
208 String getCaptivePortalServerUrl();
Ricky Wai44dcbde2018-01-23 04:09:45 +0000209
210 byte[] getNetworkWatchlistConfigHash();
Jeff Vander Stoep0ac2c092018-07-23 10:57:53 -0700211
212 int getConnectionOwnerUid(in ConnectionInfo connectionInfo);
Pavel Grafovcb3b8952018-12-14 13:51:07 +0000213 boolean isCallerCurrentAlwaysOnVpnApp();
214 boolean isCallerCurrentAlwaysOnVpnLockdownApp();
markchienf2731272019-01-16 17:44:13 +0800215
markchien9554abf2019-03-06 16:25:00 +0800216 void getLatestTetheringEntitlementResult(int type, in ResultReceiver receiver,
markchienf2731272019-01-16 17:44:13 +0800217 boolean showEntitlementUi, String callerPkg);
markchien6ea34542019-02-27 14:56:11 +0800218
219 void registerTetheringEventCallback(ITetheringEventCallback callback, String callerPkg);
220 void unregisterTetheringEventCallback(ITetheringEventCallback callback, String callerPkg);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800221}