Add overflow protection for network stats maps

Since we moved both uid stats and uid tag stats to the same map now. It
is possible for apps to create as many tags as possible to overflow the
uid tag stats map. To prevent that, add a check when tagging a socket,
and start to block request when a uid created to many entries in the
stats map.

Bug: 111441138
Test: android.app.usage.cts.NetworkUsageStatsTest
      android.net.cts.TrafficStatsTest

Change-Id: I11f42ffc83efc917ac0871a0326375031ae0a6e0
diff --git a/server/TrafficControllerTest.cpp b/server/TrafficControllerTest.cpp
index 07e3c3e..258d53d 100644
--- a/server/TrafficControllerTest.cpp
+++ b/server/TrafficControllerTest.cpp
@@ -110,6 +110,8 @@
         mTc.mStatsMapA.reset(mFakeUidStatsMap.getMap());
         mTc.mStatsMapB.reset(mFakeTagStatsMap.getMap());
         mTc.mConfigurationMap.reset(mFakeConfigurationMap.getMap());
+        ASSERT_TRUE(isOk(mFakeConfigurationMap.writeValue(CURRENT_STATS_MAP_CONFIGURATION_KEY,
+                                                          SELECT_MAP_A, BPF_ANY)));
         mTc.mUidOwnerMap.reset(mFakeUidOwnerMap.getMap());
         mTc.mUidPermissionMap.reset(mFakeUidPermissionMap.getMap());
         mTc.mPrivilegedUser.clear();