Really allow NetworkAgent immutable updates to NetworkCapabilities

This patch completes commit 1ebf219ed9 to
really allow updates of immutable capabilities to NetworkCapabilities of
NetworkAgents by using satisfiedByImmutableNetworkCapabilities instead
satisfiedByNetworkCapabilities.

Bug: 64125969
Test: runtest frameworks-net
Change-Id: I9beeb623792f0ee31abcd4ba9d0ba2451304fb2e
This commit is contained in:
Hugo Benichi
2017-08-18 14:41:22 +09:00
parent aabc00fad6
commit 7afbea0e6e

View File

@@ -4703,8 +4703,8 @@ public class ConnectivityService extends IConnectivityManager.Stub
private void updateCapabilities( private void updateCapabilities(
int oldScore, NetworkAgentInfo nai, NetworkCapabilities networkCapabilities) { int oldScore, NetworkAgentInfo nai, NetworkCapabilities networkCapabilities) {
// Once a NetworkAgent is connected, complain if some immutable capabilities are removed. // Once a NetworkAgent is connected, complain if some immutable capabilities are removed.
if (nai.everConnected && if (nai.everConnected && !nai.networkCapabilities.satisfiedByImmutableNetworkCapabilities(
!nai.networkCapabilities.satisfiedByNetworkCapabilities(networkCapabilities)) { networkCapabilities)) {
// TODO: consider not complaining when a network agent degrade its capabilities if this // TODO: consider not complaining when a network agent degrade its capabilities if this
// does not cause any request (that is not a listen) currently matching that agent to // does not cause any request (that is not a listen) currently matching that agent to
// stop being matched by the updated agent. // stop being matched by the updated agent.