Add tethering stats into statsd
Bug: 153942334 Test: atest TetheringTest IpServerTest Test: Manual test with statsd_testdrive Change-Id: I7205bb24dd30ba78b79bc352034da299d452750f
This commit is contained in:
@@ -69,6 +69,7 @@ import com.android.networkstack.tethering.BpfCoordinator.ClientInfo;
|
||||
import com.android.networkstack.tethering.BpfCoordinator.Ipv6ForwardingRule;
|
||||
import com.android.networkstack.tethering.PrivateAddressCoordinator;
|
||||
import com.android.networkstack.tethering.TetheringConfiguration;
|
||||
import com.android.networkstack.tethering.metrics.TetheringMetrics;
|
||||
import com.android.networkstack.tethering.util.InterfaceSet;
|
||||
import com.android.networkstack.tethering.util.PrefixUtils;
|
||||
|
||||
@@ -282,13 +283,15 @@ public class IpServer extends StateMachine {
|
||||
|
||||
private LinkAddress mIpv4Address;
|
||||
|
||||
private final TetheringMetrics mTetheringMetrics;
|
||||
|
||||
// TODO: Add a dependency object to pass the data members or variables from the tethering
|
||||
// object. It helps to reduce the arguments of the constructor.
|
||||
public IpServer(
|
||||
String ifaceName, Looper looper, int interfaceType, SharedLog log,
|
||||
INetd netd, @NonNull BpfCoordinator coordinator, Callback callback,
|
||||
TetheringConfiguration config, PrivateAddressCoordinator addressCoordinator,
|
||||
Dependencies deps) {
|
||||
TetheringMetrics tetheringMetrics, Dependencies deps) {
|
||||
super(ifaceName, looper);
|
||||
mLog = log.forSubComponent(ifaceName);
|
||||
mNetd = netd;
|
||||
@@ -303,6 +306,7 @@ public class IpServer extends StateMachine {
|
||||
mP2pLeasesSubnetPrefixLength = config.getP2pLeasesSubnetPrefixLength();
|
||||
mPrivateAddressCoordinator = addressCoordinator;
|
||||
mDeps = deps;
|
||||
mTetheringMetrics = tetheringMetrics;
|
||||
resetLinkProperties();
|
||||
mLastError = TetheringManager.TETHER_ERROR_NO_ERROR;
|
||||
mServingMode = STATE_AVAILABLE;
|
||||
@@ -1201,6 +1205,9 @@ public class IpServer extends StateMachine {
|
||||
stopConntrackMonitoring();
|
||||
|
||||
resetLinkProperties();
|
||||
|
||||
mTetheringMetrics.updateErrorCode(mInterfaceType, mLastError);
|
||||
mTetheringMetrics.sendReport(mInterfaceType);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user