[NS B08] More simplification
Only computing the reassignment does not actually change the default network. Test: FrameworksNetTests Change-Id: I21ddf5cc1e3d3817055dbda4246e38ceb0732407
This commit is contained in:
@@ -6692,18 +6692,17 @@ public class ConnectivityService extends IConnectivityManager.Stub
|
|||||||
private void rematchAllNetworksAndRequests() {
|
private void rematchAllNetworksAndRequests() {
|
||||||
// TODO: This may be slow, and should be optimized.
|
// TODO: This may be slow, and should be optimized.
|
||||||
final long now = SystemClock.elapsedRealtime();
|
final long now = SystemClock.elapsedRealtime();
|
||||||
final NetworkAgentInfo oldDefaultNetwork = getDefaultNetwork();
|
|
||||||
final NetworkReassignment changes = computeNetworkReassignment();
|
final NetworkReassignment changes = computeNetworkReassignment();
|
||||||
if (VDBG || DDBG) {
|
if (VDBG || DDBG) {
|
||||||
log(changes.debugString());
|
log(changes.debugString());
|
||||||
} else if (DBG) {
|
} else if (DBG) {
|
||||||
log(changes.toString()); // Shorter form, only one line of log
|
log(changes.toString()); // Shorter form, only one line of log
|
||||||
}
|
}
|
||||||
applyNetworkReassignment(changes, oldDefaultNetwork, now);
|
applyNetworkReassignment(changes, now);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void applyNetworkReassignment(@NonNull final NetworkReassignment changes,
|
private void applyNetworkReassignment(@NonNull final NetworkReassignment changes,
|
||||||
@Nullable final NetworkAgentInfo oldDefaultNetwork, final long now) {
|
final long now) {
|
||||||
// First, update the lists of satisfied requests in the network agents. This is necessary
|
// First, update the lists of satisfied requests in the network agents. This is necessary
|
||||||
// because some code later depends on this state to be correct, most prominently computing
|
// because some code later depends on this state to be correct, most prominently computing
|
||||||
// the linger status.
|
// the linger status.
|
||||||
@@ -6713,6 +6712,7 @@ public class ConnectivityService extends IConnectivityManager.Stub
|
|||||||
event.mNewNetwork, now);
|
event.mNewNetwork, now);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
final NetworkAgentInfo oldDefaultNetwork = getDefaultNetwork();
|
||||||
final NetworkRequestInfo defaultRequestInfo = mNetworkRequests.get(mDefaultRequest);
|
final NetworkRequestInfo defaultRequestInfo = mNetworkRequests.get(mDefaultRequest);
|
||||||
final NetworkReassignment.RequestReassignment reassignment =
|
final NetworkReassignment.RequestReassignment reassignment =
|
||||||
changes.getReassignment(defaultRequestInfo);
|
changes.getReassignment(defaultRequestInfo);
|
||||||
|
|||||||
Reference in New Issue
Block a user