Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c28bda57 authored by Suprabh Shukla's avatar Suprabh Shukla
Browse files

Enable default background network restrictions

This reverts commit 951e4bd8 and commit
b6a3ff2d

Test: atest CtsHostsideNetworkTests
Test: atest resolv_integration_test
Test: atest FrameworksServicesTests:NetworkPolicyManagerServiceTest

Bug: 304347838
Change-Id: I0c8e0c713f0a7aae7f0ab99e42d97d5bf770bc47
parent 24fac536
Loading
Loading
Loading
Loading
+1 −4
Original line number Diff line number Diff line
@@ -339,8 +339,6 @@ public class NetworkPolicyManagerService extends INetworkPolicyManager.Stub {
    static final String TAG = NetworkPolicyLogger.TAG;
    private static final boolean LOGD = NetworkPolicyLogger.LOGD;
    private static final boolean LOGV = NetworkPolicyLogger.LOGV;
    // TODO: b/304347838 - Remove once the feature is in staging.
    private static final boolean ALWAYS_RESTRICT_BACKGROUND_NETWORK = false;

    /**
     * No opportunistic quota could be calculated from user data plan or data settings.
@@ -1062,8 +1060,7 @@ public class NetworkPolicyManagerService extends INetworkPolicyManager.Stub {
                    }

                    // The flag is boot-stable.
                    mBackgroundNetworkRestricted = ALWAYS_RESTRICT_BACKGROUND_NETWORK
                            && Flags.networkBlockedForTopSleepingAndAbove();
                    mBackgroundNetworkRestricted = Flags.networkBlockedForTopSleepingAndAbove();
                    if (mBackgroundNetworkRestricted) {
                        // Firewall rules and UidBlockedState will get updated in
                        // updateRulesForGlobalChangeAL below.
+0 −8
Original line number Diff line number Diff line
@@ -205,7 +205,6 @@ import libcore.io.Streams;
import org.junit.After;
import org.junit.Assume;
import org.junit.Before;
import org.junit.Ignore;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.MethodRule;
@@ -2144,14 +2143,12 @@ public class NetworkPolicyManagerServiceTest {
        assertFalse(mService.isUidNetworkingBlocked(UID_E, false));
    }

    @Ignore("Temporarily disabled until the feature is enabled")
    @Test
    @RequiresFlagsEnabled(Flags.FLAG_NETWORK_BLOCKED_FOR_TOP_SLEEPING_AND_ABOVE)
    public void testBackgroundChainEnabled() throws Exception {
        verify(mNetworkManager).setFirewallChainEnabled(FIREWALL_CHAIN_BACKGROUND, true);
    }

    @Ignore("Temporarily disabled until the feature is enabled")
    @Test
    @RequiresFlagsEnabled(Flags.FLAG_NETWORK_BLOCKED_FOR_TOP_SLEEPING_AND_ABOVE)
    public void testBackgroundChainOnProcStateChange() throws Exception {
@@ -2181,7 +2178,6 @@ public class NetworkPolicyManagerServiceTest {
        assertTrue(mService.isUidNetworkingBlocked(UID_A, false));
    }

    @Ignore("Temporarily disabled until the feature is enabled")
    @Test
    @RequiresFlagsEnabled(Flags.FLAG_NETWORK_BLOCKED_FOR_TOP_SLEEPING_AND_ABOVE)
    public void testBackgroundChainOnAllowlistChange() throws Exception {
@@ -2220,7 +2216,6 @@ public class NetworkPolicyManagerServiceTest {
        assertFalse(mService.isUidNetworkingBlocked(UID_B, false));
    }

    @Ignore("Temporarily disabled until the feature is enabled")
    @Test
    @RequiresFlagsEnabled(Flags.FLAG_NETWORK_BLOCKED_FOR_TOP_SLEEPING_AND_ABOVE)
    public void testBackgroundChainOnTempAllowlistChange() throws Exception {
@@ -2250,7 +2245,6 @@ public class NetworkPolicyManagerServiceTest {
        assertTrue(mService.isUidNetworkingBlocked(UID_A, false));
    }

    @Ignore("Temporarily disabled until the feature is enabled")
    @Test
    @RequiresFlagsEnabled(Flags.FLAG_NETWORK_BLOCKED_FOR_TOP_SLEEPING_AND_ABOVE)
    public void testUidObserverFiltersProcStateChanges() throws Exception {
@@ -2313,7 +2307,6 @@ public class NetworkPolicyManagerServiceTest {
        waitForUidEventHandlerIdle();
    }

    @Ignore("Temporarily disabled until the feature is enabled")
    @Test
    @RequiresFlagsEnabled(Flags.FLAG_NETWORK_BLOCKED_FOR_TOP_SLEEPING_AND_ABOVE)
    public void testUidObserverFiltersStaleChanges() throws Exception {
@@ -2334,7 +2327,6 @@ public class NetworkPolicyManagerServiceTest {
        waitForUidEventHandlerIdle();
    }

    @Ignore("Temporarily disabled until the feature is enabled")
    @Test
    @RequiresFlagsEnabled(Flags.FLAG_NETWORK_BLOCKED_FOR_TOP_SLEEPING_AND_ABOVE)
    public void testUidObserverFiltersCapabilityChanges() throws Exception {