FileDocCategorySizeDatePackage
NetworkStateTracker.javaAPI DocAndroid 5.1 API7327Thu Mar 12 22:22:10 GMT 2015android.net

NetworkStateTracker

public interface NetworkStateTracker
Interface provides the {@link com.android.server.ConnectivityService} with three services. Events to the ConnectivityService when changes occur, an API for controlling the network and storage for network specific information. The Connectivity will call startMonitoring before any other method is called. {@hide}

Fields Summary
public static final int
EVENT_STATE_CHANGED
The network state has changed and the NetworkInfo object contains the new state. msg.what = EVENT_STATE_CHANGED msg.obj = NetworkInfo object
public static final int
EVENT_CONFIGURATION_CHANGED
msg.what = EVENT_CONFIGURATION_CHANGED msg.obj = NetworkInfo object
public static final int
EVENT_RESTORE_DEFAULT_NETWORK
msg.what = EVENT_RESTORE_DEFAULT_NETWORK msg.obj = FeatureUser object
public static final int
EVENT_NETWORK_SUBTYPE_CHANGED
msg.what = EVENT_NETWORK_SUBTYPE_CHANGED msg.obj = NetworkInfo object
public static final int
EVENT_NETWORK_CONNECTED
msg.what = EVENT_NETWORK_CONNECTED msg.obj = LinkProperties object
public static final int
EVENT_NETWORK_DISCONNECTED
msg.what = EVENT_NETWORK_CONNECTION_DISCONNECTED msg.obj = LinkProperties object, same iface name
Constructors Summary
Methods Summary
public voidcaptivePortalCheckCompleted(boolean isCaptive)
Captive portal check has completed

public voiddefaultRouteSet(boolean enabled)
Set a flag indicating default route is set for the network

public LinkPropertiesgetLinkProperties()
Return the LinkProperties for the connection.

return
a copy of the LinkProperties, is never null.

public LinkQualityInfogetLinkQualityInfo()
Get interesting information about this network link

return
a copy of link information, null if not available

public NetworkgetNetwork()

public NetworkCapabilitiesgetNetworkCapabilities()

return
a copy of this connections capabilities, may be empty but never null.

public NetworkInfogetNetworkInfo()
Fetch NetworkInfo for the network

public java.lang.StringgetNetworkInterfaceName()

public java.lang.StringgetTcpBufferSizesPropName()
Return the system properties name associated with the tcp buffer sizes for this network.

public booleanisAvailable()
Returns an indication of whether this network is available for connections. A value of {@code false} means that some quasi-permanent condition prevents connectivity to this network. NOTE that this is broken on multi-connection devices. Should be fixed in J release TODO - fix on multi-pdp devices

public booleanisDefaultRouteSet()
Check if default route is set

public booleanisPrivateDnsRouteSet()
Check if private DNS route is set for the network

public booleanisTeardownRequested()
Check if tear down was requested

public voidprivateDnsRouteSet(boolean enabled)
Set a flag indicating private DNS route is set

public booleanreconnect()
Reenable connectivity to a network after a {@link #teardown()}.

return
{@code true} if we're connected or expect to be connected

public voidsetDependencyMet(boolean met)
An external dependency has been met/unmet

public voidsetNetId(int netId)

public voidsetPolicyDataEnable(boolean enabled)
Policy control of data connection through this network, typically not persisted internally. Usually used when {@link NetworkPolicy#limitBytes} is passed.

public booleansetRadio(boolean turnOn)
Turn the wireless radio off for a network.

param
turnOn {@code true} to turn the radio on, {@code false}

public voidsetTeardownRequested(boolean isRequested)
Indicate tear down requested from connectivity

public voidsetUserDataEnable(boolean enabled)
User control of data connection through this network, typically persisted internally.

public voidstartMonitoring(android.content.Context context, android.os.Handler target)
Begin monitoring data connectivity. This is the first method called when this interface is used.

param
context is the current Android context
param
target is the Hander to which to return the events.

public voidstartSampling(SamplingDataTracker.SamplingSnapshot s)

public voidstopSampling(SamplingDataTracker.SamplingSnapshot s)

public voidsupplyMessenger(android.os.Messenger messenger)

public booleanteardown()
Disable connectivity to a network

return
{@code true} if a teardown occurred, {@code false} if the teardown did not occur.