Package org.robolectric.shadows
Class ShadowNetworkCapabilities
java.lang.Object
org.robolectric.shadows.ShadowNetworkCapabilities
@Implements(android.net.NetworkCapabilities.class)
public class ShadowNetworkCapabilities
extends Object
Robolectric provides overrides for fetching and updating transport.
- 
Field SummaryFields
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionaddCapability(int capability) Addscapabilityto the NetworkCapabilities.addTransportType(int transportType) Updates the transport types for this network capabilities to includetransportType.voidClears capabilities.static NetworkCapabilitiesremoveCapability(int capability) Removescapabilityfrom the NetworkCapabilities.removeTransportType(int transportType) Updates the transport types for this network capabilities to removetransportType.setLinkDownstreamBandwidthKbps(int kbps) Sets the LinkDownstreamBandwidthKbps of the NetworkCapabilities.protected voidsetLinkDownstreamBandwidthKbpsPrePie(int kbps) Sets the LinkDownstreamBandwidthKbps of the NetworkCapabilities.setLinkUpstreamBandwidthKbps(int kbps) Sets the LinkUpstreamBandwidthKbps of the NetworkCapabilities.protected voidsetLinkUpstreamBandwidthKbpsPrePie(int kbps) Sets the LinkUpstreamBandwidthKbps of the NetworkCapabilities.setNetworkSpecifier(NetworkSpecifier networkSpecifier) ChangesNetworkSpecifierfor this network capabilities.setNetworkSpecifier(String networkSpecifier) ChangesNetworkSpecifierfor this network capabilities.setTransportInfo(TransportInfo transportInfo) Sets thetransportInfoof the NetworkCapabilities.
- 
Field Details- 
realNetworkCapabilities
- 
NET_CAPABILITY_NOT_BANDWIDTH_CONSTRAINEDpublic static final int NET_CAPABILITY_NOT_BANDWIDTH_CONSTRAINED- See Also:
 
 
- 
- 
Constructor Details- 
ShadowNetworkCapabilitiespublic ShadowNetworkCapabilities()
 
- 
- 
Method Details- 
newInstance
- 
addTransportTypeUpdates the transport types for this network capabilities to includetransportType.
- 
removeTransportTypeUpdates the transport types for this network capabilities to removetransportType.
- 
addCapabilityAddscapabilityto the NetworkCapabilities.
- 
removeCapabilityRemovescapabilityfrom the NetworkCapabilities.
- 
setNetworkSpecifier@Implementation(minSdk=26) public NetworkCapabilities setNetworkSpecifier(NetworkSpecifier networkSpecifier) ChangesNetworkSpecifierfor this network capabilities. Works only on Android O and higher. For lower versions usesetNetworkSpecifier(String)
- 
setNetworkSpecifier@Implementation(minSdk=24, maxSdk=25) public NetworkCapabilities setNetworkSpecifier(String networkSpecifier) ChangesNetworkSpecifierfor this network capabilities. Works only on Android N_MR1 and lower. For higher versions usesetNetworkSpecifier(NetworkSpecifier)
- 
setTransportInfo@HiddenApi @Implementation(minSdk=29) public NetworkCapabilities setTransportInfo(TransportInfo transportInfo) Sets thetransportInfoof the NetworkCapabilities.
- 
setLinkDownstreamBandwidthKbpsPrePie@HiddenApi @Implementation(maxSdk=27, methodName="setLinkDownstreamBandwidthKbps") protected void setLinkDownstreamBandwidthKbpsPrePie(int kbps) Sets the LinkDownstreamBandwidthKbps of the NetworkCapabilities.
- 
setLinkDownstreamBandwidthKbps@HiddenApi @Implementation(minSdk=28) public NetworkCapabilities setLinkDownstreamBandwidthKbps(int kbps) Sets the LinkDownstreamBandwidthKbps of the NetworkCapabilities.Return type changed to NetworkCapabilitiesstarting from Pie.
- 
setLinkUpstreamBandwidthKbpsPrePie@HiddenApi @Implementation(maxSdk=27, methodName="setLinkUpstreamBandwidthKbps") protected void setLinkUpstreamBandwidthKbpsPrePie(int kbps) Sets the LinkUpstreamBandwidthKbps of the NetworkCapabilities.
- 
setLinkUpstreamBandwidthKbps@HiddenApi @Implementation(minSdk=28) public NetworkCapabilities setLinkUpstreamBandwidthKbps(int kbps) Sets the LinkUpstreamBandwidthKbps of the NetworkCapabilities.Return type changed to NetworkCapabilitiesstarting from Pie.
- 
clearCapabilitiespublic void clearCapabilities()Clears capabilities.
 
-