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