Fix a bug where 'avoid unvalidated' is broken
After setting 'avoid unvalidated' the next update of the
score by the agent will set the wrong value for that
flag in the NetworkScore object.
Also have the default behavior on S and T be like the old
one, rather than the new one
Test: manual
Change-Id: I0c161fe7098d3c60827fd50190911b6b762dfa42
diff --git a/service/ServiceConnectivityResources/res/values/config.xml b/service/ServiceConnectivityResources/res/values/config.xml
index 7d777ec..22d9b01 100644
--- a/service/ServiceConnectivityResources/res/values/config.xml
+++ b/service/ServiceConnectivityResources/res/values/config.xml
@@ -97,7 +97,7 @@
On Android 14 and above, the behavior is always like 1, regardless of the value of this
setting. -->
- <integer translatable="false" name="config_activelyPreferBadWifi">1</integer>
+ <integer translatable="false" name="config_activelyPreferBadWifi">0</integer>
<!-- Array of ConnectivityManager.TYPE_xxxx constants for networks that may only
be controlled by systemOrSignature apps. -->
diff --git a/service/src/com/android/server/connectivity/NetworkAgentInfo.java b/service/src/com/android/server/connectivity/NetworkAgentInfo.java
index c732170..2e92d43 100644
--- a/service/src/com/android/server/connectivity/NetworkAgentInfo.java
+++ b/service/src/com/android/server/connectivity/NetworkAgentInfo.java
@@ -1208,7 +1208,7 @@
*/
public void setScore(final NetworkScore score) {
mScore = FullScore.fromNetworkScore(score, networkCapabilities, networkAgentConfig,
- everValidated(), 0L == getAvoidUnvalidated(), yieldToBadWiFi(),
+ everValidated(), 0L != getAvoidUnvalidated(), yieldToBadWiFi(),
0L != mFirstEvaluationConcludedTime, isDestroyed());
}