From 78ce5d79a97ca5706d333b5f24a785163116a5c3 Mon Sep 17 00:00:00 2001 From: Chalard Jean Date: Thu, 6 May 2021 23:21:41 +0900 Subject: [PATCH] Allow network providers to set yield to bad wifi While the "yield to bad wifi" policy is handled by CS for backward compatibility, the network provider should in fact be in control of it. There is no downside to allowing providers to set it as no provider is using this, and it will allow for migration in the future. The code is also simpler, and becomes possible to test through CTS. Test: NetworkScoreTest Bug: 184037351 Change-Id: I3b2418f37bf1f0374d0a626fda7e2b6f3a3b41ba --- .../java/com/android/server/connectivity/FullScore.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/services/core/java/com/android/server/connectivity/FullScore.java b/services/core/java/com/android/server/connectivity/FullScore.java index 14cec09560..fbfa7a18c9 100644 --- a/services/core/java/com/android/server/connectivity/FullScore.java +++ b/services/core/java/com/android/server/connectivity/FullScore.java @@ -108,9 +108,10 @@ public class FullScore { // and all bits managed by FullScore unset. As bits are handled from 0 up in NetworkScore and // from 63 down in FullScore, cut at the 32nd bit for simplicity, but change this if some day // there are more than 32 bits handled on either side. - // YIELD_TO_BAD_WIFI is temporarily handled by ConnectivityService. - private static final long EXTERNAL_POLICIES_MASK = - 0x00000000FFFFFFFFL & ~(1L << POLICY_YIELD_TO_BAD_WIFI); + // YIELD_TO_BAD_WIFI is temporarily handled by ConnectivityService, but the factory is still + // allowed to set it, so that it's possible to transition from handling it in CS to handling + // it in the factory. + private static final long EXTERNAL_POLICIES_MASK = 0x00000000FFFFFFFFL; @VisibleForTesting static @NonNull String policyNameOf(final int policy) {