1/* 2 * Copyright (C) 2022 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17syntax = "proto2"; 18option java_multiple_files = true; 19 20package com.android.metrics; 21 22import "frameworks/proto_logging/stats/enums/stats/connectivity/connectivity_service.proto"; 23 24/** 25 * Logs NSD(Network service discovery) client session 26 * 27 * Log from: 28 * packages/modules/Connectivity/service-t/src/com/android/server/NsdService 29 */ 30message NetworkNsdReported { 31 // Indicate if the device is using the legacy or the new implementation 32 optional bool is_legacy = 1; 33 34 // It is a random number to represent different clients. Each client is an app on the device. 35 optional int32 client_id = 2; 36 37 // It is a increment_number to represent different transactions. 38 // Each transaction is a request from an app client. 39 optional int32 transaction_id = 3; 40 41 // Indicate the service in resolution is a known service in the discovered services cache 42 optional bool is_known_service = 4; 43 44 // Record each NSD session type 45 optional .android.stats.connectivity.NsdEventType type = 5; 46 47 // The process duration of the event in milli-second 48 optional int64 event_duration_millisec = 6; 49 50 // Record each mdns query result 51 optional .android.stats.connectivity.MdnsQueryResult query_result = 7; 52 53 // Count of services in cache at the end of discovery 54 optional int32 found_service_count = 8; 55 56 // Count of found callback when discovery is stopped 57 optional int32 found_callback_count = 9; 58 59 // Count of lost callback when discovery is stopped 60 optional int32 lost_callback_count = 10; 61 62 // Record query service count before unregistered service 63 optional int32 replied_requests_count = 11; 64 65 // Record sent query count before stopped discovery 66 optional int32 sent_query_count = 12; 67 68 // Record sent packet count before unregistered service 69 optional int32 sent_packet_count = 13; 70 71 // Record number of conflict during probing 72 optional int32 conflict_during_probing_count = 14; 73 74 // Record number of conflict after probing 75 optional int32 conflict_after_probing_count = 15; 76 77 // The random number between 0 ~ 999 for sampling 78 optional int32 random_number = 16; 79} 80 81/** 82 * Logs the number of network count on each list of transports 83 * 84 * Logs from: 85 * packages/modules/Connectivity/service/src/com/android/server/ConnectivityService.java 86 */ 87message NetworkCountPerTransports { 88 // the number of network count on each list of transports 89 repeated NetworkCountForTransports network_count_for_transports = 1; 90} 91 92/** 93 * Logs the number of network count and transport type 94 * 95 * Logs from: 96 * packages/modules/Connectivity/service/src/com/android/server/ConnectivityService.java 97 */ 98message NetworkCountForTransports { 99 // Transport types of the network 100 optional int32 transport_types = 1; 101 102 // Number of networks for one list of transport types 103 optional int32 network_count = 2; 104} 105 106/** 107 * Logs a list of networks 108 * 109 * Logs from: 110 * packages/modules/Connectivity/service/src/com/android/server/ConnectivityService.java 111 */ 112message NetworkList { 113 repeated NetworkDescription network_description = 1; 114} 115 116/** 117 * Logs connection duration in seconds and list of transports 118 * 119 * Logs from: 120 * packages/modules/Connectivity/service/src/com/android/server/ConnectivityService.java 121 */ 122message ConnectionDurationForTransports { 123 // Transport types of the network 124 optional int32 transport_types = 1; 125 126 // Time duration that the device stays connected to the network 127 optional int32 duration_sec = 2; 128} 129 130/** 131 * Logs connection duration on each list of transports, in seconds 132 * 133 * Logs from: 134 * packages/modules/Connectivity/service/src/com/android/server/ConnectivityService.java 135 */ 136message ConnectionDurationPerTransports { 137 repeated ConnectionDurationForTransports connection_duration_for_transports = 1; 138} 139 140/** 141 * Logs network request count & request type 142 * 143 * Logs from: 144 * packages/modules/Connectivity/service/src/com/android/server/ConnectivityService.java 145 */ 146message RequestCountForType { 147 // The type of network request 148 optional .android.stats.connectivity.RequestType request_type = 1; 149 150 // Number of network requests 151 optional int32 request_count = 2; 152} 153 154/** 155 * Logs network request count 156 * 157 * Logs from: 158 * packages/modules/Connectivity/service/src/com/android/server/ConnectivityService.java 159 */ 160message NetworkRequestCount { 161 // Network request count for request type 162 repeated RequestCountForType request_count_for_type = 1; 163} 164 165/** 166 * Logs information about a network 167 * 168 * Logs from: 169 * packages/modules/Connectivity/service/src/com/android/server/ConnectivityService.java 170 */ 171message NetworkDescription { 172 // The transport types of the network. A network may include multiple transport types. 173 // Each transfer type is represented by a different bit, defined in 174 // packages/modules/Connectivity/framework/src/android/net/NetworkCapabilities.java 175 optional int32 transport_types = 1; 176 177 // Indicates the network is metered, non-metered or temporarily-unmetered 178 optional .android.stats.connectivity.MeteredState metered_state = 2; 179 180 // Indicates the network is validated, non-validated, partial or portal 181 optional .android.stats.connectivity.ValidatedState validated_state = 3; 182 183 // Record the bitmask of all the policies applied to this score of network. 184 // Each policy is represented by a different bit, defined in 185 // packages/modules/Connectivity/service/src/com/android/server/connectivity/FullScore.java 186 optional int64 score_policies = 4; 187 188 // The capabilities of the network. A network may include multiple network capabilities. 189 // Each capability is represented by a different bit, defined in 190 // packages/modules/Connectivity/framework/src/android/net/NetworkCapabilities.java 191 optional int64 capabilities = 5; 192 193 // Bitfield representing the network's enterprise capability identifier, defined in 194 // packages/modules/Connectivity/framework/src/android/net/NetworkCapabilities.java 195 optional int32 enterprise_id = 6; 196} 197 198/** 199 * Pulls a list of NumberOfRematchesPerReason. 200 * 201 * Pulled from: 202 * packages/modules/Connectivity/service/src/com/android/server/ConnectivityService.java 203 */ 204message NumberOfRematchesPerReason { 205 // Number of network rematches for each rematch reason 206 repeated NumberOfRematchesForReason number_of_rematches_per_reason= 1; 207} 208 209/** 210 * Logs number of network rematches for rematch reason 211 * 212 * Logs from: 213 * packages/modules/Connectivity/service/src/com/android/server/ConnectivityService.java 214 */ 215message NumberOfRematchesForReason { 216 // The reason of network rematch 217 optional .android.stats.connectivity.RematchReason rematch_reason = 1; 218 219 // Number of network rematches 220 optional int32 rematch_count = 2; 221}; 222 223/** 224 * Pulls information for connectivity stats. 225 * 226 * Pulled from: 227 * packages/modules/Connectivity/service/src/com/android/server/ConnectivityService.java 228 */ 229message ConnectivityStateSample { 230 // Number of networks per list of transports 231 optional NetworkCountPerTransports network_count_per_transports = 1; 232 233 // This is a list of networks with their transports and the duration 234 optional ConnectionDurationPerTransports connection_duration_per_transports = 2; 235 236 // Number of requests per category 237 optional NetworkRequestCount network_request_count = 3; 238 239 // Full list of network details (slice by transport / meteredness / internet+validated) 240 optional NetworkList networks = 4; 241} 242 243 244/** 245 * Pulls information for network selection rematch info. 246 * 247 * Pulled from: 248 * packages/modules/Connectivity/service/src/com/android/server/ConnectivityService.java 249 */ 250message NetworkSelectionRematchReasonsInfo { 251 // Number of rematch per rematch reason 252 optional NumberOfRematchesPerReason number_of_rematches_per_reason = 1; 253} 254 255/** 256 * Logs rematch information for the default network 257 * 258 * Logs from: 259 * packages/modules/Connectivity/service/src/com/android/server/ConnectivityService.java 260 */ 261message DefaultNetworkRematchInfo { 262 // The session id comes from each reboot, this is used to correlate the statistics of the 263 // networkselect on the same boot 264 optional int64 session_id = 1; 265 266 // The information of old device default network 267 optional NetworkDescription old_network = 2; 268 269 // The information of new device default network 270 optional NetworkDescription new_network = 3; 271 272 // The reason of network rematch 273 optional .android.stats.connectivity.RematchReason rematch_reason = 4; 274 275 // The time duration the device kept the old network as the default in seconds 276 optional int32 time_duration_on_old_network_sec = 5; 277} 278 279/** 280 * Logs network selection performance 281 * 282 * Logs from: 283 * packages/modules/Connectivity/service/src/com/android/server/ConnectivityService.java 284 */ 285message NetworkSelectionPerformance { 286 // Number of network requests 287 optional int32 number_of_network_requests = 1; 288 289 // List of networks right now 290 // (slice by transport / meteredness / internet+validated) 291 optional NetworkList networks = 2; 292 293 // The latency of selection computed in milli-second 294 optional int32 selection_computed_latency_milli = 3; 295 296 // The latency of selection applied in milli-second 297 optional int32 selection_applied_latency_milli = 4; 298 299 // The latency of selection issued in milli-second 300 optional int32 selection_issued_latency_milli = 5; 301} 302 303message NetworkSliceRequestCountSample { 304 // Bitfield representing the network's capability(e.g. NET_CAPABILITY_PRIORITIZE_LATENCY), 305 // defined in packages/modules/Connectivity/framework/src/android/net/NetworkCapabilities.java 306 optional int64 slice_id = 1; 307 308 // Bitfield representing the network's enterprise capability identifier 309 // (e.g. NET_ENTERPRISE_ID_1), defined in 310 // packages/modules/Connectivity/framework/src/android/net/NetworkCapabilities.java 311 optional int32 enterprise_id = 2; 312 313 // number of request for this slice 314 optional int32 request_count = 3; 315 316 // number of apps with outstanding request(s) for this slice 317 optional int32 distinct_app_count = 4; 318} 319 320message NetworkSliceSessionEnded { 321 // Bitfield representing the network's capability(e.g. NET_CAPABILITY_PRIORITIZE_LATENCY), 322 // defined in packages/modules/Connectivity/framework/src/android/net/NetworkCapabilities.java 323 optional int64 slice_id = 1; 324 325 // Bitfield representing the network's enterprise capability identifier 326 // (e.g. NET_ENTERPRISE_ID_1), defined in 327 // packages/modules/Connectivity/framework/src/android/net/NetworkCapabilities.java 328 optional int32 enterprise_id = 2; 329 330 // Number of bytes received at the device on this slice id 331 optional int64 rx_bytes = 3; 332 333 // Number of bytes transmitted by the device on this slice id 334 optional int64 tx_bytes = 4; 335 336 // Number of apps that have used this slice 337 optional int32 number_of_apps = 5; 338 339 // How long(in seconds) this slice has been connected 340 optional int32 slice_connection_duration_sec = 6; 341} 342 343message NetworkSliceDailyDataUsageReported { 344 // Bitfield representing the network's capability(e.g. NET_CAPABILITY_PRIORITIZE_LATENCY), 345 // defined in packages/modules/Connectivity/framework/src/android/net/NetworkCapabilities.java 346 optional int64 slice_id = 1; 347 348 // Bitfield representing the network's enterprise capability identifier 349 // (e.g. NET_ENTERPRISE_ID_1), defined in 350 // packages/modules/Connectivity/framework/src/android/net/NetworkCapabilities.java 351 optional int32 enterprise_id = 2; 352 353 // Number of bytes received at the device on this slice id 354 optional int64 rx_bytes = 3; 355 356 // Number of bytes transmitted by the device on this slice id 357 optional int64 tx_bytes = 4; 358 359 // Number of apps that have used this slice 360 optional int32 number_of_apps = 5; 361 362 // How long(in seconds) this slice has been connected 363 optional int32 slice_connection_duration_sec = 6; 364} 365 366/** 367 * Logs DailykeepaliveInfoReported 368 * 369 * Logs from: packages/modules/Connectivity/service/src/com/android/ 370 * server/connectivity/AutomaticOnOffKeepaliveTracker. 371 */ 372message DailykeepaliveInfoReported{ 373 // Daily duration per number of concurrent keepalive 374 optional DurationPerNumOfKeepalive duration_per_num_of_keepalive = 1; 375 376 // Daily keepalive registered/active duration on each list of keepalive session, in 377 // milli-seconds 378 optional KeepaliveLifetimePerCarrier keepalive_lifetime_per_carrier = 2; 379 380 // Daily number of keepalive requests 381 optional int32 keepalive_requests = 3; 382 383 // Daily number of automatic keepalive requests 384 optional int32 automatic_keepalive_requests = 4; 385 386 // Daily number of distinct apps that requested keepalives 387 optional int32 distinct_user_count = 5; 388 389 // Daily distinct apps uid list that requested keepalives 390 repeated int32 uid = 6; 391} 392 393/** 394 * Daily duration per number of concurrent keepalive 395 * 396 * Logs from: packages/modules/Connectivity/service/src/com/android/ 397 * server/connectivity/AutomaticOnOffKeepaliveTracker. 398 */ 399message DurationPerNumOfKeepalive { 400 repeated DurationForNumOfKeepalive duration_for_num_of_keepalive = 1; 401} 402 403message DurationForNumOfKeepalive { 404 // The number of concurrent keepalives is in the device 405 optional int32 num_of_keepalive = 1; 406 407 // How many milliseconds the device has keepalive registration number is num_of_keepalive 408 optional int32 keepalive_registered_durations_msec = 2; 409 410 // How many milliseconds the device has keepalive active(not paused) number is num_of_keepalive 411 optional int32 keepalive_active_durations_msec = 3; 412} 413 414/** 415 * Daily keepalive registered/active duration on each list of Keepalive session, in milli-seconds 416 * 417 * Logs from: packages/modules/Connectivity/service/src/com/android/ 418 * server/connectivity/AutomaticOnOffKeepaliveTracker. 419 */ 420message KeepaliveLifetimePerCarrier { 421 // The number of network count on each list of carriers 422 repeated KeepaliveLifetimeForCarrier keepalive_lifetime_for_carrier = 1; 423} 424 425/** 426 * Logs the keepalive registered/active duration in milli-seconds and carrier 427 * info(carrier id, transport, keepalive interval). 428 * 429 * Logs from: packages/modules/Connectivity/service/src/com/android/ 430 * server/connectivity/AutomaticOnOffKeepaliveTracker. 431 */ 432message KeepaliveLifetimeForCarrier { 433 // The carrier ID for each keepalive, or TelephonyManager.UNKNOWN_CARRIER_ID(-1) if not cell 434 optional int32 carrier_id = 1; 435 436 // The transport types of the underlying network for each keepalive. A network may include 437 // multiple transport types. Each transfer type is represented by a different bit, defined in 438 // packages/modules/Connectivity/framework/src/android/net/NetworkCapabilities.java 439 optional int32 transport_types = 2; 440 441 // The keepalive interval for each keepalive 442 optional int32 intervals_msec = 3; 443 444 // The lifetime of the keepalive registered today 445 optional int32 lifetime_msec = 4; 446 447 // The duration for which the keepalive was active (not suspended) 448 optional int32 active_lifetime_msec = 5; 449} 450 451