[NS B05] Remove old dead code
Test: FrameworksNetTests Change-Id: I553721b327b76ede0e76b9fb7a0130fcae012175
This commit is contained in:
@@ -6625,81 +6625,6 @@ public class ConnectivityService extends IConnectivityManager.Stub
|
||||
}
|
||||
}
|
||||
|
||||
// TODO : remove this when it's useless
|
||||
@NonNull private NetworkReassignment computeInitialReassignment() {
|
||||
final NetworkReassignment change = new NetworkReassignment();
|
||||
for (NetworkRequestInfo nri : mNetworkRequests.values()) {
|
||||
change.addRequestReassignment(new NetworkReassignment.RequestReassignment(nri,
|
||||
nri.mSatisfier, nri.mSatisfier));
|
||||
}
|
||||
return change;
|
||||
}
|
||||
|
||||
private void computeRequestReassignmentForNetwork(@NonNull final NetworkReassignment changes,
|
||||
@NonNull final NetworkAgentInfo newNetwork) {
|
||||
final int score = newNetwork.getCurrentScore();
|
||||
for (NetworkRequestInfo nri : mNetworkRequests.values()) {
|
||||
// Process requests in the first pass and listens in the second pass. This allows us to
|
||||
// change a network's capabilities depending on which requests it has. This is only
|
||||
// correct if the change in capabilities doesn't affect whether the network satisfies
|
||||
// requests or not, and doesn't affect the network's score.
|
||||
if (nri.request.isListen()) continue;
|
||||
|
||||
// The reassignment has been seeded with the initial assignment, therefore
|
||||
// getReassignment can't be null and mNewNetwork is only null if there was no
|
||||
// satisfier in the first place or there was an explicit reassignment to null.
|
||||
final NetworkAgentInfo currentNetwork = changes.getReassignment(nri).mNewNetwork;
|
||||
final boolean satisfies = newNetwork.satisfies(nri.request);
|
||||
if (newNetwork == currentNetwork && satisfies) continue;
|
||||
|
||||
// check if it satisfies the NetworkCapabilities
|
||||
if (VDBG) log(" checking if request is satisfied: " + nri.request);
|
||||
if (satisfies) {
|
||||
// next check if it's better than any current network we're using for
|
||||
// this request
|
||||
if (VDBG || DDBG) {
|
||||
log("currentScore = "
|
||||
+ (currentNetwork != null ? currentNetwork.getCurrentScore() : 0)
|
||||
+ ", newScore = " + score);
|
||||
}
|
||||
if (currentNetwork == null || currentNetwork.getCurrentScore() < score) {
|
||||
changes.addRequestReassignment(new NetworkReassignment.RequestReassignment(
|
||||
nri, currentNetwork, newNetwork));
|
||||
}
|
||||
} else if (newNetwork == currentNetwork) {
|
||||
changes.addRequestReassignment(new NetworkReassignment.RequestReassignment(
|
||||
nri, currentNetwork, null));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Handles a network appearing or improving its score.
|
||||
//
|
||||
// - Evaluates all current NetworkRequests that can be
|
||||
// satisfied by newNetwork, and reassigns to newNetwork
|
||||
// any such requests for which newNetwork is the best.
|
||||
//
|
||||
// - Writes into the passed reassignment object all changes that should be done for
|
||||
// rematching this network with all requests, to be applied later.
|
||||
//
|
||||
// TODO : stop writing to the passed reassignment. This is temporarily more useful, but
|
||||
// it's unidiomatic Java and it's hard to read.
|
||||
//
|
||||
// @param changes a currently-building list of changes to write to
|
||||
// @param newNetwork is the network to be matched against NetworkRequests.
|
||||
// @param now the time the rematch starts, as returned by SystemClock.elapsedRealtime();
|
||||
private void rematchNetworkAndRequests(@NonNull final NetworkReassignment changes,
|
||||
@NonNull final NetworkAgentInfo newNetwork) {
|
||||
if (!newNetwork.everConnected) return;
|
||||
|
||||
changes.addRematchedNetwork(new NetworkReassignment.NetworkBgStatePair(newNetwork,
|
||||
newNetwork.isBackgroundNetwork()));
|
||||
|
||||
if (VDBG || DDBG) log("rematching " + newNetwork.toShortString());
|
||||
|
||||
computeRequestReassignmentForNetwork(changes, newNetwork);
|
||||
}
|
||||
|
||||
private void updateSatisfiersForRematchRequest(@NonNull final NetworkRequestInfo nri,
|
||||
@Nullable final NetworkAgentInfo previousSatisfier,
|
||||
@Nullable final NetworkAgentInfo newSatisfier,
|
||||
|
||||
Reference in New Issue
Block a user