Merge "Remove ConnectivityManager swapActiveStatsMap API"

This commit is contained in:
Treehugger Robot
2022-03-08 06:31:23 +00:00
committed by Gerrit Code Review
7 changed files with 8 additions and 51 deletions

View File

@@ -62,8 +62,6 @@ public final class BpfNetMapsTest {
verify(mNetd).firewallAddUidInterfaceRules(IFNAME, TEST_UIDS);
mBpfNetMaps.removeUidInterfaceRules(TEST_UIDS);
verify(mNetd).firewallRemoveUidInterfaceRules(TEST_UIDS);
mBpfNetMaps.swapActiveStatsMap();
verify(mNetd).trafficSwapActiveStatsMap();
mBpfNetMaps.setNetPermForUids(PERMISSION_INTERNET, TEST_UIDS);
verify(mNetd).trafficSetNetPermForUids(PERMISSION_INTERNET, TEST_UIDS);
}

View File

@@ -32,12 +32,9 @@ import static com.android.server.net.NetworkStatsFactory.kernelToTag;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.fail;
import static org.mockito.Matchers.eq;
import static org.mockito.Mockito.doReturn;
import android.content.Context;
import android.content.res.Resources;
import android.net.ConnectivityManager;
import android.net.NetworkStats;
import android.net.TrafficStats;
import android.net.UnderlyingNetworkInfo;
@@ -77,7 +74,6 @@ public class NetworkStatsFactoryTest extends NetworkStatsBaseTest {
private File mTestProc;
private NetworkStatsFactory mFactory;
@Mock private Context mContext;
@Mock private ConnectivityManager mCm;
@Before
public void setUp() throws Exception {
@@ -88,9 +84,6 @@ public class NetworkStatsFactoryTest extends NetworkStatsBaseTest {
// applications. So in order to have a test support native library, the native code
// related to networkStatsFactory is compiled to a minimal native library and loaded here.
System.loadLibrary("networkstatsfactorytestjni");
doReturn(Context.CONNECTIVITY_SERVICE).when(mContext).getSystemServiceName(
eq(ConnectivityManager.class));
doReturn(mCm).when(mContext).getSystemService(eq(Context.CONNECTIVITY_SERVICE));
mFactory = new NetworkStatsFactory(mContext, mTestProc, false);
mFactory.updateUnderlyingNetworkInfos(new UnderlyingNetworkInfo[0]);
}