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 66/** 67 * Logs the number of network count on each list of transports 68 * 69 * Logs from: 70 * packages/modules/Connectivity/service/src/com/android/server/ConnectivityService.java 71 */ 72message NetworkCountPerTransports { 73 // the number of network count on each list of transports 74 repeated NetworkCountForTransports network_count_for_transports = 1; 75} 76 77/** 78 * Logs the number of network count and transport type 79 * 80 * Logs from: 81 * packages/modules/Connectivity/service/src/com/android/server/ConnectivityService.java 82 */ 83message NetworkCountForTransports { 84 // Transport types of the network 85 optional int32 transport_types = 1; 86 87 // Number of networks for one list of transport types 88 optional int32 network_count = 2; 89} 90 91/** 92 * Logs a list of networks 93 * 94 * Logs from: 95 * packages/modules/Connectivity/service/src/com/android/server/ConnectivityService.java 96 */ 97message NetworkList { 98 repeated NetworkDescription network_description = 1; 99} 100 101/** 102 * Logs connection duration in seconds and list of transports 103 * 104 * Logs from: 105 * packages/modules/Connectivity/service/src/com/android/server/ConnectivityService.java 106 */ 107message ConnectionDurationForTransports { 108 // Transport types of the network 109 optional int32 transport_types = 1; 110 111 // Time duration that the device stays connected to the network 112 optional int32 duration_sec = 2; 113} 114 115/** 116 * Logs connection duration on each list of transports, in seconds 117 * 118 * Logs from: 119 * packages/modules/Connectivity/service/src/com/android/server/ConnectivityService.java 120 */ 121message ConnectionDurationPerTransports { 122 repeated ConnectionDurationForTransports connection_duration_for_transports = 1; 123} 124 125/** 126 * Logs network request count & request type 127 * 128 * Logs from: 129 * packages/modules/Connectivity/service/src/com/android/server/ConnectivityService.java 130 */ 131message RequestCountForType { 132 // The type of network request 133 optional .android.stats.connectivity.RequestType request_type = 1; 134 135 // Number of network requests 136 optional int32 request_count = 2; 137} 138 139/** 140 * Logs network request count 141 * 142 * Logs from: 143 * packages/modules/Connectivity/service/src/com/android/server/ConnectivityService.java 144 */ 145message NetworkRequestCount { 146 // Network request count for request type 147 repeated RequestCountForType request_count_for_type = 1; 148} 149 150/** 151 * Logs information about a network 152 * 153 * Logs from: 154 * packages/modules/Connectivity/service/src/com/android/server/ConnectivityService.java 155 */ 156message NetworkDescription { 157 // The transport types of the network. A network may include multiple transport types. 158 // Each transfer type is represented by a different bit, defined in 159 // packages/modules/Connectivity/framework/src/android/net/NetworkCapabilities.java 160 optional int32 transport_types = 1; 161 162 // Indicates the network is metered, non-metered or temporarily-unmetered 163 optional .android.stats.connectivity.MeteredState metered_state = 2; 164 165 // Indicates the network is validated, non-validated, partial or portal 166 optional .android.stats.connectivity.ValidatedState validated_state = 3; 167 168 // Record the bitmask of all the policies applied to this score of network. 169 // Each policy is represented by a different bit, defined in 170 // packages/modules/Connectivity/service/src/com/android/server/connectivity/FullScore.java 171 optional int64 score_policies = 4; 172 173 // The capabilities of the network. A network may include multiple network capabilities. 174 // Each capability is represented by a different bit, defined in 175 // packages/modules/Connectivity/framework/src/android/net/NetworkCapabilities.java 176 optional int64 capabilities = 5; 177 178 // Bitfield representing the network's enterprise capability identifier, defined in 179 // packages/modules/Connectivity/framework/src/android/net/NetworkCapabilities.java 180 optional int32 enterprise_id = 6; 181} 182 183/** 184 * Pulls a list of NumberOfRematchesPerReason. 185 * 186 * Pulled from: 187 * packages/modules/Connectivity/service/src/com/android/server/ConnectivityService.java 188 */ 189message NumberOfRematchesPerReason { 190 // Number of network rematches for each rematch reason 191 repeated NumberOfRematchesForReason number_of_rematches_per_reason= 1; 192} 193 194/** 195 * Logs number of network rematches for rematch reason 196 * 197 * Logs from: 198 * packages/modules/Connectivity/service/src/com/android/server/ConnectivityService.java 199 */ 200message NumberOfRematchesForReason { 201 // The reason of network rematch 202 optional .android.stats.connectivity.RematchReason rematch_reason = 1; 203 204 // Number of network rematches 205 optional int32 rematch_count = 2; 206}; 207 208/** 209 * Pulls information for connectivity stats. 210 * 211 * Pulled from: 212 * packages/modules/Connectivity/service/src/com/android/server/ConnectivityService.java 213 */ 214message ConnectivityStateSample { 215 // Number of networks per list of transports 216 optional NetworkCountPerTransports network_count_per_transports = 1; 217 218 // This is a list of networks with their transports and the duration 219 optional ConnectionDurationPerTransports connection_duration_per_transports = 2; 220 221 // Number of requests per category 222 optional NetworkRequestCount network_request_count = 3; 223 224 // Full list of network details (slice by transport / meteredness / internet+validated) 225 optional NetworkList networks = 4; 226} 227 228 229/** 230 * Pulls information for network selection rematch info. 231 * 232 * Pulled from: 233 * packages/modules/Connectivity/service/src/com/android/server/ConnectivityService.java 234 */ 235message NetworkSelectionRematchReasonsInfo { 236 // Number of rematch per rematch reason 237 optional NumberOfRematchesPerReason number_of_rematches_per_reason = 1; 238} 239 240/** 241 * Logs rematch information for the default network 242 * 243 * Logs from: 244 * packages/modules/Connectivity/service/src/com/android/server/ConnectivityService.java 245 */ 246message DefaultNetworkRematchInfo { 247 // The session id comes from each reboot, this is used to correlate the statistics of the 248 // networkselect on the same boot 249 optional int64 session_id = 1; 250 251 // The information of old device default network 252 optional NetworkDescription old_network = 2; 253 254 // The information of new device default network 255 optional NetworkDescription new_network = 3; 256 257 // The reason of network rematch 258 optional .android.stats.connectivity.RematchReason rematch_reason = 4; 259 260 // The time duration the device kept the old network as the default in seconds 261 optional int32 time_duration_on_old_network_sec = 5; 262} 263 264/** 265 * Logs network selection performance 266 * 267 * Logs from: 268 * packages/modules/Connectivity/service/src/com/android/server/ConnectivityService.java 269 */ 270message NetworkSelectionPerformance { 271 // Number of network requests 272 optional int32 number_of_network_requests = 1; 273 274 // List of networks right now 275 // (slice by transport / meteredness / internet+validated) 276 optional NetworkList networks = 2; 277 278 // The latency of selection computed in milli-second 279 optional int32 selection_computed_latency_milli = 3; 280 281 // The latency of selection applied in milli-second 282 optional int32 selection_applied_latency_milli = 4; 283 284 // The latency of selection issued in milli-second 285 optional int32 selection_issued_latency_milli = 5; 286} 287 288message NetworkSliceRequestCountSample { 289 // Bitfield representing the network's capability(e.g. NET_CAPABILITY_PRIORITIZE_LATENCY), 290 // defined in packages/modules/Connectivity/framework/src/android/net/NetworkCapabilities.java 291 optional int64 slice_id = 1; 292 293 // Bitfield representing the network's enterprise capability identifier 294 // (e.g. NET_ENTERPRISE_ID_1), defined in 295 // packages/modules/Connectivity/framework/src/android/net/NetworkCapabilities.java 296 optional int32 enterprise_id = 2; 297 298 // number of request for this slice 299 optional int32 request_count = 3; 300 301 // number of apps with outstanding request(s) for this slice 302 optional int32 distinct_app_count = 4; 303} 304 305message NetworkSliceSessionEnded { 306 // Bitfield representing the network's capability(e.g. NET_CAPABILITY_PRIORITIZE_LATENCY), 307 // defined in packages/modules/Connectivity/framework/src/android/net/NetworkCapabilities.java 308 optional int64 slice_id = 1; 309 310 // Bitfield representing the network's enterprise capability identifier 311 // (e.g. NET_ENTERPRISE_ID_1), defined in 312 // packages/modules/Connectivity/framework/src/android/net/NetworkCapabilities.java 313 optional int32 enterprise_id = 2; 314 315 // Number of bytes received at the device on this slice id 316 optional int64 rx_bytes = 3; 317 318 // Number of bytes transmitted by the device on this slice id 319 optional int64 tx_bytes = 4; 320 321 // Number of apps that have used this slice 322 optional int32 number_of_apps = 5; 323 324 // How long(in seconds) this slice has been connected 325 optional int32 slice_connection_duration_sec = 6; 326} 327 328message NetworkSliceDailyDataUsageReported { 329 // Bitfield representing the network's capability(e.g. NET_CAPABILITY_PRIORITIZE_LATENCY), 330 // defined in packages/modules/Connectivity/framework/src/android/net/NetworkCapabilities.java 331 optional int64 slice_id = 1; 332 333 // Bitfield representing the network's enterprise capability identifier 334 // (e.g. NET_ENTERPRISE_ID_1), defined in 335 // packages/modules/Connectivity/framework/src/android/net/NetworkCapabilities.java 336 optional int32 enterprise_id = 2; 337 338 // Number of bytes received at the device on this slice id 339 optional int64 rx_bytes = 3; 340 341 // Number of bytes transmitted by the device on this slice id 342 optional int64 tx_bytes = 4; 343 344 // Number of apps that have used this slice 345 optional int32 number_of_apps = 5; 346 347 // How long(in seconds) this slice has been connected 348 optional int32 slice_connection_duration_sec = 6; 349} 350 351/** 352 * Logs DailykeepaliveInfoReported 353 * 354 * Logs from: packages/modules/Connectivity/service/src/com/android/ 355 * server/connectivity/AutomaticOnOffKeepaliveTracker. 356 */ 357message DailykeepaliveInfoReported{ 358 // Daily duration per number of concurrent keepalive 359 optional DurationPerNumOfKeepalive duration_per_num_of_keepalive = 1; 360 361 // Daily keepalive registered/active duration on each list of keepalive session, in 362 // milli-seconds 363 optional KeepaliveLifetimePerCarrier keepalive_lifetime_per_carrier = 2; 364 365 // Daily number of keepalive requests 366 optional int32 keepalive_requests = 3; 367 368 // Daily number of automatic keepalive requests 369 optional int32 automatic_keepalive_requests = 4; 370 371 // Daily number of distinct apps that requested keepalives 372 optional int32 distinct_user_count = 5; 373 374 // Daily distinct apps uid list that requested keepalives 375 repeated int32 uid = 6; 376} 377 378/** 379 * Daily duration per number of concurrent keepalive 380 * 381 * Logs from: packages/modules/Connectivity/service/src/com/android/ 382 * server/connectivity/AutomaticOnOffKeepaliveTracker. 383 */ 384message DurationPerNumOfKeepalive { 385 repeated DurationForNumOfKeepalive duration_for_num_of_keepalive = 1; 386} 387 388message DurationForNumOfKeepalive { 389 // The number of concurrent keepalives is in the device 390 optional int32 num_of_keepalive = 1; 391 392 // How many milliseconds the device has keepalive registration number is num_of_keepalive 393 optional int32 keepalive_registered_durations_msec = 2; 394 395 // How many milliseconds the device has keepalive active(not paused) number is num_of_keepalive 396 optional int32 keepalive_active_durations_msec = 3; 397} 398 399/** 400 * Daily keepalive registered/active duration on each list of Keepalive session, in milli-seconds 401 * 402 * Logs from: packages/modules/Connectivity/service/src/com/android/ 403 * server/connectivity/AutomaticOnOffKeepaliveTracker. 404 */ 405message KeepaliveLifetimePerCarrier { 406 // The number of network count on each list of carriers 407 repeated KeepaliveLifetimeForCarrier keepalive_lifetime_for_carrier = 1; 408} 409 410/** 411 * Logs the keepalive registered/active duration in milli-seconds and carrier 412 * info(carrier id, transport, keepalive interval). 413 * 414 * Logs from: packages/modules/Connectivity/service/src/com/android/ 415 * server/connectivity/AutomaticOnOffKeepaliveTracker. 416 */ 417message KeepaliveLifetimeForCarrier { 418 // The carrier ID for each keepalive, or TelephonyManager.UNKNOWN_CARRIER_ID(-1) if not cell 419 optional int32 carrier_id = 1; 420 421 // The transport types of the underlying network for each keepalive. A network may include 422 // multiple transport types. Each transfer type is represented by a different bit, defined in 423 // packages/modules/Connectivity/framework/src/android/net/NetworkCapabilities.java 424 optional int32 transport_types = 2; 425 426 // The keepalive interval for each keepalive 427 optional int32 intervals_msec = 3; 428 429 // The lifetime of the keepalive registered today 430 optional int32 lifetime_msec = 4; 431 432 // The duration for which the keepalive was active (not suspended) 433 optional int32 active_lifetime_msec = 5; 434} 435 436