Loading core/java/android/net/ConnectivityMetricsEvent.java +4 −1 Original line number Diff line number Diff line Loading @@ -78,7 +78,10 @@ public final class ConnectivityMetricsEvent implements Parcelable { public String toString() { StringBuilder buffer = new StringBuilder("ConnectivityMetricsEvent("); buffer.append(String.format("%tT.%tL", timestamp, timestamp)); // TODO: add transports, netId // TODO: add transports if (netId != 0) { buffer.append(", ").append(netId); } if (ifname != null) { buffer.append(", ").append(ifname); } Loading core/java/android/net/NetworkCapabilities.java +11 −0 Original line number Diff line number Diff line Loading @@ -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. * Loading core/java/android/net/metrics/IpConnectivityLog.java +15 −0 Original line number Diff line number Diff line Loading @@ -109,6 +109,21 @@ public class IpConnectivityLog { return log(ev); } /** * Log an IpConnectivity event. * @param netid the id of the network associated with the event. * @param transports the current transports of the network associated with the event, as defined * in NetworkCapabilities. * @param data is a Parcelable instance representing the event. * @return true if the event was successfully logged. */ public boolean log(int netid, long transports, Parcelable data) { ConnectivityMetricsEvent ev = makeEv(data); ev.netId = netid; ev.transports = transports; return log(ev); } /** * Log an IpConnectivity event. * @param data is a Parcelable instance representing the event. Loading core/java/android/net/metrics/ValidationProbeEvent.java +6 −14 Original line number Diff line number Diff line Loading @@ -48,26 +48,19 @@ public final class ValidationProbeEvent implements Parcelable { @Retention(RetentionPolicy.SOURCE) public @interface ReturnCode {} public final int netId; public final long durationMs; public long durationMs; // probeType byte format (MSB to LSB): // byte 0: unused // byte 1: unused // byte 2: 0 = UNKNOWN, 1 = FIRST_VALIDATION, 2 = REVALIDATION // byte 3: PROBE_* constant public final int probeType; public final @ReturnCode int returnCode; public ValidationProbeEvent( int netId, long durationMs, int probeType, @ReturnCode int returnCode) { this.netId = netId; this.durationMs = durationMs; this.probeType = probeType; this.returnCode = returnCode; public int probeType; public @ReturnCode int returnCode; public ValidationProbeEvent() { } private ValidationProbeEvent(Parcel in) { netId = in.readInt(); durationMs = in.readLong(); probeType = in.readInt(); returnCode = in.readInt(); Loading @@ -75,7 +68,6 @@ public final class ValidationProbeEvent implements Parcelable { @Override public void writeToParcel(Parcel out, int flags) { out.writeInt(netId); out.writeLong(durationMs); out.writeInt(probeType); out.writeInt(returnCode); Loading Loading @@ -111,7 +103,7 @@ public final class ValidationProbeEvent implements Parcelable { @Override public String toString() { return String.format("ValidationProbeEvent(%d, %s:%d %s, %dms)", netId, return String.format("ValidationProbeEvent(%s:%d %s, %dms)", getProbeName(probeType), returnCode, getValidationStage(probeType), durationMs); } Loading services/core/java/com/android/server/connectivity/IpConnectivityEventBuilder.java +0 −1 Original line number Diff line number Diff line Loading @@ -210,7 +210,6 @@ final public class IpConnectivityEventBuilder { private static void setValidationProbeEvent(IpConnectivityEvent out, ValidationProbeEvent in) { IpConnectivityLogClass.ValidationProbeEvent validationProbeEvent = new IpConnectivityLogClass.ValidationProbeEvent(); validationProbeEvent.networkId = netIdOf(in.netId); validationProbeEvent.latencyMs = (int) in.durationMs; validationProbeEvent.probeType = in.probeType; validationProbeEvent.probeResult = in.returnCode; Loading Loading
core/java/android/net/ConnectivityMetricsEvent.java +4 −1 Original line number Diff line number Diff line Loading @@ -78,7 +78,10 @@ public final class ConnectivityMetricsEvent implements Parcelable { public String toString() { StringBuilder buffer = new StringBuilder("ConnectivityMetricsEvent("); buffer.append(String.format("%tT.%tL", timestamp, timestamp)); // TODO: add transports, netId // TODO: add transports if (netId != 0) { buffer.append(", ").append(netId); } if (ifname != null) { buffer.append(", ").append(ifname); } Loading
core/java/android/net/NetworkCapabilities.java +11 −0 Original line number Diff line number Diff line Loading @@ -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. * Loading
core/java/android/net/metrics/IpConnectivityLog.java +15 −0 Original line number Diff line number Diff line Loading @@ -109,6 +109,21 @@ public class IpConnectivityLog { return log(ev); } /** * Log an IpConnectivity event. * @param netid the id of the network associated with the event. * @param transports the current transports of the network associated with the event, as defined * in NetworkCapabilities. * @param data is a Parcelable instance representing the event. * @return true if the event was successfully logged. */ public boolean log(int netid, long transports, Parcelable data) { ConnectivityMetricsEvent ev = makeEv(data); ev.netId = netid; ev.transports = transports; return log(ev); } /** * Log an IpConnectivity event. * @param data is a Parcelable instance representing the event. Loading
core/java/android/net/metrics/ValidationProbeEvent.java +6 −14 Original line number Diff line number Diff line Loading @@ -48,26 +48,19 @@ public final class ValidationProbeEvent implements Parcelable { @Retention(RetentionPolicy.SOURCE) public @interface ReturnCode {} public final int netId; public final long durationMs; public long durationMs; // probeType byte format (MSB to LSB): // byte 0: unused // byte 1: unused // byte 2: 0 = UNKNOWN, 1 = FIRST_VALIDATION, 2 = REVALIDATION // byte 3: PROBE_* constant public final int probeType; public final @ReturnCode int returnCode; public ValidationProbeEvent( int netId, long durationMs, int probeType, @ReturnCode int returnCode) { this.netId = netId; this.durationMs = durationMs; this.probeType = probeType; this.returnCode = returnCode; public int probeType; public @ReturnCode int returnCode; public ValidationProbeEvent() { } private ValidationProbeEvent(Parcel in) { netId = in.readInt(); durationMs = in.readLong(); probeType = in.readInt(); returnCode = in.readInt(); Loading @@ -75,7 +68,6 @@ public final class ValidationProbeEvent implements Parcelable { @Override public void writeToParcel(Parcel out, int flags) { out.writeInt(netId); out.writeLong(durationMs); out.writeInt(probeType); out.writeInt(returnCode); Loading Loading @@ -111,7 +103,7 @@ public final class ValidationProbeEvent implements Parcelable { @Override public String toString() { return String.format("ValidationProbeEvent(%d, %s:%d %s, %dms)", netId, return String.format("ValidationProbeEvent(%s:%d %s, %dms)", getProbeName(probeType), returnCode, getValidationStage(probeType), durationMs); } Loading
services/core/java/com/android/server/connectivity/IpConnectivityEventBuilder.java +0 −1 Original line number Diff line number Diff line Loading @@ -210,7 +210,6 @@ final public class IpConnectivityEventBuilder { private static void setValidationProbeEvent(IpConnectivityEvent out, ValidationProbeEvent in) { IpConnectivityLogClass.ValidationProbeEvent validationProbeEvent = new IpConnectivityLogClass.ValidationProbeEvent(); validationProbeEvent.networkId = netIdOf(in.netId); validationProbeEvent.latencyMs = (int) in.durationMs; validationProbeEvent.probeType = in.probeType; validationProbeEvent.probeResult = in.returnCode; Loading