Lines Matching defs:network

64  * Class that answers queries about the state of network connectivity. It also
65 * notifies applications when network connectivity changes. Get an instance
71 * <li>Monitor network connections (Wi-Fi, GPRS, UMTS, etc.)</li>
72 * <li>Send broadcast intents when network connectivity changes</li>
73 * <li>Attempt to "fail over" to another network when connectivity to a network
85 * A change in network connectivity has occurred. A default connection has either
86 * been established or lost. The NetworkInfo for the affected network is
91 * disconnected network, then the FAILOVER_CONNECTION boolean extra is
95 * to connect (or has already connected) to another network, the
96 * NetworkInfo for the new network is also passed as an extra. This lets
112 * They do too many network requests and the long list of apps listening
121 * The device has connected to a network that has presented a captive
123 * with a notification that network sign in is required,
125 * desire to sign in to the network. Apps handling this activity should
126 * facilitate signing in to the network. This action includes a
128 * the network presenting the captive portal; all communication with the
136 * the network and the captive portal has been dismissed, the app should
138 * reevaluate the network. If reevaluation finds the network no longer
139 * subject to a captive portal, the network may become the default active
140 * data network. </li>
142 * to ignore the captive portal and the network, the app should call
154 * should always obtain network information through
170 * is for a network to which the connectivity manager was failing over
171 * following a disconnect on another network.
177 * there is another network that it may be possible to connect to. Retrieve with
183 * complete lack of connectivity, i.e., no network is available.
189 * to a network failed. The string has no particular structure. It is
196 * extra information about the network state. The information
198 * meaning may be specific to a particular network type. Retrieve
227 * (idle or active) on a network in a recent period.
228 * The network becomes active when data transmission is started, or
235 * The lookup key for an enum that indicates the network device type on which this data activity
256 * If an application uses the network in the background, it should listen
276 * Broadcast Action: The network connection may not be good
279 * the network and it's condition.
338 * Action used to display a dialog that asks the user whether to connect to a network that is
346 * Action used to display a dialog that asks the user whether to avoid a network that is no
427 * will use this network type's interface by default
433 * will use this network type's interface by default
438 * An MMS-specific Mobile data connection. This network type may use the
439 * same network interface as {@link #TYPE_MOBILE} or it may use a different
444 * {@link #requestNetwork(NetworkRequest, NetworkCallback)} to request a network that
449 * A SUPL-specific Mobile data connection. This network type may use the
450 * same network interface as {@link #TYPE_MOBILE} or it may use a different
455 * {@link #requestNetwork(NetworkRequest, NetworkCallback)} to request a network that
460 * A DUN-specific Mobile data connection. This network type may use the
461 * same network interface as {@link #TYPE_MOBILE} or it may use a different
467 * A High Priority Mobile data connection. This network type uses the
468 * same network interface as {@link #TYPE_MOBILE} but the routing setup
472 * {@link #requestNetwork(NetworkRequest, NetworkCallback)} to request a network that
478 * will use this network type's interface by default
485 * will use this network type's interface by default
497 * will use this network type's interface by default
528 * The network to use for initially attaching to the network
541 * The network that uses proxy to achieve connectivity.
547 * A virtual network using one or more native bearers.
559 * If you want to set the default network preference,you can directly
563 * network default network preference can't really express
599 * Tests if a given integer represents a valid network type.
602 * @deprecated All APIs accepting a network type are deprecated. There should be no need to
603 * validate a network type.
610 * Returns a non-localized string representing a given network type.
662 * This should be replaced in the future by a network property.
664 * @return a boolean - {@code true} if uses cellular network, else {@code false}
686 * Checks if the given network type is backed by a Wi-Fi radio.
701 * Specifies the preferred network type. When the device has more
702 * than one type available the preferred network type will be used.
704 * @param preference the network type to prefer over all others. It is
705 * unspecified what happens to the old preferred network in the
709 * preference. Instead we use dynamic network properties of
716 * Retrieves the current preferred network type.
720 * @return an integer representing the preferred network type
724 * preference. Instead we use dynamic network properties of
732 * Returns details about the currently active default data network. When
733 * connected, this network is the default route for outgoing connections.
735 * network traffic. This may return {@code null} when there is no default
736 * network.
740 * @return a {@link NetworkInfo} object for the current default network
741 * or {@code null} if no default network is currently active
753 * default data network. In the event that the current active default data
754 * network disconnects, the returned {@code Network} object will no longer
756 * network.
760 * @return a {@link Network} object for the current default network or
761 * {@code null} if no default network is currently active
773 * default data network for a specific UID. In the event that the default data
774 * network disconnects, the returned {@code Network} object will no longer
776 * network for the UID.
780 * @return a {@link Network} object for the current default network for the
781 * given UID or {@code null} if no default network is currently active
842 * Returns details about the currently active default data network
848 * @return a {@link NetworkInfo} object for the current default network
849 * for the given uid or {@code null} if no default network is
869 * network type.
876 * network type or {@code null} if the type is not
897 * @param network {@link Network} specifying which network
900 * network or {@code null} if the {@code Network}
903 public NetworkInfo getNetworkInfo(Network network) {
904 return getNetworkInfoForUid(network, Process.myUid(), false);
908 public NetworkInfo getNetworkInfoForUid(Network network, int uid, boolean ignoreBlocked) {
910 return mService.getNetworkInfoForUid(network, uid, ignoreBlocked);
917 * Returns connection status information about all network
987 * Returns the IP information for the current default network.
992 * for the current default network, or {@code null} if there
993 * is no current default network.
1006 * Returns the IP information for a given network type.
1010 * @param networkType the network type of interest.
1013 * no current default network.
1031 * will return {@code null} if the network is unknown.
1035 * @param network The {@link Network} object identifying the network in question.
1036 * @return The {@link LinkProperties} for the network, or {@code null}.
1038 public LinkProperties getLinkProperties(Network network) {
1040 return mService.getLinkProperties(network);
1048 * convenience with the current satisfying network's LinkProperties.
1049 * If no such network exists no callback invocation is performed.
1068 * will return {@code null} if the network is unknown.
1072 * @param network The {@link Network} object identifying the network in question.
1073 * @return The {@link android.net.NetworkCapabilities} for the network, or {@code null}.
1075 public NetworkCapabilities getNetworkCapabilities(Network network) {
1077 return mService.getNetworkCapabilities(network);
1085 * convenience with the current satisfying network's NetworkCapabilities.
1086 * If no such network exists no callback invocation is performed.
1131 * @param networkType specifies which network the request pertains to
1186 * @param networkType specifies which network the request pertains to
1250 * Guess what the network request was trying to say so that the resulting
1251 * network is accessible via the legacy (deprecated) API such as
1259 * the resulting network will not be available to the legacy APIs.
1372 public void onAvailable(Network network) {
1373 currentNetwork = network;
1374 Log.d(TAG, "startUsingNetworkFeature got Network:" + network);
1375 setProcessDefaultNetworkForHostResolution(network);
1378 public void onLost(Network network) {
1379 if (network.equals(currentNetwork)) clearDnsBinding();
1380 Log.d(TAG, "startUsingNetworkFeature lost Network:" + network);
1529 private PacketKeepalive(Network network, PacketKeepaliveCallback callback) {
1530 checkNotNull(network, "network cannot be null");
1532 mNetwork = network;
1576 Network network, int intervalSeconds, PacketKeepaliveCallback callback,
1578 final PacketKeepalive k = new PacketKeepalive(network, callback);
1580 mService.startNattKeepalive(network, intervalSeconds, k.mMessenger, new Binder(),
1591 * Ensure that a network route exists to deliver traffic to the specified
1592 * host via the specified network interface. An attempt to add a route that
1600 * @param networkType the type of the network over which traffic to the specified
1616 * Ensure that a network route exists to deliver traffic to the specified
1617 * host via the specified network interface. An attempt to add a route that
1625 * @param networkType the type of the network over which traffic to the specified
1644 * applications should not use the network if the application is not in the
1648 * All applications that have background services that use the network
1681 * Return quota status for the current active network, or {@code null} if no
1682 * network is active. Quota status can change rapidly, so these values
1723 * to find out when the system default network has gone in to a high power state.
1727 * Called on the main thread of the process to report that the current data network
1728 * has become active, and it is now a good time to perform any pending network
1729 * operations. Note that this listener only tells you when the network becomes
1731 * to initiate network traffic), you can retrieve its instantaneous state with
1753 * Start listening to reports when the system's default data network is active, meaning it is
1754 * a good time to perform network traffic. Use {@link #isDefaultNetworkActive()}
1755 * to determine the current state of the system's default network after registering the
1758 * If the process default network has been set with
1762 * @param l The listener to be told when the network is active.
1781 * Remove network active listener previously registered with
1799 * Return whether the data network is currently active. An active network means that
1802 * more power efficient to batch network traffic together when the radio is already in
1804 * initiate network traffic, as the network is already active.
1956 * to the best active upstream network interface. Note that if no upstream
1957 * IP network interface is available, dhcp will still run and traffic will be
1959 * access will of course fail until an upstream network interface becomes
2121 * USB network interfaces. If USB tethering is not supported by the
2141 * Wifi network interfaces. If Wifi tethering is not supported by the
2161 * Bluetooth network interfaces. If Bluetooth tethering is not supported by the
2250 * Report network connectivity status. This is currently used only
2255 * @param networkType The type of network you want to report on
2268 * Report a problem network to the framework. This provides a hint to the system
2269 * that there might be connectivity problems on this network and may cause
2270 * the framework to re-evaluate network connectivity and/or switch to another
2271 * network.
2273 * @param network The {@link Network} the application was attempting to use
2274 * or {@code null} to indicate the current default network.
2278 public void reportBadNetwork(Network network) {
2282 mService.reportNetworkConnectivity(network, true);
2283 mService.reportNetworkConnectivity(network, false);
2290 * Report to the framework whether a network has working connectivity.
2291 * This provides a hint to the system that a particular network is providing
2293 * the network's connectivity and might take further action thereafter.
2295 * @param network The {@link Network} the application was attempting to use
2296 * or {@code null} to indicate the current default network.
2298 * Internet using {@code network} or {@code false} if not.
2300 public void reportNetworkConnectivity(Network network, boolean hasConnectivity) {
2302 mService.reportNetworkConnectivity(network, hasConnectivity);
2309 * Set a network-independent global http proxy. This is not normally what you want
2310 * for typical HTTP proxies - they are general network dependent. However if you're
2312 * a private network where the proxy is not accessible, you may break HTTP using this.
2329 * Retrieve any network-independent global HTTP proxy.
2345 * network-specific HTTP proxy. If {@code network} is null, the
2346 * network-specific proxy returned is the proxy of the default active
2347 * network.
2350 * global HTTP proxy is set, {@code ProxyInfo} for {@code network},
2351 * or when {@code network} is {@code null},
2352 * the {@code ProxyInfo} for the default active network. Returns
2354 * permission to use {@code network}.
2357 public ProxyInfo getProxyForNetwork(Network network) {
2359 return mService.getProxyForNetwork(network);
2369 * the default network's proxy is returned.
2379 * Returns true if the hardware supports the given network type
2381 * or are authorized onto a network, just whether or not the
2388 * @param networkType The network type we'd like to check
2402 * Returns if the currently active data network is metered. A network is
2407 * network is available.
2539 * Base class for NetworkRequest callbacks. Used for notifications about network
2544 * Called when the framework connects to a new network to evaluate whether it satisfies this
2546 * callback. There is no guarantee that this new network will satisfy any requests, or that
2547 * the network will stay connected for longer than the time necessary to evaluate it.
2551 * the framework in properly evaluating the network &mdash; for example, an application that
2554 * @param network The {@link Network} of the network that is being evaluated.
2558 public void onPreCheck(Network network) {}
2561 * Called when the framework connects and has declared a new network ready for use.
2565 * @param network The {@link Network} of the satisfying network.
2567 public void onAvailable(Network network) {}
2570 * Called when the network is about to be disconnected. Often paired with an
2571 * {@link NetworkCallback#onAvailable} call with the new replacement network
2575 * {@link NetworkCallback#onAvailable} call for this network depending
2578 * @param network The {@link Network} that is about to be disconnected.
2580 * network connected. Note that the network may suffer a
2583 public void onLosing(Network network, int maxMsToLive) {}
2586 * Called when the framework has a hard loss of the network or when the
2589 * @param network The {@link Network} lost.
2591 public void onLost(Network network) {}
2594 * Called if no network is found in the given timeout time. If no timeout is given,
2601 * Called when the network the framework connected to for this request
2604 * @param network The {@link Network} whose capabilities have changed.
2605 * @param networkCapabilities The new {@link android.net.NetworkCapabilities} for this network.
2607 public void onCapabilitiesChanged(Network network,
2611 * Called when the network the framework connected to for this request
2614 * @param network The {@link Network} whose link properties have changed.
2615 * @param linkProperties The new {@link LinkProperties} for this network.
2617 public void onLinkPropertiesChanged(Network network, LinkProperties linkProperties) {}
2620 * Called when the network the framework connected to for this request
2623 * temporarily network data fails to transfer. Specifically this is used
2628 public void onNetworkSuspended(Network network) {}
2631 * Called when the network the framework connected to for this request
2637 public void onNetworkResumed(Network network) {}
2686 Network network = (Network) getObject(message, Network.class);
2688 Log.d(TAG, whatToString(message.what) + " for network " + network);
2694 callback.onPreCheck(network);
2701 callback.onAvailable(network);
2708 callback.onLosing(network, message.arg1);
2715 callback.onLost(network);
2732 callback.onCapabilitiesChanged(network, cap);
2742 callback.onLinkPropertiesChanged(network, lp);
2749 callback.onNetworkSuspended(network);
2756 callback.onNetworkResumed(network);
2864 * Helper function to request a network with a particular legacy type.
2868 * instead network notifications.
2881 * Request a network to satisfy a set of {@link android.net.NetworkCapabilities}.
2887 * can be used to direct traffic to the network.
2888 * <p>It is presently unsupported to request a network with mutable
2893 * network may never attain, and whether a network will attain these states
2894 * is unknown prior to bringing up the network so the framework does not
2915 * Request a network to satisfy a set of {@link android.net.NetworkCapabilities}, limited
2919 * network is not found within the given time (in milliseconds) the
2932 * @param timeoutMs The time in milliseconds to attempt looking for a suitable network
2946 * The maximum number of milliseconds the framework will look for a suitable network
2954 * successfully finding a network for the applications request. Retrieve it with
2964 * successfully finding a network for the applications request. Retrieve it with
2971 * Request a network to satisfy a set of {@link android.net.NetworkCapabilities}.
2976 * network is found.
2987 * Intent to reserve the network or it will be released shortly after the Intent
2996 * <p>It is presently unsupported to request a network with either
3000 * network may never attain, and whether a network will attain these states
3001 * is unknown prior to bringing up the network so the framework does not
3010 * @param operation Action to perform when the network is available (corresponds
3031 * releasing network resources and disconnecting.
3069 * Registers a PendingIntent to be sent when a network is available which satisfies the given
3075 * network is found.
3095 * @param operation Action to perform when the network is available (corresponds
3109 * Registers to receive notifications about changes in the system default network. The callbacks
3116 * system default network changes.
3124 // satisfied by the same network, if any, that satisfies the default
3125 // request, i.e., the system default network.
3132 * network connection for updated bandwidth information. The caller will be notified via
3135 * {@link #registerNetworkCallback(NetworkRequest, NetworkCallback)} to listen for network
3138 * @param network {@link Network} specifying which network you're interested.
3141 public boolean requestBandwidthUpdate(Network network) {
3143 return mService.requestBandwidthUpdate(network);
3186 * Informs the system whether it should switch to {@code network} regardless of whether it is
3187 * validated or not. If {@code accept} is true, and the network was explicitly selected by the
3188 * user (e.g., by selecting a Wi-Fi network in the Settings app), then the network will become
3189 * the system default network regardless of any other network that's currently connected. If
3191 * connects to this network, the system will switch to it.
3196 * @param network The network to accept.
3197 * @param accept Whether to accept the network even if unvalidated.
3202 public void setAcceptUnvalidated(Network network, boolean accept, boolean always) {
3204 mService.setAcceptUnvalidated(network, accept, always);
3211 * Informs the system to penalize {@code network}'s score when it becomes unvalidated. This is
3219 * @param network The network to accept.
3223 public void setAvoidUnvalidated(Network network) {
3225 mService.setAvoidUnvalidated(network);
3244 * Binds the current process to {@code network}. All Sockets created in the future
3247 * {@code network}. All host name resolutions will be limited to {@code network} as well.
3248 * Note that if {@code network} ever disconnects, all Sockets created in this way will cease to
3251 * To clear binding pass {@code null} for {@code network}. Using individually bound
3253 * performing network-specific host name resolutions via
3257 * @param network The {@link Network} to bind the current process to, or {@code null} to clear
3261 public boolean bindProcessToNetwork(Network network) {
3264 return setProcessDefaultNetwork(network);
3268 * Binds the current process to {@code network}. All Sockets created in the future
3271 * {@code network}. All host name resolutions will be limited to {@code network} as well.
3272 * Note that if {@code network} ever disconnects, all Sockets created in this way will cease to
3275 * To clear binding pass {@code null} for {@code network}. Using individually bound
3277 * performing network-specific host name resolutions via
3281 * @param network The {@link Network} to bind the current process to, or {@code null} to clear
3288 public static boolean setProcessDefaultNetwork(Network network) {
3289 int netId = (network == null) ? NETID_UNSET : network.netId;
3294 // Set HTTP proxy system properties to match network.
3302 // Must flush DNS cache as new network may have different DNS resolutions.
3304 // Must flush socket pool as idle sockets will be bound to previous network and may
3305 // cause subsequent fetches to be performed on old network.
3369 * Binds host resolutions performed by this process to {@code network}.
3372 * @param network The {@link Network} to bind host resolutions from the current process to, or
3378 public static boolean setProcessDefaultNetworkForHostResolution(Network network) {
3380 network == null ? NETID_UNSET : network.netId);
3384 * Device is not restricting metered network activity while application is running on
3390 * Device is restricting metered network activity while application is running on background,
3393 * In this state, application should take action to mitigate metered network access.
3399 * Device is restricting metered network activity while application is running on background.
3401 * In this state, application should not try to use the network while running on background,
3407 * A change in the background metered network activity restriction has occurred.
3440 * Determines if the calling application is subject to metered network restrictions while