DO NOT MERGE IpConnectivity metrics: add version number
am: 31cf55bdfe
Change-Id: Iccdf7d09ef4dc80f05c76774c456b5effb2c08c7
This commit is contained in:
@@ -48,6 +48,10 @@ final public class IpConnectivityEventBuilder {
|
||||
final IpConnectivityLog log = new IpConnectivityLog();
|
||||
log.events = toProto(events);
|
||||
log.droppedEvents = dropped;
|
||||
if ((log.events.length > 0) || (dropped > 0)) {
|
||||
// Only write version number if log has some information at all.
|
||||
log.version = IpConnectivityMetrics.VERSION;
|
||||
}
|
||||
return IpConnectivityLog.toByteArray(log);
|
||||
}
|
||||
|
||||
|
||||
@@ -40,6 +40,13 @@ final public class IpConnectivityMetrics extends SystemService {
|
||||
private static final String TAG = IpConnectivityMetrics.class.getSimpleName();
|
||||
private static final boolean DBG = false;
|
||||
|
||||
// The logical version numbers of ipconnectivity.proto, corresponding to the
|
||||
// "version" field of IpConnectivityLog.
|
||||
private static final int NYC = 0;
|
||||
private static final int NYC_MR1 = 1;
|
||||
private static final int NYC_MR2 = 2;
|
||||
public static final int VERSION = NYC_MR2;
|
||||
|
||||
private static final String SERVICE_NAME = IpConnectivityLog.SERVICE_NAME;
|
||||
|
||||
// Default size of the event buffer. Once the buffer is full, incoming events are dropped.
|
||||
|
||||
@@ -53,6 +53,7 @@ message IpReachabilityEvent {
|
||||
|
||||
// The event type code of the probe, represented by constants defined in
|
||||
// android.net.metrics.IpReachabilityEvent.
|
||||
// NUD_FAILED_ORGANIC and PROVISIONING_LOST_ORGANIC recorded since version 1.
|
||||
optional int32 event_type = 2;
|
||||
};
|
||||
|
||||
@@ -126,11 +127,12 @@ message DHCPEvent {
|
||||
|
||||
// Lifetime duration in milliseconds of a DhcpClient state, or transition
|
||||
// time in milliseconds between specific pairs of DhcpClient's states.
|
||||
// Only populated when state_transition is populated.
|
||||
// Only populated since version 1, when state_transition is populated.
|
||||
optional int32 duration_ms = 4;
|
||||
}
|
||||
|
||||
// Represents the generation of an Android Packet Filter program.
|
||||
// Since version 1.
|
||||
message ApfProgramEvent {
|
||||
// Lifetime of the program in seconds.
|
||||
optional int64 lifetime = 1;
|
||||
@@ -154,6 +156,7 @@ message ApfProgramEvent {
|
||||
|
||||
// Represents Router Advertisement listening statistics for an interface with
|
||||
// Android Packet Filter enabled.
|
||||
// Since version 1.
|
||||
message ApfStatistics {
|
||||
// The time interval in milliseconds these stastistics cover.
|
||||
optional int64 duration_ms = 1;
|
||||
@@ -183,6 +186,7 @@ message ApfStatistics {
|
||||
|
||||
// Represents the reception of a Router Advertisement packet for an interface
|
||||
// with Android Packet Filter enabled.
|
||||
// Since version 1.
|
||||
message RaEvent {
|
||||
// All lifetime values are expressed in seconds. The default value for an
|
||||
// option lifetime that was not present in the RA option list is -1.
|
||||
@@ -271,4 +275,11 @@ message IpConnectivityLog {
|
||||
|
||||
// The number of events that had to be dropped due to a full buffer.
|
||||
optional int32 dropped_events = 2;
|
||||
|
||||
// The version number of the metrics events being collected.
|
||||
// nyc-dev: not populated, implicitly 0
|
||||
// nyc-dr1: not populated, implicitly 1 (sailfish and marlin only)
|
||||
// nyc-mr1: not populated, implicitly 1
|
||||
// nyc-mr2: 2
|
||||
optional int32 version = 3;
|
||||
};
|
||||
|
||||
@@ -71,7 +71,8 @@ public class IpConnectivityEventBuilderTest extends TestCase {
|
||||
" transport_types: 3",
|
||||
" >",
|
||||
" time_ms: 1",
|
||||
">");
|
||||
">",
|
||||
"version: 2");
|
||||
|
||||
verifySerialization(want, ev);
|
||||
}
|
||||
@@ -93,7 +94,8 @@ public class IpConnectivityEventBuilderTest extends TestCase {
|
||||
" state_transition: \"SomeState\"",
|
||||
" >",
|
||||
" time_ms: 1",
|
||||
">");
|
||||
">",
|
||||
"version: 2");
|
||||
|
||||
verifySerialization(want, ev);
|
||||
}
|
||||
@@ -114,7 +116,8 @@ public class IpConnectivityEventBuilderTest extends TestCase {
|
||||
" state_transition: \"\"",
|
||||
" >",
|
||||
" time_ms: 1",
|
||||
">");
|
||||
">",
|
||||
"version: 2");
|
||||
|
||||
verifySerialization(want, ev);
|
||||
}
|
||||
@@ -160,7 +163,8 @@ public class IpConnectivityEventBuilderTest extends TestCase {
|
||||
" return_codes: 178",
|
||||
" >",
|
||||
" time_ms: 1",
|
||||
">");
|
||||
">",
|
||||
"version: 2");
|
||||
|
||||
verifySerialization(want, ev);
|
||||
}
|
||||
@@ -181,7 +185,8 @@ public class IpConnectivityEventBuilderTest extends TestCase {
|
||||
" latency_ms: 5678",
|
||||
" >",
|
||||
" time_ms: 1",
|
||||
">");
|
||||
">",
|
||||
"version: 2");
|
||||
|
||||
verifySerialization(want, ev);
|
||||
}
|
||||
@@ -200,7 +205,8 @@ public class IpConnectivityEventBuilderTest extends TestCase {
|
||||
" if_name: \"wlan0\"",
|
||||
" >",
|
||||
" time_ms: 1",
|
||||
">");
|
||||
">",
|
||||
"version: 2");
|
||||
|
||||
verifySerialization(want, ev);
|
||||
}
|
||||
@@ -223,7 +229,8 @@ public class IpConnectivityEventBuilderTest extends TestCase {
|
||||
" >",
|
||||
" >",
|
||||
" time_ms: 1",
|
||||
">");
|
||||
">",
|
||||
"version: 2");
|
||||
|
||||
verifySerialization(want, ev);
|
||||
}
|
||||
@@ -248,7 +255,8 @@ public class IpConnectivityEventBuilderTest extends TestCase {
|
||||
" probe_result: 204",
|
||||
" probe_type: 1",
|
||||
" >",
|
||||
">");
|
||||
">",
|
||||
"version: 2");
|
||||
|
||||
verifySerialization(want, ev);
|
||||
}
|
||||
@@ -274,7 +282,8 @@ public class IpConnectivityEventBuilderTest extends TestCase {
|
||||
" program_length: 2048",
|
||||
" >",
|
||||
" time_ms: 1",
|
||||
">");
|
||||
">",
|
||||
"version: 2");
|
||||
|
||||
verifySerialization(want, ev);
|
||||
}
|
||||
@@ -305,7 +314,8 @@ public class IpConnectivityEventBuilderTest extends TestCase {
|
||||
" zero_lifetime_ras: 1",
|
||||
" >",
|
||||
" time_ms: 1",
|
||||
">");
|
||||
">",
|
||||
"version: 2");
|
||||
|
||||
verifySerialization(want, ev);
|
||||
}
|
||||
@@ -332,7 +342,8 @@ public class IpConnectivityEventBuilderTest extends TestCase {
|
||||
" router_lifetime: 2000",
|
||||
" >",
|
||||
" time_ms: 1",
|
||||
">");
|
||||
">",
|
||||
"version: 2");
|
||||
|
||||
verifySerialization(want, ev);
|
||||
}
|
||||
|
||||
@@ -204,7 +204,8 @@ public class IpConnectivityMetricsTest extends TestCase {
|
||||
" router_lifetime: 2000",
|
||||
" >",
|
||||
" time_ms: 700",
|
||||
">");
|
||||
">",
|
||||
"version: 2");
|
||||
|
||||
verifySerialization(want, getdump("flush"));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user