File: metric_data.proto

package info (click to toggle)
chromium 139.0.7258.127-2
  • links: PTS, VCS
  • area: main
  • in suites: forky
  • size: 6,122,156 kB
  • sloc: cpp: 35,100,771; ansic: 7,163,530; javascript: 4,103,002; python: 1,436,920; asm: 946,517; xml: 746,709; pascal: 187,653; perl: 88,691; sh: 88,436; objc: 79,953; sql: 51,488; cs: 44,583; fortran: 24,137; makefile: 22,147; tcl: 15,277; php: 13,980; yacc: 8,984; ruby: 7,485; awk: 3,720; lisp: 3,096; lex: 1,327; ada: 727; jsp: 228; sed: 36
file content (964 lines) | stat: -rw-r--r-- 33,876 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

syntax = "proto2";

import "components/reporting/proto/synced/session_affiliated_user.proto";
import "components/services/app_service/public/protos/app_types.proto";

option optimize_for = LITE_RUNTIME;

package reporting;

// Diagnostics routine verdict.
enum RoutineVerdict {
  ROUTINE_VERDICT_UNSPECIFIED = 0;
  // Routine ran successfully and no connectivity problem found.
  NO_PROBLEM = 1;
  // Routine ran successfully and connectivity problem found.
  PROBLEM = 2;
  // Routine has not been run.
  NOT_RUN = 3;
}

// Https latency problems.
enum HttpsLatencyProblem {
  HTTPS_LATENCY_PROBLEM_UNSPECIFIED = 0;
  // One or more DNS resolutions resulted in a failure.
  FAILED_DNS_RESOLUTIONS = 1;
  // One or more HTTPS requests resulted in a failure.
  FAILED_HTTPS_REQUESTS = 2;
  // HTTPS request latency is high.
  HIGH_LATENCY = 3;
  // HTTPS request latency is very high.
  VERY_HIGH_LATENCY = 4;
}

// Data that describe the result of the https latency diagnostics routine.
// Default checking rate: 10 mins.
// Policy: ReportDeviceNetworkStatus
// Policy default: true
message HttpsLatencyRoutineData {
  // Https latency routine verdict.
  optional RoutineVerdict verdict = 1;
  // Https latency routine problem if a problem occurred.
  optional HttpsLatencyProblem problem = 2;
  // Https latency in milliseconds if routine succeeded or failed because of
  // `HIGH_LATENCY` or `VERY_HIGH_LATENCY`.
  optional int64 latency_ms = 3;
}

// Data describing observed network bandwidth
// Default checking rate: 60 mins.
// Checking rate policy: ReportDeviceNetworkTelemetryCollectionRateMs
// Policy: ReportDeviceNetworkStatus
// Policy default: true
message BandwidthData {
  // Download speed in kbps
  optional int64 download_speed_kbps = 1;
  // Upload speed in kbps
  optional int64 upload_speed_kbps = 2;
}

// Network connection state.
enum NetworkConnectionState {
  NETWORK_CONNECTION_STATE_UNSPECIFIED = 0;
  // The network is connected and internet connectivity is available.
  ONLINE = 1;
  // The network is connected and not in a detected portal state, but
  // internet connectivity may not be available.
  CONNECTED = 2;
  // The network is connected but a portal state was detected. Internet
  // connectivity may be limited.
  PORTAL = 3;
  // The network is in the process of connecting.
  CONNECTING = 4;
  // The network is not connected.
  NOT_CONNECTED = 5;
}

// Network connection type.
enum NetworkType {
  NETWORK_TYPE_UNSPECIFIED = 0;
  CELLULAR = 1;
  ETHERNET = 2;
  TETHER = 3;
  VPN = 4;
  WIFI = 5;
}

// A single network telemetry data collected at a specific point of time.
// Contained inside the `NetworksTelemetry` message.
// Default checking rate: 60 mins.
// Checking rate policy: ReportDeviceNetworkTelemetryCollectionRateMs,
// Policy: ReportDeviceNetworkStatus
// Policy default: true
message NetworkTelemetry {
  // Unique identifier of the network.
  optional string guid = 1;
  // Current connection state of the network.
  optional NetworkConnectionState connection_state = 2;
  // Signal strength of the network provided only for wireless networks. Values
  // are normalized between 0 to 100 inclusive.
  optional int32 signal_strength = 3;
  // For networks associated with a device, the path of the device.
  optional string device_path = 4;
  // The IP address this interface is bound to, if any.
  optional string ip_address = 5;
  // The gateway IP for this interface, if any.
  optional string gateway = 6;
  // Network connection type.
  optional NetworkType type = 7;

  reserved 8;

  // Transmission bit rate measured in Mbps.
  optional int64 tx_bit_rate_mbps = 9;
  // Receiving bit rate measured in Mbps.
  optional int64 rx_bit_rate_mbps = 10;
  // Transmission power measured in dBm.
  optional int32 tx_power_dbm = 11;
  // Is wifi encryption key on or not.
  optional bool encryption_on = 12;
  // Wifi link quality.
  optional int64 link_quality = 13;
  // Wifi power management enabled
  optional bool power_management_enabled = 14;
  // Signal strength for wireless networks in dBm.
  optional int32 signal_strength_dbm = 15;

  // IPv6 addresses assigned to this network.
  repeated string ipv6_address = 16;
  // The gateway IPv6 for this interface, if any.
  optional string ipv6_gateway = 17;
  // Is the network metered or not.
  optional bool is_metered = 18;
  // Link reported max download speed.
  optional int32 link_down_speed_kbps = 19;
}

// Message describing the NETWORK_CONNECTION_STATE_CHANGE event.
// Policy: ReportDeviceNetworkStatus
// Policy default: true
// Triggered by an event, not collected periodically or once per boot.
// Triggered when there is a network state change from one stage to another one.
message NetworkConnectionStateChangeEventData {
  // Unique identifier of the network.
  optional string guid = 1;
  // New connection state of the network.
  optional NetworkConnectionState connection_state = 2;
}

// Message describing the WIFI_SIGNAL_STRENGTH_LOW and
// WIFI_SIGNAL_STRENGTH_RECOVERED events.
// Policy: ReportDeviceNetworkStatus
// Policy default: true
// Triggered by an event, not collected periodically or once per boot.
// Triggered when the signal of the WiFi network drops below the
// dbm threshold of -70 or if the signal was low and it improves
// above the threshold we also report it.
message SignalStrengthEventData {
  // Unique identifier of the network.
  optional string guid = 1;
  // Signal strength value in dBm.
  optional int32 signal_strength_dbm = 2;
}

// Configured networks telemetry data. This is umbrella networks telemetry proto
// containing multiple network telemetry types, for the specific network
// telemetry take a look at the NetworkTelemetry message. Each of the internal
// messages have separate collection/reporting rates. Policy:
// ReportDeviceNetworkStatus Policy default: true
message NetworksTelemetry {
  // List of each network telemetry.
  repeated NetworkTelemetry network_telemetry = 1;
  // Https latency diagnostics routine result.
  optional HttpsLatencyRoutineData https_latency_data = 2;
  // Observed bandwidth data for active connection
  optional BandwidthData bandwidth_data = 3;
  // Network connection data describing the NETWORK_CONNECTION_STATE_CHANGE
  // event.
  optional NetworkConnectionStateChangeEventData
      network_connection_change_event_data = 4;
  // Signal strength data describing the WIFI_SIGNAL_STRENGTH_LOW and
  // WIFI_SIGNAL_STRENGTH_RECOVERED events.
  optional SignalStrengthEventData signal_strength_event_data = 5;
}

// Security level of the thunderbolt bus.
enum ThunderboltSecurityLevel {
  UNSPECIFIED_THUNDERBOLT_SECURITY_LEVEL = 0;
  // All devices are automatically connected by the firmware. No user approval
  // is needed.
  THUNDERBOLT_SECURITY_NONE_LEVEL = 1;
  // User is asked whether the device is allowed to be connected.
  THUNDERBOLT_SECURITY_USER_LEVEL = 2;
  // User is asked whether the device is allowed to be connected. In addition
  // the device is sent a challenge that should match the expected one based on
  // a random key written to the key sysfs attribute
  THUNDERBOLT_SECURITY_SECURE_LEVEL = 3;
  // The firmware automatically creates tunnels for thunderbolt.
  THUNDERBOLT_SECURITY_DP_ONLY_LEVEL = 4;
  // The firmware automatically creates tunnels for the USB controller and
  // Display Port in a dock. All PCIe links downstream of the dock are removed.
  THUNDERBOLT_SECURITY_USB_ONLY_LEVEL = 5;
  // PCIE tunneling is disabled.
  THUNDERBOLT_SECURITY_NO_PCIE_LEVEL = 6;
}

// Collected once per boot.
// Policy: ReportDeviceSecurityStatus
// Policy default: false
message ThunderboltInfo {
  optional ThunderboltSecurityLevel security_level = 1;
}

// Currently we are only reporting bus device info for thunderbolt, though we
// will certainly add more in the future.
// Collected once per boot.
// Policy: ReportDeviceSecurityStatus
// Policy default: false
message BusDeviceInfo {
  repeated ThunderboltInfo thunderbolt_info = 1;
}

enum MemoryEncryptionState {
  UNSPECIFIED_MEMORY_ENCRYPTION_STATE = 0;
  // The memory encryption state is unknown.
  MEMORY_ENCRYPTION_STATE_UNKNOWN = 1;
  // Memory encrpytion on the device is disabled.
  MEMORY_ENCRYPTION_STATE_DISABLED = 2;
  // Memory encryption on the device uses total memory encryption.
  MEMORY_ENCRYPTION_STATE_TME = 3;
  // Memory encryption on the device uses multi-key total memory encryption.
  MEMORY_ENCRYPTION_STATE_MKTME = 4;
}

enum MemoryEncryptionAlgorithm {
  UNSPECIFIED_MEMORY_ENCRYPTION_ALGORITHM = 0;
  // The memory encryption algorithm being used is unknown.
  MEMORY_ENCRYPTION_ALGORITHM_UNKNOWN = 1;
  // The memory encryption algorithm is using the AES_XTS encryption algorithm
  // with a 128 bit block cypher.
  MEMORY_ENCRYPTION_ALGORITHM_AES_XTS_128 = 2;
  // The memory encryption algorithm is using the AES_XTS encryption algorithm
  // with a 256 bit block cypher.
  MEMORY_ENCRYPTION_ALGORITHM_AES_XTS_256 = 3;
}

// Collected once per boot.
// Policy: ReportDeviceMemoryInfo
// Policy default: false
message TotalMemoryEncryptionInfo {
  // The state of memory encryption on the device.
  optional MemoryEncryptionState encryption_state = 1;
  // The maximum number of keys that can be used for encryption.
  optional int64 max_keys = 2;
  // The length of the encryption keys.
  optional int64 key_length = 3;
  // The encryption algorithm being used on the device.
  optional MemoryEncryptionAlgorithm encryption_algorithm = 4;
}

// Collected once per boot.
// Policy: ReportDeviceMemoryInfo
// Policy default: false
message MemoryInfo {
  // TME info for the device.
  optional TotalMemoryEncryptionInfo tme_info = 1;
}

enum NetworkDeviceType {
  NETWORK_DEVICE_TYPE_UNSPECIFIED = 0;
  CELLULAR_DEVICE = 1;
  ETHERNET_DEVICE = 2;
  WIFI_DEVICE = 5;
}

// Info details about network interface.
message NetworkInterface {
  // Network device type.
  optional NetworkDeviceType type = 1;

  // MAC address (if applicable) of the corresponding network device. This is
  // formatted as an ASCII string with 12 hex digits. Example: A0B1C2D3E4F5.
  optional string mac_address = 2;

  // MEID (if applicable) of the corresponding network device. Formatted as
  // ASCII string composed of 14 hex digits. Example: A10000009296F2.
  optional string meid = 3;

  // IMEI (if applicable) of the corresponding network device. 15-16 decimal
  // digits encoded as ASCII string. Example: 355402040158759.
  optional string imei = 4;

  // The device path associated with this network interface.
  optional string device_path = 5;

  // The integrated circuit card ID associated with the device's sim card.
  optional string iccid = 6;

  // The mobile directory number associated with the device's sim card.
  optional string mdn = 7;

  // List of EID (EUICC Identifier) of all cellular EUICCs
  // (Embedded Universal Integrated Circuit Cards) on the device.
  // 32 decimal digits encoded as ASCII string.
  repeated string eids = 8;
}

// Networks info data.
// Collected once per boot.
// Policy: ReportDeviceNetworkStatus
// Policy default: true
message NetworksInfo {
  repeated NetworkInterface network_interfaces = 1;
}

// Touch screens info data.
// Collected once per boot.
// Policy: ReportDeviceGraphicsStatus
// Policy default: false
message TouchScreenInfo {
  // The touchpad library name used by the input stack.
  optional string library_name = 1;
  // List of the touchscreen devices.
  repeated TouchScreenDevice touch_screen_devices = 2;
}

// Information about the internal touch screen of a device.
message TouchScreenDevice {
  // Name of the device (touchscreen).
  optional string display_name = 1;
  // Number of touch points this device supports.
  optional int32 touch_points = 2;
  // True if the specified touchscreen device is stylus capable.
  optional bool has_stylus = 3;
}

// Information about ePrivacy Screens
// Collected once per boot.
// Policy: ReportDeviceGraphicsStatus
// Policy default: false
message PrivacyScreenInfo {
  // If ePrivacy Screen is supported on the device.
  optional bool supported = 1;
}

// Information about the displays.
// Collected once per boot.
// Policy: ReportDeviceGraphicsStatus
// Policy default: false
message DisplayInfo {
  // Info on all the screens the device has.
  repeated DisplayDevice display_device = 1;
}

// Information on one display.
message DisplayDevice {
  // Name of display product.
  optional string display_name = 1;
  // Display width in millimeters.
  optional int32 display_width = 2;
  // Display height in millimeters.
  optional int32 display_height = 3;
  // Internal or external display.
  optional bool is_internal = 4;
  // Three letter manufacturer ID.
  optional string manufacturer = 5;
  // Manufacturer product code.
  optional int32 model_id = 6;
  // Year of manufacture.
  optional int32 manufacture_year = 7;
  // 32 bits serial number.
  optional uint32 serial_number = 8;
  // EDID version.
  optional string edid_version = 9;
}

// Information about keylocker. This is supported on Intel CPUs.
message KeylockerInfo {
  // If keylocker is supported on the devices CPUs.
  optional bool supported = 1;
  // If keylocker is configured on the devices CPUs.
  optional bool configured = 2;
}

// Collected once per boot.
// Policy: ReportDeviceCpuInfo
// Policy default: false
message CpuInfo {
  // Information about keylocker for the devices CPUs.
  optional KeylockerInfo keylocker_info = 1;
}

// Data that is considered immutable, should only be reported on startup and
// policy enablment.
message InfoData {
  // CPU info for the device.
  optional CpuInfo cpu_info = 1;
  // Bus Device info for the device.
  optional BusDeviceInfo bus_device_info = 2;
  // Memory info for the device.
  optional MemoryInfo memory_info = 3;
  // Network interfaces info.
  optional NetworksInfo networks_info = 4;
  // Touch screen info.
  optional TouchScreenInfo touch_screen_info = 5;
  // Information about the ePrivacy Screen.
  optional PrivacyScreenInfo privacy_screen_info = 6;
  // Information about the displays.
  optional DisplayInfo display_info = 7;
}

// Audio telemetry data recorded intermittently
// Default checking rate: 15 mins.
// Checking rate policy: ReportDeviceAudioStatusCheckingRateMs
// Policy: ReportDeviceAudioStatus
// Policy default: true
message AudioTelemetry {
  // Is active output device mute or not.
  optional bool output_mute = 1;
  // Is active input device mute or not.
  optional bool input_mute = 2;
  // Active output device's volume in [0, 100].
  optional int32 output_volume = 3;
  // Active output device's name.
  optional string output_device_name = 4;
  // Active input device's gain in [0, 100].
  optional int32 input_gain = 5;
  // Active input device's name.
  optional string input_device_name = 6;
}

// Boot Performance telemetry data
// Collected once per boot
// Policy: ReportDeviceBootMode
// Policy default: true
message BootPerformanceTelemetry {
  // Total time when to boot up.
  optional int64 boot_up_seconds = 1;
  // The Timestamp when power came on.
  optional int64 boot_up_timestamp_seconds = 2;
  // Total time since shutdown start to power off.
  optional int64 shutdown_seconds = 3;
  // Timestamp when shutdown.
  optional int64 shutdown_timestamp_seconds = 4;
  // Shutdown reason.
  optional string shutdown_reason = 5;
}

// Data tracking user status information
// Default checking rate: 15 mins.
// Checking rate policy: DeviceActivityHeartbeatCollectionRateMs
// Policy: DeviceActivityHeartbeatEnabled
// Policy default: false
message UserStatusTelemetry {
  enum DeviceActivityState {
    DEVICE_ACTIVITY_STATE_UNKNOWN = 0;
    ACTIVE = 1;
    IDLE = 2;
    LOCKED = 3;
  }

  // Device state.
  optional DeviceActivityState device_activity_state = 1;
}

// Displays telemetry data
// Default checking rate: 3 hrs. Also collected on external display
// connected/disconnected events.
// Policy: ReportDeviceGraphicsStatus
// Policy default: false
message DisplaysTelemetry {
  // Status of all the displays.
  repeated DisplayStatus display_status = 1;
}

message DisplayStatus {
  // Name of display product.
  optional string display_name = 1;
  // Horizontal resolution.
  optional int32 resolution_horizontal = 2;
  // Vertical resolution.
  optional int32 resolution_vertical = 3;
  // Refresh rate.
  optional int64 refresh_rate = 4;
  // Internal or external display.
  optional bool is_internal = 5;

  // These data members are similar to the ones in the DisplayDevice. But are
  // duplicated here to ensure clients are able to distinguish displays based on
  // the external display connected/disconnected events as DisplayDevice is
  // part of InfoData that is gathered only on boot.
  //
  // 32 bits serial number.
  optional uint32 serial_number = 6;
  // EDID version.
  optional string edid_version = 7;
}

// Deliberately left empty as there is no payload for Heartbeat messages.
// It just implicitly indicates that the sender is still alive.
// Default checking rate: 2 mins.
// Policy: HeartbeatEnabled
// Policy default: false
message KioskHeartbeatTelemetry {
  // No payload
}

// A message describing a single attention span of a person for the Kiosk
// Vision telemetry report.
message KioskVisionView {
  // Start time of this view. In seconds since epoch.
  optional int64 start_time_sec = 1;
  // End time of this view. In seconds.
  optional int64 end_time_sec = 2;
}

// A message describing the attention of one person for the Kiosk Vision
// telemetry report.
message KioskVisionAudience {
  // The start date when this person was first detected.
  // In seconds since epoch.
  optional int64 presence_start_date_sec = 1;
  // The end date when this person was no longer detected.
  // In seconds since epoch.
  optional int64 presence_end_date_sec = 2;
  // The view information of this person.
  // Repeated, as a person can view multiple times.
  repeated KioskVisionView views = 3;
}

// A message to report Kiosk Vision's audience data.
message KioskVisionTelemetry {
  // Start date of this aggregate report. In seconds since epoch.
  optional int64 start_date_sec = 1;
  // End date of this aggregate report. In seconds since epoch.
  optional int64 end_date_sec = 2;
  // Number of persons that left in the time frame of this aggregate
  // report and looked at the sign.
  optional int32 view_count = 3;
  // Number of persons that left in the time frame of this aggregate
  // report and didn't look at the sign.
  optional int32 pass_count = 4;
  // Audience information. Only information from people that are no
  // longer detected is transmitted. This also means that the
  // audience information includes older data.
  repeated KioskVisionAudience audience = 5;
}

// A message to report the current state and potential errors of the
// KioskVision framework to the telemetry api.
message KioskVisionStatusReport {
  enum KioskVisionState {
    // Kiosk vision is functioning normally.
    KIOSK_VISION_STATE_ACTIVE = 0;
    // An unknown error has occurred.
    KIOSK_VISION_STATE_UNKNOWN_ERROR = 1;
    // The KioskVision framework could not detect a camera.
    KIOSK_VISION_STATE_CAMERA_NOT_FOUND = 2;
  }
  optional KioskVisionState state = 1;

  // Time stamp of this status report (seconds since epoch).
  optional int64 time_stamp_sec = 2;

  // Time stamp of the last status change (seconds since epoch).
  optional int64 state_change_time_stamp_sec = 3;
}

// Data that can change over time, collected and reported every specific period
// of time or when an event occur.
// IMPORTANT: Do not add additional non-message fields (bool, int, string,
// etc.) to `TelemetryData` -- they will be ignored by the server and not
// written to the telemetry database.
message TelemetryData {
  // Indicates whether the telemetry data was collected in response to an event.
  optional bool is_event_driven = 8;

  // At least one of the following telemetry should be present.

  // Networks telemetry data.
  optional NetworksTelemetry networks_telemetry = 1;
  // Audio telemetry data.
  optional AudioTelemetry audio_telemetry = 2;
  // Peripherals telemetry data
  optional PeripheralsTelemetry peripherals_telemetry = 3;
  // Boot Performance telemetry data.
  optional BootPerformanceTelemetry boot_performance_telemetry = 4;
  // User status telemetry data.
  optional UserStatusTelemetry user_status_telemetry = 5;
  // Displays telemetry data.
  optional DisplaysTelemetry displays_telemetry = 6;
  // App telemetry data.
  optional AppTelemetry app_telemetry = 7;
  // Fatal crash data.
  optional FatalCrashTelemetry fatal_crash_telemetry = 9;
  // Runtime counter data.
  optional RuntimeCountersTelemetry runtime_counters_telemetry = 10;
  // Website telemetry data.
  optional WebsiteTelemetry website_telemetry = 11;
  // Kiosk Heartbeats as telemetry data.
  optional KioskHeartbeatTelemetry heartbeat_telemetry = 12;
  // Kiosk Vision telemetry data.
  optional KioskVisionTelemetry kiosk_vision_telemetry = 13;
  // Kiosk Vision status data.
  optional KioskVisionStatusReport kiosk_vision_status = 14;
}

// Type of event metric being reported.
// This must be kept in sync with //tools/metrics/histograms/enums.xml's
// EnterpriseCloudReportingMetricEventType in the Chromium repo.
enum MetricEventType {
  EVENT_TYPE_UNSPECIFIED = 0;
  NETWORK_HTTPS_LATENCY_CHANGE = 1;
  AUDIO_SEVERE_UNDERRUN = 4;
  USB_ADDED = 5;
  USB_REMOVED = 6;
  APP_INSTALLED = 7;
  APP_UNINSTALLED = 8;
  APP_LAUNCHED = 9;
  WIFI_SIGNAL_STRENGTH_LOW = 13;
  WIFI_SIGNAL_STRENGTH_RECOVERED = 14;
  NETWORK_STATE_CHANGE = 15;
  VPN_CONNECTION_STATE_CHANGE = 16;
  FATAL_CRASH = 17;
  URL_OPENED = 18;
  URL_CLOSED = 19;
  KIOSK_HEARTBEAT = 20;
  EXTERNAL_DISPLAY_CONNECTED = 21;
  EXTERNAL_DISPLAY_DISCONNECTED = 22;

  reserved 2, 3, 10, 11, 12;
}

// App telemetry data.
// Policy: ReportAppInventory
// Policy default: false
message AppTelemetry {
  oneof app_metric_data {
    // App installation data.
    AppInstallData app_install_data = 3;
    // App uninstall data.
    AppUninstallData app_uninstall_data = 4;
    // App launch data.
    AppLaunchData app_launch_data = 5;
    // App usage data.
    AppUsageData app_usage_data = 6;
  }

  reserved 1, 2;
}

// App installation data.
// Policy: ReportAppInventory
// Policy default: false
// Triggered by an event, not collected periodically or once per boot.
// Triggered when an Chrome app, extension or progressive web app is launched.
// Depends on the policy.
message AppInstallData {
  // App installation source.
  optional apps.ApplicationInstallSource app_install_source = 1;
  // App installation reason.
  optional apps.ApplicationInstallReason app_install_reason = 2;
  // App installation time depending on the app lifecycle.
  optional apps.ApplicationInstallTime app_install_time = 3;
  // App id.
  optional string app_id = 4;
  // Type of app.
  optional apps.ApplicationType app_type = 5;
}

// App launch data.
// Policy: ReportAppInventory
// Policy default: false
// Triggered by an event, not collected periodically or once per boot.
// Triggered when an Chrome app, extension or progressive web app is launched.
// Depends on the policy.
message AppLaunchData {
  // App launch source.
  optional apps.ApplicationLaunchSource app_launch_source = 1;
  // App id.
  optional string app_id = 2;
  // Type of app.
  optional apps.ApplicationType app_type = 3;
}

// App usage data.
// Default checking rate: 15 mins.
// Policy: ReportAppInventory
// Policy default: false
// Minimum usage time threshold for app usage reporting: 1 millisecond.
message AppUsageData {
  message AppUsage {
    // App foreground running time (in milliseconds).
    optional int64 running_time_ms = 1;
    // App id.
    optional string app_id = 2;
    // Type of app.
    optional apps.ApplicationType app_type = 3;
    // Application instance id. This will be unique per window/instance.
    optional string app_instance_id = 4;
  }

  // Usage data that also includes other app metadata.
  repeated AppUsage app_usage = 2;

  reserved 1;
}

// App uninstall data.
// Policy: ReportAppInventory
// Policy default: false
// Triggered by an event, not collected periodically or once per boot.
// Triggered when an Chrome app, extension or progressive web app is
// uninstalled. Depends on the policy.
message AppUninstallData {
  // App uninstall source.
  optional apps.ApplicationUninstallSource app_uninstall_source = 1;
  // App id.
  optional string app_id = 2;
  // Type of app.
  optional apps.ApplicationType app_type = 3;
}

// Website telemetry data.
// Policy: ReportWebsiteActivityAllowlist
// Policy default: false
message WebsiteTelemetry {
  oneof website_metric_data {
    // Website opened data.
    WebsiteOpenedData website_opened_data = 1;
    // Website closed data.
    WebsiteClosedData website_closed_data = 2;
    // Website usage data.
    WebsiteUsageData website_usage_data = 3;
  }
}

// Website opened data.
// Policy: ReportWebsiteActivityAllowlist
// Policy default: false
// Triggered by an event, not collected periodically or once per boot.
// Triggered if the website is in the allowlist of the policy and when
// that website is opened.
message WebsiteOpenedData {
  // Website URL.
  optional string url = 1;
  // Render process host id.
  optional int32 render_process_host_id = 2;
  // Render frame routing id.
  optional int32 render_frame_routing_id = 3;
}

// Website closed data.
// Policy: ReportWebsiteActivityAllowlist
// Policy default: false
// Triggered by an event, not collected periodically or once per boot.
// Triggered if the website is in the allowlist of the policy and when
// that website is closed.
message WebsiteClosedData {
  // Website URL.
  optional string url = 1;
  // Render process host id.
  optional int32 render_process_host_id = 2;
  // Render frame routing id.
  optional int32 render_frame_routing_id = 3;
}

// Website usage data.
// Default checking rate: 15 mins.
// Policy: ReportWebsiteActivityAllowlist
// Policy default: false
// Minimum usage time threshold for app usage reporting: 1 millisecond.
message WebsiteUsageData {
  message WebsiteUsage {
    // Website URL.
    optional string url = 1;
    // Website foreground running time (in milliseconds).
    optional int64 running_time_ms = 2;
  }

  // Usage data that includes other website metadata.
  repeated WebsiteUsage website_usage = 3;
}

// Peripherals data.
// Triggered by an event, not collected periodically or once per boot.
// Policy: ReportDevicePeripherals
// Policy default: false
// Triggering mechanisms:
// 1. A USB device is added or removed from the device during an affiliated user
// session. We send the added/removed event, and then send a separate event
// containing a list of USBs currently connected to the device.
// 2. An affiliated user logs in. We send a list of USBs connected to the
// device.
message PeripheralsTelemetry {
  repeated UsbTelemetry usb_telemetry = 1;
}

// Usb data.
message UsbTelemetry {
  // Vendor name
  optional string vendor = 1;
  // Device name, model name, or product name
  optional string name = 2;
  // Vendor ID
  optional int32 vid = 3;
  // Product ID
  optional int32 pid = 4;
  // Categories the device belongs to
  // https://www.usb.org/defined-class-codes
  repeated string categories = 5;
  // Class ID
  // https://www.usb.org/defined-class-codes
  optional int32 class_id = 6;
  // Subclass ID
  // https://www.usb.org/defined-class-codes
  optional int32 subclass_id = 7;
  // Firmware version
  optional string firmware_version = 8;
}

// Fatal crash data.
// Policy: ReportDeviceCrashReportInfo
// Policy default: false
// Triggered by an event, not collected periodically or once per boot.
// Triggered by fatal crashes in the embedded controller, kernel, or Chrome.
// Crash severity is generally assigned in the associated crash collector in
// src/platform2/crash-reporter, however for Chrome crashes, our definition of a
// fatal crash is a crash that is "user disruptive". The following types of
// Chrome crashes are user disruptive:
// 1. Crashes or hangs in the browser process (except if they occur during
// shutdown)
// 2. Crashes in the renderer, utility, or extension process that are
// assigned a severity of ERROR.
//
// The code for determining if a Chrome crash is user
// disruptive is in crash-reporter/crash_sender_util.cc
message FatalCrashTelemetry {
  enum CrashType {
    // Unknown crashes.
    CRASH_TYPE_UNSPECIFIED = 0;
    // Kernel crashes.
    CRASH_TYPE_KERNEL = 1;
    // EC crashes.
    CRASH_TYPE_EMBEDDED_CONTROLLER = 2;
    // Chrome crashes.
    CRASH_TYPE_CHROME = 3;
  }
  // The session types follow user_manager::UserType. The server side will
  // translate to the types described below.
  enum SessionType {
    // Including when a crash occurs on the login screen.
    SESSION_TYPE_UNSPECIFIED = 0;
    // When presenting to the admin, the following will be SIGNED_IN_USER
    SESSION_TYPE_REGULAR = 1;
    SESSION_TYPE_CHILD = 2;

    // When presenting to the admin, the following will be KIOSK
    SESSION_TYPE_KIOSK_APP = 3;
    SESSION_TYPE_ARC_KIOSK_APP = 4;
    SESSION_TYPE_WEB_KIOSK_APP = 5;

    // When presenting to the admin, the following will be MANAGED_GUEST
    SESSION_TYPE_GUEST = 6;
    SESSION_TYPE_PUBLIC_ACCOUNT = 7;

    // When presenting to the admin, the following will be ACTIVE_DIRECTORY
    SESSION_TYPE_ACTIVE_DIRECTORY = 8;

    // When presenting to the admin, the following will be KIOSK
    SESSION_TYPE_KIOSK_IWA = 9;
  }
  // required
  optional CrashType type = 1;
  // required
  optional SessionType session_type = 2;
  // required
  optional int64 timestamp_us = 3;
  // Absent if not signed in or the user is not affiliated. Currently only
  // contains user email.
  optional SessionAffiliatedUser affiliated_user = 4;
  // Absent if the crash has not been uploaded by crash_sender yet.
  optional string crash_report_id = 5;
  // required
  optional string local_id = 6;
  // If crash report ID is available, has this event been reported without ID
  // once before?
  // The optionality of crash_report_id is not sufficient because we need to
  // distinguish the two cases: (a) A crash is reported for the first time with
  // a crash report ID and (b) a crash is reported for the first time without a
  // crash report ID and only has a crash report ID when it is reported for the
  // second time.
  optional bool been_reported_without_crash_report_id = 7;
  // Event based log upload ID that contains the logs related to the crash
  // event. This Id will be used in the server to connect the uploaded log file
  // to the specific crash event.
  optional string event_based_log_id = 8;
}

// Runtime counters retrieved from CPU. Currently the runtime counters telemetry
// is only supported by Intel vPro PSR on Gen 14+.
// Default checking rate: 1 day.
// Checking rate policy: DeviceReportRuntimeCountersCheckingRateMs
// Policy: DeviceReportRuntimeCounters
// Policy default: false
message RuntimeCountersTelemetry {
  // All fields below are currently required since Intel vPro is the only
  // supported source, but we reserve the possibility that absence of a field
  // implies that it is unavailable on the device in the future.

  // Hardly any of the following fields can be beyond the size of int32.
  // However, we use int64 because: (a) healthD retrieves uint32 integers from
  // the hardware, and therefore using int32 here risks overflow. (b) Server
  // side requires signed integers and therefore uint32 is not an option.

  // Total lifetime runtime. Currently always S0 runtime from Intel vPro PSR.
  optional int64 uptime_runtime_seconds = 1;
  // Number of times that the device has entered into the sleep state. Currently
  // obtained via the PSR, count from S0->S3. As of Oct 2023, this number is
  // expected to be always zero as ChromeOS devices do not use this state.
  optional int64 counter_enter_sleep = 2;
  // Number of times that the device has entered into the hibernation state.
  // Currently obtained via the PSR, count from S0->S4. As of Oct 2023, this
  // number is expected to be always zero, unless the ChromeOS device is
  // equipped with Intel KeyLocker.
  optional int64 counter_enter_hibernation = 3;
  // Number of times that the device has entered into the power-off state.
  // Currently obtained via the PSR, count from S0->S5.
  optional int64 counter_enter_poweroff = 4;
}

// Indicates one of the following conditions occurred on the device, data
// associated with the event will be reported as `TelemetryData`.
// IMPORTANT: DO NOT add any additional fields to `EventData`.
message EventData {
  optional MetricEventType type = 1;
}

// Main message to be reported, can contain `InfoData`, `TelemetryData`, or
// `EventData`. Data, associated with an event or collected in response to an
// event, is added as `TelemetryData` along with EventData.
message MetricData {
  // The time from epoch when the data was collected.
  optional int64 timestamp_ms = 1;

  oneof metric_type {
    // Info data collected.
    // All of this is collected once per boot unless specified otherwise.
    InfoData info_data = 2;
    // Telemetry data collected.
    // The collection of this data varies, check each message, some of the
    // messages are collected when an event is detected, if that is the case you
    // should also expect the `EventData` to be populated with the appropriate
    // enum.
    TelemetryData telemetry_data = 3;
  }

  // Event data collected. This is just an enum, if there is data related to
  // this event is should be present in `TelemetryData`.
  optional EventData event_data = 4;
}