public abstract class BaseNetworkStateTracker extends Object implements NetworkStateTracker
ConnectivityManager
. Surfaces events
through the registered Handler
to enable ConnectivityManager
to respond to state changes over time.Modifier and Type | Field and Description |
---|---|
protected Context |
mContext |
protected LinkCapabilities |
mLinkCapabilities |
protected LinkProperties |
mLinkProperties |
protected NetworkInfo |
mNetworkInfo |
static String |
PROP_TCP_BUFFER_UNKNOWN |
static String |
PROP_TCP_BUFFER_WIFI |
EVENT_CONFIGURATION_CHANGED, EVENT_NETWORK_SUBTYPE_CHANGED, EVENT_RESTORE_DEFAULT_NETWORK, EVENT_STATE_CHANGED
Constructor and Description |
---|
BaseNetworkStateTracker(int networkType) |
Modifier and Type | Method and Description |
---|---|
void |
captivePortalCheckComplete()
Ready to switch on to the network after captive portal check
|
void |
defaultRouteSet(boolean enabled)
Set a flag indicating default route is set for the network
|
protected void |
dispatchConfigurationChanged() |
protected void |
dispatchStateChanged() |
LinkCapabilities |
getLinkCapabilities()
A capability is an Integer/String pair, the capabilities
are defined in the class LinkSocket#Key.
|
LinkProperties |
getLinkProperties()
Return the LinkProperties for the connection.
|
NetworkInfo |
getNetworkInfo()
Fetch NetworkInfo for the network
|
protected Handler |
getTargetHandler()
Deprecated.
|
boolean |
isAvailable()
Returns an indication of whether this network is available for
connections.
|
boolean |
isDefaultRouteSet()
Check if default route is set
|
boolean |
isPrivateDnsRouteSet()
Check if private DNS route is set for the network
|
boolean |
isTeardownRequested()
Check if tear down was requested
|
void |
privateDnsRouteSet(boolean enabled)
Set a flag indicating private DNS route is set
|
void |
setDependencyMet(boolean met)
An external dependency has been met/unmet
|
void |
setPolicyDataEnable(boolean enabled)
Policy control of data connection through this network, typically not
persisted internally.
|
boolean |
setRadio(boolean turnOn)
Turn the wireless radio off for a network.
|
void |
setTeardownRequested(boolean isRequested)
Indicate tear down requested from connectivity
|
void |
setUserDataEnable(boolean enabled)
User control of data connection through this network, typically persisted
internally.
|
void |
startMonitoring(Context context,
Handler target)
Begin monitoring data connectivity.
|
protected abstract void |
startMonitoringInternal() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getTcpBufferSizesPropName, reconnect, teardown
public static final String PROP_TCP_BUFFER_UNKNOWN
public static final String PROP_TCP_BUFFER_WIFI
protected Context mContext
protected NetworkInfo mNetworkInfo
protected LinkProperties mLinkProperties
protected LinkCapabilities mLinkCapabilities
@Deprecated protected Handler getTargetHandler()
protected final void dispatchStateChanged()
protected final void dispatchConfigurationChanged()
public final void startMonitoring(Context context, Handler target)
NetworkStateTracker
startMonitoring
in interface NetworkStateTracker
context
- is the current Android contexttarget
- is the Hander to which to return the events.protected abstract void startMonitoringInternal()
public final NetworkInfo getNetworkInfo()
NetworkStateTracker
getNetworkInfo
in interface NetworkStateTracker
public final LinkProperties getLinkProperties()
NetworkStateTracker
getLinkProperties
in interface NetworkStateTracker
public final LinkCapabilities getLinkCapabilities()
NetworkStateTracker
getLinkCapabilities
in interface NetworkStateTracker
public void captivePortalCheckComplete()
NetworkStateTracker
captivePortalCheckComplete
in interface NetworkStateTracker
public boolean setRadio(boolean turnOn)
NetworkStateTracker
setRadio
in interface NetworkStateTracker
turnOn
- true
to turn the radio on, false
public boolean isAvailable()
NetworkStateTracker
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 devicesisAvailable
in interface NetworkStateTracker
public void setUserDataEnable(boolean enabled)
NetworkStateTracker
setUserDataEnable
in interface NetworkStateTracker
public void setPolicyDataEnable(boolean enabled)
NetworkStateTracker
NetworkPolicy.limitBytes
is passed.setPolicyDataEnable
in interface NetworkStateTracker
public boolean isPrivateDnsRouteSet()
NetworkStateTracker
isPrivateDnsRouteSet
in interface NetworkStateTracker
public void privateDnsRouteSet(boolean enabled)
NetworkStateTracker
privateDnsRouteSet
in interface NetworkStateTracker
public boolean isDefaultRouteSet()
NetworkStateTracker
isDefaultRouteSet
in interface NetworkStateTracker
public void defaultRouteSet(boolean enabled)
NetworkStateTracker
defaultRouteSet
in interface NetworkStateTracker
public boolean isTeardownRequested()
NetworkStateTracker
isTeardownRequested
in interface NetworkStateTracker
public void setTeardownRequested(boolean isRequested)
NetworkStateTracker
setTeardownRequested
in interface NetworkStateTracker
public void setDependencyMet(boolean met)
NetworkStateTracker
setDependencyMet
in interface NetworkStateTracker