[NS A21] More cleanup
Test: FrameworksNetTests NetworkStackTests Change-Id: I4771f2e9151ff16a7045d9c3025ac686f244b22d
This commit is contained in:
@@ -6468,8 +6468,9 @@ public class ConnectivityService extends IConnectivityManager.Stub
|
|||||||
// before LegacyTypeTracker sends legacy broadcasts
|
// before LegacyTypeTracker sends legacy broadcasts
|
||||||
for (NetworkRequestInfo nri : addedRequests) notifyNetworkAvailable(newNetwork, nri);
|
for (NetworkRequestInfo nri : addedRequests) notifyNetworkAvailable(newNetwork, nri);
|
||||||
|
|
||||||
// Second pass: process all listens.
|
// Maybe the network changed background states. Update its capabilities.
|
||||||
if (wasBackgroundNetwork != newNetwork.isBackgroundNetwork()) {
|
final boolean backgroundChanged = wasBackgroundNetwork != newNetwork.isBackgroundNetwork();
|
||||||
|
if (backgroundChanged) {
|
||||||
final NetworkCapabilities newNc = mixInCapabilities(newNetwork,
|
final NetworkCapabilities newNc = mixInCapabilities(newNetwork,
|
||||||
newNetwork.networkCapabilities);
|
newNetwork.networkCapabilities);
|
||||||
|
|
||||||
@@ -6486,13 +6487,10 @@ public class ConnectivityService extends IConnectivityManager.Stub
|
|||||||
synchronized (newNetwork) {
|
synchronized (newNetwork) {
|
||||||
newNetwork.setNetworkCapabilities(newNc);
|
newNetwork.setNetworkCapabilities(newNc);
|
||||||
}
|
}
|
||||||
|
|
||||||
// The requestable capabilities and the score can't have changed, therefore the change
|
|
||||||
// in background can't affect any requests. Only processing the listens is fine.
|
|
||||||
processListenRequests(newNetwork, true);
|
|
||||||
} else {
|
|
||||||
processListenRequests(newNetwork, false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Finally, process listen requests.
|
||||||
|
processListenRequests(newNetwork, backgroundChanged);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user