Address comments on ag/14486203

Bug: 186458024
Test: comment-only change
Change-Id: I7b086abbb57354086e8fb1a41c63140f2227173f
This commit is contained in:
Chalard Jean
2021-05-14 17:31:30 +09:00
parent bdcc8678a1
commit 8e27d76e43

View File

@@ -237,9 +237,9 @@ public class NetworkRanker {
partitionInto(candidates, nai -> nai.getScore().hasPolicy(POLICY_TRANSPORT_PRIMARY),
accepted, rejected);
if (accepted.size() > 0) {
// Some networks are primary. For each transport, keep only the primary, but also
// keep all networks for which there isn't a primary (which are now in the |rejected|
// array).
// Some networks are primary for their transport. For each transport, keep only the
// primary, but also keep all networks for which there isn't a primary (which are now
// in the |rejected| array).
// So for each primary network, remove from |rejected| all networks with the same
// transports as one of the primary networks. The remaining networks should be accepted.
for (final T defaultSubNai : accepted) {
@@ -247,6 +247,8 @@ public class NetworkRanker {
rejected.removeIf(
nai -> Arrays.equals(transports, nai.getCapsNoCopy().getTransportTypes()));
}
// Now the |rejected| list contains networks with transports for which there isn't
// a primary network. Add them back to the candidates.
accepted.addAll(rejected);
candidates = new ArrayList<>(accepted);
}