From 4dd0f9c1940373c884800af2e660bcef65d8d7fa Mon Sep 17 00:00:00 2001 From: Chiachang Wang Date: Tue, 3 Aug 2021 12:04:51 +0800 Subject: [PATCH] Revert "Allow network providers to set yield to bad wifi" This reverts commit c4660c98f6a63a73df1a79c34fbbf2266a6b381e. The reverted commit removed the POLICY_YIELD_TO_BAD_WIFI exclusive bit from the EXTERNAL_POLICIES_MASK. The new policy calculation is done by bitwise-or-ing with existing policy. If the POLICY_YIELD_TO_BAD_WIFI was ever set to policy in the FullScore , CS will not be able to remove the policy to reflect the avoid bad wifi setting change since the result is always be true unless the policy is updated from factories. Eventually, the original commit is the intended design but current design could not work well with it. Thus, revert it to keep the control on CS now. Bug: 195612849 Test: atest CtsNetTestCases FrameworksNetTests Change-Id: I002e206ffd41796cb0996b9c559afed3d619b67c Ignore-AOSP-First: Commit is only available in internal branch --- service/src/com/android/server/connectivity/FullScore.java | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/service/src/com/android/server/connectivity/FullScore.java b/service/src/com/android/server/connectivity/FullScore.java index fbfa7a18c9..14cec09560 100644 --- a/service/src/com/android/server/connectivity/FullScore.java +++ b/service/src/com/android/server/connectivity/FullScore.java @@ -108,10 +108,9 @@ 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, 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; + // YIELD_TO_BAD_WIFI is temporarily handled by ConnectivityService. + private static final long EXTERNAL_POLICIES_MASK = + 0x00000000FFFFFFFFL & ~(1L << POLICY_YIELD_TO_BAD_WIFI); @VisibleForTesting static @NonNull String policyNameOf(final int policy) {