Search in sources :

Example 36 with ConnectivityMetricsEvent

use of android.net.ConnectivityMetricsEvent in project platform_frameworks_base by android.

the class IpConnectivityEventBuilder method toProto.

public static IpConnectivityEvent[] toProto(List<ConnectivityMetricsEvent> eventsIn) {
    final ArrayList<IpConnectivityEvent> eventsOut = new ArrayList<>(eventsIn.size());
    for (ConnectivityMetricsEvent in : eventsIn) {
        final IpConnectivityEvent out = toProto(in);
        if (out == null) {
            continue;
        }
        eventsOut.add(out);
    }
    return eventsOut.toArray(new IpConnectivityEvent[eventsOut.size()]);
}
Also used : IpConnectivityEvent(com.android.server.connectivity.metrics.IpConnectivityLogClass.IpConnectivityEvent) ArrayList(java.util.ArrayList) ConnectivityMetricsEvent(android.net.ConnectivityMetricsEvent)

Example 37 with ConnectivityMetricsEvent

use of android.net.ConnectivityMetricsEvent in project android_frameworks_base by DirtyUnicorns.

the class IpConnectivityEventBuilder method toProto.

public static List<IpConnectivityEvent> toProto(List<ConnectivityMetricsEvent> eventsIn) {
    final ArrayList<IpConnectivityEvent> eventsOut = new ArrayList<>(eventsIn.size());
    for (ConnectivityMetricsEvent in : eventsIn) {
        final IpConnectivityEvent out = toProto(in);
        if (out == null) {
            continue;
        }
        eventsOut.add(out);
    }
    return eventsOut;
}
Also used : IpConnectivityEvent(com.android.server.connectivity.metrics.IpConnectivityLogClass.IpConnectivityEvent) ArrayList(java.util.ArrayList) ConnectivityMetricsEvent(android.net.ConnectivityMetricsEvent)

Example 38 with ConnectivityMetricsEvent

use of android.net.ConnectivityMetricsEvent in project android_frameworks_base by DirtyUnicorns.

the class MetricsLoggerServiceTest method testLogOneByOne.

public void testLogOneByOne() throws Exception {
    for (ConnectivityMetricsEvent ev : EVENTS) {
        mService.mBinder.logEvent(ev);
    }
    Reference r = new Reference(0);
    assertArrayEquals(EVENTS, mService.mBinder.getEvents(r));
    assertEquals(N_EVENTS, r.getValue());
    assertArrayEquals(NO_EVENTS, mService.mBinder.getEvents(r));
    assertEquals(N_EVENTS, r.getValue());
}
Also used : Reference(android.net.ConnectivityMetricsEvent.Reference) ConnectivityMetricsEvent(android.net.ConnectivityMetricsEvent)

Example 39 with ConnectivityMetricsEvent

use of android.net.ConnectivityMetricsEvent in project android_frameworks_base by DirtyUnicorns.

the class IpConnectivityEventBuilderTest method testRaEventSerialization.

@SmallTest
public void testRaEventSerialization() {
    ConnectivityMetricsEvent ev = describeIpEvent(aType(RaEvent.class), aLong(2000), aLong(400), aLong(300), aLong(-1), aLong(1000), aLong(-1));
    String want = joinLines("dropped_events: 0", "events <", "  time_ms: 1", "  transport: 0", "  ra_event <", "    dnssl_lifetime: -1", "    prefix_preferred_lifetime: 300", "    prefix_valid_lifetime: 400", "    rdnss_lifetime: 1000", "    route_info_lifetime: -1", "    router_lifetime: 2000", "  >", ">", "version: 2");
    verifySerialization(want, ev);
}
Also used : RaEvent(android.net.metrics.RaEvent) ConnectivityMetricsEvent(android.net.ConnectivityMetricsEvent) MetricsTestUtil.aString(com.android.server.connectivity.MetricsTestUtil.aString) SmallTest(android.test.suitebuilder.annotation.SmallTest)

Example 40 with ConnectivityMetricsEvent

use of android.net.ConnectivityMetricsEvent in project android_frameworks_base by DirtyUnicorns.

the class IpConnectivityEventBuilderTest method testApfStatsSerialization.

@SmallTest
public void testApfStatsSerialization() {
    ConnectivityMetricsEvent ev = describeIpEvent(aType(ApfStats.class), aLong(45000), anInt(10), anInt(2), anInt(2), anInt(1), anInt(2), anInt(4), anInt(2048));
    String want = joinLines("dropped_events: 0", "events <", "  time_ms: 1", "  transport: 0", "  apf_statistics <", "    dropped_ras: 2", "    duration_ms: 45000", "    matching_ras: 2", "    max_program_size: 2048", "    parse_errors: 2", "    program_updates: 4", "    received_ras: 10", "    zero_lifetime_ras: 1", "  >", ">", "version: 2");
    verifySerialization(want, ev);
}
Also used : ApfStats(android.net.metrics.ApfStats) ConnectivityMetricsEvent(android.net.ConnectivityMetricsEvent) MetricsTestUtil.aString(com.android.server.connectivity.MetricsTestUtil.aString) SmallTest(android.test.suitebuilder.annotation.SmallTest)

Aggregations

ConnectivityMetricsEvent (android.net.ConnectivityMetricsEvent)63 MetricsTestUtil.aString (com.android.server.connectivity.MetricsTestUtil.aString)44 SmallTest (android.test.suitebuilder.annotation.SmallTest)39 DefaultNetworkEvent (android.net.metrics.DefaultNetworkEvent)8 IpConnectivityLog (android.net.metrics.IpConnectivityLog)8 Reference (android.net.ConnectivityMetricsEvent.Reference)6 IpConnectivityEvent (com.android.server.connectivity.metrics.IpConnectivityLogClass.IpConnectivityEvent)5 ArrayList (java.util.ArrayList)5 ApfProgramEvent (android.net.metrics.ApfProgramEvent)4 ApfStats (android.net.metrics.ApfStats)4 DhcpClientEvent (android.net.metrics.DhcpClientEvent)4 DhcpErrorEvent (android.net.metrics.DhcpErrorEvent)4 DnsEvent (android.net.metrics.DnsEvent)4 IpManagerEvent (android.net.metrics.IpManagerEvent)4 IpReachabilityEvent (android.net.metrics.IpReachabilityEvent)4 NetworkEvent (android.net.metrics.NetworkEvent)4 RaEvent (android.net.metrics.RaEvent)4 ValidationProbeEvent (android.net.metrics.ValidationProbeEvent)4 FileDescriptor (java.io.FileDescriptor)3 FileOutputStream (java.io.FileOutputStream)3