Connectivity metrics: add transports to validation probes

This patch adds transports info to ValidationProbeEvent and migrates
netId logging for this event to the topt-level netId field in
ConnectivityMetricsEvent.

Test: modified unit tests. $ runtest frameworks-net passes
Bug: 3490169
Change-Id: Ibf51049ba8901ae5ca4ea86e2f500944a4738b5c
This commit is contained in:
Hugo Benichi
2017-03-17 15:42:40 +09:00
parent 075cd83383
commit 7f818778a8
3 changed files with 18 additions and 8 deletions

View File

@@ -477,6 +477,17 @@ public final class NetworkCapabilities implements Parcelable {
return enumerateBits(mTransportTypes);
}
/**
* Gets all the transports set on this {@code NetworkCapability} instance.
*
* @return a bit field composed of up bits at indexes defined by
* {@code NetworkCapabilities.TRANSPORT_*} values for this instance.
* @hide
*/
public long getTransports() {
return mTransportTypes;
}
/**
* Tests for the presence of a transport on this instance.
*

View File

@@ -402,7 +402,6 @@ public class IpConnectivityEventBuilderTest extends TestCase {
public void testValidationProbeEventSerialization() {
ConnectivityMetricsEvent ev = describeIpEvent(
aType(ValidationProbeEvent.class),
anInt(120),
aLong(40730),
anInt(ValidationProbeEvent.PROBE_HTTP),
anInt(204));
@@ -417,9 +416,6 @@ public class IpConnectivityEventBuilderTest extends TestCase {
" transports: 0",
" validation_probe_event <",
" latency_ms: 40730",
" network_id <",
" network_id: 120",
" >",
" probe_result: 204",
" probe_type: 1",
" >",

View File

@@ -153,12 +153,18 @@ public class IpConnectivityMetricsTest extends TestCase {
apfStats.programUpdatesAll = 7;
apfStats.programUpdatesAllowingMulticast = 3;
apfStats.maxProgramSize = 2048;
ValidationProbeEvent validationEv = new ValidationProbeEvent();
validationEv.durationMs = 40730;
validationEv.probeType = ValidationProbeEvent.PROBE_HTTP;
validationEv.returnCode = 204;
Parcelable[] events = {
new IpReachabilityEvent(IpReachabilityEvent.NUD_FAILED),
new DhcpClientEvent("SomeState", 192),
new DefaultNetworkEvent(102, new int[]{1,2,3}, 101, true, false),
new IpManagerEvent(IpManagerEvent.PROVISIONING_OK, 5678),
new ValidationProbeEvent(120, 40730, ValidationProbeEvent.PROBE_HTTP, 204),
validationEv,
apfStats,
new RaEvent(2000, 400, 300, -1, 1000, -1)
};
@@ -235,9 +241,6 @@ public class IpConnectivityMetricsTest extends TestCase {
" transports: 0",
" validation_probe_event <",
" latency_ms: 40730",
" network_id <",
" network_id: 120",
" >",
" probe_result: 204",
" probe_type: 1",
" >",