Remove the gettetherstats command.
Bug: 32163131
Bug: 64995262
Test: netd_{unit,integration}_test pass
Test: tethering data usage UI reflects actual data usage
Change-Id: I1722f64cf775e73d71df997f6bae4820133e67bf
diff --git a/server/TetherController.cpp b/server/TetherController.cpp
index 334da2e..3f6efe9 100644
--- a/server/TetherController.cpp
+++ b/server/TetherController.cpp
@@ -714,16 +714,9 @@
return 0;
}
-std::string TetherController::TetherStats::getStatsLine() const {
- std::string msg;
- StringAppendF(&msg, "%s %s %" PRId64" %" PRId64" %" PRId64" %" PRId64, intIface.c_str(),
- extIface.c_str(), rxBytes, rxPackets, txBytes, txPackets);
- return msg;
-}
-
-StatusOr<TetherController::TetherStatsList> TetherController::getTetherStats(
- std::string& extraProcessingInfo) {
+StatusOr<TetherController::TetherStatsList> TetherController::getTetherStats() {
TetherStatsList statsList;
+ std::string parsedIptablesOutput;
for (const IptablesTarget target : {V4, V6}) {
std::string statsString;
@@ -732,30 +725,15 @@
target, ret));
}
- if (int ret = addForwardChainStats(statsList, statsString, extraProcessingInfo)) {
+ if (int ret = addForwardChainStats(statsList, statsString, parsedIptablesOutput)) {
return statusFromErrno(-ret, StringPrintf("failed to parse %s tether stats:\n%s",
target == V4 ? "IPv4": "IPv6",
- extraProcessingInfo.c_str()));
+ parsedIptablesOutput.c_str()));
}
}
return statsList;
}
-int TetherController::getTetherStats(SocketClient *cli, std::string &extraProcessingInfo) {
- StatusOr<TetherStatsList> statsList = getTetherStats(extraProcessingInfo);
- if (!isOk(statsList)) {
- return -1;
- }
-
- for (const auto& stats: statsList.value()) {
- cli->sendMsg(ResponseCode::TetheringStatsListResult,
- stats.getStatsLine().c_str(), false);
- }
- cli->sendMsg(ResponseCode::CommandOkay, "Tethering stats list completed", false);
-
- return 0;
-}
-
} // namespace net
} // namespace android