Search in sources :

Example 1 with IpConnectivityLog

use of com.android.server.connectivity.metrics.IpConnectivityLogClass.IpConnectivityLog in project android_frameworks_base by AOSPA.

the class IpConnectivityEventBuilder method serialize.

public static byte[] serialize(int dropped, List<IpConnectivityEvent> events) throws IOException {
    final IpConnectivityLog log = new IpConnectivityLog();
    log.events = events.toArray(new IpConnectivityEvent[events.size()]);
    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);
}
Also used : IpConnectivityEvent(com.android.server.connectivity.metrics.IpConnectivityLogClass.IpConnectivityEvent) IpConnectivityLog(com.android.server.connectivity.metrics.IpConnectivityLogClass.IpConnectivityLog)

Example 2 with IpConnectivityLog

use of com.android.server.connectivity.metrics.IpConnectivityLogClass.IpConnectivityLog in project android_frameworks_base by ResurrectionRemix.

the class IpConnectivityEventBuilder method serialize.

public static byte[] serialize(int dropped, List<IpConnectivityEvent> events) throws IOException {
    final IpConnectivityLog log = new IpConnectivityLog();
    log.events = events.toArray(new IpConnectivityEvent[events.size()]);
    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);
}
Also used : IpConnectivityEvent(com.android.server.connectivity.metrics.IpConnectivityLogClass.IpConnectivityEvent) IpConnectivityLog(com.android.server.connectivity.metrics.IpConnectivityLogClass.IpConnectivityLog)

Example 3 with IpConnectivityLog

use of com.android.server.connectivity.metrics.IpConnectivityLogClass.IpConnectivityLog in project android_frameworks_base by crdroidandroid.

the class IpConnectivityEventBuilderTest method verifySerialization.

static void verifySerialization(String want, ConnectivityMetricsEvent... input) {
    try {
        byte[] got = IpConnectivityEventBuilder.serialize(0, IpConnectivityEventBuilder.toProto(Arrays.asList(input)));
        IpConnectivityLog log = IpConnectivityLog.parseFrom(got);
        assertEquals(want, log.toString());
    } catch (Exception e) {
        fail(e.toString());
    }
}
Also used : IpConnectivityLog(com.android.server.connectivity.metrics.IpConnectivityLogClass.IpConnectivityLog)

Example 4 with IpConnectivityLog

use of com.android.server.connectivity.metrics.IpConnectivityLogClass.IpConnectivityLog in project platform_frameworks_base by android.

the class IpConnectivityEventBuilderTest method verifySerialization.

static void verifySerialization(String want, ConnectivityMetricsEvent... input) {
    try {
        byte[] got = IpConnectivityEventBuilder.serialize(0, Arrays.asList(input));
        IpConnectivityLog log = new IpConnectivityLog();
        MessageNano.mergeFrom(log, got);
        assertEquals(want, log.toString());
    } catch (Exception e) {
        fail(e.toString());
    }
}
Also used : IpConnectivityLog(com.android.server.connectivity.metrics.IpConnectivityLogClass.IpConnectivityLog)

Example 5 with IpConnectivityLog

use of com.android.server.connectivity.metrics.IpConnectivityLogClass.IpConnectivityLog in project platform_frameworks_base by android.

the class IpConnectivityEventBuilder method serialize.

public static byte[] serialize(int dropped, List<ConnectivityMetricsEvent> events) throws IOException {
    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);
}
Also used : IpConnectivityLog(com.android.server.connectivity.metrics.IpConnectivityLogClass.IpConnectivityLog)

Aggregations

IpConnectivityLog (com.android.server.connectivity.metrics.IpConnectivityLogClass.IpConnectivityLog)9 IpConnectivityEvent (com.android.server.connectivity.metrics.IpConnectivityLogClass.IpConnectivityEvent)4