Address comments on ag/14486203 am: 20c7cad598
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1744649 Change-Id: Icfbf8cb124277e54fad40d6d4e558b76d904fdba
This commit is contained in:
@@ -237,9 +237,9 @@ public class NetworkRanker {
|
|||||||
partitionInto(candidates, nai -> nai.getScore().hasPolicy(POLICY_TRANSPORT_PRIMARY),
|
partitionInto(candidates, nai -> nai.getScore().hasPolicy(POLICY_TRANSPORT_PRIMARY),
|
||||||
accepted, rejected);
|
accepted, rejected);
|
||||||
if (accepted.size() > 0) {
|
if (accepted.size() > 0) {
|
||||||
// Some networks are primary. For each transport, keep only the primary, but also
|
// Some networks are primary for their transport. For each transport, keep only the
|
||||||
// keep all networks for which there isn't a primary (which are now in the |rejected|
|
// primary, but also keep all networks for which there isn't a primary (which are now
|
||||||
// array).
|
// in the |rejected| array).
|
||||||
// So for each primary network, remove from |rejected| all networks with the same
|
// 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.
|
// transports as one of the primary networks. The remaining networks should be accepted.
|
||||||
for (final T defaultSubNai : accepted) {
|
for (final T defaultSubNai : accepted) {
|
||||||
@@ -247,6 +247,8 @@ public class NetworkRanker {
|
|||||||
rejected.removeIf(
|
rejected.removeIf(
|
||||||
nai -> Arrays.equals(transports, nai.getCapsNoCopy().getTransportTypes()));
|
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);
|
accepted.addAll(rejected);
|
||||||
candidates = new ArrayList<>(accepted);
|
candidates = new ArrayList<>(accepted);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user