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

Commit dc78c3ba authored by Frank Li's avatar Frank Li Committed by Automerger Merge Worker
Browse files

Merge "Adding NetworkStack Metrics/atoms" into rvc-dev am: 64a3cb03

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/11629772

Change-Id: Ibb7aa50863308e4364c16701d15f76c47725e707
parents 89a5c51e 64a3cb03
Loading
Loading
Loading
Loading
+171 −0
Original line number Diff line number Diff line
@@ -465,6 +465,11 @@ message Atom {
            288 [(module) = "car"];
        CarUserHalSetUserAssociationResponseReported car_user_hal_set_user_association_response_reported =
            289 [(module) = "car"];
        NetworkIpProvisioningReported network_ip_provisioning_reported =
            290 [(module) = "network_stack"];
        NetworkDhcpRenewReported network_dhcp_renew_reported = 291 [(module) = "network_stack"];
        NetworkValidationReported network_validation_reported = 292 [(module) = "network_stack"];
        NetworkStackQuirkReported network_stack_quirk_reported = 293 [(module) = "network_stack"];

        // StatsdStats tracks platform atoms with ids upto 500.
        // Update StatsdStats::kMaxPushedAtomId when atom ids here approach that value.
@@ -6821,6 +6826,172 @@ message NetworkDnsEventReported {
    optional int32 sampling_rate_denom = 9;
}

/**
 * logs the CapportApiData info
 * Logged from:
 * packages/modules/NetworkStack/src/com/android/server/connectivity/NetworkMonitor.java
 */
message CapportApiData {
    // The TTL of the network connection provided by captive portal
    optional int32 remaining_ttl_secs = 1;

    // The limit traffic data of the network connection provided by captive portal
    optional int32 remaining_bytes = 2;

    // Is portal url option included in the DHCP packet (Yes, No)
    optional bool has_portal_url = 3;

    // Is venue info (e.g. store info, maps, flight status) included (Yes, No)
    optional bool has_venue_info = 4;
}

/**
 * logs a network Probe Event
 * Logged from:
 * packages/modules/NetworkStack/src/com/android/server/connectivity/NetworkMonitor.java
 */
message ProbeEvent {
    // The probe type (http or https, or captive portal API...)
    optional android.stats.connectivity.ProbeType probe_type = 1;

    // The latency in microseconds of the probe event
    optional int32 latency_micros = 2;

    // The result of the probe event
    optional android.stats.connectivity.ProbeResult probe_result = 3;

    // The CaptivePortal API info
    optional CapportApiData capport_api_data = 4;
}

/**
 * log each ProbeEvent in ProbeEvents
 * Logged from:
 * packages/modules/NetworkStack/src/com/android/server/connectivity/NetworkMonitor.java
 */
message ProbeEvents {
    // Record probe event during the validation
    repeated ProbeEvent probe_event = 1;
}

/**
 * The DHCP (Dynamic Host Configuration Protocol) session info
 * Logged from:
 * packages/modules/NetworkStack/src/android/net/dhcp/DhcpClient.java
 */
message DhcpSession {
    // The DHCP Feature(s) enabled in this session
    repeated android.stats.connectivity.DhcpFeature used_features = 1;

    // The discover packet (re)transmit count
    optional int32 discover_count = 2;

    // The request packet (re)transmit count
    optional int32 request_count = 3;

    // The IPv4 address conflict count
    // (only be meaningful when duplicate address detection is enabled)
    optional int32 conflict_count = 4;

    // The DHCP packet parsing error code in this session
    // (defined in android.net.metrics.DhcpErrorEvent)
    repeated android.stats.connectivity.DhcpErrorCode error_code = 5;

    // The result of DHCP hostname transliteration
    optional android.stats.connectivity.HostnameTransResult ht_result = 6;
}

/**
 * Logs Network IP provisioning event
 * Logged from:
 * packages/modules/NetworkStack/src/com/android/networkstack/metrics/NetworkIpProvisioningMetrics.java
 */
message NetworkIpProvisioningReported {
    // Transport type (WIFI, CELLULAR, BLUETOOTH, ..)
    optional android.stats.connectivity.TransportType transport_type = 1;

    // The latency in microseconds of IP Provisioning over IPV4
    optional int32 ipv4_latency_micros = 2;

    // The latency in microseconds of IP Provisioning over IPV6
    optional int32 ipv6_latency_micros = 3;

    // The time duration between provisioning start and end (success or failure)
    optional int64 provisioning_duration_micros = 4;

    // The specific disconnect reason for this IP provisioning
    optional android.stats.connectivity.DisconnectCode disconnect_code = 5;

    // Log DHCP session info (Only valid for IPv4)
    optional DhcpSession dhcp_session = 6 [(log_mode) = MODE_BYTES];

    // The random number between 0 ~ 999 for sampling
    optional int32 random_number = 7;
}

/**
 * Logs Network DHCP Renew event
 * Logged from:
 * packages/modules/NetworkStack/src/android/net/dhcp/DhcpClient.java
 */
message NetworkDhcpRenewReported {
    // Transport type (WIFI, CELLULAR, BLUETOOTH, ..)
    optional android.stats.connectivity.TransportType transport_type = 1;

    // The request packet (re)transmit count
    optional int32 request_count = 2;

    // The latency in microseconds of DHCP Renew
    optional int32 latency_micros = 3;

    // The DHCP error code is defined in android.net.metrics.DhcpErrorEvent
    optional android.stats.connectivity.DhcpErrorCode error_code = 4;

    // The result of DHCP renew
    optional android.stats.connectivity.DhcpRenewResult renew_result = 5;

    // The random number between 0 ~ 999 for sampling
    optional int32 random_number = 6;
}

/**
 * Logs Network Validation event
 * Logged from:
 * packages/modules/NetworkStack/src/com/android/server/connectivity/NetworkMonitor.java
 */
message NetworkValidationReported {
    // Transport type (WIFI, CELLULAR, BLUETOOTH, ..)
    optional android.stats.connectivity.TransportType transport_type = 1;

    // Record each probe event
    optional ProbeEvents probe_events = 2 [(log_mode) = MODE_BYTES];

    // The result of the network validation
    optional android.stats.connectivity.ValidationResult validation_result = 3;

    // The latency in microseconds of network validation
    optional int32 latency_micros = 4;

    // The validation index (the first validation attempt or second, third...)
    optional int32 validation_index = 5;

    // The random number between 0 ~ 999 for sampling
    optional int32 random_number = 6;
}

/**
 * Logs NetworkStack Quirk event
 * Logged from:
 * packages/modules/NetworkStack/src/com/android/networkstack/
 */
message NetworkStackQuirkReported {
    // Transport type (WIFI, CELLULAR, BLUETOOTH, ..)
    optional android.stats.connectivity.TransportType transport_type = 1;

    // Record each Quirk event
    optional android.stats.connectivity.NetworkQuirkEvent event = 2;
}

/**
 * Logs when a data stall event occurs.
 *
+3 −3
Original line number Diff line number Diff line
@@ -13,12 +13,12 @@
// limitations under the License.

java_library_static {
    name: "networkstackprotosnano",
    name: "networkstackprotos",
    proto: {
        type: "nano",
        type: "lite",
    },
    srcs: [
        "network_stack.proto",
    ],
    sdk_version: "system_current",
    sdk_version: "system_29",
}
+154 −0
Original line number Diff line number Diff line
@@ -20,6 +20,160 @@ package android.stats.connectivity;
option java_multiple_files = true;
option java_outer_classname = "NetworkStackProto";

enum DhcpRenewResult {
    RR_UNKNOWN = 0;
    RR_SUCCESS = 1;
    RR_ERROR_NAK = 2;
    RR_ERROR_IP_MISMATCH = 3;
    RR_ERROR_IP_EXPIRE = 4;
}

enum DisconnectCode {
    DC_NONE = 0;
    DC_NORMAL_TERMINATION = 1;
    DC_PROVISIONING_FAIL = 2;
    DC_ERROR_STARTING_IPV4 = 4;
    DC_ERROR_STARTING_IPV6 = 5;
    DC_ERROR_STARTING_IPREACHABILITYMONITOR = 6;
    DC_INVALID_PROVISIONING = 7;
    DC_INTERFACE_NOT_FOUND = 8;
    DC_PROVISIONING_TIMEOUT = 9;
}

enum TransportType {
    TT_UNKNOWN = 0;
    // Indicates this network uses a Cellular transport
    TT_CELLULAR = 1;
    // Indicates this network uses a Wi-Fi transport
    TT_WIFI = 2;
    // Indicates this network uses a Bluetooth transport
    TT_BLUETOOTH = 3;
    // Indicates this network uses an Ethernet transport
    TT_ETHERNET = 4;
    // Indicates this network uses a Wi-Fi Aware transport
    TT_WIFI_AWARE = 5;
    // Indicates this network uses a LoWPAN transport
    TT_LOWPAN = 6;
    // Indicates this network uses a Cellular+VPN transport
    TT_CELLULAR_VPN = 7;
    // Indicates this network uses a Wi-Fi+VPN transport
    TT_WIFI_VPN = 8;
    // Indicates this network uses a Bluetooth+VPN transport
    TT_BLUETOOTH_VPN = 9;
    // Indicates this network uses an Ethernet+VPN transport
    TT_ETHERNET_VPN = 10;
    // Indicates this network uses a Wi-Fi+Cellular+VPN transport
    TT_WIFI_CELLULAR_VPN = 11;
    // Indicates this network uses for test only
    TT_TEST = 12;
}

enum DhcpFeature {
    DF_UNKNOWN = 0;
    // DHCP INIT-REBOOT state
    DF_INITREBOOT = 1;
    // DHCP rapid commit option
    DF_RAPIDCOMMIT  = 2;
    // Duplicate address detection
    DF_DAD = 3;
    // Fast initial Link setup
    DF_FILS = 4;
}

enum HostnameTransResult {
    HTR_UNKNOWN = 0;
    HTR_SUCCESS = 1;
    HTR_FAILURE = 2;
    HTR_DISABLE = 3;
}

enum ProbeResult {
    PR_UNKNOWN = 0;
    PR_SUCCESS = 1;
    PR_FAILURE = 2;
    PR_PORTAL = 3;
    // DNS query for the probe host returned a private IP address
    PR_PRIVATE_IP_DNS = 4;
}

enum ValidationResult {
    VR_UNKNOWN = 0;
    VR_SUCCESS = 1;
    VR_FAILURE = 2;
    VR_PORTAL = 3;
    VR_PARTIAL = 4;
}

enum ProbeType {
    PT_UNKNOWN = 0;
    PT_DNS       = 1;
    PT_HTTP      = 2;
    PT_HTTPS     = 3;
    PT_PAC       = 4;
    PT_FALLBACK  = 5;
    PT_PRIVDNS   = 6;
    PT_CAPPORT_API = 7;
}

// The Dhcp error code is defined in android.net.metrics.DhcpErrorEvent
enum DhcpErrorCode {
    ET_UNKNOWN = 0;
    ET_L2_ERROR = 1;
    ET_L3_ERROR = 2;
    ET_L4_ERROR = 3;
    ET_DHCP_ERROR = 4;
    ET_MISC_ERROR = 5;
    /* Reserve for error type
    // ET_L2_ERROR_TYPE = ET_L2_ERROR << 8;
    ET_L2_ERROR_TYPE = 256;
    // ET_L3_ERROR_TYPE = ET_L3_ERROR << 8;
    ET_L3_ERROR_TYPE = 512;
    // ET_L4_ERROR_TYPE = ET_L4_ERROR << 8;
    ET_L4_ERROR_TYPE = 768;
    // ET_DHCP_ERROR_TYPE = ET_DHCP_ERROR << 8;
    ET_DHCP_ERROR_TYPE = 1024;
    // ET_MISC_ERROR_TYPE = ET_MISC_ERROR << 8;
    ET_MISC_ERROR_TYPE = 1280;
    */
    // ET_L2_TOO_SHORT = (ET_L2_ERROR_TYPE | 0x1) << 16;
    ET_L2_TOO_SHORT = 16842752;
    // ET_L2_WRONG_ETH_TYPE = (ET_L2_ERROR_TYPE | 0x2) << 16;
    ET_L2_WRONG_ETH_TYPE = 16908288;
    // ET_L3_TOO_SHORT = (ET_L3_ERROR_TYPE | 0x1) << 16;
    ET_L3_TOO_SHORT = 33619968;
    // ET_L3_NOT_IPV4 = (ET_L3_ERROR_TYPE | 0x2) << 16;
    ET_L3_NOT_IPV4 = 33685504;
    // ET_L3_INVALID_IP = (ET_L3_ERROR_TYPE | 0x3) << 16;
    ET_L3_INVALID_IP = 33751040;
    // ET_L4_NOT_UDP = (ET_L4_ERROR_TYPE | 0x1) << 16;
    ET_L4_NOT_UDP = 50397184;
    // ET_L4_WRONG_PORT = (ET_L4_ERROR_TYPE | 0x2) << 16;
    ET_L4_WRONG_PORT = 50462720;
    // ET_BOOTP_TOO_SHORT = (ET_DHCP_ERROR_TYPE | 0x1) << 16;
    ET_BOOTP_TOO_SHORT = 67174400;
    // ET_DHCP_BAD_MAGIC_COOKIE = (ET_DHCP_ERROR_TYPE | 0x2) << 16;
    ET_DHCP_BAD_MAGIC_COOKIE = 67239936;
    // ET_DHCP_INVALID_OPTION_LENGTH = (ET_DHCP_ERROR_TYPE | 0x3) << 16;
    ET_DHCP_INVALID_OPTION_LENGTH = 67305472;
    // ET_DHCP_NO_MSG_TYPE = (ET_DHCP_ERROR_TYPE | 0x4) << 16;
    ET_DHCP_NO_MSG_TYPE = 67371008;
    // ET_DHCP_UNKNOWN_MSG_TYPE = (ET_DHCP_ERROR_TYPE | 0x5) << 16;
    ET_DHCP_UNKNOWN_MSG_TYPE = 67436544;
    // ET_DHCP_NO_COOKIE = (ET_DHCP_ERROR_TYPE | 0x6) << 16;
    ET_DHCP_NO_COOKIE = 67502080;
    // ET_BUFFER_UNDERFLOW = (ET_MISC_ERROR_TYPE | 0x1) << 16;
    ET_BUFFER_UNDERFLOW = 83951616;
    // ET_RECEIVE_ERROR = (ET_MISC_ERROR_TYPE | 0x2) << 16;
    ET_RECEIVE_ERROR = 84017152;
    // ET_PARSING_ERROR = (ET_MISC_ERROR_TYPE | 0x3) << 16;
    ET_PARSING_ERROR = 84082688;
}

enum NetworkQuirkEvent {
    QE_UNKNOWN = 0;
    QE_IPV6_PROVISIONING_ROUTER_LOST = 1;
}

message NetworkStackEventData {

}