[NS A41] Cut out a function to update NAI info
Test: ConnectivityServiceTest Change-Id: I6d92fb1699eb0acb1bcd7baa4a5d9d3e1c0dc728
This commit is contained in:
@@ -6636,6 +6636,14 @@ public class ConnectivityService extends IConnectivityManager.Stub
|
||||
final NetworkAgentInfo newSatisfier = entry.getValue();
|
||||
changes.addRequestReassignment(new NetworkReassignment.RequestReassignment(
|
||||
nri, previousSatisfier, newSatisfier));
|
||||
updateSatisfiersForRematchRequest(nri, previousSatisfier, newSatisfier, now);
|
||||
}
|
||||
}
|
||||
|
||||
private void updateSatisfiersForRematchRequest(@NonNull final NetworkRequestInfo nri,
|
||||
@Nullable final NetworkAgentInfo previousSatisfier,
|
||||
@Nullable final NetworkAgentInfo newSatisfier,
|
||||
final long now) {
|
||||
if (newSatisfier != null) {
|
||||
if (VDBG) log("rematch for " + newSatisfier.name());
|
||||
if (previousSatisfier != null) {
|
||||
@@ -6652,22 +6660,14 @@ public class ConnectivityService extends IConnectivityManager.Stub
|
||||
Slog.wtf(TAG, "BUG: " + newSatisfier.name() + " already has " + nri.request);
|
||||
}
|
||||
} else {
|
||||
// If "newNetwork" is listed as satisfying "nri" but no longer satisfies "nri",
|
||||
// mark it as no longer satisfying "nri". Because networks are processed by
|
||||
// rematchAllNetworksAndRequests() in descending score order, "currentNetwork" will
|
||||
// match "newNetwork" before this loop will encounter a "currentNetwork" with higher
|
||||
// score than "newNetwork" and where "currentNetwork" no longer satisfies "nri".
|
||||
// This means this code doesn't have to handle the case where "currentNetwork" no
|
||||
// longer satisfies "nri" when "currentNetwork" does not equal "newNetwork".
|
||||
if (DBG) {
|
||||
log("Network " + newNetwork.name() + " stopped satisfying" +
|
||||
" request " + nri.request.requestId);
|
||||
log("Network " + previousSatisfier.name() + " stopped satisfying"
|
||||
+ " request " + nri.request.requestId);
|
||||
}
|
||||
newNetwork.removeRequest(nri.request.requestId);
|
||||
previousSatisfier.removeRequest(nri.request.requestId);
|
||||
}
|
||||
nri.mSatisfier = newSatisfier;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Attempt to rematch all Networks with NetworkRequests. This may result in Networks
|
||||
|
||||
Reference in New Issue
Block a user