Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit afdd4cfc authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge changes I8bfabcb1,I563a6a31

* changes:
  Connectivity metrics: change how interface names are logged
  Connectivity metrics: serialize networkId, transports, ifname
parents 60b4af5d 948a8594
Loading
Loading
Loading
Loading
+8 −2
Original line number Diff line number Diff line
@@ -76,7 +76,13 @@ public final class ConnectivityMetricsEvent implements Parcelable {

    @Override
    public String toString() {
        // TODO: add transports, netId, ifname
        return String.format("ConnectivityMetricsEvent(%tT.%tL): %s", timestamp, timestamp, data);
        StringBuilder buffer = new StringBuilder("ConnectivityMetricsEvent(");
        buffer.append(String.format("%tT.%tL", timestamp, timestamp));
        // TODO: add transports, netId
        if (ifname != null) {
            buffer.append(", ").append(ifname);
        }
        buffer.append("): ").append(data.toString());
        return buffer.toString();
    }
}
+4 −2
Original line number Diff line number Diff line
@@ -423,8 +423,10 @@ public final class NetworkCapabilities implements Parcelable {
     */
    public static final int TRANSPORT_WIFI_AWARE = 5;

    private static final int MIN_TRANSPORT = TRANSPORT_CELLULAR;
    private static final int MAX_TRANSPORT = TRANSPORT_WIFI_AWARE;
    /** @hide */
    public static final int MIN_TRANSPORT = TRANSPORT_CELLULAR;
    /** @hide */
    public static final int MAX_TRANSPORT = TRANSPORT_WIFI_AWARE;

    /**
     * Adds the given transport type to this {@code NetworkCapability} instance.
+2 −6
Original line number Diff line number Diff line
@@ -31,25 +31,21 @@ public final class DhcpClientEvent implements Parcelable {
    /** {@hide} Represents transitions from and to DhcpBoundState via DhcpRenewingState */
    public static final String RENEWING_BOUND = "RenewingBoundState";

    public final String ifName;
    public final String msg;
    public final int durationMs;

    public DhcpClientEvent(String ifName, String msg, int durationMs) {
        this.ifName = ifName;
    public DhcpClientEvent(String msg, int durationMs) {
        this.msg = msg;
        this.durationMs = durationMs;
    }

    private DhcpClientEvent(Parcel in) {
        this.ifName = in.readString();
        this.msg = in.readString();
        this.durationMs = in.readInt();
    }

    @Override
    public void writeToParcel(Parcel out, int flags) {
        out.writeString(ifName);
        out.writeString(msg);
        out.writeInt(durationMs);
    }
@@ -61,7 +57,7 @@ public final class DhcpClientEvent implements Parcelable {

    @Override
    public String toString() {
        return String.format("DhcpClientEvent(%s, %s, %dms)", ifName, msg, durationMs);
        return String.format("DhcpClientEvent(%s, %dms)", msg, durationMs);
    }

    public static final Parcelable.Creator<DhcpClientEvent> CREATOR
+2 −6
Original line number Diff line number Diff line
@@ -54,7 +54,6 @@ public final class DhcpErrorEvent implements Parcelable {
    public static final int RECEIVE_ERROR              = makeErrorCode(MISC_ERROR, 2);
    public static final int PARSING_ERROR              = makeErrorCode(MISC_ERROR, 3);

    public final String ifName;
    // error code byte format (MSB to LSB):
    // byte 0: error type
    // byte 1: error subtype
@@ -62,19 +61,16 @@ public final class DhcpErrorEvent implements Parcelable {
    // byte 3: optional code
    public final int errorCode;

    public DhcpErrorEvent(String ifName, int errorCode) {
        this.ifName = ifName;
    public DhcpErrorEvent(int errorCode) {
        this.errorCode = errorCode;
    }

    private DhcpErrorEvent(Parcel in) {
        this.ifName = in.readString();
        this.errorCode = in.readInt();
    }

    @Override
    public void writeToParcel(Parcel out, int flags) {
        out.writeString(ifName);
        out.writeInt(errorCode);
    }

@@ -104,7 +100,7 @@ public final class DhcpErrorEvent implements Parcelable {

    @Override
    public String toString() {
        return String.format("DhcpErrorEvent(%s, %s)", ifName, Decoder.constants.get(errorCode));
        return String.format("DhcpErrorEvent(%s)", Decoder.constants.get(errorCode));
    }

    final static class Decoder {
+12 −0
Original line number Diff line number Diff line
@@ -97,6 +97,18 @@ public class IpConnectivityLog {
        return log(ev);
    }

    /**
     * Log an IpConnectivity event.
     * @param ifname the network interface associated with the event.
     * @param data is a Parcelable instance representing the event.
     * @return true if the event was successfully logged.
     */
    public boolean log(String ifname, Parcelable data) {
        ConnectivityMetricsEvent ev = makeEv(data);
        ev.ifname = ifname;
        return log(ev);
    }

    /**
     * Log an IpConnectivity event.
     * @param data is a Parcelable instance representing the event.
Loading