'How to get App process traffic data of Android 10 system through ADB
Starting with Android 10, xt_qtaguid is abandoned and ebpf is used to record network traffic data, so process traffic data cannot be obtained through the /proc/net/xt_qtaguid/stats file. At present, it is found that there are 4 ways to get process traffic data through adb:
- Read /proc/uid_stat/$uid/tcp_rcv and /proc/uid_stat/$uid/tcp_snd: poor compatibility, many mobile phones do not have these two files;
- Read /proc/$pid/net/dev: $pid will confuse people, thinking it is process-related traffic data, but after testing, it is found that the file records the traffic data of the network adapter, and the traffic data of the process cannot be obtained;
- Read /proc/net/xt_qtaguid/stats: This method can get process traffic data, but it can only be used in Android 9.0 and below systems
- Read /sys/fs/bpf/traffic_uid_stats_map: This method should be able to get process traffic data in Android 10 and above systems, but requires root privileges
Is there any other way to get process traffic data in Android 10?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
