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

Commit 6880d632 authored by Chenbo Feng's avatar Chenbo Feng
Browse files

Adjust map names due to new bpfloader

With the new loader support added. The bpf map format is defined by bpf
kernel program as well. Change the netd bpf program to the new format.

Test: CtsUsageStatsTestCases
Bug: 112334572
Change-Id: I34e38e0a8cf0cca54dc52ec897771452f9d90525
parent 0f1bf44c
Loading
Loading
Loading
Loading
+2 −3
Original line number Diff line number Diff line
@@ -20,6 +20,7 @@ import static android.net.NetworkStats.SET_ALL;
import static android.net.NetworkStats.TAG_ALL;
import static android.net.NetworkStats.TAG_NONE;
import static android.net.NetworkStats.UID_ALL;

import static com.android.server.NetworkManagementSocketTagger.kernelToTag;

import android.annotation.Nullable;
@@ -33,10 +34,8 @@ import com.android.internal.util.ProcFileReader;

import libcore.io.IoUtils;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileReader;
import java.io.IOException;
import java.net.ProtocolException;
import java.util.Arrays;
@@ -127,7 +126,7 @@ public class NetworkStatsFactory {
    }

    public NetworkStatsFactory() {
        this(new File("/proc/"), new File("/sys/fs/bpf/traffic_uid_stats_map").exists());
        this(new File("/proc/"), new File("/sys/fs/bpf/map_netd_app_uid_stats_map").exists());
    }

    @VisibleForTesting
+1 −1
Original line number Diff line number Diff line
@@ -361,7 +361,7 @@ public class NetworkStatsService extends INetworkStatsService.Stub {
        mStatsObservers = checkNotNull(statsObservers, "missing NetworkStatsObservers");
        mSystemDir = checkNotNull(systemDir, "missing systemDir");
        mBaseDir = checkNotNull(baseDir, "missing baseDir");
        mUseBpfTrafficStats = new File("/sys/fs/bpf/traffic_uid_stats_map").exists();
        mUseBpfTrafficStats = new File("/sys/fs/bpf/map_netd_app_uid_stats_map").exists();
    }

    private void registerLocalService() {