Log BPF programs & maps in bugreport

Currently (T+), BPF program and map status are only dumped on demand.
$ adb shell dumpsys connectivity trafficcontroller

The information can be useful for issue debugging, especially on Data
Usage and NetworkPolicyManagerService. It should be logged in bugreport
dumpsys connectivity section as Android S (which is handled by netd).

Bug: 237954856
Test: adb bugreport
Change-Id: Ic02a58ff2ebdbf375d9df0917e8218ab8faa96da
This commit is contained in:
Ken Chen
2022-07-04 11:09:28 +08:00
parent eae7873814
commit daf5cb64cc

View File

@@ -3422,6 +3422,17 @@ public class ConnectivityService extends IConnectivityManager.Stub
pw.increaseIndent();
mNetworkActivityTracker.dump(pw);
pw.decreaseIndent();
// pre-T is logged by netd.
if (SdkLevel.isAtLeastT()) {
pw.println();
pw.println("BPF programs & maps:");
pw.increaseIndent();
// Flush is required. Otherwise, the traces in fd can interleave with traces in pw.
pw.flush();
dumpTrafficController(pw, fd, /*verbose=*/ true);
pw.decreaseIndent();
}
}
private void dumpNetworks(IndentingPrintWriter pw) {