summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--service/java/com/android/server/wifi/BubbleFunScorer.java44
-rw-r--r--service/java/com/android/server/wifi/CompatibilityScorer.java10
-rw-r--r--service/java/com/android/server/wifi/ScoreCardBasedScorer.java10
-rw-r--r--service/java/com/android/server/wifi/WifiCandidates.java14
-rw-r--r--service/java/com/android/server/wifi/WifiNetworkSelector.java2
-rw-r--r--tests/wifitests/src/com/android/server/wifi/CandidateScorerTest.java4
-rw-r--r--tests/wifitests/src/com/android/server/wifi/WifiNetworkSelectorTest.java7
7 files changed, 39 insertions, 52 deletions
diff --git a/service/java/com/android/server/wifi/BubbleFunScorer.java b/service/java/com/android/server/wifi/BubbleFunScorer.java
index 497c22dce..e5bda737c 100644
--- a/service/java/com/android/server/wifi/BubbleFunScorer.java
+++ b/service/java/com/android/server/wifi/BubbleFunScorer.java
@@ -33,12 +33,14 @@ final class BubbleFunScorer implements WifiCandidates.CandidateScorer {
* This should match WifiNetworkSelector.experimentIdFromIdentifier(getIdentifier())
* when using the default ScoringParams.
*/
- public static final int BUBBLE_FUN_SCORER_DEFAULT_EXPID = 42598151;
+ public static final int BUBBLE_FUN_SCORER_DEFAULT_EXPID = 42598152;
- private static final double SECURITY_AWARD = 80.0;
- private static final double CURRENT_NETWORK_BOOST = 80.0;
- private static final double LOW_BAND_FACTOR = 0.3;
+ private static final double SECURITY_AWARD = 44.0;
+ private static final double CURRENT_NETWORK_BOOST = 22.0;
+ private static final double LAST_SELECTION_BOOST = 250.0;
+ private static final double LOW_BAND_FACTOR = 0.25;
private static final double TYPICAL_SCAN_RSSI_STD = 4.0;
+ private static final boolean USE_USER_CONNECT_CHOICE = true;
private final ScoringParams mScoringParams;
@@ -48,7 +50,7 @@ final class BubbleFunScorer implements WifiCandidates.CandidateScorer {
@Override
public String getIdentifier() {
- return "BubbleFunScorer_v1";
+ return "BubbleFunScorer_v2";
}
/**
@@ -65,18 +67,6 @@ final class BubbleFunScorer implements WifiCandidates.CandidateScorer {
// If we are below the entry threshold, make the score more negative
if (score < 0.0) score *= 10.0;
- // A recently selected network gets a large boost
- score += candidate.getLastSelectionWeight() * CURRENT_NETWORK_BOOST;
-
- // Hysteresis to prefer staying on the current network.
- if (candidate.isCurrentNetwork()) {
- score += CURRENT_NETWORK_BOOST;
- }
-
- if (!candidate.isOpenNetwork()) {
- score += SECURITY_AWARD;
- }
-
// The gain is approximately the derivative of shapeFunction at the given rssi
// This is used to estimate the error
double gain = shapeFunction(rssi + 0.5)
@@ -89,7 +79,20 @@ final class BubbleFunScorer implements WifiCandidates.CandidateScorer {
gain *= LOW_BAND_FACTOR;
}
- return new ScoredCandidate(score, TYPICAL_SCAN_RSSI_STD * gain, candidate);
+ // A recently selected network gets a large boost
+ score += candidate.getLastSelectionWeight() * LAST_SELECTION_BOOST;
+
+ // Hysteresis to prefer staying on the current network.
+ if (candidate.isCurrentNetwork()) {
+ score += CURRENT_NETWORK_BOOST;
+ }
+
+ if (!candidate.isOpenNetwork()) {
+ score += SECURITY_AWARD;
+ }
+
+ return new ScoredCandidate(score, TYPICAL_SCAN_RSSI_STD * gain,
+ USE_USER_CONNECT_CHOICE, candidate);
}
/**
@@ -127,9 +130,4 @@ final class BubbleFunScorer implements WifiCandidates.CandidateScorer {
return choice;
}
- @Override
- public boolean userConnectChoiceOverrideWanted() {
- return true;
- }
-
}
diff --git a/service/java/com/android/server/wifi/CompatibilityScorer.java b/service/java/com/android/server/wifi/CompatibilityScorer.java
index 550eca72a..26ff1c293 100644
--- a/service/java/com/android/server/wifi/CompatibilityScorer.java
+++ b/service/java/com/android/server/wifi/CompatibilityScorer.java
@@ -57,6 +57,8 @@ final class CompatibilityScorer implements WifiCandidates.CandidateScorer {
// config_wifi_framework_SAME_BSSID_AWARD
public static final int SAME_BSSID_AWARD_IS_24 = 24;
+ private static final boolean USE_USER_CONNECT_CHOICE = true;
+
CompatibilityScorer(ScoringParams scoringParams) {
mScoringParams = scoringParams;
}
@@ -95,7 +97,8 @@ final class CompatibilityScorer implements WifiCandidates.CandidateScorer {
// The old method breaks ties on the basis of RSSI, which we can
// emulate easily since our score does not need to be an integer.
double tieBreaker = candidate.getScanRssi() / 1000.0;
- return new ScoredCandidate(score + tieBreaker, 10, candidate);
+ return new ScoredCandidate(score + tieBreaker, 10,
+ USE_USER_CONNECT_CHOICE, candidate);
}
@Override
@@ -112,9 +115,4 @@ final class CompatibilityScorer implements WifiCandidates.CandidateScorer {
return choice;
}
- @Override
- public boolean userConnectChoiceOverrideWanted() {
- return true;
- }
-
}
diff --git a/service/java/com/android/server/wifi/ScoreCardBasedScorer.java b/service/java/com/android/server/wifi/ScoreCardBasedScorer.java
index 34adfcba4..7e290caca 100644
--- a/service/java/com/android/server/wifi/ScoreCardBasedScorer.java
+++ b/service/java/com/android/server/wifi/ScoreCardBasedScorer.java
@@ -64,6 +64,8 @@ final class ScoreCardBasedScorer implements WifiCandidates.CandidateScorer {
// Maximum allowable adjustment of the cutoff rssi (dB)
public static final int RSSI_RAIL = 5;
+ private static final boolean USE_USER_CONNECT_CHOICE = true;
+
ScoreCardBasedScorer(ScoringParams scoringParams) {
mScoringParams = scoringParams;
}
@@ -99,7 +101,8 @@ final class ScoreCardBasedScorer implements WifiCandidates.CandidateScorer {
// which evaluator added the candidate.
score -= 1000 * candidate.getEvaluatorId();
- return new ScoredCandidate(score, 10, candidate);
+ return new ScoredCandidate(score, 10,
+ USE_USER_CONNECT_CHOICE, candidate);
}
private int estimatedCutoff(Candidate candidate) {
@@ -134,9 +137,4 @@ final class ScoreCardBasedScorer implements WifiCandidates.CandidateScorer {
return choice;
}
- @Override
- public boolean userConnectChoiceOverrideWanted() {
- return true;
- }
-
}
diff --git a/service/java/com/android/server/wifi/WifiCandidates.java b/service/java/com/android/server/wifi/WifiCandidates.java
index ee5bd30bf..d51f5a662 100644
--- a/service/java/com/android/server/wifi/WifiCandidates.java
+++ b/service/java/com/android/server/wifi/WifiCandidates.java
@@ -253,12 +253,6 @@ public class WifiCandidates {
*/
@Nullable ScoredCandidate scoreCandidates(@NonNull Collection<Candidate> group);
- /**
- * Returns true if the legacy user connect choice logic should be used.
- *
- * @returns false to disable the legacy logic
- */
- boolean userConnectChoiceOverrideWanted();
}
/**
@@ -275,16 +269,20 @@ public class WifiCandidates {
public final double value;
public final double err;
public final Key candidateKey;
- public ScoredCandidate(double value, double err, Candidate candidate) {
+ public final boolean userConnectChoiceOverride;
+ public ScoredCandidate(double value, double err, boolean userConnectChoiceOverride,
+ Candidate candidate) {
this.value = value;
this.err = err;
this.candidateKey = (candidate == null) ? null : candidate.getKey();
+ this.userConnectChoiceOverride = userConnectChoiceOverride;
}
/**
* Represents no score
*/
public static final ScoredCandidate NONE =
- new ScoredCandidate(Double.NEGATIVE_INFINITY, Double.POSITIVE_INFINITY, null);
+ new ScoredCandidate(Double.NEGATIVE_INFINITY, Double.POSITIVE_INFINITY,
+ false, null);
}
/**
diff --git a/service/java/com/android/server/wifi/WifiNetworkSelector.java b/service/java/com/android/server/wifi/WifiNetworkSelector.java
index 1b19b3d2e..2eac7cd2b 100644
--- a/service/java/com/android/server/wifi/WifiNetworkSelector.java
+++ b/service/java/com/android/server/wifi/WifiNetworkSelector.java
@@ -799,7 +799,7 @@ public class WifiNetworkSelector {
String chooses = " would choose ";
if (candidateScorer == activeScorer) {
chooses = " chooses ";
- legacyOverrideWanted = candidateScorer.userConnectChoiceOverrideWanted();
+ legacyOverrideWanted = choice.userConnectChoiceOverride;
selectedNetworkId = networkId;
}
String id = candidateScorer.getIdentifier();
diff --git a/tests/wifitests/src/com/android/server/wifi/CandidateScorerTest.java b/tests/wifitests/src/com/android/server/wifi/CandidateScorerTest.java
index 0f0d33a60..037fd14ab 100644
--- a/tests/wifitests/src/com/android/server/wifi/CandidateScorerTest.java
+++ b/tests/wifitests/src/com/android/server/wifi/CandidateScorerTest.java
@@ -166,8 +166,8 @@ public class CandidateScorerTest extends WifiBaseTest {
*/
@Test
public void testPreferTheCurrentNetworkEvenIfRssiDifferenceIsSignificant() throws Exception {
- assertThat(evaluate(mCandidate1.setScanRssi(-77).setCurrentNetwork(true)),
- greaterThan(evaluate(mCandidate2.setScanRssi(-68))));
+ assertThat(evaluate(mCandidate1.setScanRssi(-74).setCurrentNetwork(true)),
+ greaterThan(evaluate(mCandidate2.setScanRssi(-65))));
}
/**
diff --git a/tests/wifitests/src/com/android/server/wifi/WifiNetworkSelectorTest.java b/tests/wifitests/src/com/android/server/wifi/WifiNetworkSelectorTest.java
index 6dac7fe22..adb1be81c 100644
--- a/tests/wifitests/src/com/android/server/wifi/WifiNetworkSelectorTest.java
+++ b/tests/wifitests/src/com/android/server/wifi/WifiNetworkSelectorTest.java
@@ -1480,12 +1480,7 @@ public class WifiNetworkSelectorTest extends WifiBaseTest {
@Override
public WifiCandidates.ScoredCandidate scoreCandidates(
Collection<WifiCandidates.Candidate> group) {
- return new WifiCandidates.ScoredCandidate(0, 0, null);
- }
-
- @Override
- public boolean userConnectChoiceOverrideWanted() {
- return false;
+ return new WifiCandidates.ScoredCandidate(0, 0, false, null);
}
};