summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChiachang Wang <chiachangwang@google.com>2020-03-30 09:12:37 +0000
committerChiachang Wang <chiachangwang@google.com>2020-04-01 02:15:50 +0000
commit9b105a99a3223fe2b573533cba503fb63bd97257 (patch)
treeedbe13e81f97b4bd2724e634cb40384af2d418f2 /src
parent014f79a870a29dab1c963bd9df940e0b011fafab (diff)
Correct tests for verifying data stall metrics
NetworkMonitor sends data stall metrics data via static method. The DataStallStatsUtils object from its constructor is never used. Tests in NetworkMonitorTest that verify the interaction with the mock object are incorrect. Bug: 152374582 Test: atest NetworkStackTests NetworkStackNextTests Merged-In: I308344a80deef6aaf3ed4fb57723f2f210b30483 Change-Id: I308344a80deef6aaf3ed4fb57723f2f210b30483
Diffstat (limited to 'src')
-rw-r--r--src/com/android/server/connectivity/NetworkMonitor.java22
1 files changed, 16 insertions, 6 deletions
diff --git a/src/com/android/server/connectivity/NetworkMonitor.java b/src/com/android/server/connectivity/NetworkMonitor.java
index fcdd507..d16fcf5 100644
--- a/src/com/android/server/connectivity/NetworkMonitor.java
+++ b/src/com/android/server/connectivity/NetworkMonitor.java
@@ -355,7 +355,6 @@ public class NetworkMonitor extends StateMachine {
private final NetworkStackNotifier mNotifier;
private final IpConnectivityLog mMetricsLog;
private final Dependencies mDependencies;
- private final DataStallStatsUtils mDetectionStatsUtils;
private final TcpSocketTracker mTcpTracker;
// Configuration values for captive portal detection probes.
private final String mCaptivePortalUserAgent;
@@ -438,15 +437,14 @@ public class NetworkMonitor extends StateMachine {
public NetworkMonitor(Context context, INetworkMonitorCallbacks cb, Network network,
SharedLog validationLog, @NonNull NetworkStackServiceManager serviceManager) {
this(context, cb, network, new IpConnectivityLog(), validationLog, serviceManager,
- Dependencies.DEFAULT, new DataStallStatsUtils(),
- getTcpSocketTrackerOrNull(context, network));
+ Dependencies.DEFAULT, getTcpSocketTrackerOrNull(context, network));
}
@VisibleForTesting
public NetworkMonitor(Context context, INetworkMonitorCallbacks cb, Network network,
IpConnectivityLog logger, SharedLog validationLogs,
@NonNull NetworkStackServiceManager serviceManager, Dependencies deps,
- DataStallStatsUtils detectionStatsUtils, @Nullable TcpSocketTracker tst) {
+ @Nullable TcpSocketTracker tst) {
// Add suffix indicating which NetworkMonitor we're talking about.
super(TAG + "/" + network.toString());
@@ -460,7 +458,6 @@ public class NetworkMonitor extends StateMachine {
mCallback = cb;
mCallbackVersion = getCallbackVersion(cb);
mDependencies = deps;
- mDetectionStatsUtils = detectionStatsUtils;
mNetwork = network;
mCleartextDnsNetwork = deps.getPrivateDnsBypassNetwork(network);
mTelephonyManager = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
@@ -897,7 +894,8 @@ public class NetworkMonitor extends StateMachine {
final int[] transports = mNetworkCapabilities.getTransportTypes();
for (int i = 0; i < transports.length; i++) {
- DataStallStatsUtils.write(buildDataStallDetectionStats(transports[i]), result);
+ final DataStallDetectionStats stats = buildDataStallDetectionStats(transports[i]);
+ mDependencies.writeDataStallDetectionStats(stats, result);
}
mCollectDataStallMetrics = false;
}
@@ -2419,6 +2417,18 @@ public class NetworkMonitor extends StateMachine {
return NetworkStackUtils.isFeatureEnabled(context, namespace, name, defaultEnabled);
}
+ /**
+ * Collect data stall detection level information for each transport type. Write metrics
+ * data to statsd pipeline.
+ * @param stats a {@link DataStallDetectionStats} that contains the detection level
+ * information.
+ * @para result the network reevaluation result.
+ */
+ public void writeDataStallDetectionStats(@NonNull final DataStallDetectionStats stats,
+ @NonNull final CaptivePortalProbeResult result) {
+ DataStallStatsUtils.write(stats, result);
+ }
+
public static final Dependencies DEFAULT = new Dependencies();
}