summaryrefslogtreecommitdiff
path: root/service
diff options
context:
space:
mode:
Diffstat (limited to 'service')
-rw-r--r--service/java/com/android/server/wifi/BubbleFunScorer.java4
-rw-r--r--service/java/com/android/server/wifi/CompatibilityScorer.java4
-rw-r--r--service/java/com/android/server/wifi/ScoreCardBasedScorer.java4
-rw-r--r--service/java/com/android/server/wifi/WifiCandidates.java18
4 files changed, 12 insertions, 18 deletions
diff --git a/service/java/com/android/server/wifi/BubbleFunScorer.java b/service/java/com/android/server/wifi/BubbleFunScorer.java
index e5bda737c..b5da5f03e 100644
--- a/service/java/com/android/server/wifi/BubbleFunScorer.java
+++ b/service/java/com/android/server/wifi/BubbleFunScorer.java
@@ -117,9 +117,9 @@ final class BubbleFunScorer implements WifiCandidates.CandidateScorer {
}
@Override
- public ScoredCandidate scoreCandidates(@NonNull Collection<Candidate> group) {
+ public ScoredCandidate scoreCandidates(@NonNull Collection<Candidate> candidates) {
ScoredCandidate choice = ScoredCandidate.NONE;
- for (Candidate candidate : group) {
+ for (Candidate candidate : candidates) {
ScoredCandidate scoredCandidate = scoreCandidate(candidate);
if (scoredCandidate.value > choice.value) {
choice = scoredCandidate;
diff --git a/service/java/com/android/server/wifi/CompatibilityScorer.java b/service/java/com/android/server/wifi/CompatibilityScorer.java
index 26ff1c293..1bb55b9a2 100644
--- a/service/java/com/android/server/wifi/CompatibilityScorer.java
+++ b/service/java/com/android/server/wifi/CompatibilityScorer.java
@@ -102,9 +102,9 @@ final class CompatibilityScorer implements WifiCandidates.CandidateScorer {
}
@Override
- public ScoredCandidate scoreCandidates(@NonNull Collection<Candidate> group) {
+ public ScoredCandidate scoreCandidates(@NonNull Collection<Candidate> candidates) {
ScoredCandidate choice = ScoredCandidate.NONE;
- for (Candidate candidate : group) {
+ for (Candidate candidate : candidates) {
ScoredCandidate scoredCandidate = scoreCandidate(candidate);
if (scoredCandidate.value > choice.value) {
choice = scoredCandidate;
diff --git a/service/java/com/android/server/wifi/ScoreCardBasedScorer.java b/service/java/com/android/server/wifi/ScoreCardBasedScorer.java
index 7e290caca..96c8e6c09 100644
--- a/service/java/com/android/server/wifi/ScoreCardBasedScorer.java
+++ b/service/java/com/android/server/wifi/ScoreCardBasedScorer.java
@@ -124,9 +124,9 @@ final class ScoreCardBasedScorer implements WifiCandidates.CandidateScorer {
}
@Override
- public ScoredCandidate scoreCandidates(@NonNull Collection<Candidate> group) {
+ public ScoredCandidate scoreCandidates(@NonNull Collection<Candidate> candidates) {
ScoredCandidate choice = ScoredCandidate.NONE;
- for (Candidate candidate : group) {
+ for (Candidate candidate : candidates) {
ScoredCandidate scoredCandidate = scoreCandidate(candidate);
if (scoredCandidate.value > choice.value) {
choice = scoredCandidate;
diff --git a/service/java/com/android/server/wifi/WifiCandidates.java b/service/java/com/android/server/wifi/WifiCandidates.java
index 334b8d83b..ec34b6ece 100644
--- a/service/java/com/android/server/wifi/WifiCandidates.java
+++ b/service/java/com/android/server/wifi/WifiCandidates.java
@@ -260,10 +260,9 @@ public class WifiCandidates {
String getIdentifier();
/**
- * Calculates the score for a group of candidates that belong
- * to the same network.
+ * Calculates the best score for a collection of candidates.
*/
- @Nullable ScoredCandidate scoreCandidates(@NonNull Collection<Candidate> group);
+ @Nullable ScoredCandidate scoreCandidates(@NonNull Collection<Candidate> candidates);
}
@@ -404,7 +403,7 @@ public class WifiCandidates {
*/
public boolean remove(Candidate candidate) {
if (!(candidate instanceof CandidateImpl)) return failure();
- return mCandidates.remove(((CandidateImpl) candidate).key, (CandidateImpl) candidate);
+ return mCandidates.remove(((CandidateImpl) candidate).key, candidate);
}
/**
@@ -437,14 +436,9 @@ public class WifiCandidates {
*/
public @NonNull ScoredCandidate choose(@NonNull CandidateScorer candidateScorer) {
Preconditions.checkNotNull(candidateScorer);
- ScoredCandidate choice = ScoredCandidate.NONE;
- for (Collection<Candidate> group : getGroupedCandidates()) {
- ScoredCandidate scoredCandidate = candidateScorer.scoreCandidates(group);
- if (scoredCandidate != null && scoredCandidate.value > choice.value) {
- choice = scoredCandidate;
- }
- }
- return choice;
+ Collection<Candidate> candidates = new ArrayList<>(mCandidates.values());
+ ScoredCandidate choice = candidateScorer.scoreCandidates(candidates);
+ return choice == null ? ScoredCandidate.NONE : choice;
}
/**