Support "dumpsys connectivity trafficcontroller"
Enable ConnectivityService to dump BPF maps from libtraffic_controller. Bug: 202086915 Test: adb shell dumpsys connectivity trafficcontroller Test: atest CtsNetTestCases:ConnectivityManagerTest#testDumpBpfNetMaps Test: run CTS in I021789813f116940d581e2c4a1fd357ff47bfa08 Change-Id: Ib0e935ee2b714ac61daceba6d13fa7a20f97f68f
This commit is contained in:
parent
700774f34e
commit
e6d511f785
1 changed files with 68 additions and 2 deletions
|
|
@ -313,6 +313,7 @@ public class ConnectivityService extends IConnectivityManager.Stub
|
|||
public static final String SHORT_ARG = "--short";
|
||||
private static final String NETWORK_ARG = "networks";
|
||||
private static final String REQUEST_ARG = "requests";
|
||||
private static final String TRAFFICCONTROLLER_ARG = "trafficcontroller";
|
||||
|
||||
private static final boolean DBG = true;
|
||||
private static final boolean DDBG = Log.isLoggable(TAG, Log.DEBUG);
|
||||
|
|
@ -3212,6 +3213,10 @@ public class ConnectivityService extends IConnectivityManager.Stub
|
|||
} else if (CollectionUtils.contains(args, REQUEST_ARG)) {
|
||||
dumpNetworkRequests(pw);
|
||||
return;
|
||||
} else if (CollectionUtils.contains(args, TRAFFICCONTROLLER_ARG)) {
|
||||
boolean verbose = !CollectionUtils.contains(args, SHORT_ARG);
|
||||
dumpTrafficController(pw, fd, verbose);
|
||||
return;
|
||||
}
|
||||
|
||||
pw.print("NetworkProviders for:");
|
||||
|
|
@ -3429,6 +3434,17 @@ public class ConnectivityService extends IConnectivityManager.Stub
|
|||
}
|
||||
}
|
||||
|
||||
private void dumpTrafficController(IndentingPrintWriter pw, final FileDescriptor fd,
|
||||
boolean verbose) {
|
||||
try {
|
||||
mBpfNetMaps.dump(fd, verbose);
|
||||
} catch (ServiceSpecificException e) {
|
||||
pw.println(e.getMessage());
|
||||
} catch (IOException e) {
|
||||
loge("Dump BPF maps failed, " + e);
|
||||
}
|
||||
}
|
||||
|
||||
private void dumpAllRequestInfoLogsToLogcat() {
|
||||
try (PrintWriter logPw = new PrintWriter(new Writer() {
|
||||
@Override
|
||||
|
|
|
|||
Loading…
Reference in a new issue