Deprecate most of NetworkInfo.
getType, getTypeName, isConnectedOrConnecting, isConnected, isAvaisable, isFailover, isRoaming, getState, getDetailedState, getReason, and the TYPE_* constants in ConnectivityManager along with methods that use them are now stacked on a boat bound for the other side of the Styx. Test: no code changes Bug: 62844794 Change-Id: Idd70763de5b1af5580b4734cd443ac4b570069cc
This commit is contained in:
@@ -453,133 +453,177 @@ public class ConnectivityManager {
|
|||||||
public static final int TYPE_NONE = -1;
|
public static final int TYPE_NONE = -1;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The Mobile data connection. When active, all data traffic
|
* A Mobile data connection. Devices may support more than one.
|
||||||
* will use this network type's interface by default
|
*
|
||||||
* (it has a default route)
|
* @deprecated Applications should instead use {@link NetworkCapabilities#hasTransport} or
|
||||||
|
* {@link #requestNetwork(NetworkRequest, NetworkCallback)} to request an
|
||||||
|
* appropriate network. {@see NetworkCapabilities} for supported transports.
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
public static final int TYPE_MOBILE = 0;
|
public static final int TYPE_MOBILE = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The WIFI data connection. When active, all data traffic
|
* A WIFI data connection. Devices may support more than one.
|
||||||
* will use this network type's interface by default
|
*
|
||||||
* (it has a default route).
|
* @deprecated Applications should instead use {@link NetworkCapabilities#hasTransport} or
|
||||||
|
* {@link #requestNetwork(NetworkRequest, NetworkCallback)} to request an
|
||||||
|
* appropriate network. {@see NetworkCapabilities} for supported transports.
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
public static final int TYPE_WIFI = 1;
|
public static final int TYPE_WIFI = 1;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An MMS-specific Mobile data connection. This network type may use the
|
* An MMS-specific Mobile data connection. This network type may use the
|
||||||
* same network interface as {@link #TYPE_MOBILE} or it may use a different
|
* same network interface as {@link #TYPE_MOBILE} or it may use a different
|
||||||
* one. This is used by applications needing to talk to the carrier's
|
* one. This is used by applications needing to talk to the carrier's
|
||||||
* Multimedia Messaging Service servers.
|
* Multimedia Messaging Service servers.
|
||||||
*
|
*
|
||||||
* @deprecated Applications should instead use
|
* @deprecated Applications should instead use {@link NetworkCapabilities#hasCapability} or
|
||||||
* {@link #requestNetwork(NetworkRequest, NetworkCallback)} to request a network that
|
* {@link #requestNetwork(NetworkRequest, NetworkCallback)} to request a network that
|
||||||
* provides the {@link NetworkCapabilities#NET_CAPABILITY_MMS} capability.
|
* provides the {@link NetworkCapabilities#NET_CAPABILITY_MMS} capability.
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public static final int TYPE_MOBILE_MMS = 2;
|
public static final int TYPE_MOBILE_MMS = 2;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A SUPL-specific Mobile data connection. This network type may use the
|
* A SUPL-specific Mobile data connection. This network type may use the
|
||||||
* same network interface as {@link #TYPE_MOBILE} or it may use a different
|
* same network interface as {@link #TYPE_MOBILE} or it may use a different
|
||||||
* one. This is used by applications needing to talk to the carrier's
|
* one. This is used by applications needing to talk to the carrier's
|
||||||
* Secure User Plane Location servers for help locating the device.
|
* Secure User Plane Location servers for help locating the device.
|
||||||
*
|
*
|
||||||
* @deprecated Applications should instead use
|
* @deprecated Applications should instead use {@link NetworkCapabilities#hasCapability} or
|
||||||
* {@link #requestNetwork(NetworkRequest, NetworkCallback)} to request a network that
|
* {@link #requestNetwork(NetworkRequest, NetworkCallback)} to request a network that
|
||||||
* provides the {@link NetworkCapabilities#NET_CAPABILITY_SUPL} capability.
|
* provides the {@link NetworkCapabilities#NET_CAPABILITY_SUPL} capability.
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public static final int TYPE_MOBILE_SUPL = 3;
|
public static final int TYPE_MOBILE_SUPL = 3;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A DUN-specific Mobile data connection. This network type may use the
|
* A DUN-specific Mobile data connection. This network type may use the
|
||||||
* same network interface as {@link #TYPE_MOBILE} or it may use a different
|
* same network interface as {@link #TYPE_MOBILE} or it may use a different
|
||||||
* one. This is sometimes by the system when setting up an upstream connection
|
* one. This is sometimes by the system when setting up an upstream connection
|
||||||
* for tethering so that the carrier is aware of DUN traffic.
|
* for tethering so that the carrier is aware of DUN traffic.
|
||||||
|
*
|
||||||
|
* @deprecated Applications should instead use {@link NetworkCapabilities#hasCapability} or
|
||||||
|
* {@link #requestNetwork(NetworkRequest, NetworkCallback)} to request a network that
|
||||||
|
* provides the {@link NetworkCapabilities#NET_CAPABILITY_DUN} capability.
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
public static final int TYPE_MOBILE_DUN = 4;
|
public static final int TYPE_MOBILE_DUN = 4;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A High Priority Mobile data connection. This network type uses the
|
* A High Priority Mobile data connection. This network type uses the
|
||||||
* same network interface as {@link #TYPE_MOBILE} but the routing setup
|
* same network interface as {@link #TYPE_MOBILE} but the routing setup
|
||||||
* is different.
|
* is different.
|
||||||
*
|
*
|
||||||
* @deprecated Applications should instead use
|
* @deprecated Applications should instead use {@link NetworkCapabilities#hasTransport} or
|
||||||
* {@link #requestNetwork(NetworkRequest, NetworkCallback)} to request a network that
|
* {@link #requestNetwork(NetworkRequest, NetworkCallback)} to request an
|
||||||
* uses the {@link NetworkCapabilities#TRANSPORT_CELLULAR} transport.
|
* appropriate network. {@see NetworkCapabilities} for supported transports.
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public static final int TYPE_MOBILE_HIPRI = 5;
|
public static final int TYPE_MOBILE_HIPRI = 5;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The WiMAX data connection. When active, all data traffic
|
* A WiMAX data connection.
|
||||||
* will use this network type's interface by default
|
*
|
||||||
* (it has a default route).
|
* @deprecated Applications should instead use {@link NetworkCapabilities#hasTransport} or
|
||||||
|
* {@link #requestNetwork(NetworkRequest, NetworkCallback)} to request an
|
||||||
|
* appropriate network. {@see NetworkCapabilities} for supported transports.
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
public static final int TYPE_WIMAX = 6;
|
public static final int TYPE_WIMAX = 6;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The Bluetooth data connection. When active, all data traffic
|
* A Bluetooth data connection.
|
||||||
* will use this network type's interface by default
|
*
|
||||||
* (it has a default route).
|
* @deprecated Applications should instead use {@link NetworkCapabilities#hasTransport} or
|
||||||
|
* {@link #requestNetwork(NetworkRequest, NetworkCallback)} to request an
|
||||||
|
* appropriate network. {@see NetworkCapabilities} for supported transports.
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
public static final int TYPE_BLUETOOTH = 7;
|
public static final int TYPE_BLUETOOTH = 7;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Dummy data connection. This should not be used on shipping devices.
|
* Dummy data connection. This should not be used on shipping devices.
|
||||||
|
* @deprecated This is not used any more.
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
public static final int TYPE_DUMMY = 8;
|
public static final int TYPE_DUMMY = 8;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The Ethernet data connection. When active, all data traffic
|
* An Ethernet data connection.
|
||||||
* will use this network type's interface by default
|
*
|
||||||
* (it has a default route).
|
* @deprecated Applications should instead use {@link NetworkCapabilities#hasTransport} or
|
||||||
|
* {@link #requestNetwork(NetworkRequest, NetworkCallback)} to request an
|
||||||
|
* appropriate network. {@see NetworkCapabilities} for supported transports.
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
public static final int TYPE_ETHERNET = 9;
|
public static final int TYPE_ETHERNET = 9;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Over the air Administration.
|
* Over the air Administration.
|
||||||
|
* @deprecated Use {@link NetworkCapabilities} instead.
|
||||||
* {@hide}
|
* {@hide}
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
public static final int TYPE_MOBILE_FOTA = 10;
|
public static final int TYPE_MOBILE_FOTA = 10;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* IP Multimedia Subsystem.
|
* IP Multimedia Subsystem.
|
||||||
|
* @deprecated Use {@link NetworkCapabilities#NET_CAPABILITY_IMS} instead.
|
||||||
* {@hide}
|
* {@hide}
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
public static final int TYPE_MOBILE_IMS = 11;
|
public static final int TYPE_MOBILE_IMS = 11;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Carrier Branded Services.
|
* Carrier Branded Services.
|
||||||
|
* @deprecated Use {@link NetworkCapabilities#NET_CAPABILITY_CBS} instead.
|
||||||
* {@hide}
|
* {@hide}
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
public static final int TYPE_MOBILE_CBS = 12;
|
public static final int TYPE_MOBILE_CBS = 12;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A Wi-Fi p2p connection. Only requesting processes will have access to
|
* A Wi-Fi p2p connection. Only requesting processes will have access to
|
||||||
* the peers connected.
|
* the peers connected.
|
||||||
|
* @deprecated Use {@link NetworkCapabilities#NET_CAPABILITY_WIFI_P2P} instead.
|
||||||
* {@hide}
|
* {@hide}
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
public static final int TYPE_WIFI_P2P = 13;
|
public static final int TYPE_WIFI_P2P = 13;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The network to use for initially attaching to the network
|
* The network to use for initially attaching to the network
|
||||||
|
* @deprecated Use {@link NetworkCapabilities#NET_CAPABILITY_IA} instead.
|
||||||
* {@hide}
|
* {@hide}
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
public static final int TYPE_MOBILE_IA = 14;
|
public static final int TYPE_MOBILE_IA = 14;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Emergency PDN connection for emergency services. This
|
* Emergency PDN connection for emergency services. This
|
||||||
* may include IMS and MMS in emergency situations.
|
* may include IMS and MMS in emergency situations.
|
||||||
|
* @deprecated Use {@link NetworkCapabilities#NET_CAPABILITY_EIMS} instead.
|
||||||
* {@hide}
|
* {@hide}
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
public static final int TYPE_MOBILE_EMERGENCY = 15;
|
public static final int TYPE_MOBILE_EMERGENCY = 15;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The network that uses proxy to achieve connectivity.
|
* The network that uses proxy to achieve connectivity.
|
||||||
|
* @deprecated Use {@link NetworkCapabilities} instead.
|
||||||
* {@hide}
|
* {@hide}
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
public static final int TYPE_PROXY = 16;
|
public static final int TYPE_PROXY = 16;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A virtual network using one or more native bearers.
|
* A virtual network using one or more native bearers.
|
||||||
* It may or may not be providing security services.
|
* It may or may not be providing security services.
|
||||||
|
* @deprecated Applications should use {@link NetworkCapabilities#TRANSPORT_VPN} instead.
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
public static final int TYPE_VPN = 17;
|
public static final int TYPE_VPN = 17;
|
||||||
|
|
||||||
/** {@hide} */
|
/** {@hide} */
|
||||||
@@ -686,8 +730,10 @@ public class ConnectivityManager {
|
|||||||
* @param type the type needing naming
|
* @param type the type needing naming
|
||||||
* @return a String for the given type, or a string version of the type ("87")
|
* @return a String for the given type, or a string version of the type ("87")
|
||||||
* if no name is known.
|
* if no name is known.
|
||||||
|
* @deprecated Types are deprecated. Use {@link NetworkCapabilities} instead.
|
||||||
* {@hide}
|
* {@hide}
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
public static String getNetworkTypeName(int type) {
|
public static String getNetworkTypeName(int type) {
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case TYPE_NONE:
|
case TYPE_NONE:
|
||||||
@@ -738,8 +784,10 @@ public class ConnectivityManager {
|
|||||||
* This should be replaced in the future by a network property.
|
* This should be replaced in the future by a network property.
|
||||||
* @param networkType the type to check
|
* @param networkType the type to check
|
||||||
* @return a boolean - {@code true} if uses cellular network, else {@code false}
|
* @return a boolean - {@code true} if uses cellular network, else {@code false}
|
||||||
|
* @deprecated Types are deprecated. Use {@link NetworkCapabilities} instead.
|
||||||
* {@hide}
|
* {@hide}
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
public static boolean isNetworkTypeMobile(int networkType) {
|
public static boolean isNetworkTypeMobile(int networkType) {
|
||||||
switch (networkType) {
|
switch (networkType) {
|
||||||
case TYPE_MOBILE:
|
case TYPE_MOBILE:
|
||||||
@@ -761,8 +809,10 @@ public class ConnectivityManager {
|
|||||||
/**
|
/**
|
||||||
* Checks if the given network type is backed by a Wi-Fi radio.
|
* Checks if the given network type is backed by a Wi-Fi radio.
|
||||||
*
|
*
|
||||||
|
* @deprecated Types are deprecated. Use {@link NetworkCapabilities} instead.
|
||||||
* @hide
|
* @hide
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
public static boolean isNetworkTypeWifi(int networkType) {
|
public static boolean isNetworkTypeWifi(int networkType) {
|
||||||
switch (networkType) {
|
switch (networkType) {
|
||||||
case TYPE_WIFI:
|
case TYPE_WIFI:
|
||||||
@@ -1529,6 +1579,8 @@ public class ConnectivityManager {
|
|||||||
* IllegalArgumentException if no mapping from the legacy type to
|
* IllegalArgumentException if no mapping from the legacy type to
|
||||||
* NetworkCapabilities is known.
|
* NetworkCapabilities is known.
|
||||||
*
|
*
|
||||||
|
* @deprecated Types are deprecated. Use {@link NetworkCallback} or {@link NetworkRequest}
|
||||||
|
* to find the network instead.
|
||||||
* @hide
|
* @hide
|
||||||
*/
|
*/
|
||||||
public static NetworkCapabilities networkCapabilitiesForType(int type) {
|
public static NetworkCapabilities networkCapabilitiesForType(int type) {
|
||||||
@@ -2380,6 +2432,7 @@ public class ConnectivityManager {
|
|||||||
*
|
*
|
||||||
* @param networkType The type of network you want to report on
|
* @param networkType The type of network you want to report on
|
||||||
* @param percentage The quality of the connection 0 is bad, 100 is good
|
* @param percentage The quality of the connection 0 is bad, 100 is good
|
||||||
|
* @deprecated Types are deprecated. Use {@link #reportNetworkConnectivity} instead.
|
||||||
* {@hide}
|
* {@hide}
|
||||||
*/
|
*/
|
||||||
public void reportInetCondition(int networkType, int percentage) {
|
public void reportInetCondition(int networkType, int percentage) {
|
||||||
@@ -2511,9 +2564,10 @@ public class ConnectivityManager {
|
|||||||
*
|
*
|
||||||
* @param networkType The network type we'd like to check
|
* @param networkType The network type we'd like to check
|
||||||
* @return {@code true} if supported, else {@code false}
|
* @return {@code true} if supported, else {@code false}
|
||||||
*
|
* @deprecated Types are deprecated. Use {@link NetworkCapabilities} instead.
|
||||||
* @hide
|
* @hide
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
@RequiresPermission(android.Manifest.permission.ACCESS_NETWORK_STATE)
|
@RequiresPermission(android.Manifest.permission.ACCESS_NETWORK_STATE)
|
||||||
public boolean isNetworkSupported(int networkType) {
|
public boolean isNetworkSupported(int networkType) {
|
||||||
try {
|
try {
|
||||||
|
|||||||
@@ -38,14 +38,18 @@ public class NetworkInfo implements Parcelable {
|
|||||||
* <table>
|
* <table>
|
||||||
* <tr><td><b>Detailed state</b></td><td><b>Coarse-grained state</b></td></tr>
|
* <tr><td><b>Detailed state</b></td><td><b>Coarse-grained state</b></td></tr>
|
||||||
* <tr><td><code>IDLE</code></td><td><code>DISCONNECTED</code></td></tr>
|
* <tr><td><code>IDLE</code></td><td><code>DISCONNECTED</code></td></tr>
|
||||||
* <tr><td><code>SCANNING</code></td><td><code>CONNECTING</code></td></tr>
|
* <tr><td><code>SCANNING</code></td><td><code>DISCONNECTED</code></td></tr>
|
||||||
* <tr><td><code>CONNECTING</code></td><td><code>CONNECTING</code></td></tr>
|
* <tr><td><code>CONNECTING</code></td><td><code>CONNECTING</code></td></tr>
|
||||||
* <tr><td><code>AUTHENTICATING</code></td><td><code>CONNECTING</code></td></tr>
|
* <tr><td><code>AUTHENTICATING</code></td><td><code>CONNECTING</code></td></tr>
|
||||||
|
* <tr><td><code>OBTAINING_IPADDR</code></td><td><code>CONNECTING</code></td></tr>
|
||||||
|
* <tr><td><code>VERIFYING_POOR_LINK</code></td><td><code>CONNECTING</code></td></tr>
|
||||||
|
* <tr><td><code>CAPTIVE_PORTAL_CHECK</code></td><td><code>CONNECTING</code></td></tr>
|
||||||
* <tr><td><code>CONNECTED</code></td><td><code>CONNECTED</code></td></tr>
|
* <tr><td><code>CONNECTED</code></td><td><code>CONNECTED</code></td></tr>
|
||||||
|
* <tr><td><code>SUSPENDED</code></td><td><code>SUSPENDED</code></td></tr>
|
||||||
* <tr><td><code>DISCONNECTING</code></td><td><code>DISCONNECTING</code></td></tr>
|
* <tr><td><code>DISCONNECTING</code></td><td><code>DISCONNECTING</code></td></tr>
|
||||||
* <tr><td><code>DISCONNECTED</code></td><td><code>DISCONNECTED</code></td></tr>
|
* <tr><td><code>DISCONNECTED</code></td><td><code>DISCONNECTED</code></td></tr>
|
||||||
* <tr><td><code>UNAVAILABLE</code></td><td><code>DISCONNECTED</code></td></tr>
|
|
||||||
* <tr><td><code>FAILED</code></td><td><code>DISCONNECTED</code></td></tr>
|
* <tr><td><code>FAILED</code></td><td><code>DISCONNECTED</code></td></tr>
|
||||||
|
* <tr><td><code>BLOCKED</code></td><td><code>DISCONNECTED</code></td></tr>
|
||||||
* </table>
|
* </table>
|
||||||
*/
|
*/
|
||||||
public enum State {
|
public enum State {
|
||||||
@@ -163,8 +167,17 @@ public class NetworkInfo implements Parcelable {
|
|||||||
* @return one of {@link ConnectivityManager#TYPE_MOBILE}, {@link
|
* @return one of {@link ConnectivityManager#TYPE_MOBILE}, {@link
|
||||||
* ConnectivityManager#TYPE_WIFI}, {@link ConnectivityManager#TYPE_WIMAX}, {@link
|
* ConnectivityManager#TYPE_WIFI}, {@link ConnectivityManager#TYPE_WIMAX}, {@link
|
||||||
* ConnectivityManager#TYPE_ETHERNET}, {@link ConnectivityManager#TYPE_BLUETOOTH}, or other
|
* ConnectivityManager#TYPE_ETHERNET}, {@link ConnectivityManager#TYPE_BLUETOOTH}, or other
|
||||||
* types defined by {@link ConnectivityManager}
|
* types defined by {@link ConnectivityManager}.
|
||||||
|
* @deprecated Callers should switch to checking {@link NetworkCapabilities#hasTransport}
|
||||||
|
* instead with one of the NetworkCapabilities#TRANSPORT_* constants :
|
||||||
|
* {@link #getType} and {@link #getTypeName} cannot account for networks using
|
||||||
|
* multiple transports. Note that generally apps should not care about transport;
|
||||||
|
* {@link NetworkCapabilities#NET_CAPABILITY_NOT_METERED} and
|
||||||
|
* {@link NetworkCapabilities#getLinkDownstreamBandwidthKbps} are calls that
|
||||||
|
* apps concerned with meteredness or bandwidth should be looking at, as they
|
||||||
|
* offer this information with much better accuracy.
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
public int getType() {
|
public int getType() {
|
||||||
synchronized (this) {
|
synchronized (this) {
|
||||||
return mNetworkType;
|
return mNetworkType;
|
||||||
@@ -172,8 +185,10 @@ public class NetworkInfo implements Parcelable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* @deprecated Use {@link NetworkCapabilities} instead
|
||||||
* @hide
|
* @hide
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
public void setType(int type) {
|
public void setType(int type) {
|
||||||
synchronized (this) {
|
synchronized (this) {
|
||||||
mNetworkType = type;
|
mNetworkType = type;
|
||||||
@@ -205,7 +220,16 @@ public class NetworkInfo implements Parcelable {
|
|||||||
* Return a human-readable name describe the type of the network,
|
* Return a human-readable name describe the type of the network,
|
||||||
* for example "WIFI" or "MOBILE".
|
* for example "WIFI" or "MOBILE".
|
||||||
* @return the name of the network type
|
* @return the name of the network type
|
||||||
|
* @deprecated Callers should switch to checking {@link NetworkCapabilities#hasTransport}
|
||||||
|
* instead with one of the NetworkCapabilities#TRANSPORT_* constants :
|
||||||
|
* {@link #getType} and {@link #getTypeName} cannot account for networks using
|
||||||
|
* multiple transports. Note that generally apps should not care about transport;
|
||||||
|
* {@link NetworkCapabilities#NET_CAPABILITY_NOT_METERED} and
|
||||||
|
* {@link NetworkCapabilities#getLinkDownstreamBandwidthKbps} are calls that
|
||||||
|
* apps concerned with meteredness or bandwidth should be looking at, as they
|
||||||
|
* offer this information with much better accuracy.
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
public String getTypeName() {
|
public String getTypeName() {
|
||||||
synchronized (this) {
|
synchronized (this) {
|
||||||
return mTypeName;
|
return mTypeName;
|
||||||
@@ -230,7 +254,15 @@ public class NetworkInfo implements Parcelable {
|
|||||||
* that the network is fully usable.
|
* that the network is fully usable.
|
||||||
* @return {@code true} if network connectivity exists or is in the process
|
* @return {@code true} if network connectivity exists or is in the process
|
||||||
* of being established, {@code false} otherwise.
|
* of being established, {@code false} otherwise.
|
||||||
|
* @deprecated Apps should instead use the
|
||||||
|
* {@link android.net.ConnectivityManager.NetworkCallback} API to
|
||||||
|
* learn about connectivity changes.
|
||||||
|
* {@link ConnectivityManager#registerDefaultNetworkCallback} and
|
||||||
|
* {@link ConnectivityManager#registerNetworkCallback}. These will
|
||||||
|
* give a more accurate picture of the connectivity state of
|
||||||
|
* the device and let apps react more easily and quickly to changes.
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
public boolean isConnectedOrConnecting() {
|
public boolean isConnectedOrConnecting() {
|
||||||
synchronized (this) {
|
synchronized (this) {
|
||||||
return mState == State.CONNECTED || mState == State.CONNECTING;
|
return mState == State.CONNECTED || mState == State.CONNECTING;
|
||||||
@@ -259,8 +291,18 @@ public class NetworkInfo implements Parcelable {
|
|||||||
* data roaming has been disabled.</li>
|
* data roaming has been disabled.</li>
|
||||||
* <li>The device's radio is turned off, e.g., because airplane mode is enabled.</li>
|
* <li>The device's radio is turned off, e.g., because airplane mode is enabled.</li>
|
||||||
* </ul>
|
* </ul>
|
||||||
|
* Since Android L, this always returns {@code true}, because the system only
|
||||||
|
* returns info for available networks.
|
||||||
* @return {@code true} if the network is available, {@code false} otherwise
|
* @return {@code true} if the network is available, {@code false} otherwise
|
||||||
|
* @deprecated Apps should instead use the
|
||||||
|
* {@link android.net.ConnectivityManager.NetworkCallback} API to
|
||||||
|
* learn about connectivity changes.
|
||||||
|
* {@link ConnectivityManager#registerDefaultNetworkCallback} and
|
||||||
|
* {@link ConnectivityManager#registerNetworkCallback}. These will
|
||||||
|
* give a more accurate picture of the connectivity state of
|
||||||
|
* the device and let apps react more easily and quickly to changes.
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
public boolean isAvailable() {
|
public boolean isAvailable() {
|
||||||
synchronized (this) {
|
synchronized (this) {
|
||||||
return mIsAvailable;
|
return mIsAvailable;
|
||||||
@@ -270,9 +312,11 @@ public class NetworkInfo implements Parcelable {
|
|||||||
/**
|
/**
|
||||||
* Sets if the network is available, ie, if the connectivity is possible.
|
* Sets if the network is available, ie, if the connectivity is possible.
|
||||||
* @param isAvailable the new availability value.
|
* @param isAvailable the new availability value.
|
||||||
|
* @deprecated Use {@link NetworkCapabilities} instead
|
||||||
*
|
*
|
||||||
* @hide
|
* @hide
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
public void setIsAvailable(boolean isAvailable) {
|
public void setIsAvailable(boolean isAvailable) {
|
||||||
synchronized (this) {
|
synchronized (this) {
|
||||||
mIsAvailable = isAvailable;
|
mIsAvailable = isAvailable;
|
||||||
@@ -285,7 +329,10 @@ public class NetworkInfo implements Parcelable {
|
|||||||
* network following a disconnect from another network.
|
* network following a disconnect from another network.
|
||||||
* @return {@code true} if this is a failover attempt, {@code false}
|
* @return {@code true} if this is a failover attempt, {@code false}
|
||||||
* otherwise.
|
* otherwise.
|
||||||
|
* @deprecated This field is not populated in recent Android releases,
|
||||||
|
* and does not make a lot of sense in a multi-network world.
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
public boolean isFailover() {
|
public boolean isFailover() {
|
||||||
synchronized (this) {
|
synchronized (this) {
|
||||||
return mIsFailover;
|
return mIsFailover;
|
||||||
@@ -296,8 +343,10 @@ public class NetworkInfo implements Parcelable {
|
|||||||
* Set the failover boolean.
|
* Set the failover boolean.
|
||||||
* @param isFailover {@code true} to mark the current connection attempt
|
* @param isFailover {@code true} to mark the current connection attempt
|
||||||
* as a failover.
|
* as a failover.
|
||||||
|
* @deprecated This hasn't been set in any recent Android release.
|
||||||
* @hide
|
* @hide
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
public void setFailover(boolean isFailover) {
|
public void setFailover(boolean isFailover) {
|
||||||
synchronized (this) {
|
synchronized (this) {
|
||||||
mIsFailover = isFailover;
|
mIsFailover = isFailover;
|
||||||
@@ -322,7 +371,10 @@ public class NetworkInfo implements Parcelable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** {@hide} */
|
/**
|
||||||
|
* @deprecated Use {@link NetworkCapabilities#NET_CAPABILITY_NOT_ROAMING} instead.
|
||||||
|
* {@hide}
|
||||||
|
*/
|
||||||
@VisibleForTesting
|
@VisibleForTesting
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public void setRoaming(boolean isRoaming) {
|
public void setRoaming(boolean isRoaming) {
|
||||||
@@ -334,7 +386,15 @@ public class NetworkInfo implements Parcelable {
|
|||||||
/**
|
/**
|
||||||
* Reports the current coarse-grained state of the network.
|
* Reports the current coarse-grained state of the network.
|
||||||
* @return the coarse-grained state
|
* @return the coarse-grained state
|
||||||
|
* @deprecated Apps should instead use the
|
||||||
|
* {@link android.net.ConnectivityManager.NetworkCallback} API to
|
||||||
|
* learn about connectivity changes.
|
||||||
|
* {@link ConnectivityManager#registerDefaultNetworkCallback} and
|
||||||
|
* {@link ConnectivityManager#registerNetworkCallback}. These will
|
||||||
|
* give a more accurate picture of the connectivity state of
|
||||||
|
* the device and let apps react more easily and quickly to changes.
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
public State getState() {
|
public State getState() {
|
||||||
synchronized (this) {
|
synchronized (this) {
|
||||||
return mState;
|
return mState;
|
||||||
@@ -358,8 +418,10 @@ public class NetworkInfo implements Parcelable {
|
|||||||
* if one was supplied. May be {@code null}.
|
* if one was supplied. May be {@code null}.
|
||||||
* @param extraInfo an optional {@code String} providing addditional network state
|
* @param extraInfo an optional {@code String} providing addditional network state
|
||||||
* information passed up from the lower networking layers.
|
* information passed up from the lower networking layers.
|
||||||
|
* @deprecated Use {@link NetworkCapabilities} instead.
|
||||||
* @hide
|
* @hide
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
public void setDetailedState(DetailedState detailedState, String reason, String extraInfo) {
|
public void setDetailedState(DetailedState detailedState, String reason, String extraInfo) {
|
||||||
synchronized (this) {
|
synchronized (this) {
|
||||||
this.mDetailedState = detailedState;
|
this.mDetailedState = detailedState;
|
||||||
@@ -385,6 +447,8 @@ public class NetworkInfo implements Parcelable {
|
|||||||
* Report the reason an attempt to establish connectivity failed,
|
* Report the reason an attempt to establish connectivity failed,
|
||||||
* if one is available.
|
* if one is available.
|
||||||
* @return the reason for failure, or null if not available
|
* @return the reason for failure, or null if not available
|
||||||
|
* @deprecated This method does not have a consistent contract that could make it useful
|
||||||
|
* to callers.
|
||||||
*/
|
*/
|
||||||
public String getReason() {
|
public String getReason() {
|
||||||
synchronized (this) {
|
synchronized (this) {
|
||||||
|
|||||||
Reference in New Issue
Block a user