Loading api/current.txt +2 −1 Original line number Diff line number Diff line Loading @@ -25691,6 +25691,7 @@ package android.net { field public static final int NET_CAPABILITY_MMS = 0; // 0x0 field public static final int NET_CAPABILITY_NOT_METERED = 11; // 0xb field public static final int NET_CAPABILITY_NOT_RESTRICTED = 13; // 0xd field public static final int NET_CAPABILITY_NOT_ROAMING = 18; // 0x12 field public static final int NET_CAPABILITY_NOT_VPN = 15; // 0xf field public static final int NET_CAPABILITY_RCS = 8; // 0x8 field public static final int NET_CAPABILITY_SUPL = 1; // 0x1 Loading Loading @@ -25721,7 +25722,7 @@ package android.net { method public boolean isConnected(); method public boolean isConnectedOrConnecting(); method public boolean isFailover(); method public boolean isRoaming(); method public deprecated boolean isRoaming(); method public void writeToParcel(android.os.Parcel, int); field public static final android.os.Parcelable.Creator<android.net.NetworkInfo> CREATOR; } api/system-current.txt +2 −1 Original line number Diff line number Diff line Loading @@ -27889,6 +27889,7 @@ package android.net { field public static final int NET_CAPABILITY_MMS = 0; // 0x0 field public static final int NET_CAPABILITY_NOT_METERED = 11; // 0xb field public static final int NET_CAPABILITY_NOT_RESTRICTED = 13; // 0xd field public static final int NET_CAPABILITY_NOT_ROAMING = 18; // 0x12 field public static final int NET_CAPABILITY_NOT_VPN = 15; // 0xf field public static final int NET_CAPABILITY_RCS = 8; // 0x8 field public static final int NET_CAPABILITY_SUPL = 1; // 0x1 Loading Loading @@ -27919,7 +27920,7 @@ package android.net { method public boolean isConnected(); method public boolean isConnectedOrConnecting(); method public boolean isFailover(); method public boolean isRoaming(); method public deprecated boolean isRoaming(); method public void writeToParcel(android.os.Parcel, int); field public static final android.os.Parcelable.Creator<android.net.NetworkInfo> CREATOR; } api/test-current.txt +2 −1 Original line number Diff line number Diff line Loading @@ -25801,6 +25801,7 @@ package android.net { field public static final int NET_CAPABILITY_MMS = 0; // 0x0 field public static final int NET_CAPABILITY_NOT_METERED = 11; // 0xb field public static final int NET_CAPABILITY_NOT_RESTRICTED = 13; // 0xd field public static final int NET_CAPABILITY_NOT_ROAMING = 18; // 0x12 field public static final int NET_CAPABILITY_NOT_VPN = 15; // 0xf field public static final int NET_CAPABILITY_RCS = 8; // 0x8 field public static final int NET_CAPABILITY_SUPL = 1; // 0x1 Loading Loading @@ -25831,7 +25832,7 @@ package android.net { method public boolean isConnected(); method public boolean isConnectedOrConnecting(); method public boolean isFailover(); method public boolean isRoaming(); method public deprecated boolean isRoaming(); method public void writeToParcel(android.os.Parcel, int); field public static final android.os.Parcelable.Creator<android.net.NetworkInfo> CREATOR; } core/java/android/net/NetworkCapabilities.java +104 −15 Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ package android.net; import android.annotation.IntDef; import android.net.ConnectivityManager.NetworkCallback; import android.os.Parcel; import android.os.Parcelable; Loading @@ -30,15 +31,24 @@ import java.util.Objects; import java.util.StringJoiner; /** * This class represents the capabilities of a network. This is used both to specify * needs to {@link ConnectivityManager} and when inspecting a network. * * Note that this replaces the old {@link ConnectivityManager#TYPE_MOBILE} method * of network selection. Rather than indicate a need for Wi-Fi because an application * needs high bandwidth and risk obsolescence when a new, fast network appears (like LTE), * the application should specify it needs high bandwidth. Similarly if an application * needs an unmetered network for a bulk transfer it can specify that rather than assuming * all cellular based connections are metered and all Wi-Fi based connections are not. * Representation of the capabilities of a network. This object serves two * purposes: * <ul> * <li>An expression of the current capabilities of an active network, typically * expressed through * {@link NetworkCallback#onCapabilitiesChanged(Network, NetworkCapabilities)} * or {@link ConnectivityManager#getNetworkCapabilities(Network)}. * <li>An expression of the future capabilities of a desired network, typically * expressed through {@link NetworkRequest}. * </ul> * <p> * This replaces the old {@link ConnectivityManager#TYPE_MOBILE} method of * network selection. Rather than indicate a need for Wi-Fi because an * application needs high bandwidth and risk obsolescence when a new, fast * network appears (like LTE), the application should specify it needs high * bandwidth. Similarly if an application needs an unmetered network for a bulk * transfer it can specify that rather than assuming all cellular based * connections are metered and all Wi-Fi based connections are not. */ public final class NetworkCapabilities implements Parcelable { private static final String TAG = "NetworkCapabilities"; Loading Loading @@ -101,6 +111,7 @@ public final class NetworkCapabilities implements Parcelable { NET_CAPABILITY_NOT_VPN, NET_CAPABILITY_VALIDATED, NET_CAPABILITY_CAPTIVE_PORTAL, NET_CAPABILITY_NOT_ROAMING, NET_CAPABILITY_FOREGROUND, }) public @interface NetCapability { } Loading Loading @@ -217,12 +228,17 @@ public final class NetworkCapabilities implements Parcelable { */ public static final int NET_CAPABILITY_CAPTIVE_PORTAL = 17; /** * Indicates that this network is not roaming. */ public static final int NET_CAPABILITY_NOT_ROAMING = 18; /** * Indicates that this network is available for use by apps, and not a network that is being * kept up in the background to facilitate fast network switching. * @hide */ public static final int NET_CAPABILITY_FOREGROUND = 18; public static final int NET_CAPABILITY_FOREGROUND = 19; private static final int MIN_NET_CAPABILITY = NET_CAPABILITY_MMS; private static final int MAX_NET_CAPABILITY = NET_CAPABILITY_FOREGROUND; Loading @@ -237,6 +253,7 @@ public final class NetworkCapabilities implements Parcelable { (1 << NET_CAPABILITY_TRUSTED) | (1 << NET_CAPABILITY_VALIDATED) | (1 << NET_CAPABILITY_CAPTIVE_PORTAL) | (1 << NET_CAPABILITY_NOT_ROAMING) | (1 << NET_CAPABILITY_FOREGROUND); /** Loading Loading @@ -315,6 +332,21 @@ public final class NetworkCapabilities implements Parcelable { return this; } /** * Sets (or clears) the given capability on this {@link NetworkCapabilities} * instance. * * @hide */ public NetworkCapabilities setCapability(@NetCapability int capability, boolean value) { if (value) { addCapability(capability); } else { removeCapability(capability); } return this; } /** * Gets all the capabilities set on this {@code NetworkCapability} instance. * Loading @@ -325,6 +357,15 @@ public final class NetworkCapabilities implements Parcelable { return BitUtils.unpackBits(mNetworkCapabilities); } /** * Sets all the capabilities set on this {@code NetworkCapability} instance. * * @hide */ public void setCapabilities(@NetCapability int[] capabilities) { mNetworkCapabilities = BitUtils.packBits(capabilities); } /** * Tests for the presence of a capabilitity on this instance. * Loading Loading @@ -514,6 +555,21 @@ public final class NetworkCapabilities implements Parcelable { return this; } /** * Sets (or clears) the given transport on this {@link NetworkCapabilities} * instance. * * @hide */ public NetworkCapabilities setTransportType(@Transport int transportType, boolean value) { if (value) { addTransportType(transportType); } else { removeTransportType(transportType); } return this; } /** * Gets all the transports set on this {@code NetworkCapability} instance. * Loading @@ -524,6 +580,15 @@ public final class NetworkCapabilities implements Parcelable { return BitUtils.unpackBits(mTransportTypes); } /** * Sets all the transports set on this {@code NetworkCapability} instance. * * @hide */ public void setTransportTypes(@Transport int[] transportTypes) { mTransportTypes = BitUtils.packBits(transportTypes); } /** * Tests for the presence of a transport on this instance. * Loading @@ -548,13 +613,19 @@ public final class NetworkCapabilities implements Parcelable { return (nc.mTransportTypes == this.mTransportTypes); } /** * Value indicating that link bandwidth is unspecified. * @hide */ public static final int LINK_BANDWIDTH_UNSPECIFIED = 0; /** * Passive link bandwidth. This is a rough guide of the expected peak bandwidth * for the first hop on the given transport. It is not measured, but may take into account * link parameters (Radio technology, allocated channels, etc). */ private int mLinkUpBandwidthKbps; private int mLinkDownBandwidthKbps; private int mLinkUpBandwidthKbps = LINK_BANDWIDTH_UNSPECIFIED; private int mLinkDownBandwidthKbps = LINK_BANDWIDTH_UNSPECIFIED; /** * Sets the upstream bandwidth for this network in Kbps. This always only refers to Loading @@ -571,8 +642,9 @@ public final class NetworkCapabilities implements Parcelable { * @param upKbps the estimated first hop upstream (device to network) bandwidth. * @hide */ public void setLinkUpstreamBandwidthKbps(int upKbps) { public NetworkCapabilities setLinkUpstreamBandwidthKbps(int upKbps) { mLinkUpBandwidthKbps = upKbps; return this; } /** Loading Loading @@ -600,8 +672,9 @@ public final class NetworkCapabilities implements Parcelable { * @param downKbps the estimated first hop downstream (network to device) bandwidth. * @hide */ public void setLinkDownstreamBandwidthKbps(int downKbps) { public NetworkCapabilities setLinkDownstreamBandwidthKbps(int downKbps) { mLinkDownBandwidthKbps = downKbps; return this; } /** Loading @@ -628,6 +701,20 @@ public final class NetworkCapabilities implements Parcelable { return (this.mLinkUpBandwidthKbps == nc.mLinkUpBandwidthKbps && this.mLinkDownBandwidthKbps == nc.mLinkDownBandwidthKbps); } /** @hide */ public static int minBandwidth(int a, int b) { if (a == LINK_BANDWIDTH_UNSPECIFIED) { return b; } else if (b == LINK_BANDWIDTH_UNSPECIFIED) { return a; } else { return Math.min(a, b); } } /** @hide */ public static int maxBandwidth(int a, int b) { return Math.max(a, b); } private NetworkSpecifier mNetworkSpecifier = null; Loading Loading @@ -708,8 +795,9 @@ public final class NetworkCapabilities implements Parcelable { * @param signalStrength the bearer-specific signal strength. * @hide */ public void setSignalStrength(int signalStrength) { public NetworkCapabilities setSignalStrength(int signalStrength) { mSignalStrength = signalStrength; return this; } /** Loading Loading @@ -968,6 +1056,7 @@ public final class NetworkCapabilities implements Parcelable { case NET_CAPABILITY_NOT_VPN: return "NOT_VPN"; case NET_CAPABILITY_VALIDATED: return "VALIDATED"; case NET_CAPABILITY_CAPTIVE_PORTAL: return "CAPTIVE_PORTAL"; case NET_CAPABILITY_NOT_ROAMING: return "NOT_ROAMING"; case NET_CAPABILITY_FOREGROUND: return "FOREGROUND"; default: return Integer.toString(capability); } Loading core/java/android/net/NetworkIdentity.java +2 −2 Original line number Diff line number Diff line Loading @@ -189,7 +189,8 @@ public class NetworkIdentity implements Comparable<NetworkIdentity> { String subscriberId = null; String networkId = null; boolean roaming = false; boolean roaming = !state.networkCapabilities.hasCapability( NetworkCapabilities.NET_CAPABILITY_NOT_ROAMING); boolean metered = !state.networkCapabilities.hasCapability( NetworkCapabilities.NET_CAPABILITY_NOT_METERED); Loading @@ -203,7 +204,6 @@ public class NetworkIdentity implements Comparable<NetworkIdentity> { } subscriberId = state.subscriberId; roaming = state.networkInfo.isRoaming(); } else if (type == TYPE_WIFI) { if (state.networkId != null) { Loading Loading
api/current.txt +2 −1 Original line number Diff line number Diff line Loading @@ -25691,6 +25691,7 @@ package android.net { field public static final int NET_CAPABILITY_MMS = 0; // 0x0 field public static final int NET_CAPABILITY_NOT_METERED = 11; // 0xb field public static final int NET_CAPABILITY_NOT_RESTRICTED = 13; // 0xd field public static final int NET_CAPABILITY_NOT_ROAMING = 18; // 0x12 field public static final int NET_CAPABILITY_NOT_VPN = 15; // 0xf field public static final int NET_CAPABILITY_RCS = 8; // 0x8 field public static final int NET_CAPABILITY_SUPL = 1; // 0x1 Loading Loading @@ -25721,7 +25722,7 @@ package android.net { method public boolean isConnected(); method public boolean isConnectedOrConnecting(); method public boolean isFailover(); method public boolean isRoaming(); method public deprecated boolean isRoaming(); method public void writeToParcel(android.os.Parcel, int); field public static final android.os.Parcelable.Creator<android.net.NetworkInfo> CREATOR; }
api/system-current.txt +2 −1 Original line number Diff line number Diff line Loading @@ -27889,6 +27889,7 @@ package android.net { field public static final int NET_CAPABILITY_MMS = 0; // 0x0 field public static final int NET_CAPABILITY_NOT_METERED = 11; // 0xb field public static final int NET_CAPABILITY_NOT_RESTRICTED = 13; // 0xd field public static final int NET_CAPABILITY_NOT_ROAMING = 18; // 0x12 field public static final int NET_CAPABILITY_NOT_VPN = 15; // 0xf field public static final int NET_CAPABILITY_RCS = 8; // 0x8 field public static final int NET_CAPABILITY_SUPL = 1; // 0x1 Loading Loading @@ -27919,7 +27920,7 @@ package android.net { method public boolean isConnected(); method public boolean isConnectedOrConnecting(); method public boolean isFailover(); method public boolean isRoaming(); method public deprecated boolean isRoaming(); method public void writeToParcel(android.os.Parcel, int); field public static final android.os.Parcelable.Creator<android.net.NetworkInfo> CREATOR; }
api/test-current.txt +2 −1 Original line number Diff line number Diff line Loading @@ -25801,6 +25801,7 @@ package android.net { field public static final int NET_CAPABILITY_MMS = 0; // 0x0 field public static final int NET_CAPABILITY_NOT_METERED = 11; // 0xb field public static final int NET_CAPABILITY_NOT_RESTRICTED = 13; // 0xd field public static final int NET_CAPABILITY_NOT_ROAMING = 18; // 0x12 field public static final int NET_CAPABILITY_NOT_VPN = 15; // 0xf field public static final int NET_CAPABILITY_RCS = 8; // 0x8 field public static final int NET_CAPABILITY_SUPL = 1; // 0x1 Loading Loading @@ -25831,7 +25832,7 @@ package android.net { method public boolean isConnected(); method public boolean isConnectedOrConnecting(); method public boolean isFailover(); method public boolean isRoaming(); method public deprecated boolean isRoaming(); method public void writeToParcel(android.os.Parcel, int); field public static final android.os.Parcelable.Creator<android.net.NetworkInfo> CREATOR; }
core/java/android/net/NetworkCapabilities.java +104 −15 Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ package android.net; import android.annotation.IntDef; import android.net.ConnectivityManager.NetworkCallback; import android.os.Parcel; import android.os.Parcelable; Loading @@ -30,15 +31,24 @@ import java.util.Objects; import java.util.StringJoiner; /** * This class represents the capabilities of a network. This is used both to specify * needs to {@link ConnectivityManager} and when inspecting a network. * * Note that this replaces the old {@link ConnectivityManager#TYPE_MOBILE} method * of network selection. Rather than indicate a need for Wi-Fi because an application * needs high bandwidth and risk obsolescence when a new, fast network appears (like LTE), * the application should specify it needs high bandwidth. Similarly if an application * needs an unmetered network for a bulk transfer it can specify that rather than assuming * all cellular based connections are metered and all Wi-Fi based connections are not. * Representation of the capabilities of a network. This object serves two * purposes: * <ul> * <li>An expression of the current capabilities of an active network, typically * expressed through * {@link NetworkCallback#onCapabilitiesChanged(Network, NetworkCapabilities)} * or {@link ConnectivityManager#getNetworkCapabilities(Network)}. * <li>An expression of the future capabilities of a desired network, typically * expressed through {@link NetworkRequest}. * </ul> * <p> * This replaces the old {@link ConnectivityManager#TYPE_MOBILE} method of * network selection. Rather than indicate a need for Wi-Fi because an * application needs high bandwidth and risk obsolescence when a new, fast * network appears (like LTE), the application should specify it needs high * bandwidth. Similarly if an application needs an unmetered network for a bulk * transfer it can specify that rather than assuming all cellular based * connections are metered and all Wi-Fi based connections are not. */ public final class NetworkCapabilities implements Parcelable { private static final String TAG = "NetworkCapabilities"; Loading Loading @@ -101,6 +111,7 @@ public final class NetworkCapabilities implements Parcelable { NET_CAPABILITY_NOT_VPN, NET_CAPABILITY_VALIDATED, NET_CAPABILITY_CAPTIVE_PORTAL, NET_CAPABILITY_NOT_ROAMING, NET_CAPABILITY_FOREGROUND, }) public @interface NetCapability { } Loading Loading @@ -217,12 +228,17 @@ public final class NetworkCapabilities implements Parcelable { */ public static final int NET_CAPABILITY_CAPTIVE_PORTAL = 17; /** * Indicates that this network is not roaming. */ public static final int NET_CAPABILITY_NOT_ROAMING = 18; /** * Indicates that this network is available for use by apps, and not a network that is being * kept up in the background to facilitate fast network switching. * @hide */ public static final int NET_CAPABILITY_FOREGROUND = 18; public static final int NET_CAPABILITY_FOREGROUND = 19; private static final int MIN_NET_CAPABILITY = NET_CAPABILITY_MMS; private static final int MAX_NET_CAPABILITY = NET_CAPABILITY_FOREGROUND; Loading @@ -237,6 +253,7 @@ public final class NetworkCapabilities implements Parcelable { (1 << NET_CAPABILITY_TRUSTED) | (1 << NET_CAPABILITY_VALIDATED) | (1 << NET_CAPABILITY_CAPTIVE_PORTAL) | (1 << NET_CAPABILITY_NOT_ROAMING) | (1 << NET_CAPABILITY_FOREGROUND); /** Loading Loading @@ -315,6 +332,21 @@ public final class NetworkCapabilities implements Parcelable { return this; } /** * Sets (or clears) the given capability on this {@link NetworkCapabilities} * instance. * * @hide */ public NetworkCapabilities setCapability(@NetCapability int capability, boolean value) { if (value) { addCapability(capability); } else { removeCapability(capability); } return this; } /** * Gets all the capabilities set on this {@code NetworkCapability} instance. * Loading @@ -325,6 +357,15 @@ public final class NetworkCapabilities implements Parcelable { return BitUtils.unpackBits(mNetworkCapabilities); } /** * Sets all the capabilities set on this {@code NetworkCapability} instance. * * @hide */ public void setCapabilities(@NetCapability int[] capabilities) { mNetworkCapabilities = BitUtils.packBits(capabilities); } /** * Tests for the presence of a capabilitity on this instance. * Loading Loading @@ -514,6 +555,21 @@ public final class NetworkCapabilities implements Parcelable { return this; } /** * Sets (or clears) the given transport on this {@link NetworkCapabilities} * instance. * * @hide */ public NetworkCapabilities setTransportType(@Transport int transportType, boolean value) { if (value) { addTransportType(transportType); } else { removeTransportType(transportType); } return this; } /** * Gets all the transports set on this {@code NetworkCapability} instance. * Loading @@ -524,6 +580,15 @@ public final class NetworkCapabilities implements Parcelable { return BitUtils.unpackBits(mTransportTypes); } /** * Sets all the transports set on this {@code NetworkCapability} instance. * * @hide */ public void setTransportTypes(@Transport int[] transportTypes) { mTransportTypes = BitUtils.packBits(transportTypes); } /** * Tests for the presence of a transport on this instance. * Loading @@ -548,13 +613,19 @@ public final class NetworkCapabilities implements Parcelable { return (nc.mTransportTypes == this.mTransportTypes); } /** * Value indicating that link bandwidth is unspecified. * @hide */ public static final int LINK_BANDWIDTH_UNSPECIFIED = 0; /** * Passive link bandwidth. This is a rough guide of the expected peak bandwidth * for the first hop on the given transport. It is not measured, but may take into account * link parameters (Radio technology, allocated channels, etc). */ private int mLinkUpBandwidthKbps; private int mLinkDownBandwidthKbps; private int mLinkUpBandwidthKbps = LINK_BANDWIDTH_UNSPECIFIED; private int mLinkDownBandwidthKbps = LINK_BANDWIDTH_UNSPECIFIED; /** * Sets the upstream bandwidth for this network in Kbps. This always only refers to Loading @@ -571,8 +642,9 @@ public final class NetworkCapabilities implements Parcelable { * @param upKbps the estimated first hop upstream (device to network) bandwidth. * @hide */ public void setLinkUpstreamBandwidthKbps(int upKbps) { public NetworkCapabilities setLinkUpstreamBandwidthKbps(int upKbps) { mLinkUpBandwidthKbps = upKbps; return this; } /** Loading Loading @@ -600,8 +672,9 @@ public final class NetworkCapabilities implements Parcelable { * @param downKbps the estimated first hop downstream (network to device) bandwidth. * @hide */ public void setLinkDownstreamBandwidthKbps(int downKbps) { public NetworkCapabilities setLinkDownstreamBandwidthKbps(int downKbps) { mLinkDownBandwidthKbps = downKbps; return this; } /** Loading @@ -628,6 +701,20 @@ public final class NetworkCapabilities implements Parcelable { return (this.mLinkUpBandwidthKbps == nc.mLinkUpBandwidthKbps && this.mLinkDownBandwidthKbps == nc.mLinkDownBandwidthKbps); } /** @hide */ public static int minBandwidth(int a, int b) { if (a == LINK_BANDWIDTH_UNSPECIFIED) { return b; } else if (b == LINK_BANDWIDTH_UNSPECIFIED) { return a; } else { return Math.min(a, b); } } /** @hide */ public static int maxBandwidth(int a, int b) { return Math.max(a, b); } private NetworkSpecifier mNetworkSpecifier = null; Loading Loading @@ -708,8 +795,9 @@ public final class NetworkCapabilities implements Parcelable { * @param signalStrength the bearer-specific signal strength. * @hide */ public void setSignalStrength(int signalStrength) { public NetworkCapabilities setSignalStrength(int signalStrength) { mSignalStrength = signalStrength; return this; } /** Loading Loading @@ -968,6 +1056,7 @@ public final class NetworkCapabilities implements Parcelable { case NET_CAPABILITY_NOT_VPN: return "NOT_VPN"; case NET_CAPABILITY_VALIDATED: return "VALIDATED"; case NET_CAPABILITY_CAPTIVE_PORTAL: return "CAPTIVE_PORTAL"; case NET_CAPABILITY_NOT_ROAMING: return "NOT_ROAMING"; case NET_CAPABILITY_FOREGROUND: return "FOREGROUND"; default: return Integer.toString(capability); } Loading
core/java/android/net/NetworkIdentity.java +2 −2 Original line number Diff line number Diff line Loading @@ -189,7 +189,8 @@ public class NetworkIdentity implements Comparable<NetworkIdentity> { String subscriberId = null; String networkId = null; boolean roaming = false; boolean roaming = !state.networkCapabilities.hasCapability( NetworkCapabilities.NET_CAPABILITY_NOT_ROAMING); boolean metered = !state.networkCapabilities.hasCapability( NetworkCapabilities.NET_CAPABILITY_NOT_METERED); Loading @@ -203,7 +204,6 @@ public class NetworkIdentity implements Comparable<NetworkIdentity> { } subscriberId = state.subscriberId; roaming = state.networkInfo.isRoaming(); } else if (type == TYPE_WIFI) { if (state.networkId != null) { Loading