public class NetworkAgentInfo extends Object implements Comparable<NetworkAgentInfo>
Modifier and Type | Class and Description |
---|---|
static class |
NetworkAgentInfo.LingerTimer |
Modifier and Type | Field and Description |
---|---|
AsyncChannel |
asyncChannel |
boolean |
avoidUnvalidated |
Nat464Xlat |
clatd |
boolean |
created |
static int |
EVENT_NETWORK_LINGER_COMPLETE
Inform ConnectivityService that the network LINGER period has
expired.
|
boolean |
everCaptivePortalDetected |
boolean |
everConnected |
boolean |
everValidated |
boolean |
lastCaptivePortalDetected |
boolean |
lastValidated |
LinkProperties |
linkProperties |
Messenger |
messenger |
Network |
network |
NetworkCapabilities |
networkCapabilities |
NetworkInfo |
networkInfo |
NetworkMisc |
networkMisc |
NetworkMonitor |
networkMonitor |
Constructor and Description |
---|
NetworkAgentInfo(Messenger messenger,
AsyncChannel ac,
Network net,
NetworkInfo info,
LinkProperties lp,
NetworkCapabilities nc,
int score,
Context context,
Handler handler,
NetworkMisc misc,
NetworkRequest defaultRequest,
ConnectivityService connService) |
Modifier and Type | Method and Description |
---|---|
boolean |
addRequest(NetworkRequest networkRequest)
Add
networkRequest to this network as it's satisfied by this network. |
void |
clearLingerState() |
int |
compareTo(NetworkAgentInfo other)
Compares this object with the specified object for order.
|
void |
dumpLingerTimers(PrintWriter pw) |
int |
getCurrentScore() |
int |
getCurrentScoreAsValidated() |
long |
getLingerExpiry() |
NetworkState |
getNetworkState() |
boolean |
isBackgroundNetwork()
Returns whether the network is a background network.
|
boolean |
isLingering() |
boolean |
isSatisfyingRequest(int id)
Returns whether this network is currently satisfying the request with the specified ID.
|
boolean |
isVPN() |
void |
linger() |
void |
lingerRequest(NetworkRequest request,
long now,
long duration)
Sets the specified request to linger on this network for the specified time.
|
String |
name() |
int |
numBackgroundNetworkRequests()
Returns the number of requests currently satisfied by this network of type
android.net.NetworkRequest.Type.BACKGROUND_REQUEST . |
int |
numForegroundNetworkRequests()
Returns the number of foreground requests currently satisfied by this network.
|
int |
numNetworkRequests()
Returns the number of requests of any type currently satisfied by this network.
|
int |
numRequestNetworkRequests()
Returns the number of requests currently satisfied by this network for which
NetworkRequest.isRequest() returns true . |
void |
removeRequest(int requestId)
Remove the specified request from this network.
|
NetworkRequest |
requestAt(int index)
Returns the request at the specified position in the list of requests satisfied by this
network.
|
boolean |
satisfies(NetworkRequest request) |
boolean |
satisfiesImmutableCapabilitiesOf(NetworkRequest request) |
void |
setCurrentScore(int newScore) |
String |
toString()
Returns a string representation of the object.
|
void |
unlinger() |
boolean |
unlingerRequest(NetworkRequest request)
Cancel lingering.
|
void |
updateLingerTimer() |
public NetworkInfo networkInfo
public final Network network
public LinkProperties linkProperties
public NetworkCapabilities networkCapabilities
public final NetworkMonitor networkMonitor
public final NetworkMisc networkMisc
public boolean created
public boolean everConnected
public boolean everValidated
public boolean lastValidated
public boolean avoidUnvalidated
public boolean everCaptivePortalDetected
public boolean lastCaptivePortalDetected
public static final int EVENT_NETWORK_LINGER_COMPLETE
public final Messenger messenger
public final AsyncChannel asyncChannel
public Nat464Xlat clatd
public NetworkAgentInfo(Messenger messenger, AsyncChannel ac, Network net, NetworkInfo info, LinkProperties lp, NetworkCapabilities nc, int score, Context context, Handler handler, NetworkMisc misc, NetworkRequest defaultRequest, ConnectivityService connService)
public boolean addRequest(NetworkRequest networkRequest)
networkRequest
to this network as it's satisfied by this network.networkRequest
was added or false if networkRequest
was
already present.public void removeRequest(int requestId)
public boolean isSatisfyingRequest(int id)
public NetworkRequest requestAt(int index)
public int numRequestNetworkRequests()
NetworkRequest.isRequest()
returns true
.public int numBackgroundNetworkRequests()
android.net.NetworkRequest.Type.BACKGROUND_REQUEST
.public int numForegroundNetworkRequests()
public int numNetworkRequests()
public boolean isBackgroundNetwork()
public boolean satisfies(NetworkRequest request)
public boolean satisfiesImmutableCapabilitiesOf(NetworkRequest request)
public boolean isVPN()
public int getCurrentScore()
public int getCurrentScoreAsValidated()
public void setCurrentScore(int newScore)
public NetworkState getNetworkState()
public void lingerRequest(NetworkRequest request, long now, long duration)
public boolean unlingerRequest(NetworkRequest request)
public long getLingerExpiry()
public void updateLingerTimer()
public void linger()
public void unlinger()
public boolean isLingering()
public void clearLingerState()
public void dumpLingerTimers(PrintWriter pw)
public String toString()
Object
toString
method returns a string that
"textually represents" this object. The result should
be a concise but informative representation that is easy for a
person to read.
It is recommended that all subclasses override this method.
The toString
method for class Object
returns a string consisting of the name of the class of which the
object is an instance, the at-sign character `@
', and
the unsigned hexadecimal representation of the hash code of the
object. In other words, this method returns a string equal to the
value of:
getClass().getName() + '@' + Integer.toHexString(hashCode())
public String name()
public int compareTo(NetworkAgentInfo other)
Comparable
The implementor must ensure sgn(x.compareTo(y)) == -sgn(y.compareTo(x)) for all x and y. (This implies that x.compareTo(y) must throw an exception iff y.compareTo(x) throws an exception.)
The implementor must also ensure that the relation is transitive: (x.compareTo(y)>0 && y.compareTo(z)>0) implies x.compareTo(z)>0.
Finally, the implementor must ensure that x.compareTo(y)==0 implies that sgn(x.compareTo(z)) == sgn(y.compareTo(z)), for all z.
It is strongly recommended, but not strictly required that (x.compareTo(y)==0) == (x.equals(y)). Generally speaking, any class that implements the Comparable interface and violates this condition should clearly indicate this fact. The recommended language is "Note: this class has a natural ordering that is inconsistent with equals."
In the foregoing description, the notation sgn(expression) designates the mathematical signum function, which is defined to return one of -1, 0, or 1 according to whether the value of expression is negative, zero or positive.
compareTo
in interface Comparable<NetworkAgentInfo>
other
- the object to be compared.