summaryrefslogtreecommitdiff
path: root/tests/unit/java/com/android/server/BpfNetMapsTest.java
diff options
context:
space:
mode:
authorLorenzo Colitti <lorenzo@google.com>2022-03-04 23:15:00 +0900
committermarkchien <markchien@google.com>2022-03-07 12:56:18 +0800
commit82244fd16c34aad1cc51f480ea98a134d5974ee0 (patch)
treea284d571099d1ddd32515fc7dfe47af7a7c98794 /tests/unit/java/com/android/server/BpfNetMapsTest.java
parent9edd999725357a6b424a260f5d7ecbcbf604f8c8 (diff)
Remove dead code in BpfNetMaps.
Most of the methods in BpfNetMaps are only used on T+ devices, where BpfNetMaps never calls into netd. Remove the code in these methods that calls into netd, because that code can never run. The code was only written in the first place because it was necessary when TrafficController had not yet moved to mainline. The list of methods is: - addNaughtyApp - removeNaughtyApp - addNiceApp - removeNiceApp - setChildChain - replaceUidChain - setUidRule Test: treehugger Change-Id: Ie7d210be2f7983178f5aa550370b9476de66e988
Diffstat (limited to 'tests/unit/java/com/android/server/BpfNetMapsTest.java')
-rw-r--r--tests/unit/java/com/android/server/BpfNetMapsTest.java16
1 files changed, 0 insertions, 16 deletions
diff --git a/tests/unit/java/com/android/server/BpfNetMapsTest.java b/tests/unit/java/com/android/server/BpfNetMapsTest.java
index ac21e77b77..2959ac9234 100644
--- a/tests/unit/java/com/android/server/BpfNetMapsTest.java
+++ b/tests/unit/java/com/android/server/BpfNetMapsTest.java
@@ -16,8 +16,6 @@
package com.android.server;
-import static android.net.INetd.FIREWALL_CHAIN_DOZABLE;
-import static android.net.INetd.FIREWALL_RULE_ALLOW;
import static android.net.INetd.PERMISSION_INTERNET;
import static org.junit.Assume.assumeFalse;
@@ -60,20 +58,6 @@ public final class BpfNetMapsTest {
@Test
public void testBpfNetMapsBeforeT() throws Exception {
assumeFalse(SdkLevel.isAtLeastT());
- mBpfNetMaps.addNaughtyApp(TEST_UID);
- verify(mNetd).bandwidthAddNaughtyApp(TEST_UID);
- mBpfNetMaps.removeNaughtyApp(TEST_UID);
- verify(mNetd).bandwidthRemoveNaughtyApp(TEST_UID);
- mBpfNetMaps.addNiceApp(TEST_UID);
- verify(mNetd).bandwidthAddNiceApp(TEST_UID);
- mBpfNetMaps.removeNiceApp(TEST_UID);
- verify(mNetd).bandwidthRemoveNiceApp(TEST_UID);
- mBpfNetMaps.setChildChain(FIREWALL_CHAIN_DOZABLE, true);
- verify(mNetd).firewallEnableChildChain(FIREWALL_CHAIN_DOZABLE, true);
- mBpfNetMaps.replaceUidChain(CHAINNAME, true, TEST_UIDS);
- verify(mNetd).firewallReplaceUidChain(CHAINNAME, true, TEST_UIDS);
- mBpfNetMaps.setUidRule(FIREWALL_CHAIN_DOZABLE, TEST_UID, FIREWALL_RULE_ALLOW);
- verify(mNetd).firewallSetUidRule(FIREWALL_CHAIN_DOZABLE, TEST_UID, FIREWALL_RULE_ALLOW);
mBpfNetMaps.addUidInterfaceRules(IFNAME, TEST_UIDS);
verify(mNetd).firewallAddUidInterfaceRules(IFNAME, TEST_UIDS);
mBpfNetMaps.removeUidInterfaceRules(TEST_UIDS);