Move cookie tag bpf map dump to NetworkStatsService

Map status dump will do access check if map is null.
This could show different message from the current dump output.

Information in map content dump does not change
$ dumpsys connectivity trafficcontroller
....
      mCookieTagMap:
      cookie=1398 tag=0x0 uid=1029
      cookie=1433 tag=0xffffff82 uid=1051
      cookie=1166 tag=0xfffffe01 uid=1073

$ dumpsys netstats
....
  mCookieTagMap:
    cookie=1144 tag=0xfffffe01 uid=1073
    cookie=1376 tag=0x0 uid=1029
    cookie=1408 tag=0xffffff82 uid=1051

Bug: 217624062
Test: dumpsys netstats, dumpstate, atest NetworkStatsServiceTest
Change-Id: I14dd6f969a0b5eb24ace62361ce2484cf18b7470
This commit is contained in:
Motomu Utsumi
2022-07-27 08:14:09 +00:00
parent d70c34fef2
commit cedfab91c6
4 changed files with 87 additions and 18 deletions

View File

@@ -791,8 +791,6 @@ TEST_F(TrafficControllerTest, TestDumpsys) {
// ifaceIndex ifaceName tag_hex uid_int cnt_set rxBytes rxPackets txBytes txPackets
// 999 test0 0x2a 10086 1 100 1 0 0
std::vector<std::string> expectedLines = {
"mCookieTagMap:",
fmt::format("cookie={} tag={:#x} uid={}", TEST_COOKIE, TEST_TAG, TEST_UID),
"mUidCounterSetMap:",
fmt::format("{} {}", TEST_UID3, TEST_COUNTERSET),
"mAppUidStatsMap::", // TODO@: fix double colon
@@ -833,7 +831,6 @@ TEST_F(TrafficControllerTest, dumpsysInvalidMaps) {
"Read value of map -1 failed: Bad file descriptor";
std::vector<std::string> expectedLines = {
fmt::format("mCookieTagMap {}", kErrIterate),
fmt::format("mUidCounterSetMap {}", kErrIterate),
fmt::format("mAppUidStatsMap {}", kErrIterate),
fmt::format("mStatsMapA {}", kErrIterate),