summaryrefslogtreecommitdiff
path: root/cmds/statsd/src/atoms.proto
blob: 7d0d97917a4bd553ca6210a76dbc7e1bdfa9f193 (plain)
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
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
3507
3508
3509
3510
3511
3512
3513
3514
3515
3516
3517
3518
3519
3520
3521
3522
3523
3524
3525
3526
3527
3528
3529
3530
3531
3532
3533
3534
3535
3536
3537
3538
3539
3540
3541
3542
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557
3558
3559
3560
3561
3562
3563
3564
3565
3566
3567
3568
3569
3570
3571
3572
3573
3574
3575
3576
3577
3578
3579
3580
3581
3582
3583
3584
3585
3586
3587
3588
3589
3590
3591
3592
3593
3594
3595
3596
3597
3598
3599
3600
3601
3602
3603
3604
3605
3606
3607
3608
3609
3610
3611
3612
3613
3614
3615
3616
3617
3618
3619
3620
3621
3622
3623
3624
3625
3626
3627
3628
3629
3630
3631
3632
3633
3634
3635
3636
3637
3638
3639
3640
3641
3642
3643
3644
3645
3646
3647
3648
3649
3650
3651
3652
3653
3654
3655
3656
3657
3658
3659
3660
3661
3662
3663
3664
3665
3666
3667
3668
3669
3670
3671
3672
3673
3674
3675
3676
3677
3678
3679
3680
3681
3682
3683
3684
3685
3686
3687
3688
3689
3690
3691
3692
3693
3694
3695
3696
3697
3698
3699
3700
3701
3702
3703
3704
3705
3706
3707
3708
3709
3710
3711
3712
3713
3714
3715
3716
3717
3718
3719
3720
3721
3722
3723
3724
3725
3726
3727
3728
3729
3730
3731
3732
3733
3734
3735
3736
3737
3738
3739
3740
3741
3742
3743
3744
3745
3746
3747
3748
3749
3750
3751
3752
3753
3754
3755
3756
3757
3758
3759
3760
3761
3762
3763
3764
3765
3766
3767
3768
3769
3770
3771
3772
3773
3774
3775
3776
3777
3778
3779
3780
3781
3782
3783
3784
3785
3786
3787
3788
3789
3790
3791
3792
3793
3794
3795
3796
3797
3798
3799
3800
3801
3802
3803
3804
3805
3806
3807
3808
3809
3810
3811
3812
3813
3814
3815
3816
3817
3818
3819
3820
3821
3822
3823
3824
3825
3826
3827
3828
3829
3830
3831
3832
3833
3834
3835
3836
3837
3838
3839
3840
3841
3842
3843
3844
3845
3846
3847
3848
3849
3850
3851
3852
3853
3854
3855
3856
3857
3858
3859
3860
3861
3862
3863
3864
3865
3866
3867
3868
3869
3870
3871
3872
3873
3874
3875
3876
3877
3878
3879
3880
3881
3882
3883
3884
3885
3886
3887
3888
3889
3890
3891
3892
3893
3894
3895
3896
3897
3898
3899
3900
3901
3902
3903
3904
3905
3906
3907
3908
3909
3910
3911
3912
3913
3914
3915
3916
3917
3918
3919
3920
3921
3922
3923
3924
3925
3926
3927
3928
3929
3930
3931
3932
3933
3934
3935
3936
3937
3938
3939
3940
3941
3942
3943
3944
3945
3946
3947
3948
3949
3950
3951
3952
3953
3954
3955
3956
3957
3958
3959
3960
3961
3962
3963
3964
3965
3966
3967
3968
3969
3970
3971
3972
3973
3974
3975
3976
3977
3978
3979
3980
3981
3982
3983
3984
3985
3986
3987
3988
3989
3990
3991
3992
3993
3994
3995
3996
3997
3998
3999
4000
4001
4002
4003
4004
4005
4006
4007
4008
4009
4010
4011
4012
4013
4014
4015
4016
4017
4018
4019
4020
4021
4022
4023
4024
4025
4026
4027
4028
4029
4030
4031
4032
4033
4034
4035
4036
4037
4038
4039
4040
4041
4042
4043
4044
4045
4046
4047
4048
4049
4050
4051
4052
4053
4054
4055
4056
4057
4058
4059
4060
4061
4062
4063
4064
4065
4066
4067
4068
4069
4070
4071
4072
4073
4074
4075
4076
4077
4078
4079
4080
4081
4082
4083
4084
4085
4086
4087
4088
4089
4090
4091
4092
4093
4094
4095
4096
4097
4098
4099
4100
4101
4102
4103
4104
4105
4106
4107
4108
4109
4110
4111
4112
4113
4114
4115
4116
4117
4118
4119
4120
4121
4122
4123
4124
4125
4126
4127
4128
4129
4130
4131
4132
4133
4134
4135
4136
4137
4138
4139
4140
4141
4142
4143
4144
4145
4146
4147
4148
4149
4150
4151
4152
4153
4154
4155
4156
4157
4158
4159
4160
4161
4162
4163
4164
4165
4166
4167
4168
4169
4170
4171
4172
4173
4174
4175
4176
4177
4178
4179
4180
4181
4182
4183
4184
4185
4186
4187
4188
4189
4190
4191
4192
4193
4194
4195
4196
4197
4198
4199
4200
4201
4202
4203
4204
4205
4206
4207
4208
4209
4210
4211
4212
4213
4214
4215
4216
4217
4218
4219
4220
4221
4222
4223
4224
4225
4226
4227
4228
4229
4230
4231
4232
4233
4234
4235
4236
4237
4238
4239
4240
4241
4242
4243
4244
4245
4246
4247
4248
4249
4250
4251
4252
4253
4254
4255
4256
4257
4258
4259
4260
4261
4262
4263
4264
4265
4266
4267
4268
4269
4270
4271
4272
4273
4274
4275
4276
4277
4278
4279
4280
4281
4282
4283
4284
4285
4286
4287
4288
4289
4290
4291
4292
4293
4294
4295
4296
4297
4298
4299
4300
4301
4302
4303
4304
4305
4306
4307
4308
4309
4310
4311
4312
4313
4314
4315
4316
4317
4318
4319
4320
4321
4322
4323
4324
4325
4326
4327
4328
4329
4330
4331
4332
4333
4334
4335
4336
4337
4338
4339
4340
4341
4342
4343
4344
4345
4346
4347
4348
4349
4350
4351
4352
4353
4354
4355
4356
4357
4358
4359
4360
4361
4362
4363
4364
4365
4366
4367
4368
4369
4370
4371
4372
4373
4374
4375
4376
4377
4378
4379
4380
4381
4382
4383
4384
4385
4386
4387
4388
4389
4390
4391
4392
4393
4394
4395
4396
4397
4398
4399
4400
4401
4402
4403
4404
4405
4406
4407
4408
4409
4410
4411
4412
4413
4414
4415
4416
4417
4418
4419
4420
4421
4422
4423
4424
4425
4426
4427
4428
4429
4430
4431
4432
4433
4434
4435
4436
4437
4438
4439
4440
4441
4442
4443
4444
4445
4446
4447
4448
4449
4450
4451
4452
4453
4454
4455
4456
4457
4458
4459
4460
4461
4462
4463
4464
4465
4466
4467
4468
4469
4470
4471
4472
4473
4474
4475
4476
4477
4478
4479
4480
4481
4482
4483
4484
4485
4486
4487
4488
4489
4490
4491
4492
4493
4494
4495
4496
4497
4498
4499
4500
4501
4502
4503
4504
4505
4506
4507
4508
4509
4510
4511
4512
4513
4514
4515
4516
4517
4518
4519
4520
4521
4522
4523
4524
4525
4526
4527
4528
4529
4530
4531
4532
4533
4534
4535
4536
4537
4538
4539
4540
4541
4542
4543
4544
4545
4546
4547
4548
4549
4550
4551
4552
4553
4554
4555
4556
4557
4558
4559
4560
4561
4562
4563
4564
4565
4566
4567
4568
4569
4570
4571
4572
4573
4574
4575
4576
4577
4578
4579
4580
4581
4582
4583
4584
4585
4586
4587
4588
4589
4590
4591
4592
4593
4594
4595
4596
4597
4598
4599
4600
4601
4602
4603
4604
4605
4606
4607
4608
4609
4610
4611
4612
4613
4614
4615
4616
4617
4618
4619
4620
4621
4622
4623
4624
4625
4626
4627
4628
4629
4630
4631
4632
4633
4634
4635
4636
4637
4638
4639
4640
4641
4642
4643
4644
4645
4646
4647
4648
4649
4650
4651
4652
4653
4654
4655
4656
4657
4658
4659
4660
4661
4662
4663
4664
4665
4666
4667
4668
4669
4670
4671
4672
4673
4674
4675
4676
4677
4678
4679
4680
4681
4682
4683
4684
4685
4686
4687
4688
4689
4690
4691
4692
4693
4694
4695
4696
4697
4698
4699
4700
4701
4702
4703
4704
4705
4706
4707
4708
4709
4710
4711
4712
4713
4714
4715
4716
4717
4718
4719
4720
4721
4722
4723
4724
4725
4726
4727
4728
4729
4730
4731
4732
4733
4734
4735
4736
4737
4738
4739
4740
4741
4742
4743
4744
4745
4746
4747
4748
4749
4750
4751
4752
4753
4754
4755
4756
4757
4758
4759
4760
4761
4762
4763
4764
4765
4766
4767
4768
4769
4770
4771
4772
4773
4774
4775
4776
4777
4778
4779
4780
4781
4782
4783
4784
4785
4786
4787
4788
4789
4790
4791
4792
4793
4794
4795
4796
4797
4798
4799
4800
4801
4802
4803
4804
4805
4806
4807
4808
4809
4810
4811
4812
4813
4814
4815
4816
4817
4818
4819
4820
4821
4822
4823
4824
4825
4826
4827
4828
4829
4830
4831
4832
4833
4834
4835
4836
4837
4838
4839
4840
4841
4842
4843
4844
4845
4846
4847
4848
4849
4850
4851
4852
4853
4854
4855
4856
4857
4858
4859
4860
4861
4862
4863
4864
4865
4866
4867
4868
4869
4870
4871
4872
4873
4874
4875
4876
4877
4878
4879
4880
4881
4882
4883
4884
4885
4886
4887
4888
4889
4890
4891
4892
4893
4894
4895
4896
4897
4898
4899
4900
4901
4902
4903
4904
4905
4906
4907
4908
4909
4910
4911
4912
4913
4914
4915
4916
4917
4918
4919
4920
4921
4922
4923
4924
4925
4926
4927
4928
4929
4930
4931
4932
4933
4934
4935
4936
4937
4938
4939
4940
4941
4942
4943
4944
4945
4946
4947
4948
4949
4950
4951
4952
4953
4954
4955
4956
4957
4958
4959
4960
4961
4962
4963
4964
4965
4966
4967
4968
4969
4970
4971
4972
4973
4974
4975
4976
4977
4978
4979
4980
4981
4982
4983
4984
4985
4986
4987
4988
4989
4990
4991
4992
4993
4994
4995
4996
4997
4998
4999
5000
5001
5002
5003
5004
5005
5006
5007
5008
5009
5010
5011
5012
5013
5014
5015
5016
5017
5018
5019
5020
5021
5022
5023
5024
5025
5026
5027
5028
5029
5030
5031
5032
5033
5034
5035
5036
5037
5038
5039
5040
5041
5042
5043
5044
5045
5046
5047
5048
5049
5050
5051
5052
5053
5054
5055
5056
5057
5058
5059
5060
5061
5062
5063
5064
5065
5066
5067
5068
5069
5070
5071
5072
5073
5074
5075
5076
5077
5078
5079
5080
5081
5082
5083
5084
5085
5086
5087
5088
5089
5090
5091
5092
5093
5094
5095
5096
5097
5098
5099
5100
5101
5102
5103
5104
5105
5106
5107
5108
5109
5110
5111
5112
5113
5114
5115
5116
5117
5118
5119
5120
5121
5122
5123
5124
5125
5126
5127
5128
5129
5130
5131
5132
5133
5134
5135
5136
5137
5138
5139
5140
5141
5142
5143
5144
5145
5146
5147
5148
5149
5150
5151
5152
5153
5154
5155
5156
5157
5158
5159
5160
5161
5162
5163
5164
5165
5166
5167
5168
5169
5170
5171
5172
5173
5174
5175
5176
5177
5178
5179
5180
5181
5182
5183
5184
5185
5186
5187
5188
5189
5190
5191
5192
5193
5194
5195
5196
5197
5198
5199
5200
5201
5202
5203
5204
5205
5206
5207
5208
5209
5210
5211
5212
5213
5214
5215
5216
5217
5218
5219
5220
5221
5222
5223
5224
5225
5226
5227
5228
5229
5230
5231
5232
5233
5234
5235
5236
5237
5238
5239
5240
5241
5242
5243
5244
5245
5246
5247
5248
5249
5250
5251
5252
5253
5254
5255
5256
5257
5258
5259
5260
5261
5262
5263
5264
5265
5266
5267
5268
5269
5270
5271
5272
5273
5274
5275
5276
5277
5278
5279
5280
5281
5282
5283
5284
5285
5286
5287
5288
5289
5290
5291
5292
5293
5294
5295
5296
5297
5298
5299
5300
5301
5302
5303
5304
5305
5306
5307
5308
5309
5310
5311
5312
5313
5314
5315
5316
5317
5318
5319
5320
5321
5322
5323
5324
5325
5326
5327
5328
5329
5330
5331
5332
5333
5334
5335
5336
5337
5338
5339
5340
5341
5342
5343
5344
5345
5346
5347
5348
5349
5350
5351
5352
5353
5354
5355
5356
5357
5358
5359
5360
5361
5362
5363
5364
5365
5366
5367
5368
5369
5370
5371
5372
5373
5374
5375
5376
5377
5378
5379
5380
5381
5382
5383
5384
5385
5386
5387
5388
5389
5390
5391
5392
5393
5394
5395
5396
5397
5398
5399
5400
5401
5402
5403
5404
5405
5406
5407
5408
5409
5410
5411
5412
5413
5414
5415
5416
5417
5418
5419
5420
5421
5422
5423
5424
5425
5426
5427
5428
5429
5430
5431
5432
5433
5434
5435
5436
5437
5438
5439
5440
5441
5442
5443
5444
5445
5446
5447
5448
5449
5450
5451
5452
5453
5454
5455
5456
5457
5458
5459
5460
5461
5462
5463
5464
5465
5466
5467
5468
5469
5470
5471
5472
5473
5474
5475
5476
5477
5478
5479
5480
5481
5482
5483
5484
5485
5486
5487
5488
5489
5490
5491
5492
5493
5494
5495
5496
5497
5498
5499
5500
5501
5502
5503
5504
5505
5506
5507
5508
5509
5510
5511
5512
5513
5514
5515
5516
5517
5518
5519
5520
5521
5522
5523
5524
5525
5526
5527
5528
5529
5530
5531
5532
5533
5534
5535
5536
5537
5538
5539
5540
5541
5542
5543
5544
5545
5546
5547
5548
5549
5550
5551
5552
5553
5554
5555
5556
5557
5558
5559
5560
5561
5562
5563
5564
5565
5566
5567
5568
5569
5570
5571
5572
5573
5574
5575
5576
5577
5578
5579
5580
5581
5582
5583
5584
5585
5586
5587
5588
5589
5590
5591
5592
5593
5594
5595
5596
5597
5598
5599
5600
5601
5602
5603
5604
5605
5606
5607
5608
5609
5610
5611
5612
5613
5614
5615
5616
5617
5618
5619
5620
5621
5622
5623
5624
5625
5626
5627
5628
5629
5630
5631
5632
5633
5634
5635
5636
5637
5638
5639
5640
5641
5642
5643
5644
5645
5646
5647
5648
5649
5650
5651
5652
5653
5654
5655
5656
5657
5658
5659
5660
5661
5662
5663
5664
5665
5666
5667
5668
5669
5670
5671
5672
5673
5674
5675
5676
5677
5678
5679
5680
5681
5682
5683
5684
5685
5686
5687
5688
5689
5690
5691
5692
5693
5694
5695
5696
5697
5698
5699
5700
5701
5702
5703
5704
5705
5706
5707
5708
5709
5710
5711
5712
5713
5714
5715
5716
5717
5718
5719
5720
5721
5722
5723
5724
5725
5726
5727
5728
5729
5730
5731
5732
5733
5734
5735
5736
5737
5738
5739
5740
5741
5742
5743
5744
5745
5746
5747
5748
5749
5750
5751
5752
5753
5754
5755
5756
5757
5758
5759
5760
5761
5762
5763
5764
5765
5766
5767
5768
5769
5770
5771
5772
5773
5774
5775
5776
5777
5778
5779
5780
5781
5782
5783
5784
5785
5786
5787
5788
5789
5790
5791
5792
5793
5794
5795
5796
5797
5798
5799
5800
5801
5802
5803
5804
5805
5806
5807
5808
5809
5810
5811
5812
5813
5814
5815
5816
5817
5818
5819
5820
5821
5822
5823
5824
5825
5826
5827
5828
5829
5830
5831
5832
5833
5834
5835
5836
5837
5838
5839
5840
5841
5842
5843
5844
5845
5846
5847
5848
5849
5850
5851
5852
5853
5854
5855
5856
5857
5858
5859
5860
5861
5862
5863
5864
5865
5866
5867
5868
5869
5870
5871
5872
5873
5874
5875
5876
5877
5878
5879
5880
5881
5882
5883
5884
5885
5886
5887
5888
5889
5890
5891
5892
5893
5894
5895
5896
5897
5898
5899
5900
5901
5902
5903
5904
5905
5906
5907
5908
5909
5910
5911
5912
5913
5914
5915
5916
5917
5918
5919
5920
5921
5922
5923
5924
5925
5926
5927
5928
5929
5930
5931
5932
5933
5934
5935
5936
5937
5938
5939
5940
5941
5942
5943
5944
5945
5946
5947
5948
5949
5950
5951
5952
5953
5954
5955
5956
5957
5958
5959
5960
5961
5962
5963
5964
5965
5966
5967
5968
5969
5970
5971
5972
5973
5974
5975
5976
5977
5978
5979
5980
5981
5982
5983
5984
5985
5986
5987
5988
5989
5990
5991
5992
5993
5994
5995
5996
5997
5998
5999
6000
6001
6002
6003
6004
6005
6006
6007
6008
6009
6010
6011
6012
6013
6014
6015
6016
6017
6018
6019
6020
6021
6022
6023
6024
6025
6026
6027
6028
6029
6030
6031
6032
6033
6034
6035
6036
6037
6038
6039
6040
6041
6042
6043
6044
6045
6046
6047
6048
6049
6050
6051
6052
6053
6054
6055
6056
6057
6058
6059
6060
6061
6062
6063
6064
6065
6066
6067
6068
6069
6070
6071
6072
6073
6074
6075
6076
6077
6078
6079
6080
6081
6082
6083
6084
6085
6086
6087
6088
6089
6090
6091
6092
6093
6094
6095
6096
6097
6098
6099
6100
6101
6102
6103
6104
6105
6106
6107
6108
6109
6110
6111
6112
6113
6114
6115
6116
6117
6118
6119
6120
6121
6122
6123
6124
6125
6126
6127
6128
6129
6130
6131
6132
6133
6134
6135
6136
6137
6138
6139
6140
6141
6142
6143
6144
6145
6146
6147
6148
6149
6150
6151
6152
6153
6154
6155
6156
6157
6158
6159
6160
6161
6162
6163
6164
6165
6166
6167
6168
6169
6170
6171
6172
6173
6174
6175
6176
6177
6178
6179
6180
6181
6182
6183
6184
6185
6186
6187
6188
6189
6190
6191
6192
6193
6194
6195
6196
6197
6198
6199
6200
6201
6202
6203
6204
6205
6206
6207
6208
6209
6210
6211
6212
6213
6214
6215
6216
6217
6218
6219
6220
6221
6222
6223
6224
6225
6226
6227
6228
6229
6230
6231
6232
6233
6234
6235
6236
6237
6238
6239
6240
6241
6242
6243
6244
6245
6246
6247
6248
6249
6250
6251
6252
6253
6254
6255
6256
6257
6258
6259
6260
6261
6262
6263
6264
6265
6266
6267
6268
6269
6270
6271
6272
6273
6274
6275
6276
6277
6278
6279
6280
6281
6282
6283
6284
6285
6286
6287
6288
6289
6290
6291
6292
6293
6294
6295
6296
6297
6298
6299
6300
6301
6302
6303
6304
6305
6306
6307
6308
6309
6310
6311
6312
6313
6314
6315
6316
6317
6318
6319
6320
6321
6322
6323
6324
6325
6326
6327
6328
6329
6330
6331
6332
6333
6334
6335
6336
6337
6338
6339
6340
6341
6342
6343
6344
6345
6346
6347
6348
6349
6350
6351
6352
6353
6354
6355
6356
6357
6358
6359
6360
6361
6362
6363
6364
6365
6366
6367
6368
6369
6370
6371
6372
6373
6374
6375
6376
6377
6378
6379
6380
6381
6382
6383
6384
6385
6386
6387
6388
6389
6390
6391
6392
6393
6394
6395
6396
6397
6398
6399
6400
6401
6402
6403
6404
6405
6406
6407
6408
6409
6410
6411
6412
6413
6414
6415
6416
6417
6418
6419
6420
6421
6422
6423
6424
6425
6426
6427
6428
6429
6430
6431
6432
6433
6434
6435
6436
6437
6438
6439
6440
6441
6442
6443
6444
6445
6446
6447
6448
6449
6450
6451
6452
6453
6454
6455
6456
6457
6458
6459
6460
6461
6462
6463
6464
6465
6466
6467
6468
6469
6470
6471
6472
6473
6474
6475
6476
6477
6478
6479
6480
6481
6482
6483
6484
6485
6486
6487
6488
6489
6490
6491
6492
6493
6494
6495
6496
6497
6498
6499
6500
6501
6502
6503
6504
6505
6506
6507
6508
6509
6510
6511
6512
6513
6514
6515
6516
6517
6518
6519
6520
6521
6522
6523
6524
6525
6526
6527
6528
6529
6530
6531
6532
6533
6534
6535
6536
6537
6538
6539
6540
6541
6542
6543
6544
6545
6546
6547
6548
6549
6550
6551
6552
6553
6554
6555
6556
6557
6558
6559
6560
6561
6562
6563
6564
6565
6566
6567
6568
6569
6570
6571
6572
6573
6574
6575
6576
6577
6578
6579
6580
6581
6582
6583
6584
6585
6586
6587
6588
6589
6590
6591
6592
6593
6594
6595
6596
6597
6598
6599
6600
6601
6602
6603
6604
6605
6606
6607
6608
6609
6610
6611
6612
6613
6614
6615
6616
6617
6618
6619
6620
6621
6622
6623
6624
6625
6626
6627
6628
6629
6630
6631
6632
6633
6634
6635
6636
6637
6638
6639
6640
6641
6642
6643
6644
6645
6646
6647
6648
6649
6650
6651
6652
6653
6654
6655
6656
6657
6658
6659
6660
6661
6662
6663
6664
6665
6666
6667
6668
6669
6670
6671
6672
6673
6674
6675
6676
6677
6678
6679
6680
6681
6682
6683
6684
6685
6686
6687
6688
6689
6690
6691
6692
6693
6694
6695
6696
6697
6698
6699
6700
6701
6702
6703
6704
6705
6706
6707
6708
6709
6710
6711
6712
6713
6714
6715
6716
6717
6718
6719
6720
6721
6722
6723
6724
6725
6726
6727
6728
6729
6730
6731
6732
6733
6734
6735
6736
6737
6738
6739
6740
6741
6742
6743
6744
6745
6746
6747
6748
6749
6750
6751
6752
6753
6754
6755
6756
6757
6758
6759
6760
6761
6762
6763
6764
6765
6766
6767
6768
6769
6770
6771
6772
6773
6774
6775
6776
6777
6778
6779
6780
6781
6782
6783
6784
6785
6786
6787
6788
6789
6790
6791
6792
6793
6794
6795
6796
6797
6798
6799
6800
6801
6802
6803
6804
6805
6806
6807
6808
6809
6810
6811
6812
6813
6814
6815
6816
6817
6818
6819
6820
6821
6822
6823
6824
6825
6826
6827
6828
6829
6830
6831
6832
6833
6834
6835
6836
6837
6838
6839
6840
6841
6842
6843
6844
6845
6846
6847
6848
6849
6850
6851
6852
6853
6854
6855
6856
6857
6858
6859
6860
6861
6862
6863
6864
6865
6866
6867
6868
6869
6870
6871
6872
6873
6874
6875
6876
6877
6878
6879
6880
6881
6882
6883
6884
6885
6886
6887
6888
6889
6890
6891
6892
6893
6894
6895
6896
6897
6898
6899
6900
6901
6902
6903
6904
6905
6906
6907
6908
6909
6910
6911
6912
6913
6914
6915
6916
6917
6918
6919
6920
6921
6922
6923
6924
6925
6926
6927
6928
6929
6930
6931
6932
6933
6934
6935
6936
6937
6938
6939
6940
6941
6942
6943
6944
6945
6946
6947
6948
6949
6950
6951
6952
6953
6954
6955
6956
6957
6958
6959
6960
6961
6962
6963
6964
6965
6966
6967
6968
6969
6970
6971
6972
6973
6974
6975
6976
6977
6978
6979
6980
6981
6982
6983
6984
6985
6986
6987
6988
6989
6990
6991
6992
6993
6994
6995
6996
6997
6998
6999
7000
7001
7002
7003
7004
7005
7006
7007
7008
7009
7010
7011
7012
7013
7014
7015
7016
7017
7018
7019
7020
7021
7022
7023
7024
7025
7026
7027
7028
7029
7030
7031
7032
7033
7034
7035
7036
7037
7038
7039
7040
7041
7042
7043
7044
7045
7046
7047
7048
7049
7050
7051
7052
7053
7054
7055
7056
7057
7058
7059
7060
7061
7062
7063
7064
7065
7066
7067
7068
7069
7070
7071
7072
7073
7074
7075
7076
7077
7078
7079
7080
7081
7082
7083
7084
7085
7086
7087
7088
7089
7090
7091
7092
7093
7094
7095
7096
7097
7098
7099
7100
7101
7102
7103
7104
7105
7106
7107
7108
7109
7110
7111
7112
7113
7114
7115
7116
7117
7118
7119
7120
7121
7122
7123
7124
7125
7126
7127
7128
7129
7130
7131
7132
7133
7134
7135
7136
7137
7138
7139
7140
7141
7142
7143
7144
7145
7146
7147
7148
7149
7150
7151
7152
7153
7154
7155
7156
7157
7158
7159
7160
7161
7162
7163
7164
7165
7166
7167
7168
7169
7170
7171
7172
7173
7174
7175
7176
7177
7178
7179
7180
7181
7182
7183
7184
7185
7186
7187
7188
7189
7190
7191
7192
7193
7194
7195
7196
7197
7198
7199
7200
7201
7202
7203
7204
7205
7206
7207
7208
7209
7210
7211
7212
7213
7214
7215
7216
7217
7218
7219
7220
7221
7222
7223
7224
7225
7226
7227
7228
7229
7230
7231
7232
7233
7234
7235
7236
7237
7238
7239
7240
7241
7242
7243
7244
7245
7246
7247
7248
7249
7250
7251
7252
7253
7254
7255
7256
7257
7258
7259
7260
7261
7262
7263
7264
7265
7266
7267
7268
7269
7270
7271
7272
7273
7274
7275
7276
7277
7278
7279
7280
7281
7282
7283
7284
7285
7286
7287
7288
7289
7290
7291
7292
7293
7294
7295
7296
7297
7298
7299
7300
7301
7302
7303
7304
7305
7306
7307
7308
7309
7310
7311
7312
7313
7314
7315
7316
7317
7318
7319
7320
7321
7322
7323
7324
7325
7326
7327
7328
7329
7330
7331
7332
7333
7334
7335
7336
7337
7338
7339
7340
7341
7342
7343
7344
7345
7346
7347
7348
7349
7350
7351
7352
7353
7354
7355
7356
7357
7358
7359
7360
7361
7362
7363
7364
7365
7366
7367
7368
7369
7370
7371
7372
7373
7374
7375
7376
7377
7378
7379
7380
7381
7382
7383
7384
7385
7386
7387
7388
7389
7390
7391
7392
7393
7394
7395
7396
7397
7398
7399
7400
7401
7402
7403
7404
7405
7406
7407
7408
7409
7410
7411
7412
7413
7414
7415
7416
7417
7418
7419
7420
7421
7422
7423
7424
7425
7426
7427
7428
7429
7430
7431
7432
7433
7434
7435
7436
7437
7438
7439
7440
7441
7442
7443
7444
7445
7446
7447
7448
7449
7450
7451
7452
7453
7454
7455
7456
7457
7458
7459
7460
7461
7462
7463
7464
7465
7466
7467
7468
7469
7470
7471
7472
7473
7474
7475
7476
7477
7478
7479
7480
7481
7482
7483
7484
7485
7486
7487
7488
7489
7490
7491
7492
7493
7494
7495
7496
7497
7498
7499
7500
7501
7502
7503
7504
7505
7506
7507
7508
7509
7510
7511
7512
7513
7514
7515
7516
7517
7518
7519
7520
7521
7522
7523
7524
7525
7526
7527
7528
7529
7530
7531
7532
7533
7534
7535
7536
7537
7538
7539
7540
7541
7542
7543
7544
7545
7546
7547
7548
7549
7550
7551
7552
7553
7554
7555
7556
7557
7558
7559
7560
7561
7562
7563
7564
7565
7566
7567
7568
7569
7570
7571
7572
7573
7574
7575
7576
7577
7578
7579
7580
7581
7582
7583
7584
7585
7586
7587
7588
7589
7590
7591
7592
7593
7594
7595
7596
7597
7598
7599
7600
7601
7602
7603
7604
7605
7606
7607
7608
7609
7610
7611
7612
7613
7614
7615
7616
7617
7618
7619
7620
7621
7622
7623
7624
7625
7626
7627
7628
7629
7630
7631
7632
7633
7634
7635
7636
7637
7638
7639
7640
7641
7642
7643
7644
7645
7646
7647
7648
7649
7650
7651
7652
7653
7654
7655
7656
7657
7658
7659
7660
7661
7662
7663
7664
7665
7666
7667
7668
7669
7670
7671
7672
7673
7674
7675
7676
7677
7678
7679
7680
7681
7682
7683
7684
7685
7686
7687
7688
7689
7690
7691
7692
7693
7694
7695
7696
7697
7698
7699
7700
7701
7702
7703
7704
7705
7706
7707
7708
7709
7710
7711
7712
7713
7714
7715
7716
7717
7718
7719
7720
7721
7722
7723
7724
7725
7726
7727
7728
7729
7730
7731
7732
7733
7734
7735
7736
7737
7738
7739
7740
7741
7742
7743
7744
7745
7746
7747
7748
7749
7750
7751
7752
7753
7754
7755
7756
7757
7758
7759
7760
7761
7762
7763
7764
7765
7766
7767
7768
7769
7770
7771
7772
7773
7774
7775
7776
7777
7778
7779
7780
7781
7782
7783
7784
7785
7786
7787
7788
7789
7790
7791
7792
7793
7794
7795
7796
7797
7798
7799
7800
7801
7802
7803
7804
7805
7806
7807
7808
7809
7810
7811
7812
7813
7814
7815
7816
7817
7818
7819
7820
7821
7822
7823
7824
7825
7826
7827
7828
7829
7830
7831
7832
7833
7834
7835
7836
7837
7838
7839
7840
7841
7842
7843
7844
7845
7846
7847
7848
7849
7850
7851
7852
7853
7854
7855
7856
7857
7858
7859
7860
7861
7862
7863
7864
7865
7866
7867
7868
7869
7870
7871
7872
7873
7874
7875
7876
7877
7878
7879
7880
7881
7882
7883
7884
7885
7886
7887
7888
7889
7890
7891
7892
7893
7894
7895
7896
7897
7898
7899
7900
7901
7902
7903
7904
7905
7906
7907
7908
7909
7910
7911
7912
7913
7914
7915
7916
7917
7918
7919
7920
7921
7922
7923
7924
7925
7926
7927
7928
7929
7930
7931
7932
7933
7934
7935
7936
7937
7938
7939
7940
7941
7942
7943
7944
7945
7946
7947
7948
7949
7950
7951
7952
7953
7954
7955
7956
7957
7958
7959
7960
7961
7962
7963
7964
7965
7966
7967
7968
7969
7970
7971
7972
7973
7974
7975
7976
7977
7978
7979
7980
7981
7982
7983
7984
7985
7986
7987
7988
7989
7990
7991
7992
7993
7994
7995
7996
7997
7998
7999
8000
8001
8002
8003
8004
8005
8006
8007
8008
8009
8010
8011
8012
8013
8014
8015
8016
8017
8018
8019
8020
8021
8022
8023
8024
8025
8026
8027
8028
8029
8030
8031
8032
8033
8034
8035
8036
8037
8038
8039
8040
8041
8042
8043
8044
8045
8046
8047
8048
8049
8050
8051
8052
8053
8054
8055
8056
8057
8058
8059
8060
8061
8062
8063
8064
8065
8066
8067
8068
8069
8070
8071
8072
8073
8074
8075
8076
8077
8078
8079
8080
8081
8082
8083
8084
8085
8086
8087
8088
8089
8090
8091
8092
8093
8094
8095
8096
8097
8098
8099
8100
8101
8102
8103
8104
8105
8106
8107
8108
8109
8110
8111
8112
8113
8114
8115
8116
8117
8118
8119
8120
8121
8122
8123
8124
8125
8126
8127
8128
8129
8130
8131
8132
8133
8134
8135
8136
8137
8138
8139
8140
8141
8142
8143
8144
8145
8146
8147
8148
8149
8150
8151
8152
8153
8154
8155
8156
8157
8158
8159
8160
8161
8162
8163
8164
8165
8166
8167
8168
8169
8170
8171
8172
8173
8174
8175
8176
8177
8178
8179
8180
8181
8182
8183
8184
8185
8186
8187
8188
8189
8190
8191
8192
8193
8194
8195
8196
8197
8198
8199
8200
8201
8202
8203
8204
8205
8206
8207
8208
8209
8210
8211
8212
8213
8214
8215
8216
8217
8218
8219
8220
8221
8222
8223
8224
8225
8226
8227
8228
8229
8230
8231
8232
8233
8234
8235
8236
8237
8238
8239
8240
8241
8242
8243
8244
8245
8246
8247
8248
8249
8250
8251
8252
8253
8254
8255
8256
8257
8258
8259
8260
8261
8262
8263
8264
8265
8266
8267
8268
8269
8270
8271
8272
8273
8274
8275
8276
8277
8278
8279
8280
8281
8282
8283
8284
8285
8286
8287
8288
8289
8290
8291
8292
8293
8294
8295
8296
8297
8298
8299
8300
8301
8302
8303
8304
8305
8306
8307
8308
8309
8310
8311
8312
8313
8314
8315
8316
8317
8318
8319
8320
8321
8322
8323
8324
8325
8326
8327
8328
8329
8330
8331
8332
8333
8334
8335
8336
8337
8338
8339
8340
8341
8342
8343
8344
8345
8346
8347
8348
8349
8350
8351
8352
8353
8354
8355
8356
8357
8358
8359
8360
8361
8362
8363
8364
8365
8366
8367
8368
8369
8370
8371
8372
8373
8374
8375
8376
8377
8378
8379
8380
8381
8382
8383
8384
8385
8386
8387
8388
8389
8390
8391
8392
8393
8394
8395
8396
8397
8398
8399
8400
8401
8402
8403
8404
8405
8406
8407
8408
8409
8410
8411
8412
8413
8414
8415
8416
8417
8418
8419
8420
8421
8422
8423
8424
8425
8426
8427
8428
8429
8430
8431
8432
8433
8434
8435
8436
8437
8438
8439
8440
8441
8442
8443
8444
8445
8446
8447
8448
8449
8450
8451
8452
8453
8454
8455
8456
8457
8458
8459
8460
8461
8462
8463
8464
8465
8466
8467
8468
8469
8470
8471
8472
8473
8474
8475
8476
8477
8478
8479
8480
8481
8482
8483
8484
8485
8486
8487
8488
8489
8490
8491
8492
8493
8494
8495
8496
8497
8498
8499
8500
8501
8502
8503
8504
8505
8506
8507
8508
8509
8510
8511
8512
8513
8514
8515
8516
8517
8518
8519
8520
8521
8522
8523
8524
8525
8526
8527
8528
8529
8530
8531
8532
8533
8534
8535
8536
8537
8538
8539
8540
8541
8542
8543
8544
8545
8546
8547
8548
8549
8550
8551
8552
8553
8554
8555
8556
8557
8558
8559
8560
8561
8562
8563
8564
8565
8566
8567
8568
8569
8570
8571
8572
8573
8574
8575
8576
8577
8578
8579
8580
8581
8582
8583
8584
8585
8586
8587
8588
8589
8590
8591
8592
8593
8594
8595
8596
8597
8598
8599
8600
8601
8602
8603
8604
8605
8606
8607
8608
8609
8610
8611
8612
8613
8614
8615
8616
8617
8618
8619
8620
8621
8622
8623
8624
8625
8626
8627
8628
8629
8630
8631
8632
8633
8634
8635
8636
8637
8638
8639
8640
8641
8642
8643
8644
8645
8646
8647
8648
8649
8650
8651
8652
8653
8654
8655
8656
8657
8658
8659
8660
8661
8662
8663
8664
8665
8666
8667
8668
8669
8670
8671
8672
8673
8674
8675
8676
8677
8678
8679
8680
8681
8682
8683
8684
8685
8686
8687
8688
8689
8690
8691
8692
8693
8694
8695
8696
8697
8698
8699
8700
8701
8702
8703
8704
8705
8706
8707
8708
8709
8710
8711
8712
8713
8714
8715
8716
8717
8718
8719
8720
8721
8722
8723
8724
8725
8726
8727
8728
8729
8730
8731
8732
8733
8734
8735
8736
8737
8738
8739
8740
8741
8742
8743
8744
8745
8746
8747
8748
8749
8750
8751
8752
8753
8754
8755
8756
8757
8758
8759
8760
8761
8762
8763
8764
8765
8766
8767
8768
8769
8770
8771
8772
8773
8774
8775
8776
8777
8778
8779
8780
8781
8782
8783
8784
8785
8786
8787
8788
8789
8790
8791
8792
8793
8794
8795
8796
8797
8798
8799
8800
8801
8802
8803
8804
8805
8806
8807
8808
8809
8810
8811
8812
8813
8814
8815
8816
8817
8818
8819
8820
8821
8822
8823
8824
8825
8826
8827
8828
8829
8830
8831
8832
8833
8834
8835
8836
8837
8838
8839
8840
8841
8842
8843
8844
8845
8846
8847
8848
8849
8850
8851
8852
8853
8854
8855
8856
8857
8858
8859
8860
8861
8862
8863
8864
8865
8866
8867
8868
8869
8870
8871
8872
8873
8874
8875
8876
8877
8878
8879
8880
8881
8882
8883
8884
8885
8886
8887
8888
8889
8890
8891
8892
8893
8894
8895
8896
8897
8898
8899
8900
8901
8902
8903
8904
8905
8906
8907
8908
8909
8910
8911
8912
8913
8914
8915
8916
8917
8918
8919
8920
8921
8922
8923
8924
8925
8926
8927
8928
8929
8930
8931
8932
8933
8934
8935
8936
8937
8938
8939
8940
8941
8942
8943
8944
8945
8946
8947
8948
8949
8950
8951
8952
8953
8954
8955
8956
8957
8958
8959
8960
8961
8962
8963
8964
8965
8966
8967
8968
8969
8970
8971
8972
8973
8974
8975
8976
8977
8978
8979
8980
8981
8982
8983
8984
8985
8986
8987
8988
8989
8990
8991
8992
8993
8994
8995
8996
8997
8998
8999
9000
9001
9002
9003
9004
9005
9006
9007
9008
9009
9010
9011
9012
9013
9014
9015
9016
9017
9018
9019
9020
9021
9022
9023
9024
9025
9026
9027
9028
9029
9030
9031
9032
9033
9034
9035
9036
9037
9038
9039
9040
9041
9042
9043
9044
9045
9046
9047
9048
9049
9050
9051
9052
9053
9054
9055
9056
9057
9058
9059
9060
9061
9062
9063
9064
9065
9066
9067
9068
9069
9070
9071
9072
9073
9074
9075
9076
9077
9078
9079
9080
9081
9082
9083
9084
9085
9086
9087
9088
9089
9090
9091
9092
9093
9094
9095
9096
9097
9098
9099
9100
9101
9102
9103
9104
9105
9106
9107
9108
9109
9110
9111
9112
9113
9114
9115
9116
9117
9118
9119
9120
9121
9122
9123
9124
9125
9126
9127
9128
9129
9130
9131
9132
9133
9134
9135
9136
9137
9138
9139
9140
9141
9142
9143
9144
9145
9146
9147
9148
9149
9150
9151
9152
9153
9154
9155
9156
9157
9158
9159
9160
9161
9162
9163
9164
9165
9166
9167
9168
9169
9170
9171
9172
9173
9174
9175
9176
9177
9178
9179
9180
9181
9182
9183
9184
9185
9186
9187
9188
9189
9190
9191
9192
9193
9194
9195
9196
9197
9198
9199
9200
9201
9202
9203
9204
9205
9206
9207
9208
9209
9210
9211
9212
9213
9214
9215
9216
9217
9218
9219
9220
9221
9222
9223
9224
9225
9226
9227
9228
9229
9230
9231
9232
9233
9234
9235
9236
9237
9238
9239
9240
9241
9242
9243
9244
9245
9246
9247
9248
9249
9250
9251
9252
9253
9254
9255
9256
9257
9258
9259
9260
9261
9262
9263
9264
9265
9266
9267
9268
9269
9270
9271
9272
9273
9274
9275
9276
9277
9278
9279
9280
9281
9282
9283
9284
9285
9286
9287
9288
9289
9290
9291
9292
9293
9294
9295
9296
9297
9298
9299
9300
9301
9302
9303
9304
9305
9306
9307
9308
9309
9310
9311
9312
9313
9314
9315
9316
9317
9318
9319
9320
9321
9322
9323
9324
9325
9326
9327
9328
9329
9330
9331
9332
9333
9334
9335
9336
9337
9338
9339
9340
9341
9342
9343
9344
9345
9346
9347
9348
9349
9350
9351
9352
9353
9354
9355
9356
9357
9358
9359
9360
9361
9362
9363
9364
9365
9366
9367
9368
9369
9370
9371
9372
9373
9374
9375
9376
9377
9378
9379
9380
9381
9382
9383
9384
9385
9386
9387
9388
9389
9390
9391
9392
9393
9394
9395
9396
9397
9398
9399
9400
9401
9402
9403
9404
9405
9406
9407
9408
9409
9410
9411
9412
9413
9414
9415
9416
9417
9418
9419
9420
9421
9422
9423
9424
9425
9426
9427
9428
9429
9430
9431
9432
9433
9434
9435
9436
9437
9438
9439
9440
9441
9442
9443
9444
9445
9446
9447
9448
9449
9450
9451
9452
9453
9454
9455
9456
9457
9458
9459
9460
9461
9462
9463
9464
9465
9466
9467
9468
9469
9470
9471
9472
9473
9474
9475
9476
9477
9478
9479
9480
9481
9482
9483
9484
9485
9486
9487
9488
9489
9490
9491
9492
9493
9494
9495
9496
9497
9498
9499
9500
9501
9502
9503
9504
9505
9506
9507
9508
9509
9510
9511
9512
9513
9514
9515
9516
9517
9518
9519
9520
9521
9522
9523
9524
9525
9526
9527
9528
9529
9530
9531
9532
9533
9534
9535
9536
9537
9538
9539
9540
9541
9542
9543
9544
9545
9546
9547
9548
9549
9550
9551
9552
9553
9554
9555
9556
9557
9558
9559
9560
9561
9562
9563
9564
9565
9566
9567
9568
9569
9570
9571
9572
9573
9574
9575
9576
9577
9578
9579
9580
9581
9582
9583
9584
9585
9586
9587
9588
9589
9590
9591
9592
9593
9594
9595
9596
9597
9598
9599
9600
9601
9602
9603
9604
9605
9606
9607
9608
9609
9610
9611
9612
9613
9614
9615
9616
9617
9618
9619
9620
9621
9622
9623
9624
9625
9626
9627
9628
9629
9630
9631
9632
9633
9634
9635
9636
9637
9638
9639
9640
9641
9642
9643
9644
9645
9646
9647
9648
9649
9650
9651
9652
9653
9654
9655
9656
9657
9658
9659
9660
9661
9662
9663
9664
9665
9666
9667
9668
9669
9670
9671
9672
9673
9674
9675
9676
9677
9678
9679
9680
9681
9682
9683
9684
9685
9686
9687
9688
9689
9690
9691
9692
9693
9694
9695
9696
9697
9698
9699
9700
9701
9702
9703
9704
9705
9706
9707
9708
9709
9710
9711
9712
9713
9714
9715
9716
9717
9718
9719
9720
9721
9722
9723
9724
9725
9726
9727
9728
9729
9730
9731
9732
9733
9734
9735
9736
9737
9738
9739
9740
9741
9742
9743
9744
9745
9746
9747
9748
9749
9750
9751
9752
9753
9754
9755
9756
9757
9758
9759
9760
9761
9762
9763
9764
9765
9766
9767
9768
9769
9770
9771
9772
9773
9774
9775
9776
9777
9778
9779
9780
9781
9782
9783
9784
9785
9786
9787
9788
9789
9790
9791
9792
9793
9794
9795
9796
9797
9798
9799
9800
9801
9802
9803
9804
9805
9806
9807
9808
9809
9810
9811
9812
9813
9814
9815
9816
9817
9818
9819
9820
9821
9822
9823
9824
9825
9826
9827
9828
9829
9830
9831
9832
9833
9834
9835
9836
9837
9838
9839
9840
9841
9842
9843
9844
9845
9846
9847
9848
9849
9850
9851
9852
9853
9854
9855
9856
9857
9858
9859
9860
9861
9862
9863
9864
9865
9866
9867
9868
9869
9870
9871
9872
9873
9874
9875
9876
9877
9878
9879
9880
9881
9882
9883
9884
9885
9886
9887
9888
9889
9890
9891
9892
9893
9894
9895
9896
9897
9898
9899
9900
9901
9902
9903
9904
9905
9906
9907
9908
9909
9910
9911
9912
9913
9914
9915
9916
9917
9918
9919
9920
9921
9922
9923
9924
9925
9926
9927
9928
9929
9930
9931
9932
9933
9934
9935
9936
9937
9938
9939
9940
9941
9942
9943
9944
9945
9946
9947
9948
9949
9950
9951
9952
9953
9954
9955
9956
9957
9958
9959
9960
9961
9962
9963
9964
9965
9966
9967
9968
9969
9970
9971
9972
9973
9974
9975
9976
9977
9978
9979
9980
9981
9982
9983
9984
9985
9986
9987
9988
9989
9990
9991
9992
9993
9994
9995
9996
9997
9998
9999
10000
10001
10002
10003
10004
10005
10006
10007
10008
10009
10010
10011
10012
10013
10014
10015
10016
10017
10018
10019
10020
10021
10022
10023
10024
10025
10026
10027
10028
10029
10030
10031
10032
10033
10034
10035
10036
10037
10038
10039
10040
10041
10042
10043
10044
10045
10046
10047
10048
10049
10050
10051
10052
10053
10054
10055
10056
10057
10058
10059
10060
10061
10062
10063
10064
10065
10066
10067
10068
10069
10070
10071
10072
10073
10074
10075
10076
10077
10078
10079
10080
10081
10082
10083
10084
10085
10086
10087
10088
10089
10090
10091
10092
10093
10094
10095
10096
10097
10098
10099
10100
10101
10102
10103
10104
10105
10106
10107
10108
10109
10110
10111
10112
10113
10114
10115
10116
10117
10118
10119
10120
10121
10122
10123
10124
10125
10126
10127
10128
10129
10130
10131
10132
10133
10134
10135
10136
10137
10138
10139
10140
10141
10142
10143
10144
10145
10146
10147
10148
10149
10150
10151
10152
10153
10154
10155
10156
10157
10158
10159
10160
10161
10162
10163
10164
10165
10166
10167
10168
10169
10170
10171
10172
10173
10174
10175
10176
10177
10178
10179
10180
10181
10182
10183
10184
10185
10186
10187
10188
10189
10190
10191
10192
10193
10194
10195
10196
10197
10198
10199
10200
10201
10202
10203
10204
10205
10206
10207
10208
10209
10210
10211
10212
10213
10214
10215
10216
10217
10218
10219
10220
10221
10222
10223
10224
10225
10226
10227
10228
10229
10230
10231
10232
10233
10234
10235
10236
10237
10238
10239
10240
10241
10242
10243
10244
10245
10246
10247
10248
10249
10250
10251
10252
10253
10254
10255
10256
10257
10258
10259
10260
10261
10262
10263
10264
10265
10266
10267
10268
10269
10270
10271
10272
10273
10274
10275
10276
10277
10278
10279
10280
10281
10282
10283
10284
10285
10286
10287
10288
10289
10290
10291
10292
10293
10294
10295
10296
10297
10298
10299
10300
10301
10302
10303
10304
10305
10306
10307
10308
10309
10310
10311
10312
10313
10314
10315
10316
10317
10318
10319
10320
10321
10322
10323
10324
10325
10326
10327
10328
10329
10330
10331
10332
10333
10334
10335
10336
10337
10338
10339
10340
10341
10342
10343
10344
10345
10346
10347
10348
10349
10350
10351
10352
10353
10354
10355
10356
10357
10358
10359
10360
10361
10362
10363
10364
10365
10366
10367
10368
10369
10370
10371
10372
10373
10374
10375
10376
10377
10378
10379
10380
10381
10382
10383
10384
10385
10386
10387
10388
10389
10390
10391
10392
10393
10394
10395
10396
10397
10398
10399
10400
10401
10402
10403
10404
10405
10406
10407
10408
10409
10410
10411
10412
10413
10414
10415
10416
10417
10418
10419
10420
10421
10422
10423
10424
10425
10426
10427
10428
10429
10430
10431
10432
10433
10434
10435
10436
10437
10438
10439
10440
10441
10442
10443
10444
10445
10446
10447
10448
10449
10450
10451
10452
10453
10454
10455
10456
10457
10458
10459
10460
10461
10462
10463
10464
10465
10466
10467
10468
10469
10470
10471
10472
10473
10474
10475
10476
10477
10478
10479
10480
10481
10482
10483
10484
10485
10486
10487
10488
10489
10490
10491
10492
10493
10494
10495
10496
10497
10498
10499
10500
10501
10502
10503
10504
10505
10506
10507
10508
10509
10510
10511
10512
10513
10514
10515
10516
10517
10518
10519
10520
10521
10522
10523
10524
10525
10526
10527
10528
10529
10530
10531
10532
10533
10534
10535
10536
10537
10538
10539
10540
10541
10542
10543
10544
10545
10546
10547
10548
10549
10550
10551
10552
10553
10554
10555
10556
10557
10558
10559
10560
10561
10562
10563
10564
10565
10566
10567
10568
10569
10570
10571
10572
10573
10574
10575
10576
10577
10578
10579
10580
10581
10582
10583
10584
10585
10586
10587
10588
10589
10590
10591
10592
10593
10594
10595
10596
10597
10598
10599
10600
10601
10602
10603
10604
10605
10606
10607
10608
10609
10610
10611
10612
10613
10614
10615
10616
10617
10618
10619
10620
10621
10622
10623
10624
10625
10626
10627
10628
10629
10630
10631
10632
10633
10634
10635
10636
10637
10638
10639
10640
10641
10642
10643
10644
10645
10646
10647
10648
10649
10650
10651
10652
10653
10654
10655
10656
10657
10658
10659
10660
10661
10662
10663
10664
10665
10666
10667
10668
10669
10670
10671
10672
10673
10674
10675
10676
10677
10678
10679
10680
10681
10682
10683
10684
10685
10686
10687
10688
10689
10690
10691
10692
10693
10694
10695
10696
10697
10698
10699
10700
10701
10702
10703
10704
10705
10706
10707
10708
10709
10710
10711
10712
10713
10714
10715
10716
10717
10718
10719
10720
10721
10722
10723
10724
10725
10726
10727
10728
10729
10730
10731
10732
10733
10734
10735
10736
10737
10738
10739
10740
10741
10742
10743
10744
10745
10746
10747
10748
10749
10750
10751
10752
10753
10754
10755
10756
10757
10758
10759
10760
10761
10762
10763
10764
10765
10766
10767
10768
10769
10770
10771
10772
10773
10774
10775
10776
10777
10778
10779
10780
10781
10782
10783
10784
10785
10786
10787
10788
10789
10790
10791
10792
10793
10794
10795
10796
10797
10798
10799
10800
10801
10802
10803
10804
10805
10806
10807
10808
10809
10810
10811
10812
10813
10814
10815
10816
10817
10818
10819
10820
10821
10822
10823
10824
10825
10826
10827
10828
10829
10830
10831
10832
10833
10834
10835
10836
10837
10838
10839
10840
10841
10842
10843
10844
10845
10846
10847
10848
10849
10850
10851
10852
10853
10854
10855
10856
10857
10858
10859
10860
10861
10862
10863
10864
10865
10866
10867
10868
10869
10870
10871
10872
10873
10874
10875
10876
10877
10878
10879
10880
10881
10882
10883
10884
10885
10886
10887
10888
10889
10890
10891
10892
10893
10894
10895
10896
10897
10898
10899
10900
10901
10902
10903
10904
10905
10906
10907
10908
10909
10910
10911
10912
10913
10914
10915
10916
10917
10918
10919
10920
10921
10922
10923
10924
10925
10926
10927
10928
10929
10930
10931
10932
10933
10934
10935
10936
10937
10938
10939
10940
10941
10942
10943
10944
10945
10946
10947
10948
10949
10950
10951
10952
10953
10954
10955
10956
10957
10958
10959
10960
10961
10962
10963
10964
10965
10966
10967
10968
10969
10970
10971
10972
10973
10974
10975
10976
10977
10978
10979
10980
10981
10982
10983
10984
10985
10986
10987
10988
10989
10990
10991
10992
10993
10994
10995
10996
10997
10998
10999
11000
11001
11002
11003
11004
11005
11006
11007
11008
11009
11010
11011
11012
11013
11014
11015
11016
11017
11018
11019
11020
11021
11022
11023
11024
11025
11026
11027
11028
11029
11030
11031
11032
11033
11034
11035
11036
11037
11038
11039
11040
11041
11042
11043
11044
11045
11046
11047
11048
11049
11050
11051
11052
11053
11054
11055
11056
11057
11058
11059
11060
11061
11062
11063
11064
11065
11066
11067
11068
11069
11070
11071
11072
11073
11074
11075
11076
11077
11078
11079
11080
11081
11082
11083
11084
11085
11086
11087
11088
11089
11090
11091
11092
11093
11094
11095
11096
11097
11098
11099
11100
11101
11102
11103
11104
11105
11106
11107
11108
11109
11110
11111
11112
11113
11114
11115
11116
11117
11118
11119
11120
11121
11122
11123
11124
11125
11126
11127
11128
11129
11130
11131
11132
11133
11134
11135
11136
11137
11138
11139
11140
11141
11142
11143
11144
11145
11146
11147
11148
11149
11150
11151
11152
11153
11154
11155
11156
11157
11158
11159
11160
11161
11162
11163
11164
11165
11166
11167
11168
11169
11170
11171
11172
11173
11174
11175
11176
/*
 * Copyright (C) 2017 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

syntax = "proto2";

package android.os.statsd;
option java_package = "com.android.os";
option java_outer_classname = "AtomsProto";

import "frameworks/base/cmds/statsd/src/atom_field_options.proto";
import "frameworks/base/core/proto/android/app/enums.proto";
import "frameworks/base/core/proto/android/app/job/enums.proto";
import "frameworks/base/core/proto/android/app/settings_enums.proto";
import "frameworks/base/core/proto/android/app/media_output_enum.proto";
import "frameworks/base/core/proto/android/app/tvsettings_enums.proto";
import "frameworks/base/core/proto/android/bluetooth/a2dp/enums.proto";
import "frameworks/base/core/proto/android/bluetooth/enums.proto";
import "frameworks/base/core/proto/android/bluetooth/hci/enums.proto";
import "frameworks/base/core/proto/android/bluetooth/hfp/enums.proto";
import "frameworks/base/core/proto/android/bluetooth/smp/enums.proto";
import "frameworks/base/core/proto/android/debug/enums.proto";
import "frameworks/base/core/proto/android/hardware/biometrics/enums.proto";
import "frameworks/base/core/proto/android/hardware/sensor/assist/enums.proto";
import "frameworks/base/core/proto/android/net/networkcapabilities.proto";
import "frameworks/base/core/proto/android/os/enums.proto";
import "frameworks/base/core/proto/android/server/connectivity/data_stall_event.proto";
import "frameworks/base/core/proto/android/server/enums.proto";
import "frameworks/base/core/proto/android/server/job/enums.proto";
import "frameworks/base/core/proto/android/server/location/enums.proto";
import "frameworks/base/core/proto/android/service/procstats_enum.proto";
import "frameworks/base/core/proto/android/service/usb.proto";
import "frameworks/base/core/proto/android/stats/connectivity/network_stack.proto";
import "frameworks/base/core/proto/android/stats/connectivity/tethering.proto";
import "frameworks/base/core/proto/android/stats/dnsresolver/dns_resolver.proto";
import "frameworks/base/core/proto/android/stats/devicepolicy/device_policy.proto";
import "frameworks/base/core/proto/android/stats/devicepolicy/device_policy_enums.proto";
import "frameworks/base/core/proto/android/stats/docsui/docsui_enums.proto";
import "frameworks/base/core/proto/android/stats/accessibility/accessibility_enums.proto";
import "frameworks/base/core/proto/android/stats/enums.proto";
import "frameworks/base/core/proto/android/stats/intelligence/enums.proto";
import "frameworks/base/core/proto/android/stats/launcher/launcher.proto";
import "frameworks/base/core/proto/android/stats/location/location_enums.proto";
import "frameworks/base/core/proto/android/stats/mediametrics/mediametrics.proto";
import "frameworks/base/core/proto/android/stats/mediaprovider/mediaprovider_enums.proto";
import "frameworks/base/core/proto/android/stats/storage/storage_enums.proto";
import "frameworks/base/core/proto/android/stats/style/style_enums.proto";
import "frameworks/base/core/proto/android/stats/sysui/notification_enums.proto";
import "frameworks/base/core/proto/android/telecomm/enums.proto";
import "frameworks/base/core/proto/android/telephony/enums.proto";
import "frameworks/base/core/proto/android/view/enums.proto";
import "frameworks/base/core/proto/android/wifi/enums.proto";
import "frameworks/base/core/proto/android/stats/textclassifier/textclassifier_enums.proto";
import "frameworks/base/core/proto/android/stats/otaupdate/updateengine_enums.proto";

/**
 * The master atom class. This message defines all of the available
 * raw stats log events from the Android system, also known as "atoms."
 *
 * This field contains a single oneof with all of the available messages.
 * The stats-log-api-gen tool runs as part of the Android build and
 * generates the android.util.StatsLog class, which contains the constants
 * and methods that Android uses to log.
 *
 * This Atom class is not actually built into the Android system.
 * Instead, statsd on Android constructs these messages synthetically,
 * in the format defined here and in stats_log.proto.
 */
message Atom {
    // Pushed atoms start at 2.
    oneof pushed {
        // For StatsLog reasons, 1 is illegal and will not work. Must start at 2.
        BleScanStateChanged ble_scan_state_changed = 2
                [(module) = "bluetooth", (module) = "statsdtest"];
        ProcessStateChanged process_state_changed = 3 [(module) = "framework"];
        BleScanResultReceived ble_scan_result_received = 4 [(module) = "bluetooth"];
        SensorStateChanged sensor_state_changed =
                5 [(module) = "framework", (module) = "statsdtest"];
        GpsScanStateChanged gps_scan_state_changed = 6 [(module) = "framework"];
        SyncStateChanged sync_state_changed = 7 [(module) = "framework", (module) = "statsdtest"];
        ScheduledJobStateChanged scheduled_job_state_changed =
                8 [(module) = "framework", (module) = "statsdtest"];
        ScreenBrightnessChanged screen_brightness_changed =
                9 [(module) = "framework", (module) = "statsdtest"];
        WakelockStateChanged wakelock_state_changed =
                10 [(module) = "framework", (module) = "statsdtest"];
        LongPartialWakelockStateChanged long_partial_wakelock_state_changed =
                11 [(module) = "framework"];
        MobileRadioPowerStateChanged mobile_radio_power_state_changed =
                12 [(module) = "framework", (truncate_timestamp) = true];
        WifiRadioPowerStateChanged wifi_radio_power_state_changed = 13 [(module) = "framework"];
        ActivityManagerSleepStateChanged activity_manager_sleep_state_changed =
                14 [(module) = "framework"];
        MemoryFactorStateChanged memory_factor_state_changed = 15 [(module) = "framework"];
        ExcessiveCpuUsageReported excessive_cpu_usage_reported = 16 [(module) = "framework"];
        CachedKillReported cached_kill_reported = 17 [(module) = "framework"];
        ProcessMemoryStatReported process_memory_stat_reported = 18 [(module) = "framework"];
        LauncherUIChanged launcher_event = 19 [(module) = "sysui"];
        BatterySaverModeStateChanged battery_saver_mode_state_changed =
                20 [(module) = "framework", (module) = "statsdtest"];
        DeviceIdleModeStateChanged device_idle_mode_state_changed = 21 [(module) = "framework"];
        DeviceIdlingModeStateChanged device_idling_mode_state_changed = 22 [(module) = "framework"];
        AudioStateChanged audio_state_changed =
                23 [(module) = "framework", (truncate_timestamp) = true];
        MediaCodecStateChanged media_codec_state_changed = 24 [(module) = "framework"];
        CameraStateChanged camera_state_changed = 25 [(module) = "framework"];
        FlashlightStateChanged flashlight_state_changed = 26 [(module) = "framework"];
        UidProcessStateChanged uid_process_state_changed =
                27 [(module) = "framework", (module) = "statsdtest"];
        ProcessLifeCycleStateChanged process_life_cycle_state_changed =
                28 [(module) = "framework", (module) = "statsdtest"];
        ScreenStateChanged screen_state_changed =
                29 [(module) = "framework", (module) = "statsdtest"];
        BatteryLevelChanged battery_level_changed =
                30 [(module) = "framework", (module) = "statsdtest"];
        ChargingStateChanged charging_state_changed = 31 [(module) = "framework"];
        PluggedStateChanged plugged_state_changed = 32
                [(module) = "framework", (module) = "statsdtest"];
        InteractiveStateChanged interactive_state_changed = 33 [(module) = "framework"];
        TouchEventReported touch_event_reported = 34;
        WakeupAlarmOccurred wakeup_alarm_occurred = 35 [(module) = "framework"];
        KernelWakeupReported kernel_wakeup_reported = 36 [(module) = "framework"];
        WifiLockStateChanged wifi_lock_state_changed = 37 [(module) = "wifi"];
        WifiSignalStrengthChanged wifi_signal_strength_changed = 38 [(module) = "wifi"];
        WifiScanStateChanged wifi_scan_state_changed = 39 [(module) = "wifi"];
        PhoneSignalStrengthChanged phone_signal_strength_changed =
                40 [(module) = "framework", (truncate_timestamp) = true];
        SettingChanged setting_changed = 41 [(module) = "framework"];
        ActivityForegroundStateChanged activity_foreground_state_changed =
                42 [(module) = "framework", (module) = "statsdtest"];
        IsolatedUidChanged isolated_uid_changed =
                43 [(module) = "framework", (module) = "statsd", (module) = "statsdtest"];
        PacketWakeupOccurred packet_wakeup_occurred = 44 [(module) = "framework"];
        WallClockTimeShifted wall_clock_time_shifted = 45 [(module) = "framework"];
        AnomalyDetected anomaly_detected = 46 [(module) = "statsd"];
        AppBreadcrumbReported app_breadcrumb_reported = 47 [(module) = "statsd"];
        AppStartOccurred app_start_occurred = 48 [(module) = "framework", (module) = "statsdtest"];
        AppStartCanceled app_start_canceled = 49 [(module) = "framework"];
        AppStartFullyDrawn app_start_fully_drawn = 50 [(module) = "framework"];
        LmkKillOccurred lmk_kill_occurred = 51 [(module) = "lmkd"];
        PictureInPictureStateChanged picture_in_picture_state_changed = 52 [(module) = "framework"];
        WifiMulticastLockStateChanged wifi_multicast_lock_state_changed = 53 [(module) = "wifi"];
        LmkStateChanged lmk_state_changed = 54 [(module) = "lmkd"];
        AppStartMemoryStateCaptured app_start_memory_state_captured = 55 [(module) = "framework"];
        ShutdownSequenceReported shutdown_sequence_reported = 56 [(module) = "framework"];
        BootSequenceReported boot_sequence_reported = 57;
        DaveyOccurred davey_occurred = 58 [(module) = "statsd"];
        OverlayStateChanged overlay_state_changed =
                59 [(module) = "framework", (module) = "statsdtest"];
        ForegroundServiceStateChanged foreground_service_state_changed
                = 60 [(module) = "framework"];
        CallStateChanged call_state_changed =
                61 [(module) = "telecom", (truncate_timestamp) = true];
        KeyguardStateChanged keyguard_state_changed = 62 [(module) = "sysui"];
        KeyguardBouncerStateChanged keyguard_bouncer_state_changed = 63 [(module) = "sysui"];
        KeyguardBouncerPasswordEntered keyguard_bouncer_password_entered = 64 [(module) = "sysui"];
        AppDied app_died = 65 [(module) = "framework"];
        ResourceConfigurationChanged resource_configuration_changed = 66 [(module) = "framework"];
        BluetoothEnabledStateChanged bluetooth_enabled_state_changed = 67 [(module) = "framework"];
        BluetoothConnectionStateChanged bluetooth_connection_state_changed =
                68 [(module) = "bluetooth"];
        GpsSignalQualityChanged gps_signal_quality_changed = 69 [(module) = "framework"];
        UsbConnectorStateChanged usb_connector_state_changed = 70 [(module) = "framework"];
        SpeakerImpedanceReported speaker_impedance_reported = 71;
        HardwareFailed hardware_failed = 72;
        PhysicalDropDetected physical_drop_detected = 73;
        ChargeCyclesReported charge_cycles_reported = 74;
        MobileConnectionStateChanged mobile_connection_state_changed = 75 [(module) = "telephony"];
        MobileRadioTechnologyChanged mobile_radio_technology_changed = 76 [(module) = "telephony"];
        UsbDeviceAttached usb_device_attached = 77 [(module) = "framework"];
        AppCrashOccurred app_crash_occurred = 78 [(module) = "framework", (module) = "statsdtest"];
        ANROccurred anr_occurred = 79 [(module) = "framework"];
        WTFOccurred wtf_occurred = 80 [(module) = "framework"];
        LowMemReported low_mem_reported = 81 [(module) = "framework"];
        GenericAtom generic_atom = 82;
        KeyValuePairsAtom key_value_pairs_atom = 83 [(module) = "framework", (module) = "statsd"];
        VibratorStateChanged vibrator_state_changed = 84 [(module) = "framework"];
        DeferredJobStatsReported deferred_job_stats_reported = 85 [(module) = "framework"];
        ThermalThrottlingStateChanged thermal_throttling = 86 [deprecated=true];
        BiometricAcquired biometric_acquired = 87 [(module) = "framework"];
        BiometricAuthenticated biometric_authenticated = 88 [(module) = "framework"];
        BiometricErrorOccurred biometric_error_occurred = 89 [(module) = "framework"];
        UiEventReported ui_event_reported = 90 [(module) = "framework", (module) = "sysui"];
        BatteryHealthSnapshot battery_health_snapshot = 91;
        SlowIo slow_io = 92;
        BatteryCausedShutdown battery_caused_shutdown = 93;
        PhoneServiceStateChanged phone_service_state_changed = 94 [(module) = "framework"];
        PhoneStateChanged phone_state_changed = 95 [(module) = "framework"];
        UserRestrictionChanged user_restriction_changed = 96;
        SettingsUIChanged settings_ui_changed = 97 [(module) = "settings"];
        ConnectivityStateChanged connectivity_state_changed = 98 [(module) = "framework"];
        // TODO: service state change is very noisy shortly after boot, as well
        // as at other transitions - coming out of doze, device plugged in, etc.
        // Consider removing this if it becomes a problem
        ServiceStateChanged service_state_changed = 99 [(module) = "framework"];
        ServiceLaunchReported service_launch_reported = 100 [(module) = "framework"];
        FlagFlipUpdateOccurred flag_flip_update_occurred = 101 [(module) = "framework"];
        BinaryPushStateChanged binary_push_state_changed = 102 [(module) = "statsd"];
        DevicePolicyEvent device_policy_event = 103 [(module) = "framework"];
        DocsUIFileOperationCanceledReported docs_ui_file_op_canceled = 104 [(module) = "docsui"];
        DocsUIFileOperationCopyMoveModeReported docs_ui_file_op_copy_move_mode_reported =
            105 [(module) = "docsui"];
        DocsUIFileOperationFailureReported docs_ui_file_op_failure = 106 [(module) = "docsui"];
        DocsUIFileOperationReported docs_ui_provider_file_op = 107 [(module) = "docsui"];
        DocsUIInvalidScopedAccessRequestReported docs_ui_invalid_scoped_access_request =
            108 [(module) = "docsui"];
        DocsUILaunchReported docs_ui_launch_reported = 109 [(module) = "docsui"];
        DocsUIRootVisitedReported docs_ui_root_visited = 110 [(module) = "docsui"];
        DocsUIStartupMsReported docs_ui_startup_ms = 111 [(module) = "docsui"];
        DocsUIUserActionReported docs_ui_user_action_reported = 112 [(module) = "docsui"];
        WifiEnabledStateChanged wifi_enabled_state_changed = 113 [(module) = "framework"];
        WifiRunningStateChanged wifi_running_state_changed = 114
                [(module) = "framework", deprecated = true];
        AppCompacted app_compacted = 115 [(module) = "framework"];
        NetworkDnsEventReported network_dns_event_reported = 116 [(module) = "resolv"];
        DocsUIPickerLaunchedFromReported docs_ui_picker_launched_from_reported =
            117 [(module) = "docsui"];
        DocsUIPickResultReported docs_ui_pick_result_reported = 118 [(module) = "docsui"];
        DocsUISearchModeReported docs_ui_search_mode_reported = 119 [(module) = "docsui"];
        DocsUISearchTypeReported docs_ui_search_type_reported = 120 [(module) = "docsui"];
        DataStallEvent data_stall_event = 121 [(module) = "network_stack"];
        RescuePartyResetReported rescue_party_reset_reported = 122 [(module) = "framework"];
        SignedConfigReported signed_config_reported = 123 [(module) = "framework"];
        GnssNiEventReported gnss_ni_event_reported = 124 [(module) = "framework"];
        BluetoothLinkLayerConnectionEvent bluetooth_link_layer_connection_event =
                125 [(module) = "bluetooth"];
        BluetoothAclConnectionStateChanged bluetooth_acl_connection_state_changed =
                126 [(module) = "bluetooth"];
        BluetoothScoConnectionStateChanged bluetooth_sco_connection_state_changed =
                127 [(module) = "bluetooth"];
        AppDowngraded app_downgraded = 128 [(module) = "framework"];
        AppOptimizedAfterDowngraded app_optimized_after_downgraded = 129;
        LowStorageStateChanged low_storage_state_changed = 130 [(module) = "framework"];
        GnssNfwNotificationReported gnss_nfw_notification_reported = 131 [(module) = "framework"];
        GnssConfigurationReported gnss_configuration_reported = 132 [(module) = "framework"];
        UsbPortOverheatEvent usb_port_overheat_event_reported = 133;
        NfcErrorOccurred nfc_error_occurred = 134 [(module) = "nfc"];
        NfcStateChanged nfc_state_changed = 135 [(module) = "nfc"];
        NfcBeamOccurred nfc_beam_occurred = 136 [(module) = "nfc"];
        NfcCardemulationOccurred nfc_cardemulation_occurred = 137 [(module) = "nfc"];
        NfcTagOccurred nfc_tag_occurred = 138 [(module) = "nfc"];
        NfcHceTransactionOccurred nfc_hce_transaction_occurred = 139 [(module) = "nfc"];
        SeStateChanged se_state_changed = 140 [(module) = "secure_element"];
        SeOmapiReported se_omapi_reported = 141 [(module) = "secure_element"];
        BroadcastDispatchLatencyReported broadcast_dispatch_latency_reported =
                142 [(module) = "framework"];
        AttentionManagerServiceResultReported attention_manager_service_result_reported =
                143 [(module) = "framework"];
        AdbConnectionChanged adb_connection_changed = 144 [(module) = "framework"];
        SpeechDspStatReported speech_dsp_stat_reported = 145;
        UsbContaminantReported usb_contaminant_reported = 146 [(module) = "framework"];
        WatchdogRollbackOccurred watchdog_rollback_occurred =
                147 [(module) = "framework", (module) = "statsd"];
        BiometricSystemHealthIssueDetected biometric_system_health_issue_detected =
                148 [(module) = "framework"];
        BubbleUIChanged bubble_ui_changed = 149 [(module) = "sysui"];
        ScheduledJobConstraintChanged scheduled_job_constraint_changed =
                150 [(module) = "framework"];
        BluetoothActiveDeviceChanged bluetooth_active_device_changed =
                151 [(module) = "bluetooth"];
        BluetoothA2dpPlaybackStateChanged bluetooth_a2dp_playback_state_changed =
                152 [(module) = "bluetooth"];
        BluetoothA2dpCodecConfigChanged bluetooth_a2dp_codec_config_changed =
                153 [(module) = "bluetooth"];
        BluetoothA2dpCodecCapabilityChanged bluetooth_a2dp_codec_capability_changed =
                154 [(module) = "bluetooth"];
        BluetoothA2dpAudioUnderrunReported bluetooth_a2dp_audio_underrun_reported =
                155 [(module) = "bluetooth"];
        BluetoothA2dpAudioOverrunReported bluetooth_a2dp_audio_overrun_reported =
                156 [(module) = "bluetooth"];
        BluetoothDeviceRssiReported bluetooth_device_rssi_reported =
                157 [(module) = "bluetooth"];
        BluetoothDeviceFailedContactCounterReported
                bluetooth_device_failed_contact_counter_reported = 158 [(module) = "bluetooth"];
        BluetoothDeviceTxPowerLevelReported bluetooth_device_tx_power_level_reported =
                159 [(module) = "bluetooth"];
        BluetoothHciTimeoutReported bluetooth_hci_timeout_reported =
                160 [(module) = "bluetooth"];
        BluetoothQualityReportReported bluetooth_quality_report_reported =
                161 [(module) = "bluetooth"];
        BluetoothDeviceInfoReported bluetooth_device_info_reported =
                162 [(module) = "bluetooth"];
        BluetoothRemoteVersionInfoReported bluetooth_remote_version_info_reported =
                163 [(module) = "bluetooth"];
        BluetoothSdpAttributeReported bluetooth_sdp_attribute_reported =
                164 [(module) = "bluetooth"];
        BluetoothBondStateChanged bluetooth_bond_state_changed =
                165 [(module) = "bluetooth"];
        BluetoothClassicPairingEventReported bluetooth_classic_pairing_event_reported =
                166 [(module) = "bluetooth"];
        BluetoothSmpPairingEventReported bluetooth_smp_pairing_event_reported =
                167 [(module) = "bluetooth"];
        ScreenTimeoutExtensionReported screen_timeout_extension_reported =
                168 [(module) = "framework"];
        ProcessStartTime process_start_time = 169 [(module) = "framework"];
        PermissionGrantRequestResultReported permission_grant_request_result_reported =
                170 [(module) = "permissioncontroller"];
        BluetoothSocketConnectionStateChanged bluetooth_socket_connection_state_changed = 171;
        DeviceIdentifierAccessDenied device_identifier_access_denied =
                172 [(module) = "telephony_common"];
        BubbleDeveloperErrorReported bubble_developer_error_reported = 173 [(module) = "framework"];
        AssistGestureStageReported assist_gesture_stage_reported = 174 [(module) = "sysui"];
        AssistGestureFeedbackReported assist_gesture_feedback_reported = 175 [(module) = "sysui"];
        AssistGestureProgressReported assist_gesture_progress_reported = 176 [(module) = "sysui"];
        TouchGestureClassified touch_gesture_classified = 177 [(module) = "framework"];
        HiddenApiUsed hidden_api_used = 178 [(module) = "framework"];
        StyleUIChanged style_ui_changed = 179 [(module) = "sysui"];
        PrivacyIndicatorsInteracted privacy_indicators_interacted =
                180 [(module) = "permissioncontroller"];
        AppInstallOnExternalStorageReported app_install_on_external_storage_reported =
                181 [(module) = "framework"];
        NetworkStackReported network_stack_reported = 182 [(module) = "network_stack"];
        AppMovedStorageReported app_moved_storage_reported = 183 [(module) = "framework"];
        BiometricEnrolled biometric_enrolled = 184 [(module) = "framework"];
        SystemServerWatchdogOccurred system_server_watchdog_occurred = 185 [(module) = "framework"];
        TombStoneOccurred tomb_stone_occurred = 186 [(module) = "framework"];
        BluetoothClassOfDeviceReported bluetooth_class_of_device_reported =
                187 [(module) = "bluetooth"];
        IntelligenceEventReported intelligence_event_reported =
                188 [(module) = "intelligence"];
        ThermalThrottlingSeverityStateChanged thermal_throttling_severity_state_changed =
                189 [(module) = "framework"];
        RoleRequestResultReported role_request_result_reported =
                190 [(module) = "permissioncontroller"];
        MediametricsAudiopolicyReported mediametrics_audiopolicy_reported = 191;
        MediametricsAudiorecordReported mediametrics_audiorecord_reported = 192;
        MediametricsAudiothreadReported mediametrics_audiothread_reported = 193;
        MediametricsAudiotrackReported mediametrics_audiotrack_reported = 194;
        MediametricsCodecReported mediametrics_codec_reported = 195;
        MediametricsDrmWidevineReported mediametrics_drm_widevine_reported = 196;
        MediametricsExtractorReported mediametrics_extractor_reported = 197;
        MediametricsMediadrmReported mediametrics_mediadrm_reported = 198;
        MediametricsNuPlayerReported mediametrics_nuplayer_reported = 199;
        MediametricsRecorderReported mediametrics_recorder_reported = 200;
        MediametricsDrmManagerReported mediametrics_drmmanager_reported = 201;
        CarPowerStateChanged car_power_state_changed = 203 [(module) = "car"];
        GarageModeInfo garage_mode_info = 204 [(module) = "car"];
        TestAtomReported test_atom_reported = 205 [(module) = "cts"];
        ContentCaptureCallerMismatchReported content_capture_caller_mismatch_reported =
                206 [(module) = "framework"];
        ContentCaptureServiceEvents content_capture_service_events = 207 [(module) = "framework"];
        ContentCaptureSessionEvents content_capture_session_events = 208 [(module) = "framework"];
        ContentCaptureFlushed content_capture_flushed = 209 [(module) = "framework"];
        LocationManagerApiUsageReported location_manager_api_usage_reported =
                210 [(module) = "framework"];
        ReviewPermissionsFragmentResultReported review_permissions_fragment_result_reported =
                211 [(module) = "permissioncontroller"];
        RuntimePermissionsUpgradeResult runtime_permissions_upgrade_result =
                212 [(module) = "permissioncontroller"];
        GrantPermissionsActivityButtonActions grant_permissions_activity_button_actions =
                213 [(module) = "permissioncontroller"];
        LocationAccessCheckNotificationAction location_access_check_notification_action =
                214 [(module) = "permissioncontroller"];
        AppPermissionFragmentActionReported app_permission_fragment_action_reported =
                215 [(module) = "permissioncontroller"];
        AppPermissionFragmentViewed app_permission_fragment_viewed =
                216 [(module) = "permissioncontroller"];
        AppPermissionsFragmentViewed app_permissions_fragment_viewed =
                217 [(module) = "permissioncontroller"];
        PermissionAppsFragmentViewed permission_apps_fragment_viewed =
                218  [(module) = "permissioncontroller"];
        TextSelectionEvent text_selection_event = 219  [(module) = "textclassifier"];
        TextLinkifyEvent text_linkify_event = 220  [(module) = "textclassifier"];
        ConversationActionsEvent conversation_actions_event = 221  [(module) = "textclassifier"];
        LanguageDetectionEvent language_detection_event = 222  [(module) = "textclassifier"];
        ExclusionRectStateChanged exclusion_rect_state_changed = 223 [(module) = "framework"];
        BackGesture back_gesture_reported_reported = 224 [(module) = "sysui"];
        UpdateEngineUpdateAttemptReported update_engine_update_attempt_reported = 225;
        UpdateEngineSuccessfulUpdateReported update_engine_successful_update_reported = 226;
        CameraActionEvent camera_action_event = 227 [(module) = "framework"];
        AppCompatibilityChangeReported app_compatibility_change_reported =
                228 [(module) = "framework"];
        PerfettoUploaded perfetto_uploaded = 229 [(module) = "perfetto"];
        VmsClientConnectionStateChanged vms_client_connection_state_changed =
                230 [(module) = "car"];
        MediaProviderScanOccurred media_provider_scan_occurred = 233 [(module) = "mediaprovider"];
        MediaContentDeleted media_content_deleted = 234 [(module) = "mediaprovider"];
        MediaProviderPermissionRequested media_provider_permission_requested =
            235 [(module) = "mediaprovider"];
        MediaProviderSchemaChanged media_provider_schema_changed = 236 [(module) = "mediaprovider"];
        MediaProviderIdleMaintenanceFinished media_provider_idle_maintenance_finished =
            237 [(module) = "mediaprovider"];
        RebootEscrowRecoveryReported reboot_escrow_recovery_reported = 238 [(module) = "framework"];
        BootTimeEventDuration boot_time_event_duration_reported = 239 [(module) = "framework"];
        BootTimeEventElapsedTime boot_time_event_elapsed_time_reported =
                240 [(module) = "framework"];
        BootTimeEventUtcTime boot_time_event_utc_time_reported = 241;
        BootTimeEventErrorCode boot_time_event_error_code_reported = 242 [(module) = "framework"];
        UserspaceRebootReported userspace_reboot_reported = 243 [(module) = "framework"];
        NotificationReported notification_reported = 244 [(module) = "framework"];
        NotificationPanelReported notification_panel_reported = 245 [(module) = "sysui"];
        NotificationChannelModified notification_channel_modified = 246 [(module) = "framework"];
        IntegrityCheckResultReported integrity_check_result_reported = 247 [(module) = "framework"];
        IntegrityRulesPushed integrity_rules_pushed = 248 [(module) = "framework"];
        CellBroadcastMessageReported cb_message_reported =
            249 [(module) = "cellbroadcast"];
        CellBroadcastMessageError cb_message_error =
            250 [(module) = "cellbroadcast"];
        WifiHealthStatReported wifi_health_stat_reported = 251 [(module) = "wifi"];
        WifiFailureStatReported wifi_failure_stat_reported = 252 [(module) = "wifi"];
        WifiConnectionResultReported wifi_connection_result_reported = 253 [(module) = "wifi"];
        AppFreezeChanged app_freeze_changed = 254 [(module) = "framework"];
        SnapshotMergeReported snapshot_merge_reported = 255;
        ForegroundServiceAppOpSessionEnded foreground_service_app_op_session_ended =
            256  [(module) = "framework"];
        DisplayJankReported display_jank_reported = 257;
        AppStandbyBucketChanged app_standby_bucket_changed = 258 [(module) = "framework"];
        SharesheetStarted sharesheet_started = 259 [(module) = "framework"];
        RankingSelected ranking_selected = 260 [(module) = "framework", (module) = "sysui"];
        TvSettingsUIInteracted tvsettings_ui_interacted = 261 [(module) = "tv_settings"];
        LauncherStaticLayout launcher_snapshot = 262 [(module) = "sysui"];
        PackageInstallerV2Reported package_installer_v2_reported = 263 [(module) = "framework"];
        UserLifecycleJourneyReported user_lifecycle_journey_reported = 264 [(module) = "framework"];
        UserLifecycleEventOccurred user_lifecycle_event_occurred = 265 [(module) = "framework"];
        AccessibilityShortcutReported accessibility_shortcut_reported =
            266 [(module) = "framework"];
        AccessibilityServiceReported accessibility_service_reported = 267 [(module) = "settings"];
        DocsUIDragAndDropReported docs_ui_drag_and_drop_reported = 268 [(module) = "docsui"];
        AppUsageEventOccurred app_usage_event_occurred = 269 [(module) = "framework"];
        AutoRevokeNotificationClicked auto_revoke_notification_clicked =
            270 [(module) = "permissioncontroller"];
        AutoRevokeFragmentAppViewed auto_revoke_fragment_app_viewed =
            271 [(module) = "permissioncontroller"];
        AutoRevokedAppInteraction auto_revoked_app_interaction =
            272 [(module) = "permissioncontroller", (module) = "settings"];
        AppPermissionGroupsFragmentAutoRevokeAction
            app_permission_groups_fragment_auto_revoke_action =
            273 [(module) = "permissioncontroller"];
        EvsUsageStatsReported evs_usage_stats_reported = 274 [(module) = "evs"];
        AudioPowerUsageDataReported audio_power_usage_data_reported = 275;
        TvTunerStateChanged tv_tuner_state_changed = 276 [(module) = "framework"];
        MediaOutputOpSwitchReported mediaoutput_op_switch_reported =
            277 [(module) = "settings"];
        CellBroadcastMessageFiltered cb_message_filtered =
            278 [(module) = "cellbroadcast"];
        TvTunerDvrStatus tv_tuner_dvr_status = 279 [(module) = "framework"];
        TvCasSessionOpenStatus tv_cas_session_open_status =
            280 [(module) = "framework"];
        AssistantInvocationReported assistant_invocation_reported = 281 [(module) = "framework"];
        DisplayWakeReported display_wake_reported = 282 [(module) = "framework"];
        CarUserHalModifyUserRequestReported car_user_hal_modify_user_request_reported =
            283 [(module) = "car"];
        CarUserHalModifyUserResponseReported car_user_hal_modify_user_response_reported =
            284 [(module) = "car"];
        CarUserHalPostSwitchResponseReported car_user_hal_post_switch_response_reported =
            285 [(module) = "car"];
        CarUserHalInitialUserInfoRequestReported car_user_hal_initial_user_info_request_reported =
            286 [(module) = "car"];
        CarUserHalInitialUserInfoResponseReported car_user_hal_initial_user_info_response_reported =
            287 [(module) = "car"];
        CarUserHalUserAssociationRequestReported car_user_hal_user_association_request_reported =
            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"];
        MediametricsAudioRecordDeviceUsageReported mediametrics_audiorecorddeviceusage_reported =
            294;
        MediametricsAudioThreadDeviceUsageReported mediametrics_audiothreaddeviceusage_reported =
            295;
        MediametricsAudioTrackDeviceUsageReported mediametrics_audiotrackdeviceusage_reported =
            296;
        MediametricsAudioDeviceConnectionReported mediametrics_audiodeviceconnection_reported =
            297;
        BlobCommitted blob_committed = 298 [(module) = "framework"];
        BlobLeased blob_leased = 299 [(module) = "framework"];
        BlobOpened blob_opened = 300 [(module) = "framework"];
        ContactsProviderStatusReported contacts_provider_status_reported = 301;
        KeystoreKeyEventReported keystore_key_event_reported = 302;
        NetworkTetheringReported  network_tethering_reported =
            303 [(module) = "network_tethering"];
        ImeTouchReported ime_touch_reported = 304 [(module) = "sysui"];

        // StatsdStats tracks platform atoms with ids upto 500.
        // Update StatsdStats::kMaxPushedAtomId when atom ids here approach that value.
    }

    // Pulled events will start at field 10000.
    // Next: 10084
    oneof pulled {
        WifiBytesTransfer wifi_bytes_transfer = 10000 [(module) = "framework"];
        WifiBytesTransferByFgBg wifi_bytes_transfer_by_fg_bg = 10001 [(module) = "framework"];
        MobileBytesTransfer mobile_bytes_transfer =
                10002 [(module) = "framework", (truncate_timestamp) = true];
        MobileBytesTransferByFgBg mobile_bytes_transfer_by_fg_bg =
                10003 [(module) = "framework", (truncate_timestamp) = true];
        BluetoothBytesTransfer bluetooth_bytes_transfer = 10006 [(module) = "framework"];
        KernelWakelock kernel_wakelock = 10004 [(module) = "framework"];
        SubsystemSleepState subsystem_sleep_state = 10005 [(module) = "statsdtest"];
        CpuTimePerFreq cpu_time_per_freq = 10008 [(module) = "framework"];
        CpuTimePerUid cpu_time_per_uid = 10009 [(module) = "framework", (module) = "statsdtest"];
        CpuTimePerUidFreq cpu_time_per_uid_freq =
                10010 [(module) = "framework", (module) = "statsd"];
        WifiActivityInfo wifi_activity_info = 10011 [(module) = "framework"];
        ModemActivityInfo modem_activity_info = 10012 [(module) = "framework"];
        BluetoothActivityInfo bluetooth_activity_info = 10007 [(module) = "framework"];
        ProcessMemoryState process_memory_state = 10013 [(module) = "framework"];
        SystemElapsedRealtime system_elapsed_realtime = 10014 [(module) = "framework"];
        SystemUptime system_uptime = 10015 [(module) = "framework"];
        CpuActiveTime cpu_active_time = 10016 [(module) = "framework", (module) = "statsdtest"];
        CpuClusterTime cpu_cluster_time = 10017 [(module) = "framework"];
        DiskSpace disk_space = 10018 [deprecated=true, (module) = "statsdtest"];
        RemainingBatteryCapacity remaining_battery_capacity = 10019 [(module) = "framework"];
        FullBatteryCapacity full_battery_capacity = 10020 [(module) = "framework"];
        Temperature temperature = 10021 [(module) = "framework", (module) = "statsdtest"];
        BinderCalls binder_calls = 10022 [(module) = "framework", (module) = "statsd"];
        BinderCallsExceptions binder_calls_exceptions = 10023 [(module) = "framework"];
        LooperStats looper_stats = 10024 [(module) = "framework", (module) = "statsd"];
        DiskStats disk_stats = 10025 [(module) = "framework"];
        DirectoryUsage directory_usage = 10026 [(module) = "framework"];
        AppSize app_size = 10027 [(module) = "framework"];
        CategorySize category_size = 10028 [(module) = "framework"];
        ProcStats proc_stats = 10029 [(module) = "framework"];
        BatteryVoltage battery_voltage = 10030 [(module) = "framework"];
        NumFingerprintsEnrolled num_fingerprints_enrolled = 10031 [(module) = "framework"];
        DiskIo disk_io = 10032 [(module) = "framework"];
        PowerProfile power_profile = 10033 [(module) = "framework"];
        ProcStatsPkgProc proc_stats_pkg_proc = 10034 [(module) = "framework"];
        ProcessCpuTime process_cpu_time = 10035 [(module) = "framework"];
        CpuTimePerThreadFreq cpu_time_per_thread_freq = 10037 [(module) = "framework"];
        OnDevicePowerMeasurement on_device_power_measurement = 10038;
        DeviceCalculatedPowerUse device_calculated_power_use = 10039 [(module) = "framework"];
        DeviceCalculatedPowerBlameUid device_calculated_power_blame_uid =
                10040 [(module) = "framework"];
        DeviceCalculatedPowerBlameOther device_calculated_power_blame_other =
                10041 [(module) = "framework"];
        ProcessMemoryHighWaterMark process_memory_high_water_mark = 10042 [(module) = "framework"];
        BatteryLevel battery_level = 10043 [(module) = "framework"];
        BuildInformation build_information = 10044 [(module) = "framework"];
        BatteryCycleCount battery_cycle_count = 10045 [(module) = "framework"];
        DebugElapsedClock debug_elapsed_clock = 10046 [(module) = "framework"];
        DebugFailingElapsedClock debug_failing_elapsed_clock = 10047 [(module) = "framework"];
        NumFacesEnrolled num_faces_enrolled = 10048 [(module) = "framework"];
        RoleHolder role_holder = 10049 [(module) = "framework"];
        DangerousPermissionState dangerous_permission_state = 10050 [(module) = "framework"];
        TrainInfo train_info = 10051 [(module) = "statsd"];
        TimeZoneDataInfo time_zone_data_info = 10052 [(module) = "framework"];
        ExternalStorageInfo external_storage_info = 10053 [(module) = "framework"];
        GpuStatsGlobalInfo gpu_stats_global_info = 10054;
        GpuStatsAppInfo gpu_stats_app_info = 10055;
        SystemIonHeapSize system_ion_heap_size = 10056 [deprecated = true, (module) = "framework"];
        AppsOnExternalStorageInfo apps_on_external_storage_info = 10057 [(module) = "framework"];
        FaceSettings face_settings = 10058 [(module) = "framework"];
        CoolingDevice cooling_device = 10059 [(module) = "framework"];
        AppOps app_ops = 10060 [(module) = "framework"];
        ProcessSystemIonHeapSize process_system_ion_heap_size = 10061 [(module) = "framework"];
        SurfaceflingerStatsGlobalInfo surfaceflinger_stats_global_info = 10062;
        SurfaceflingerStatsLayerInfo surfaceflinger_stats_layer_info = 10063;
        ProcessMemorySnapshot process_memory_snapshot = 10064 [(module) = "framework"];
        VmsClientStats vms_client_stats = 10065 [(module) = "car"];
        NotificationRemoteViews notification_remote_views = 10066 [(module) = "framework"];
        DangerousPermissionStateSampled dangerous_permission_state_sampled =
                10067 [(module) = "framework"];
        GraphicsStats graphics_stats = 10068;
        RuntimeAppOpAccess runtime_app_op_access = 10069 [(module) = "framework"];
        IonHeapSize ion_heap_size = 10070 [(module) = "framework"];
        PackageNotificationPreferences package_notification_preferences =
                10071 [(module) = "framework"];
        PackageNotificationChannelPreferences package_notification_channel_preferences =
                10072 [(module) = "framework"];
        PackageNotificationChannelGroupPreferences package_notification_channel_group_preferences =
                10073 [(module) = "framework"];
        GnssStats gnss_stats = 10074 [(module) = "framework"];
        AttributedAppOps attributed_app_ops = 10075 [(module) = "framework"];
        VoiceCallSession voice_call_session = 10076 [(module) = "telephony"];
        VoiceCallRatUsage voice_call_rat_usage = 10077 [(module) = "telephony"];
        SimSlotState sim_slot_state = 10078 [(module) = "telephony"];
        SupportedRadioAccessFamily supported_radio_access_family = 10079 [(module) = "telephony"];
        SettingSnapshot setting_snapshot = 10080 [(module) = "framework"];
        BlobInfo blob_info = 10081 [(module) = "framework"];
        DataUsageBytesTransfer data_usage_bytes_transfer = 10082 [(module) = "framework"];
        BytesTransferByTagAndMetered bytes_transfer_by_tag_and_metered =
                10083 [(module) = "framework"];
        DNDModeProto dnd_mode_rule = 10084 [(module) = "framework"];
        GeneralExternalStorageAccessStats general_external_storage_access_stats =
            10085 [(module) = "mediaprovider"];
    }

    // DO NOT USE field numbers above 100,000 in AOSP.
    // Field numbers 100,000 - 199,999 are reserved for non-AOSP (e.g. OEMs) to use.
    // Field numbers 200,000 and above are reserved for future use; do not use them at all.

    reserved 10036;
}

/**
 * This proto represents a node of an attribution chain.
 * Note: All attribution chains are represented as a repeated field of type
 * AttributionNode. It is understood that in such arrays, the order is that
 * of calls, that is [A, B, C] if A calls B that calls C.
 */
message AttributionNode {
    // The uid for a given element in the attribution chain.
    optional int32 uid = 1;

    // The (optional) string tag for an element in the attribution chain. If the
    // element has no tag, it is encoded as an empty string.
    optional string tag = 2;
}

message KeyValuePair {
    optional int32 key = 1;
    oneof value {
        int32 value_int = 2;
        int64 value_long = 3;
        string value_str = 4;
        float value_float = 5;
    }
}

message KeyValuePairsAtom {
    optional int32 uid = 1;
    repeated KeyValuePair pairs = 2;
}

/*
 * *****************************************************************************
 * Below are all of the individual atoms that are logged by Android via statsd.
 *
 * RULES:
 *   - The field ids for each atom must start at 1, and count upwards by 1.
 *     Skipping field ids is not allowed.
 *   - These form an API, so renaming, renumbering or removing fields is
 *     not allowed between android releases.  (This is not currently enforced,
 *     but there will be a tool to enforce this restriction).
 *   - The types must be built-in protocol buffer types, namely, no sub-messages
 *     are allowed (yet).  The bytes type is also not allowed.
 *   - The CamelCase name of the message type should match the
 *     underscore_separated name as defined in Atom.
 *   - If an atom represents work that can be attributed to an app, there can
 *     be exactly one AttributionChain field. It must be field number 1.
 *   - A field that is a uid should be a string field, tagged with the [xxx]
 *     annotation. The generated code on android will be represented by UIDs,
 *     and those UIDs will be translated in xxx to those strings.
 *
 * CONVENTIONS:
 *   - Events are past tense. e.g. ScreenStateChanged, not ScreenStateChange.
 *   - If there is a UID, it goes first. Think in an object-oriented fashion.
 * *****************************************************************************
 */

/**
 * This atom is deprecated starting in Q. Please use ThermalThrottlingSeverityStateChanged.
 * Logs when the Thermal service HAL notifies the throttling start/stop events.
 *
 * Logged from:
 *   frameworks/base/services/core/java/com/android/server/stats/StatsCompanionService.java
 */
message ThermalThrottlingStateChanged {
    // The type of temperature being reported (CPU, GPU, SKIN, etc)
    optional android.os.TemperatureTypeEnum sensor_type = 1;

    // Throttling state, this field is DEPRECATED
    enum State {
        UNKNOWN = 0;
        START = 1; // START indicated that throttling was triggered.
        STOP = 2; // STOP indicates that throttling was cleared.
    }
    optional State state = 2;

    optional float temperature = 3;
}

/**
 * Logs when the screen state changes.
 *
 * Logged from:
 *   frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
 */
message ScreenStateChanged {
    // New screen state, from frameworks/base/core/proto/android/view/enums.proto.
    optional android.view.DisplayStateEnum state = 1
            [(state_field_option).exclusive_state = true, (state_field_option).nested = false];
}

/**
 * Logs that the process state of the uid, as determined by ActivityManager
 * (i.e. the highest process state of that uid's processes) has changed.
 *
 * Logged from:
 *   frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
 */
message UidProcessStateChanged {
    optional int32 uid = 1 [(state_field_option).primary_field = true, (is_uid) = true];

    // The state, from frameworks/base/core/proto/android/app/enums.proto.
    optional android.app.ProcessStateEnum state = 2
            [(state_field_option).exclusive_state = true, (state_field_option).nested = false];
}

/**
 * Logs process state change of a process, as per the activity manager.
 *
 * Logged from:
 *   frameworks/base/services/core/java/com/android/server/am/ProcessRecord.java
 */
message ProcessStateChanged {
    optional int32 uid = 1;
    optional string process_name = 2;
    optional string package_name = 3;
    // TODO: remove this when validation is done
    optional int64 version = 5;
    // The state, from frameworks/base/core/proto/android/app/enums.proto.
    optional android.app.ProcessStateEnum state = 4;
}

/**
 * Logs when ActivityManagerService sleep state is changed.
 *
 * Logged from:
 *   frameworks/base/services/core/java/com/android/server/am/ActivityTaskManagerService.java
 */
message ActivityManagerSleepStateChanged {
    // TODO: import frameworks proto
    enum State {
        UNKNOWN = 0;
        ASLEEP = 1;
        AWAKE = 2;
    }
    optional State state = 1
            [(state_field_option).exclusive_state = true, (state_field_option).nested = false];
}

/**
 * Logs when system memory state changes.
 *
 * Logged from:
 *   frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
 */
message MemoryFactorStateChanged {
    // TODO: import frameworks proto
    enum State {
        MEMORY_UNKNOWN = 0;
        NORMAL = 1;     // normal.
        MODERATE = 2;   // moderate memory pressure.
        LOW = 3;        // low memory.
        CRITICAL = 4;   // critical memory.

    }
    optional State factor = 1 [(state_field_option).exclusive_state = true];
}

/**
 * Logs when app is using too much cpu, according to ActivityManagerService.
 *
 * Logged from:
 *   frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
 */
message ExcessiveCpuUsageReported {
    optional int32 uid = 1;
    optional string process_name = 2;
    optional string package_name = 3;
    // package version. TODO: remove this when validation is done
    optional int64 version = 4;
}

/**
 * Logs when a cached process is killed, along with its pss.
 *
 * Logged from:
 *   frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
 */
message CachedKillReported {
    optional int32 uid = 1;
    optional string process_name = 2;
    optional string package_name = 3;
    // TODO: remove this when validation is done
    optional int64 version = 5;
    optional int64 pss = 4;
}

/**
 * Logs the change in wifi health.
 *
 * Logged from:
 *   frameworks/opt/net/wifi/service/java/com/android/server/wifi/WifiDataStall.java
 */
message WifiHealthStatReported {
    enum Band {
        UNKNOWN = 0;
        // All of 2.4GHz band
        BAND_2G = 1;
        // Frequencies in the range of [5150, 5250) GHz
        BAND_5G_LOW = 2;
        // Frequencies in the range of [5250, 5725) GHz
        BAND_5G_MIDDLE = 3;
        // Frequencies in the range of [5725, 5850) GHz
        BAND_5G_HIGH = 4;
        // Frequencies in the range of [5925, 6425) GHz
        BAND_6G_LOW = 5;
        // Frequencies in the range of [6425, 6875) GHz
        BAND_6G_MIDDLE = 6;
        // Frequencies in the range of [6875, 7125) GHz
        BAND_6G_HIGH = 7;
    }
    // duration this stat is obtained over in milliseconds
    optional int32 duration_millis = 1;
    // whether wifi is classified as sufficient for the user's data traffic, determined
    // by whether the calculated throughput exceeds the average demand within |duration_millis|
    optional bool is_sufficient = 2;
    // whether cellular data is available
    optional bool is_cell_data_available = 3;
    // the Band bucket the connected network is on
    optional Band band = 4;
}

/**
 * Logged when wifi detects a significant change in connection failure rate.
 *
 * Logged from: frameworks/opt/net/wifi/service/java/com/android/server/wifi/WifiHealthMonitor.java
 *
 */
message WifiFailureStatReported {
    enum AbnormalityType {
        UNKNOWN = 0;
        SIGNIFICANT_INCREASE = 1;
        SIGNIFICANT_DECREASE = 2;
        SIMPLY_HIGH = 3;
    }
    enum FailureType {
        FAILURE_UNKNOWN = 0;
        FAILURE_CONNECTION = 1;
        FAILURE_ASSOCIATION_REJECTION = 2;
        FAILURE_ASSOCIATION_TIMEOUT = 3;
        FAILURE_AUTHENTICATION = 4;
        FAILURE_NON_LOCAL_DISCONNECTION = 5;
        FAILURE_SHORT_CONNECTION_DUE_TO_NON_LOCAL_DISCONNECTION = 6;
    }
    // Reason for uploading this stat
    optional AbnormalityType abnormality_type = 1;
    // The particular type of failure
    optional FailureType failure_type = 2;
    // How many times we have encountered this combination of AbnormalityType and FailureType
    optional int32 failure_count = 3;
}

/**
 * Logs whether a wifi connection is successful and reasons for failure if it isn't.
 *
 * Logged from:
 *   frameworks/opt/net/wifi/service/java/com/android/server/wifi/ClientModeImpl.java
 */
message WifiConnectionResultReported {
    enum FailureCode {
        FAILURE_UNKNOWN = 0;
        FAILURE_ASSOCIATION_TIMEOUT = 1;
        FAILURE_ASSOCIATION_REJECTION = 2;
        FAILURE_AUTHENTICATION_GENERAL = 3;
        FAILURE_AUTHENTICATION_EAP = 4;
        FAILURE_DHCP = 5;
        FAILURE_NETWORK_DISCONNECTION = 6;
        FAILURE_ROAM_TIMEOUT = 7;
    }
    // true represents a successful connection
    optional bool connection_result = 1;
    // reason for the connection failure
    optional FailureCode failure_code = 2;
    // scan rssi before the connection attempt
    optional int32 rssi = 3;
}

/**
 * Logs when memory stats of a process is reported.
 *
 * Logged from:
 *   frameworks/base/services/core/java/com/android/server/am/ProcessRecord.java
 */
message ProcessMemoryStatReported {
    optional int32 uid = 1;
    optional string process_name = 2;
    optional string package_name = 3;
    //TODO: remove this when validation is done
    optional int64 version = 9;
    optional int64 pss = 4;
    optional int64 uss = 5;
    optional int64 rss = 6;
    enum Type {
        ADD_PSS_INTERNAL_SINGLE = 0;
        ADD_PSS_INTERNAL_ALL_MEM = 1;
        ADD_PSS_INTERNAL_ALL_POLL = 2;
        ADD_PSS_EXTERNAL = 3;
        ADD_PSS_EXTERNAL_SLOW = 4;
    }
    optional Type type = 7;
    optional int64 duration_millis = 8;
}

/**
 * Logs that a process started, finished, crashed, or ANRed.
 *
 * Logged from:
 *   frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
 */
message ProcessLifeCycleStateChanged {
    optional int32 uid = 1 [(is_uid) = true];

    // The process name (usually same as the app name).
    optional string process_name = 2;

    // What lifecycle state the process changed to.
    // This enum is specific to atoms.proto.
    enum State {
        FINISHED = 0;
        STARTED = 1;
        CRASHED = 2;
    }
    optional State state = 3;
}

/**
 * Logs when the ble scan state changes.
 *
 * Logged from:
 *   packages/apps/Bluetooth/src/com/android/bluetooth/gatt/AppScanStats.java
 */
message BleScanStateChanged {
    repeated AttributionNode attribution_node = 1
            [(state_field_option).primary_field_first_uid = true];

    enum State {
        OFF = 0;
        ON = 1;
        // RESET indicates all ble stopped. Used when it (re)starts (e.g. after it crashes).
        RESET = 2;
    }
    optional State state = 2 [
        (state_field_option).exclusive_state = true,
        (state_field_option).default_state_value = 0 /* State.OFF */,
        (state_field_option).trigger_state_reset_value = 2 /* State.RESET */,
        (state_field_option).nested = true
    ];

    // Does the scan have a filter.
    optional bool is_filtered = 3 [(state_field_option).primary_field = true];
    // Whether the scan is a CALLBACK_TYPE_FIRST_MATCH scan. Called 'background' scan internally.
    optional bool is_first_match = 4 [(state_field_option).primary_field = true];
    // Whether the scan set to piggy-back off the results of other scans (SCAN_MODE_OPPORTUNISTIC).
    optional bool is_opportunistic = 5 [(state_field_option).primary_field = true];
}

/**
 * Logs reporting of a ble scan finding results.
 *
 * Logged from:
 *   packages/apps/Bluetooth/src/com/android/bluetooth/gatt/AppScanStats.java
 */
// TODO: Consider also tracking per-scanner-id.
message BleScanResultReceived {
    repeated AttributionNode attribution_node = 1;

    // Number of ble scan results returned.
    optional int32 num_results = 2;
}

/**
 * Logs when a sensor state changes.
 *
 * Logged from:
 *   frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
 */
message SensorStateChanged {
    repeated AttributionNode attribution_node = 1;

    // The id (int) of the sensor.
    optional int32 sensor_id = 2;

    enum State {
        OFF = 0;
        ON = 1;
    }
    optional State state = 3;
}

/**
 * Logs when GPS state changes.
 *
 * Logged from:
 *   frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
 */
message GpsScanStateChanged {
    repeated AttributionNode attribution_node = 1;

    enum State {
        OFF = 0;
        ON = 1;
    }
    optional State state = 2;
}

/**
 * Logs when GPS signal quality.
 *
 * Logged from:
 *   /frameworks/base/location/java/com/android/internal/location/gnssmetrics/GnssMetrics.java
 */
message GpsSignalQualityChanged {
    optional android.server.location.GpsSignalQualityEnum level = 1;
}


/**
 * Logs when a sync manager sync state changes.
 *
 * Logged from:
 *   frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
 */
message SyncStateChanged {
    repeated AttributionNode attribution_node = 1;

    // Name of the sync (as named in the app). Can be chosen at run-time.
    optional string sync_name = 2;

    enum State {
        OFF = 0;
        ON = 1;
    }
    optional State state = 3;
}

/*
 * Deferred job stats.
 *
 * Logged from:
 *   frameworks/base/services/core/java/com/android/server/job/JobSchedulerService.java
*/
message DeferredJobStatsReported {
    repeated AttributionNode attribution_node = 1;

    // Number of jobs deferred.
    optional int32 num_jobs_deferred = 2;

    // Time since the last job runs.
    optional int64 time_since_last_job_millis = 3;
}

/**
 * Logs when a job scheduler job state changes.
 *
 * Logged from:
 *   frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
 */
message ScheduledJobStateChanged {
    repeated AttributionNode attribution_node = 1;

    // Name of the job (as named in the app)
    optional string job_name = 2;

    enum State {
        FINISHED = 0;
        STARTED = 1;
        SCHEDULED = 2;
    }
    optional State state = 3;

    // The reason a job has stopped.
    // This is only applicable when the state is FINISHED.
    // The default value is STOP_REASON_UNKNOWN.
    optional android.app.job.StopReasonEnum stop_reason = 4;

    // The standby bucket of the app that scheduled the job. These match the framework constants
    // defined in JobSchedulerService.java with the addition of UNKNOWN using -1, as ACTIVE is
    // already assigned 0.
    enum Bucket {
        UNKNOWN = -1;
        ACTIVE = 0;
        WORKING_SET = 1;
        FREQUENT = 2;
        RARE = 3;
        NEVER = 4;
        RESTRICTED = 5;
    }
    optional Bucket standby_bucket = 5 [default = UNKNOWN];

    // The job id (as assigned by the app).
    optional int32 job_id = 6;

    // One flag for each of the API constraints defined by Jobscheduler. Does not include implcit
    // constraints as they are always assumed to be set.
    optional bool has_charging_constraint = 7;
    optional bool has_battery_not_low_constraint = 8;
    optional bool has_storage_not_low_constraint = 9;
    optional bool has_timing_delay_constraint = 10;
    optional bool has_deadline_constraint = 11;
    optional bool has_idle_constraint = 12;
    optional bool has_connectivity_constraint = 13;
    optional bool has_content_trigger_constraint = 14;
}

/**
 * Logs when the audio state changes.
 *
 * Logged from:
 *   frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
 */
message AudioStateChanged {
    repeated AttributionNode attribution_node = 1;

    enum State {
        OFF = 0;
        ON = 1;
        // RESET indicates all audio stopped. Used when it (re)starts (e.g. after it crashes).
        RESET = 2;
    }
    optional State state = 2;
}

/**
 * Logs when the video codec state changes.
 *
 * Logged from:
 *   frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
 */
message MediaCodecStateChanged {
    repeated AttributionNode attribution_node = 1;

    enum State {
        OFF = 0;
        ON = 1;
        // RESET indicates all mediaCodec stopped. Used when it (re)starts (e.g. after it crashes).
        RESET = 2;
    }
    optional State state = 2;
}

/**
 * Logs when the flashlight state changes.
 *
 * Logged from:
 *   frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
 */
message FlashlightStateChanged {
    repeated AttributionNode attribution_node = 1;

    enum State {
        OFF = 0;
        ON = 1;
        // RESET indicates all flashlight stopped. Used when it (re)starts (e.g. after it crashes).
        RESET = 2;
    }
    optional State state = 2;
}

/**
 * Logs when the camera state changes.
 *
 * Logged from:
 *   frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
 */
message CameraStateChanged {
    repeated AttributionNode attribution_node = 1;

    enum State {
        OFF = 0;
        ON = 1;
        // RESET indicates all camera stopped. Used when it (re)starts (e.g. after it crashes).
        RESET = 2;
    }
    optional State state = 2;
}

/**
 * Logs that the state of a wakelock (per app and per wakelock name) has changed.
 *
 * Logged from:
 *   TODO
 */
message WakelockStateChanged {
    repeated AttributionNode attribution_node = 1
            [(state_field_option).primary_field_first_uid = true];

    // The type (level) of the wakelock; e.g. a partial wakelock or a full wakelock.
    // From frameworks/base/core/proto/android/os/enums.proto.
    optional android.os.WakeLockLevelEnum type = 2 [(state_field_option).primary_field = true];

    // The wakelock tag (Called tag in the Java API, sometimes name elsewhere).
    optional string tag = 3 [(state_field_option).primary_field = true];

    enum State {
        RELEASE = 0;
        ACQUIRE = 1;
        CHANGE_RELEASE = 2;
        CHANGE_ACQUIRE = 3;
    }
    optional State state = 4 [
        (state_field_option).exclusive_state = true,
        (state_field_option).default_state_value = 0,
        (state_field_option).nested = true
    ];
}

/**
 * Logs when a partial wakelock is considered 'long' (over 1 min).
 *
 * Logged from:
 *   frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
 */
message LongPartialWakelockStateChanged {
    repeated AttributionNode attribution_node = 1;

    // The wakelock tag (Called tag in the Java API, sometimes name elsewhere).
    optional string tag = 2;

    // TODO: I have no idea what this is.
    optional string history_tag = 3;

    enum State {
        OFF = 0;
        ON = 1;
    }
    optional State state = 4;
}

/**
 * Logs when the device is interactive, according to the PowerManager Notifier.
 *
 * Logged from:
 *   frameworks/base/services/core/java/com/android/server/power/Notifier.java
 */
message InteractiveStateChanged {
    enum State {
        OFF = 0;
        ON = 1;
    }
    optional State state = 1;
}

/**
 * Logs Battery Saver state change.
 *
 * Logged from:
 *   frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
 */
message BatterySaverModeStateChanged {
    enum State {
        OFF = 0;
        ON = 1;
    }
    optional State state = 1
            [(state_field_option).exclusive_state = true, (state_field_option).nested = false];
}

/**
 * Logs Doze mode state change.
 *
 * Logged from:
 *   frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
 */
message DeviceIdleModeStateChanged {
    optional android.server.DeviceIdleModeEnum state = 1
            [(state_field_option).exclusive_state = true, (state_field_option).nested = false];
}


/**
 * Logs state change of Doze mode including maintenance windows.
 *
 * Logged from:
 *   frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
 */
message DeviceIdlingModeStateChanged {
    optional android.server.DeviceIdleModeEnum state = 1
            [(state_field_option).exclusive_state = true, (state_field_option).nested = false];
}

/**
 * Logs screen brightness level.
 *
 * Logged from:
 *   frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
 */
message ScreenBrightnessChanged {
    // Screen brightness level. Should be in [-1, 255] according to PowerManager.java.
    optional int32 level = 1;
}

/**
 * Logs battery level (percent full, from 0 to 100).
 *
 * Logged from:
 *   frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
 */
message BatteryLevelChanged {
    // Battery level. Should be in [0, 100].
    optional int32 battery_level = 1;
}

/**
 * Logs change in charging status of the device.
 *
 * Logged from:
 *   frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
 */
message ChargingStateChanged {
    // State of the battery, from frameworks/base/core/proto/android/os/enums.proto.
    optional android.os.BatteryStatusEnum state = 1
            [(state_field_option).exclusive_state = true, (state_field_option).nested = false];
}

/**
 * Logs whether the device is plugged in, and what power source it is using.
 *
 * Logged from:
 *   frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
 */
message PluggedStateChanged {
    // Whether the device is plugged in, from frameworks/base/core/proto/android/os/enums.proto.
    optional android.os.BatteryPluggedStateEnum state = 1
            [(state_field_option).exclusive_state = true, (state_field_option).nested = false];
}

/**
 * Logs when an app's wakeup alarm fires.
 *
 * Logged from:
 *   frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
 */
message WakeupAlarmOccurred {
    repeated AttributionNode attribution_node = 1;

    // Name of the wakeup alarm.
    optional string tag = 2;

    // Name of source package (for historical reasons, since BatteryStats tracked it).
    optional string package_name = 3;

    // The App Standby bucket of the app that scheduled the alarm at the time the alarm fired.
    optional AppStandbyBucketChanged.Bucket app_standby_bucket = 4;
}

/**
 * Logs when an an app causes the mobile radio to change state.
 * Changing from LOW to MEDIUM or HIGH can be considered the app waking the mobile radio.
 *
 * Logged from:
 *   frameworks/base/services/core/java/com/android/server/NetworkManagementService.java
 */
message MobileRadioPowerStateChanged {
    repeated AttributionNode attribution_node = 1;

    // Power state, from frameworks/base/core/proto/android/telephony/enums.proto.
    optional android.telephony.DataConnectionPowerStateEnum state = 2;
}

/**
 * Logs when an an app causes the wifi radio to change state.
 * Changing from LOW to MEDIUM or HIGH can be considered the app waking the wifi radio.
 *
 * Logged from:
 *   frameworks/base/services/core/java/com/android/server/NetworkManagementService.java
 */
message WifiRadioPowerStateChanged {
    repeated AttributionNode attribution_node = 1;

    // Power state, from frameworks/base/core/proto/android/telephony/enums.proto.
    optional android.telephony.DataConnectionPowerStateEnum state = 2;
}

/**
 * Logs kernel wakeup reasons and aborts.
 *
 * Logged from:
 *   frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
 */
message KernelWakeupReported {
    // Name of the kernel wakeup reason (or abort).
    optional string wakeup_reason_name = 1;

    // Duration (in microseconds) for the wake-up interrupt to be serviced.
    optional int64 duration_micros = 2;
}

/**
 * Logs when Wifi is toggled on/off.
 * Note that Wifi may still perform certain functions (e.g. location scanning) even when disabled.
 *
 * Logged from:
 *   frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
 */
message WifiEnabledStateChanged {
    enum State {
        OFF = 0;
        ON = 1;
    }
    optional State state = 1;
}

/**
 * This atom is deprecated starting in R.
 *
 * Logs when an app causes Wifi to run. In this context, 'to run' means to use Wifi Client Mode.
 * TODO: Include support for Hotspot, perhaps by using an extra field to denote 'mode'.
 * Note that Wifi Scanning is monitored separately in WifiScanStateChanged.
 *
 * Logged from:
 *   frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
 */
message WifiRunningStateChanged {
    repeated AttributionNode attribution_node = 1;

    enum State {
        OFF = 0;
        ON = 1;
    }
    optional State state = 2;
}

/**
 * Logs wifi locks held by an app.
 *
 * Logged from:
 *   frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
 */
message WifiLockStateChanged {
    repeated AttributionNode attribution_node = 1;

    enum State {
        OFF = 0;
        ON = 1;
    }
    optional State state = 2;

    // WifiLock type, from frameworks/base/core/proto/android/wifi/enums.proto.
    optional android.net.wifi.WifiModeEnum mode = 3;
}

/**
 * Logs wifi signal strength changes.
 *
 * Logged from:
 *   frameworks/opt/net/wifi/service/java/com/android/server/wifi/ClientModeImpl.java
 */
message WifiSignalStrengthChanged {
    // Signal strength, from frameworks/base/core/proto/android/telephony/enums.proto.
    optional android.telephony.SignalStrengthEnum signal_strength = 1;
}

/**
 * Logs wifi scans performed by an app.
 *
 * Logged from:
 *   frameworks/opt/net/wifi/service/java/com/android/server/wifi/scanner/WifiScanningServiceImpl.java
 */
message WifiScanStateChanged {
    repeated AttributionNode attribution_node = 1;

    enum State {
        OFF = 0;
        ON = 1;
    }
    optional State state = 2;
}

/**
 * Logs wifi multicast locks held by an app
 *
 * Logged from:
 *   frameworks/opt/net/wifi/service/java/com/android/server/wifi/WifiMulticastLockManager.java
 */
message WifiMulticastLockStateChanged {
    repeated AttributionNode attribution_node = 1;

    enum State {
        OFF = 0;
        ON = 1;
    }
    optional State state = 2;

    optional string tag = 3;
}

/**
 * Logs shutdown reason and duration on next boot.
 *
 * Logged from:
 *   frameworks/base/core/java/com/android/server/BootReceiver.java
 */
message ShutdownSequenceReported {
    // True if shutdown is for a reboot. Default: false if we do not know.
    optional bool reboot = 1;

    // Reason for shutdown. Eg: userrequested. Default: "<EMPTY>".
    optional string reason = 2;

    // Beginning of shutdown time in ms using wall clock time since unix epoch.
    // Default: 0 if no start time received.
    optional int64 start_time_millis = 3;

    // Duration of shutdown in ms. Default: 0 if no duration received.
    optional int64 duration_millis = 4;
}


/**
 * Logs boot reason and duration.
 *
 * Logged from:
 *   system/core/bootstat/bootstat.cpp
 */
message BootSequenceReported {
    // Reason for bootloader boot. Eg. reboot. See bootstat.cpp for larger list
    // Default: "<EMPTY>" if not available.
    optional string bootloader_reason = 1;

    // Reason for system boot. Eg. bootloader, reboot,userrequested
    // Default: "<EMPTY>" if not available.
    optional string system_reason = 2;

    // End of boot time in ms from unix epoch using system wall clock.
    optional int64 end_time_millis = 3;

    // Total boot duration in ms.
    optional int64 total_duration_millis = 4;

    // Bootloader duration in ms.
    optional int64 bootloader_duration_millis = 5;

    // Time since last boot in ms. Default: 0 if not available.
    optional int64 time_since_last_boot = 6;
}


/**
 * Logs call state and disconnect cause (if applicable).
 *
 * Logged from:
 *   packages/services/Telecomm/src/com/android/server/telecom/Call.java
 */
message CallStateChanged {
    // The state of the call. Eg. DIALING, ACTIVE, ON_HOLD, DISCONNECTED.
    // From frameworks/base/core/proto/android/telecomm/enums.proto.
    optional android.telecom.CallStateEnum call_state = 1;

    // The reason the call disconnected. Eg. ERROR, MISSED, REJECTED, BUSY.
    // This value is only applicable when the call_state is DISCONNECTED, and
    // should always be UNKNOWN if the call_state is not DISCONNECTED.
    // From frameworks/base/core/proto/android/telecomm/enums.proto.
    optional android.telecom.DisconnectCauseEnum disconnect_cause = 2;

    // True if the call is self-managed, which are apps that use the
    // telecom infrastructure to make their own calls.
    optional bool self_managed = 3;

    // True if call is external. External calls are calls on connected Wear
    // devices but show up in Telecom so the user can pull them onto the device.
    optional bool external_call = 4;
}

/**
 * Logs keyguard state. The keyguard is the lock screen.
 *
 * Logged from:
 *   frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java
 */
message KeyguardStateChanged {
    enum State {
        UNKNOWN = 0;
        // The keyguard is hidden when the phone is unlocked.
        HIDDEN = 1;
        // The keyguard is shown when the phone is locked (screen turns off).
        SHOWN= 2;
        // The keyguard is occluded when something is overlaying the keyguard.
        // Eg. Opening the camera while on the lock screen.
        OCCLUDED = 3;
    }
    optional State state = 1;
}

/**
 * Logs keyguard bouncer state. The bouncer is a part of the keyguard, and
 * prompts the user to enter a password (pattern, pin, etc).
 *
 * Logged from:
 *   frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBouncer.java
 */

message KeyguardBouncerStateChanged {
    enum State {
        UNKNOWN = 0;
        // Bouncer is hidden, either as a result of successfully entering the
        // password, screen timing out, or user going back to lock screen.
        HIDDEN = 1;
        // This is when the user is being prompted to enter the password.
        SHOWN = 2;
    }
    optional State state = 1;
}

/**
 * Logs the result of entering a password into the keyguard bouncer.
 *
 * Logged from:
 *   frameworks/base/packages/SystemUI/src/com/android/keyguard/KeyguardSecurityContainer.java
 */
message KeyguardBouncerPasswordEntered {
    enum BouncerResult {
        UNKNOWN = 0;
        // The password entered was incorrect.
        FAILURE = 1;
        // The password entered was correct.
        SUCCESS = 2;
    }
    optional BouncerResult result = 1;
}

/*
 * Logs changes to the configuration of the device. The configuration is defined
 * in frameworks/base/core/java/android/content/res/Configuration.java
 * More documentation is at https://d.android.com/reference/android/content/res/Configuration.html
 * Please go there to interpret the possible values each field can be.
 *
 * Logged from:
 *   frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
 */
message ResourceConfigurationChanged {
    // Bit mask of color capabilities of the screen.
    // Contains information about the color gamut and hdr mode of the screen.
    // See: https://d.android.com/reference/android/content/res/Configuration.html#colorMode
    optional int32 color_mode = 1;

    // The target screen density being rendered to.
    // See: https://d.android.com/reference/android/content/res/Configuration.html#densityDpi
    optional int32 density_dpi = 2;

    // Current user preference for the scaling factor for fonts,
    // relative to the base density scaling.
    // See: https://d.android.com/reference/android/content/res/Configuration.html#fontScale
    optional float font_scale = 3;

    // Flag indicating whether the hard keyboard is hidden.
    // See: https://d.android.com/reference/android/content/res/Configuration.html#hardKeyboardHidden
    optional int32 hard_keyboard_hidden = 4;

    // The type of keyboard attached to the device.
    // See: https://d.android.com/reference/android/content/res/Configuration.html#keyboard
    optional int32 keyboard = 5;

    // Flag indicating whether any keyboard is available. Takes soft keyboards into account.
    // See: https://d.android.com/reference/android/content/res/Configuration.html#keyboardHidden
    optional int32 keyboard_hidden = 6;

    // IMSI MCC (Mobile Country Code), corresponding to mcc resource qualifier.
    // 0 if undefined.
    // See: https://d.android.com/reference/android/content/res/Configuration.html#mcc
    optional int32 mcc = 7;

    // IMSI MNC (Mobile Network Code), corresponding to mnc resource qualifier.
    // 0 if undefined. Note: the actual MNC may be 0, to check for this use the
    // MNC_ZERO symbol defined in Configuration.java.
    // See: https://d.android.com/reference/android/content/res/Configuration.html#mnc
    optional int32 mnc = 8;

    // The kind of navigation available on the device.
    // See: https://developer.android.com/reference/android/content/res/Configuration.html#navigation
    optional int32 navigation = 9;

    // Flag indicating whether the navigation is available.
    // See: https://d.android.com/reference/android/content/res/Configuration.html#navigationHidden
    optional int32 navigation_hidden = 10;

    // Overall orientation of the screen.
    // See: https://d.android.com/reference/android/content/res/Configuration.html#orientation
    optional int32 orientation = 11;

    // The current height of the available screen space, in dp units.
    // See: https://d.android.com/reference/android/content/res/Configuration.html#screenHeightDp
    optional int32 screen_height_dp = 12;

    // Bit mask of overall layout of the screen.
    // Contains information about screen size, whether the screen is wider/taller
    // than normal, whether the screen layout is right-tl-left or left-to-right,
    // and whether the screen has a rounded shape.
    // See: https://d.android.com/reference/android/content/res/Configuration.html#screenLayout
    optional int32 screen_layout = 13;

    // Current width of the available screen space, in dp units.
    // See: https://d.android.com/reference/android/content/res/Configuration.html#screenWidthDp
    optional int32 screen_width_dp = 14;

    // The smallest screen size an application will see in normal operation.
    // This is the smallest value of both screenWidthDp and screenHeightDp
    // in portrait and landscape.
    // See: https://d.android.com/reference/android/content/res/Configuration.html#smallestScreenWidthDp
    optional int32 smallest_screen_width_dp = 15;

    // The type of touch screen attached to the device.
    // See: https://d.android.com/reference/android/content/res/Configuration.html#touchscreen
    optional int32 touchscreen = 16;

    // Bit mask of the ui mode.
    // Contains information about the overall ui mode of the device.
    // Eg: NORMAL, DESK, CAR, TELEVISION, WATCH, VR_HEADSET
    // Also contains information about whether the device is in night mode.
    // See: https://d.android.com/reference/android/content/res/Configuration.html#uiMode
    optional int32 ui_mode = 17;
}


/**
 * Logs changes in the connection state of the mobile radio.
 *
 * Logged from:
 *    frameworks/opt/telephony/src/java/com/android/internal/telephony/dataconnection/DataConnection.java
 */
message MobileConnectionStateChanged {
    // States are from the state machine DataConnection.java.
    enum State {
        UNKNOWN = 0;
        // The connection is inactive, or disconnected.
        INACTIVE = 1;
        // The connection is being activated, or connecting.
        ACTIVATING = 2;
        // The connection is active, or connected.
        ACTIVE = 3;
        // The connection is disconnecting.
        DISCONNECTING = 4;
        // The connection is disconnecting after creating a connection.
        DISCONNECTION_ERROR_CREATING_CONNECTION = 5;
    }
    optional State state  = 1;
    // For multi-sim phones, this distinguishes between the sim cards.
    optional int32 sim_slot_index = 2;
    // Used to identify the connection. Starts at 0 and increments by 1 for
    // every new network created. Resets whenever the device reboots.
    optional int32 data_connection_id = 3;
    // A bitmask for the capabilities of this connection.
    // Eg. DEFAULT (internet), MMS, SUPL, DUN, IMS.
    // Default value (if we have no information): 0
    optional int64 capabilities = 4;
    // If this connection has internet.
    // This just checks if the DEFAULT bit of capabilities is set.
    optional bool has_internet = 5;
}

/**
 * Logs changes in mobile radio technology. eg: LTE, EDGE, CDMA.
 *
 * Logged from:
 *   frameworks/opt/telephony/src/java/com/android/internal/telephony/ServiceStateTracker.java
 */
message MobileRadioTechnologyChanged {
    optional android.telephony.NetworkTypeEnum state = 1;
    // For multi-sim phones, this distinguishes between the sim cards.
    optional int32 sim_slot_index = 2;
}

/**
 * Logs the VID and PID of any connected USB devices.
 *
 * Notes if any Audio, HID (input buttons/mouse/keyboard), or Storage interfaces are present.
 *
 * Logged by Vendor.
 */
message UsbDeviceAttached {
    optional int32 vid = 1;
    optional int32 pid = 2;
    optional bool has_audio = 3;
    optional bool has_hid = 4;
    optional bool has_storage = 5;
    enum State {
        STATE_DISCONNECTED = 0;
        STATE_CONNECTED = 1;
    }
    optional State state = 6;
    optional int64 last_connect_duration_millis = 7;
}


/**
 * Logs when Bluetooth is enabled and disabled.
 *
 * Logged from:
 *   services/core/java/com/android/server/BluetoothManagerService.java
 */
message BluetoothEnabledStateChanged {
    repeated AttributionNode attribution_node = 1;
    // Whether or not bluetooth is enabled on the device.
    enum State {
        UNKNOWN = 0;
        ENABLED = 1;
        DISABLED = 2;
    }
    optional State state = 2;
    // The reason for being enabled/disabled.
    // Eg. Airplane mode, crash, application request.
    optional android.bluetooth.EnableDisableReasonEnum reason = 3;
    // If the reason is an application request, this will be the package name.
    optional string pkg_name = 4;
}

/**
 * Logs when profiles on a Bluetooth device connects and disconnects.
 *
 * Logged from:
 *    packages/apps/Bluetooth/src/com/android/bluetooth/btservice/RemoteDevices.java
 *
 * Next Tag: 6
 */
message BluetoothConnectionStateChanged {
    // The state of the connection.
    // Eg: CONNECTING, CONNECTED, DISCONNECTING, DISCONNECTED.
    optional android.bluetooth.ConnectionStateEnum state = 1;
    // An identifier that can be used to match connect and disconnect events.
    // Currently is last two bytes of a hash of a device level ID and
    // the mac address of the bluetooth device that is connected.
    // Deprecated: use obfuscated_id instead, this one is always 0 for Q+
    optional int32 obfuscated_id = 2 [deprecated = true];
    // The profile that is connected. Eg. GATT, A2DP, HEADSET.
    // From android.bluetooth.BluetoothAdapter.java
    // Default: 0 when not used
    optional int32 bt_profile = 3;
    // An identifier that can be used to match events for this device.
    // Currently, this is a salted hash of the MAC address of this Bluetooth device.
    // Salt: Randomly generated 256 bit value
    // Hash algorithm: HMAC-SHA256
    // Size: 32 byte
    // Default: null or empty if the device identifier is not known
    optional bytes new_obfuscated_id = 4 [(android.os.statsd.log_mode) = MODE_BYTES];
    // An identifier that can be used to match events for this device.
    // The incremental identifier is locally generated and guaranteed not derived
    // from any globally unique hardware id.
    // For paired devices, it stays consistent between Bluetooth toggling for the
    // same remote device.
    // For unpaired devices, it stays consistent within the same Bluetooth adapter
    // session for the same remote device.
    // Default: 0 if the device's metric id is unknown.
    optional int32 metric_id = 5;
}

/**
 * Logs when a Bluetooth device connects and disconnects over ACL
 *
 * Logged from:
 *    packages/apps/Bluetooth/src/com/android/bluetooth/btservice/AdapterProperties.java
 *
 * Next Tag: 4
 */
message BluetoothAclConnectionStateChanged {
    // An identifier that can be used to match events for this device.
    // Currently, this is a salted hash of the MAC address of this Bluetooth device.
    // Salt: Randomly generated 256 bit value
    // Hash algorithm: HMAC-SHA256
    // Size: 32 byte
    // Default: null or empty if the device identifier is not known
    optional bytes obfuscated_id = 1 [(android.os.statsd.log_mode) = MODE_BYTES];
    // The state of the connection.
    // Eg: CONNECTING, CONNECTED, DISCONNECTING, DISCONNECTED.
    optional android.bluetooth.ConnectionStateEnum state = 2;
    // An identifier that can be used to match events for this device.
    // The incremental identifier is locally generated and guaranteed not derived
    // from any globally unique hardware id.
    // For paired devices, it stays consistent between Bluetooth toggling for the
    // same remote device.
    // For unpaired devices, it stays consistent within the same Bluetooth adapter
    // session for the same remote device.
    // Default: 0 if the device's metric id is unknown.
    optional int32 metric_id = 3;
}

/**
 * Logs when a Bluetooth device connects and disconnects over SCO
 *
 * Logged from:
 *    packages/apps/Bluetooth/src/com/android/bluetooth/hfp/HeadsetStateMachine.java
 *    packages/apps/Bluetooth/src/com/android/bluetooth/hfp/HeadsetClientStateMachine.java
 *
 * Next Tag: 5
 */
message BluetoothScoConnectionStateChanged {
    // An identifier that can be used to match events for this device.
    // Currently, this is a salted hash of the MAC address of this Bluetooth device.
    // Salt: Randomly generated 256 bit value
    // Hash algorithm: HMAC-SHA256
    // Size: 32 byte
    // Default: null or empty if the device identifier is not known
    optional bytes obfuscated_id = 1 [(android.os.statsd.log_mode) = MODE_BYTES];
    // The state of the connection.
    // Eg: CONNECTING, CONNECTED, DISCONNECTING, DISCONNECTED.
    optional android.bluetooth.ConnectionStateEnum state = 2;
    // Codec used for this SCO connection
    // Default: UNKNOWN
    optional android.bluetooth.hfp.ScoCodec codec = 3;
    // An identifier that can be used to match events for this device.
    // The incremental identifier is locally generated and guaranteed not derived
    // from any globally unique hardware id.
    // For paired devices, it stays consistent between Bluetooth toggling for the
    // same remote device.
    // For unpaired devices, it stays consistent within the same Bluetooth adapter
    // session for the same remote device.
    // Default: 0 if the device's metric id is unknown.
    optional int32 metric_id = 4;
}

/**
 * Logged when active device of a profile changes
 *
 * Logged from:
 *     packages/apps/Bluetooth/src/com/android/bluetooth/a2dp/A2dpService.java
 *     packages/apps/Bluetooth/src/com/android/bluetooth/hfp/HeadsetService.java
 *     packages/apps/Bluetooth/src/com/android/bluetooth/hearingaid/HearingAidService.java
 */
message BluetoothActiveDeviceChanged {
    // The profile whose active device has changed. Eg. A2DP, HEADSET, HEARING_AID
    // From android.bluetooth.BluetoothProfile
    optional int32 bt_profile = 1;
    // An identifier that can be used to match events for this new active device.
    // Currently, this is a salted hash of the MAC address of this Bluetooth device.
    // Salt: Randomly generated 256 bit value
    // Hash algorithm: HMAC-SHA256
    // Size: 32 byte
    // Default: null or empty if there is no active device for this profile
    optional bytes obfuscated_id = 2 [(android.os.statsd.log_mode) = MODE_BYTES];
    // An identifier that can be used to match events for this device.
    // The incremental identifier is locally generated and guaranteed not derived
    // from any globally unique hardware id.
    // For paired devices, it stays consistent between Bluetooth toggling for the
    // same remote device.
    // For unpaired devices, it stays consistent within the same Bluetooth adapter
    // session for the same remote device.
    // Default: 0 if the device's metric id is unknown.
    optional int32 metric_id = 3;
}

// Logs when there is an event affecting Bluetooth device's link layer connection.
// - This event is triggered when there is a related HCI command or event
// - Users of this metrics can deduce Bluetooth device's connection state from these events
// - HCI commands are logged before the command is sent, after receiving command status, and after
//   receiving command complete
// - HCI events are logged when they arrive
//
// Low level log from system/bt
//
// Bluetooth classic commands:
// - CMD_CREATE_CONNECTION
// - CMD_DISCONNECT
// - CMD_CREATE_CONNECTION_CANCEL
// - CMD_ACCEPT_CONNECTION_REQUEST
// - CMD_REJECT_CONNECTION_REQUEST
// - CMD_SETUP_ESCO_CONNECTION
// - CMD_ACCEPT_ESCO_CONNECTION
// - CMD_REJECT_ESCO_CONNECTION
// - CMD_ENH_SETUP_ESCO_CONNECTION
// - CMD_ENH_ACCEPT_ESCO_CONNECTION
//
// Bluetooth low energy commands:
// - CMD_BLE_CREATE_LL_CONN [Only logged on error or when initiator filter policy is 0x00]
// - CMD_BLE_CREATE_CONN_CANCEL [Only logged when there is an error]
// - CMD_BLE_EXTENDED_CREATE_CONNECTION [Only logged on error or when initiator filter policy is 0x00]
// - CMD_BLE_CLEAR_WHITE_LIST
// - CMD_BLE_ADD_WHITE_LIST
// - CMD_BLE_REMOVE_WHITE_LIST
//
// Bluetooth classic events:
// - EVT_CONNECTION_COMP
// - EVT_CONNECTION_REQUEST
// - EVT_DISCONNECTION_COMP
// - EVT_ESCO_CONNECTION_COMP
// - EVT_ESCO_CONNECTION_CHANGED
//
// Bluetooth low energy meta events:
// - BLE_EVT_CONN_COMPLETE_EVT
// - BLE_EVT_ENHANCED_CONN_COMPLETE_EVT
//
// Next tag: 10
message BluetoothLinkLayerConnectionEvent {
    // An identifier that can be used to match events for this device.
    // Currently, this is a salted hash of the MAC address of this Bluetooth device.
    // Salt: Randomly generated 256 bit value
    // Hash algorithm: HMAC-SHA256
    // Size: 32 byte
    // Default: null or empty if the device identifier is not known
    optional bytes obfuscated_id = 1 [(android.os.statsd.log_mode) = MODE_BYTES];
    // Connection handle of this connection if available
    // Range: 0x0000 - 0x0EFF (12 bits)
    // Default: 0xFFFF if the handle is unknown
    optional int32 connection_handle = 2;
    // Direction of the link
    // Default: DIRECTION_UNKNOWN
    optional android.bluetooth.DirectionEnum direction = 3;
    // Type of this link
    // Default: LINK_TYPE_UNKNOWN
    optional android.bluetooth.LinkTypeEnum type = 4;

    // Reason metadata for this link layer connection event, rules for interpretation:
    // 1. If hci_cmd is set and valid, hci_event can be either EVT_COMMAND_STATUS or
    //    EVT_COMMAND_COMPLETE, ignore hci_ble_event in this case
    // 2. If hci_event is set to EVT_BLE_META, look at hci_ble_event; otherwise, if hci_event is
    //    set and valid, ignore hci_ble_event

    // HCI command associated with this event
    // Default: CMD_UNKNOWN
    optional android.bluetooth.hci.CommandEnum hci_cmd = 5;
    // HCI event associated with this event
    // Default: EVT_UNKNOWN
    optional android.bluetooth.hci.EventEnum hci_event = 6;
    // HCI BLE meta event associated with this event
    // Default: BLE_EVT_UNKNOWN
    optional android.bluetooth.hci.BleMetaEventEnum hci_ble_event = 7;
    // HCI command status code if this is triggerred by hci_cmd
    // Default: STATUS_UNKNOWN
    optional android.bluetooth.hci.StatusEnum cmd_status = 8;
    // HCI reason code associated with this event
    // Default: STATUS_UNKNOWN
    optional android.bluetooth.hci.StatusEnum reason_code = 9;
    // An identifier that can be used to match events for this device.
    // The incremental identifier is locally generated and guaranteed not derived
    // from any globally unique hardware id.
    // For paired devices, it stays consistent between Bluetooth toggling for the
    // same remote device.
    // For unpaired devices, it stays consistent within the same Bluetooth adapter
    // session for the same remote device.
    // Default: 0 if the device's metric id is unknown.
    optional int32 metric_id = 10;
}

/**
 * Logs when a module is rolled back by Watchdog.
 *
 * Logged from: Rollback Manager
 */
message WatchdogRollbackOccurred {
    enum RollbackType {
        UNKNOWN = 0;
        ROLLBACK_INITIATE = 1;
        ROLLBACK_SUCCESS = 2;
        ROLLBACK_FAILURE = 3;
        ROLLBACK_BOOT_TRIGGERED = 4;
    }
    optional RollbackType rollback_type = 1;

    optional string package_name = 2;

    optional int32 package_version_code = 3;

    enum RollbackReasonType {
        REASON_UNKNOWN = 0;
        REASON_NATIVE_CRASH = 1;
        REASON_EXPLICIT_HEALTH_CHECK = 2;
        REASON_APP_CRASH = 3;
        REASON_APP_NOT_RESPONDING = 4;
        REASON_NATIVE_CRASH_DURING_BOOT = 5;
    }
    optional RollbackReasonType rollback_reason = 4;

    // Set by RollbackPackageHealthObserver to be the package that is failing when a rollback
    // is initiated. Empty if the package is unknown.
    optional string failing_package_name = 5;

    optional TrainExperimentIds experiment_ids = 6 [(log_mode) = MODE_BYTES];
}

/**
 * Logs when there is a change in Bluetooth A2DP playback state
 *
 * Logged from:
 *     packages/apps/Bluetooth/src/com/android/bluetooth/a2dp/A2dpService.java
 */
message BluetoothA2dpPlaybackStateChanged {
    // An identifier that can be used to match events for this device.
    // Currently, this is a salted hash of the MAC address of this Bluetooth device.
    // Salt: Randomly generated 256 bit value
    // Hash algorithm: HMAC-SHA256
    // Size: 32 byte
    // Default: null or empty if the device identifier is not known
    optional bytes obfuscated_id = 1 [(android.os.statsd.log_mode) = MODE_BYTES];
    // Current playback state
    // Default: PLAYBACK_STATE_UNKNOWN
    optional android.bluetooth.a2dp.PlaybackStateEnum playback_state = 2;
    // Current audio coding mode
    // Default: AUDIO_CODING_MODE_UNKNOWN
    optional android.bluetooth.a2dp.AudioCodingModeEnum audio_coding_mode = 3;
    // An identifier that can be used to match events for this device.
    // The incremental identifier is locally generated and guaranteed not derived
    // from any globally unique hardware id.
    // For paired devices, it stays consistent between Bluetooth toggling for the
    // same remote device.
    // For unpaired devices, it stays consistent within the same Bluetooth adapter
    // session for the same remote device.
    // Default: 0 if the device's metric id is unknown.
    optional int32 metric_id = 4;
}

/**
 * Logs when there is a change in A2DP codec config for a particular remote device
 *
 * Logged from:
 *     frameworks/base/core/java/android/bluetooth/BluetoothCodecConfig.java
 *     packages/apps/Bluetooth/src/com/android/bluetooth/a2dp/A2dpService.java
 */
message BluetoothA2dpCodecConfigChanged {
    // An identifier that can be used to match events for this device.
    // Currently, this is a salted hash of the MAC address of this Bluetooth device.
    // Salt: Randomly generated 256 bit value
    // Hash algorithm: HMAC-SHA256
    // Size: 32 byte
    // Default: null or empty if the device identifier is not known
    optional bytes obfuscated_id = 1 [(android.os.statsd.log_mode) = MODE_BYTES];
    // Type of codec as defined by various SOURCE_CODEC_TYPE_* constants in BluetoothCodecConfig
    // Default SOURCE_CODEC_TYPE_INVALID
    optional int32 codec_type = 2;
    // Codec priroity, the higher the more preferred, -1 for disabled
    // Default: CODEC_PRIORITY_DEFAULT
    optional int32 codec_priority = 3;
    // Sample rate in Hz as defined by various SAMPLE_RATE_* constants in BluetoothCodecConfig
    // Default: SAMPLE_RATE_NONE
    optional int32 sample_rate = 4;
    // Bits per sample as defined by various BITS_PER_SAMPLE_* constants in BluetoothCodecConfig
    // Default: BITS_PER_SAMPLE_NONE
    optional int32 bits_per_sample = 5;
    // Channel mode as defined by various CHANNEL_MODE_* constants in BluetoothCodecConfig
    // Default: CHANNEL_MODE_NONE
    optional int32 channel_mode = 6;
    // Codec specific values
    // Default 0
    optional int64 codec_specific_1 = 7;
    optional int64 codec_specific_2 = 8;
    optional int64 codec_specific_3 = 9;
    optional int64 codec_specific_4 = 10;
    // An identifier that can be used to match events for this device.
    // The incremental identifier is locally generated and guaranteed not derived
    // from any globally unique hardware id.
    // For paired devices, it stays consistent between Bluetooth toggling for the
    // same remote device.
    // For unpaired devices, it stays consistent within the same Bluetooth adapter
    // session for the same remote device.
    // Default: 0 if the device's metric id is unknown.
    optional int32 metric_id = 11;
}

/**
 * Logs when there is a change in selectable A2DP codec capability for a paricular remote device
 * Each codec's capability is logged separately due to statsd restriction
 *
 * Logged from:
 *     frameworks/base/core/java/android/bluetooth/BluetoothCodecConfig.java
 *     packages/apps/Bluetooth/src/com/android/bluetooth/a2dp/A2dpService.java
 */
message BluetoothA2dpCodecCapabilityChanged {
    // An identifier that can be used to match events for this device.
    // Currently, this is a salted hash of the MAC address of this Bluetooth device.
    // Salt: Randomly generated 256 bit value
    // Hash algorithm: HMAC-SHA256
    // Size: 32 byte
    // Default: null or empty if the device identifier is not known
    optional bytes obfuscated_id = 1 [(android.os.statsd.log_mode) = MODE_BYTES];
    // Type of codec as defined by various SOURCE_CODEC_TYPE_* constants in BluetoothCodecConfig
    // Default SOURCE_CODEC_TYPE_INVALID
    optional int32 codec_type = 2;
    // Codec priroity, the higher the more preferred, -1 for disabled
    // Default: CODEC_PRIORITY_DEFAULT
    optional int32 codec_priority = 3;
    // A bit field of supported sample rates as defined by various SAMPLE_RATE_* constants
    // in BluetoothCodecConfig
    // Default: empty and SAMPLE_RATE_NONE for individual item
    optional int32 sample_rate = 4;
    // A bit field of supported bits per sample as defined by various BITS_PER_SAMPLE_* constants
    // in BluetoothCodecConfig
    // Default: empty and BITS_PER_SAMPLE_NONE for individual item
    optional int32 bits_per_sample = 5;
    // A bit field of supported channel mode as defined by various CHANNEL_MODE_* constants in
    // BluetoothCodecConfig
    // Default: empty and CHANNEL_MODE_NONE for individual item
    optional int32 channel_mode = 6;
    // Codec specific values
    // Default 0
    optional int64 codec_specific_1 = 7;
    optional int64 codec_specific_2 = 8;
    optional int64 codec_specific_3 = 9;
    optional int64 codec_specific_4 = 10;
    // An identifier that can be used to match events for this device.
    // The incremental identifier is locally generated and guaranteed not derived
    // from any globally unique hardware id.
    // For paired devices, it stays consistent between Bluetooth toggling for the
    // same remote device.
    // For unpaired devices, it stays consistent within the same Bluetooth adapter
    // session for the same remote device.
    // Default: 0 if the device's metric id is unknown.
    optional int32 metric_id = 11;
}

/**
 * Logs when A2DP failed to read from PCM source.
 * This typically happens when audio HAL cannot supply A2DP with data fast enough for encoding.
 *
 * Logged from:
 *     system/bt
 */
message BluetoothA2dpAudioUnderrunReported {
    // An identifier that can be used to match events for this device.
    // Currently, this is a salted hash of the MAC address of this Bluetooth device.
    // Salt: Randomly generated 256 bit value
    // Hash algorithm: HMAC-SHA256
    // Size: 32 byte
    // Default: null or empty if the device identifier is not known
    optional bytes obfuscated_id = 1 [(android.os.statsd.log_mode) = MODE_BYTES];
    // Encoding interval in nanoseconds
    // Default: 0
    optional int64 encoding_interval_nanos = 2;
    // Number of bytes of PCM data that could not be read from the source
    // Default: 0
    optional int32 num_missing_pcm_bytes = 3;
    // An identifier that can be used to match events for this device.
    // The incremental identifier is locally generated and guaranteed not derived
    // from any globally unique hardware id.
    // For paired devices, it stays consistent between Bluetooth toggling for the
    // same remote device.
    // For unpaired devices, it stays consistent within the same Bluetooth adapter
    // session for the same remote device.
    // Default: 0 if the device's metric id is unknown.
    optional int32 metric_id = 4;
}

/**
 * Logs when A2DP failed send encoded data to the remote device fast enough such that the transmit
 * buffer queue is full and we have to drop data
 *
 * Logged from:
 *     system/bt
 */
message BluetoothA2dpAudioOverrunReported {
    // An identifier that can be used to match events for this device.
    // Currently, this is a salted hash of the MAC address of this Bluetooth device.
    // Salt: Randomly generated 256 bit value
    // Hash algorithm: HMAC-SHA256
    // Size: 32 byte
    // Default: null or empty if the device identifier is not known
    optional bytes obfuscated_id = 1 [(android.os.statsd.log_mode) = MODE_BYTES];
    // Encoding interval in nanoseconds
    // Default: 0
    optional int64 encoding_interval_nanos = 2;
    // Number of buffers dropped in this event
    // Each buffer is encoded in one encoding interval and consists of multiple encoded frames
    // Default: 0
    optional int32 num_dropped_buffers = 3;
    // Number of encoded buffers dropped in this event
    // Default 0
    optional int32 num_dropped_encoded_frames = 4;
    // Number of encoded bytes dropped in this event
    // Default: 0
    optional int32 num_dropped_encoded_bytes = 5;
    // An identifier that can be used to match events for this device.
    // The incremental identifier is locally generated and guaranteed not derived
    // from any globally unique hardware id.
    // For paired devices, it stays consistent between Bluetooth toggling for the
    // same remote device.
    // For unpaired devices, it stays consistent within the same Bluetooth adapter
    // session for the same remote device.
    // Default: 0 if the device's metric id is unknown.
    optional int32 metric_id = 6;
}

/**
 * Logs when we receive reports regarding a device's RSSI value
 *
 * Logged from:
 *     system/bt
 */
message BluetoothDeviceRssiReported {
    // An identifier that can be used to match events for this device.
    // Currently, this is a salted hash of the MAC address of this Bluetooth device.
    // Salt: Randomly generated 256 bit value
    // Hash algorithm: HMAC-SHA256
    // Size: 32 byte
    // Default: null or empty if the device identifier is not known
    optional bytes obfuscated_id = 1 [(android.os.statsd.log_mode) = MODE_BYTES];
    // Connection handle of this connection if available
    // Range: 0x0000 - 0x0EFF (12 bits)
    // Default: 0xFFFF if the handle is unknown
    optional int32 connection_handle = 2;
    // HCI command status code if this is triggerred by hci_cmd
    // Default: STATUS_UNKNOWN
    optional android.bluetooth.hci.StatusEnum hci_status = 3;
    // BR/EDR
    //   Range: -128 ≤ N ≤ 127 (signed integer)
    //   Units: dB
    // LE:
    //   Range: -127 to 20, 127 (signed integer)
    //   Units: dBm
    // Invalid when an out of range value is reported
    optional int32 rssi = 4;
    // An identifier that can be used to match events for this device.
    // The incremental identifier is locally generated and guaranteed not derived
    // from any globally unique hardware id.
    // For paired devices, it stays consistent between Bluetooth toggling for the
    // same remote device.
    // For unpaired devices, it stays consistent within the same Bluetooth adapter
    // session for the same remote device.
    // Default: 0 if the device's metric id is unknown.
    optional int32 metric_id = 5;
}

/**
 * Logs when we receive reports regarding how many consecutive failed contacts for a connection
 *
 * Logged from:
 *     system/bt
 */
message BluetoothDeviceFailedContactCounterReported {
    // An identifier that can be used to match events for this device.
    // Currently, this is a salted hash of the MAC address of this Bluetooth device.
    // Salt: Randomly generated 256 bit value
    // Hash algorithm: HMAC-SHA256
    // Size: 32 byte
    // Default: null or empty if the device identifier is not known
    optional bytes obfuscated_id = 1 [(android.os.statsd.log_mode) = MODE_BYTES];
    // Connection handle of this connection if available
    // Range: 0x0000 - 0x0EFF (12 bits)
    // Default: 0xFFFF if the handle is unknown
    optional int32 connection_handle = 2;
    // HCI command status code if this is triggerred by hci_cmd
    // Default: STATUS_UNKNOWN
    optional android.bluetooth.hci.StatusEnum cmd_status = 3;
    // Number of consecutive failed contacts for a connection corresponding to the Handle
    // Range: uint16_t, 0-0xFFFF
    // Default: 0xFFFFF
    optional int32 failed_contact_counter = 4;
    // An identifier that can be used to match events for this device.
    // The incremental identifier is locally generated and guaranteed not derived
    // from any globally unique hardware id.
    // For paired devices, it stays consistent between Bluetooth toggling for the
    // same remote device.
    // For unpaired devices, it stays consistent within the same Bluetooth adapter
    // session for the same remote device.
    // Default: 0 if the device's metric id is unknown.
    optional int32 metric_id = 5;
}

/**
 * Logs when we receive reports regarding the tranmit power level used for a specific connection
 *
 * Logged from:
 *     system/bt
 */
message BluetoothDeviceTxPowerLevelReported {
    // An identifier that can be used to match events for this device.
    // Currently, this is a salted hash of the MAC address of this Bluetooth device.
    // Salt: Randomly generated 256 bit value
    // Hash algorithm: HMAC-SHA256
    // Size: 32 byte
    // Default: null or empty if the device identifier is not known
    optional bytes obfuscated_id = 1 [(android.os.statsd.log_mode) = MODE_BYTES];
    // Connection handle of this connection if available
    // Range: 0x0000 - 0x0EFF (12 bits)
    // Default: 0xFFFF if the handle is unknown
    optional int32 connection_handle = 2;
    // HCI command status code if this is triggered by hci_cmd
    // Default: STATUS_UNKNOWN
    optional android.bluetooth.hci.StatusEnum hci_status = 3;
    // Range: -30 ≤ N ≤ 20
    // Units: dBm
    // Invalid when an out of range value is reported
    optional int32 transmit_power_level = 4;
    // An identifier that can be used to match events for this device.
    // The incremental identifier is locally generated and guaranteed not derived
    // from any globally unique hardware id.
    // For paired devices, it stays consistent between Bluetooth toggling for the
    // same remote device.
    // For unpaired devices, it stays consistent within the same Bluetooth adapter
    // session for the same remote device.
    // Default: 0 if the device's metric id is unknown.
    optional int32 metric_id = 5;
}

/**
 * Logs when Bluetooth controller failed to reply with command status within a timeout period after
 * receiving an HCI command from the host
 *
 * Logged from: system/bt
 */
message BluetoothHciTimeoutReported {
    // HCI command associated with this event
    // Default: CMD_UNKNOWN
    optional android.bluetooth.hci.CommandEnum hci_command = 1;
}

/**
 * Logs when we receive Bluetooth Link Quality Report event from the controller
 * See Android Bluetooth HCI specification for more details
 *
 * Note: all count and bytes field are counted since last event
 *
 * Logged from: system/bt
 */
message BluetoothQualityReportReported {
    // Quality report ID
    // Original type: uint8_t
    // Default: BQR_ID_UNKNOWN
    optional android.bluetooth.hci.BqrIdEnum quality_report_id = 1;
    // Packet type of the connection
    // Original type: uint8_t
    // Default: BQR_PACKET_TYPE_UNKNOWN
    optional android.bluetooth.hci.BqrPacketTypeEnum packet_types = 2;
    // Connection handle of the connection
    // Original type: uint16_t
    optional int32 connection_handle = 3;
    // Performing Role for the connection
    // Original type: uint8_t
    optional int32 connection_role = 4;
    // Current Transmit Power Level for the connection. This value is the same as the controller's
    // response to the HCI_Read_Transmit_Power_Level HCI command
    // Original type: uint8_t
    optional int32 tx_power_level = 5;
    // Received Signal Strength Indication (RSSI) value for the connection. This value is an
    // absolute receiver signal strength value
    // Original type: int8_t
    optional int32 rssi = 6;
    // Signal-to-Noise Ratio (SNR) value for the connection. It is the average SNR of all the
    // channels used by the link currently
    // Original type: uint8_t
    optional int32 snr = 7;
    // Indicates the number of unused channels in AFH_channel_map
    // Original type: uint8_t
    optional int32 unused_afh_channel_count = 8;
    // Indicates the number of the channels which are interfered and quality is bad but are still
    // selected for AFH
    // Original type: uint8_t
    optional int32 afh_select_unideal_channel_count = 9;
    // Current Link Supervision Timeout Setting
    // Unit: N * 0.3125 ms (1 Bluetooth Clock)
    // Original type: uint16_t
    optional int32 lsto = 10;
    // Piconet Clock for the specified Connection_Handle. This value is the same as the controller's
    // response to HCI_Read_Clock HCI command with the parameter "Which_Clock" of
    // 0x01 (Piconet Clock)
    // Unit: N * 0.3125 ms (1 Bluetooth Clock)
    // Original type: uint32_t
    optional int64 connection_piconet_clock = 11;
    // The count of retransmission
    // Original type: uint32_t
    optional int64 retransmission_count = 12;
    // The count of no RX
    // Original type: uint32_t
    optional int64 no_rx_count = 13;
    // The count of NAK (Negative Acknowledge)
    // Original type: uint32_t
    optional int64 nak_count = 14;
    // Controller timestamp of last TX ACK
    // Unit: N * 0.3125 ms (1 Bluetooth Clock)
    // Original type: uint32_t
    optional int64 last_tx_ack_timestamp = 15;
    // The count of Flow-off (STOP)
    // Original type: uint32_t
    optional int64 flow_off_count = 16;
    // Controller timestamp of last Flow-on (GO)
    // Unit: N * 0.3125 ms (1 Bluetooth Clock)
    // Original type: uint32_t
    optional int64 last_flow_on_timestamp = 17;
    // Buffer overflow count (how many bytes of TX data are dropped) since the last event
    // Original type: uint32_t
    optional int64 buffer_overflow_bytes = 18;
    // Buffer underflow count (in byte) since last event
    // Original type: uint32_t
    optional int64 buffer_underflow_bytes = 19;
}

/**
 * Logs when a Bluetooth device's manufacturer information is learnt by the Bluetooth stack
 *
 * Notes:
 * - Each event can be partially filled as we might learn different pieces of device
 *   information at different time
 * - Multiple device info events can be combined to give more complete picture
 * - When multiple device info events tries to describe the same information, the
 *   later one wins
 *
 * Logged from:
 *     packages/apps/Bluetooth
 */
message BluetoothDeviceInfoReported {
    // An identifier that can be used to match events for this device.
    // Currently, this is a salted hash of the MAC address of this Bluetooth device.
    // Salt: Randomly generated 256 bit value
    // Hash algorithm: HMAC-SHA256
    // Size: 32 byte
    // Default: null or empty if the device identifier is not known
    optional bytes obfuscated_id = 1 [(android.os.statsd.log_mode) = MODE_BYTES];
    // Where is this device info obtained from
    optional android.bluetooth.DeviceInfoSrcEnum source_type = 2;
    // Name of the data source
    // For EXTERNAL: package name of the data source
    // For INTERNAL: null for general case, component name otherwise
    optional string source_name = 3;
    // Name of the manufacturer of this device
    optional string manufacturer = 4;
    // Model of this device
    optional string model = 5;
    // Hardware version of this device
    optional string hardware_version = 6;
    // Software version of this device
    optional string software_version = 7;
    // An identifier that can be used to match events for this device.
    // The incremental identifier is locally generated and guaranteed not derived
    // from any globally unique hardware id.
    // For paired devices, it stays consistent between Bluetooth toggling for the
    // same remote device.
    // For unpaired devices, it stays consistent within the same Bluetooth adapter
    // session for the same remote device.
    // Default: 0 if the device's metric id is unknown.
    optional int32 metric_id = 8;
}

/**
 * Logs when we receive Bluetooth Read Remote Version Information Complete Event from the remote
 * device, as documented by the Bluetooth Core HCI specification
 * Reference: https://www.bluetooth.com/specifications/bluetooth-core-specification
 * Vol 2, Part E, Page 1118
 *
 * Logged from:
 *     system/bt
 */
message BluetoothRemoteVersionInfoReported {
    // Connection handle of the connection
    // Original type: uint16_t
    optional int32 connection_handle = 1;
    // HCI command status code
    // Default: STATUS_UNKNOWN
    optional android.bluetooth.hci.StatusEnum hci_status = 2;
    // 1 byte Version of current LMP in the remote controller
    optional int32 lmp_version = 3;
    // 2 bytes LMP manufacturer code of the remote controller
    // https://www.bluetooth.com/specifications/assigned-numbers/company-identifiers
    optional int32 lmp_manufacturer_code = 4;
    // 4 bytes subversion of the LMP in the remote controller
    optional int32 lmp_subversion = 5;
}

/**
 * Logs when certain Bluetooth SDP attributes are discovered
 * Constant definitions are from:
 *     https://www.bluetooth.com/specifications/assigned-numbers/service-discovery
 *
 * Current logged attributes:
 * - BluetoothProfileDescriptorList
 * - Supported Features Bitmask
 *
 * Logged from:
 *     system/bt
 */
message BluetoothSdpAttributeReported {
    // An identifier that can be used to match events for this device.
    // Currently, this is a salted hash of the MAC address of this Bluetooth device.
    // Salt: Randomly generated 256 bit value
    // Hash algorithm: HMAC-SHA256
    optional bytes obfuscated_id = 1 [(android.os.statsd.log_mode) = MODE_BYTES];
    // Short form UUIDs used to identify Bluetooth protocols, profiles, and service classes
    // Original type: uint16_t
    optional int32 protocol_uuid = 2;
    // Short form UUIDs used to identify Bluetooth SDP attribute types
    // Original type: uint16_t
    optional int32 attribute_id = 3;
    // Attribute value for the particular attribute
    optional bytes attribute_value = 4 [(android.os.statsd.log_mode) = MODE_BYTES];
    // An identifier that can be used to match events for this device.
    // The incremental identifier is locally generated and guaranteed not derived
    // from any globally unique hardware id.
    // For paired devices, it stays consistent between Bluetooth toggling for the
    // same remote device.
    // For unpaired devices, it stays consistent within the same Bluetooth adapter
    // session for the same remote device.
    // Default: 0 if the device's metric id is unknown.
    optional int32 metric_id = 5;
}

/**
 * Logs when bond state of a Bluetooth device changes
 *
 * Logged from:
 *     frameworks/base/core/java/android/bluetooth/BluetoothDevice.java
 *     packages/apps/Bluetooth/src/com/android/bluetooth/btservice/BondStateMachine.java
 */
message BluetoothBondStateChanged {
    // An identifier that can be used to match events for this device.
    // Currently, this is a salted hash of the MAC address of this Bluetooth device.
    // Salt: Randomly generated 256 bit value
    // Hash algorithm: HMAC-SHA256
    // Size: 32 byte
    // Default: null or empty if the device identifier is not known
    optional bytes obfuscated_id = 1 [(android.os.statsd.log_mode) = MODE_BYTES];
    // Preferred transport type to remote dual mode device
    // Default: TRANSPORT_AUTO means no preference
    optional android.bluetooth.TransportTypeEnum transport = 2;
    // The type of this Bluetooth device (Classic, LE, or Dual mode)
    // Default: UNKNOWN
    optional android.bluetooth.DeviceTypeEnum type = 3;
    // Current bond state (NONE, BONDING, BONDED)
    // Default: BOND_STATE_UNKNOWN
    optional android.bluetooth.BondStateEnum bond_state = 4;
    // Bonding sub state
    // Default: BOND_SUB_STATE_UNKNOWN
    optional android.bluetooth.BondSubStateEnum bonding_sub_state = 5;
    // Unbond Reason
    // Default: UNBOND_REASON_UNKNOWN
    optional android.bluetooth.UnbondReasonEnum unbond_reason = 6;
    // An identifier that can be used to match events for this device.
    // The incremental identifier is locally generated and guaranteed not derived
    // from any globally unique hardware id.
    // For paired devices, it stays consistent between Bluetooth toggling for the
    // same remote device.
    // For unpaired devices, it stays consistent within the same Bluetooth adapter
    // session for the same remote device.
    // Default: 0 if the device's metric id is unknown.
    optional int32 metric_id = 7;
}

/**
 * Logs there is an event related Bluetooth classic pairing
 *
 * Logged from:
 *     system/bt
 */
message BluetoothClassicPairingEventReported {
    // An identifier that can be used to match events for this device.
    // Currently, this is a salted hash of the MAC address of this Bluetooth device.
    // Salt: Randomly generated 256 bit value
    // Hash algorithm: HMAC-SHA256
    // Size: 32 byte
    // Default: null or empty if the device identifier is not known
    optional bytes obfuscated_id = 1 [(android.os.statsd.log_mode) = MODE_BYTES];
    // Connection handle of this connection if available
    // Range: 0x0000 - 0x0EFF (12 bits)
    // Default: 0xFFFF if the handle is unknown
    optional int32 connection_handle = 2;
    // HCI command associated with this event
    // Default: CMD_UNKNOWN
    optional android.bluetooth.hci.CommandEnum hci_cmd = 3;
    // HCI event associated with this event
    // Default: EVT_UNKNOWN
    optional android.bluetooth.hci.EventEnum hci_event = 4;
    // HCI command status code if this is triggerred by hci_cmd
    // Default: STATUS_UNKNOWN
    optional android.bluetooth.hci.StatusEnum cmd_status = 5;
    // HCI reason code associated with this event
    // Default: STATUS_UNKNOWN
    optional android.bluetooth.hci.StatusEnum reason_code = 6;
    // A status value related to this specific event
    // Default: 0
    optional int64 event_value = 7;
    // An identifier that can be used to match events for this device.
    // The incremental identifier is locally generated and guaranteed not derived
    // from any globally unique hardware id.
    // For paired devices, it stays consistent between Bluetooth toggling for the
    // same remote device.
    // For unpaired devices, it stays consistent within the same Bluetooth adapter
    // session for the same remote device.
    // Default: 0 if the device's metric id is unknown.
    optional int32 metric_id = 8;
}

/**
 * Logs when there is an event related to Bluetooth Security Manager Protocol (SMP)
 *
 * Logged from:
 *     system/bt
 */
message BluetoothSmpPairingEventReported {
    // An identifier that can be used to match events for this device.
    // Currently, this is a salted hash of the MAC address of this Bluetooth device.
    // Salt: Randomly generated 256 bit value
    // Hash algorithm: HMAC-SHA256
    // Size: 32 byte
    // Default: null or empty if the device identifier is not known
    optional bytes obfuscated_id = 1 [(android.os.statsd.log_mode) = MODE_BYTES];
    // SMP command sent or received over L2CAP
    // Default: CMD_UNKNOWN
    optional android.bluetooth.smp.CommandEnum smp_command = 2;
    // Whether this command is sent or received
    // Default: DIRECTION_UNKNOWN
    optional android.bluetooth.DirectionEnum direction = 3;
    // SMP failure reason code
    // Default: PAIRING_FAIL_REASON_DEFAULT
    optional android.bluetooth.smp.PairingFailReasonEnum smp_fail_reason = 4;
    // An identifier that can be used to match events for this device.
    // The incremental identifier is locally generated and guaranteed not derived
    // from any globally unique hardware id.
    // For paired devices, it stays consistent between Bluetooth toggling for the
    // same remote device.
    // For unpaired devices, it stays consistent within the same Bluetooth adapter
    // session for the same remote device.
    // Default: 0 if the device's metric id is unknown.
    optional int32 metric_id = 5;
}

/**
 * Logs when a Bluetooth socket’s connection state changed
 *
 * Logged from:
 *   system/bt
 */
message BluetoothSocketConnectionStateChanged {
    // An identifier that can be used to match events for this device.
    // Currently, this is a salted hash of the MAC address of this Bluetooth device.
    // Salt: Randomly generated 256 bit value
    // Hash algorithm: HMAC-SHA256
    // Size: 32 byte
    // Default: null or empty if this is a server listener socket
    optional bytes obfuscated_id = 1 [(android.os.statsd.log_mode) = MODE_BYTES];
    // Temporary port of this socket for the current connection or session only
    // Default 0 when unknown or don't care
    optional int32 port = 2;
    // Socket type as mentioned in
    // frameworks/base/core/java/android/bluetooth/BluetoothSocket.java
    // Default: SOCKET_TYPE_UNKNOWN
    optional android.bluetooth.SocketTypeEnum type = 3;
    // Socket connection state
    // Default: SOCKET_CONNECTION_STATE_UNKNOWN
    optional android.bluetooth.SocketConnectionstateEnum state = 4;
    // Number of bytes sent to remote device during this connection
    optional int64 tx_bytes = 5;
    // Number of bytes received from remote device during this connection
    optional int64 rx_bytes = 6;
    // Socket owner's UID
    optional int32 uid = 7 [(is_uid) = true];
    // Server port of this socket, if any. When both |server_port| and |port| fields are populated,
    // |port| must be spawned by |server_port|
    // Default 0 when unknown or don't care
    optional int32 server_port = 8;
    // Whether this is a server listener socket
    optional android.bluetooth.SocketRoleEnum is_server = 9;
    // An identifier that can be used to match events for this device.
    // The incremental identifier is locally generated and guaranteed not derived
    // from any globally unique hardware id.
    // For paired devices, it stays consistent between Bluetooth toggling for the
    // same remote device.
    // For unpaired devices, it stays consistent within the same Bluetooth adapter
    // session for the same remote device.
    // Default: 0 if the device's metric id is unknown.
    optional int32 metric_id = 10;
}

/**
 * Logs when Class of Device (CoD) value is learnt for a device during pairing or connection
 *
 * Logged from:
 *   packages/apps/Bluetooth/src/com/android/bluetooth/btservice/BondStateMachine.java
 *   packages/apps/Bluetooth/src/com/android/bluetooth/btservice/RemoteDevices.java
 *
 */
message BluetoothClassOfDeviceReported {
    // An identifier that can be used to match events for this device.
    // Currently, this is a salted hash of the MAC address of this Bluetooth device.
    // Salt: Randomly generated 256 bit value
    // Hash algorithm: HMAC-SHA256
    // Size: 32 byte
    // Default: null or empty if this is a server listener socket
    optional bytes obfuscated_id = 1 [(android.os.statsd.log_mode) = MODE_BYTES];
    // Class of Device (CoD) value including both Major, Minor device class and service class
    // Defined in: https://www.bluetooth.com/specifications/assigned-numbers/baseband
    // Also defined in: https://developer.android.com/reference/android/bluetooth/BluetoothClass
    // Default: 0
    optional int32 class_of_device = 2;
    // An identifier that can be used to match events for this device.
    // The incremental identifier is locally generated and guaranteed not derived
    // from any globally unique hardware id.
    // For paired devices, it stays consistent between Bluetooth toggling for the
    // same remote device.
    // For unpaired devices, it stays consistent within the same Bluetooth adapter
    // session for the same remote device.
    // Default: 0 if the device's metric id is unknown.
    optional int32 metric_id = 3;
}

/**
 * Logs when something is plugged into or removed from the USB-C connector.
 *
 * Logged from:
 *  UsbService
 */
message UsbConnectorStateChanged {
    enum State {
        STATE_DISCONNECTED = 0;
        STATE_CONNECTED = 1;
    }
    optional State state = 1
            [(state_field_option).exclusive_state = true, (state_field_option).nested = false];
    optional string id = 2 [(state_field_option).primary_field = true];
    // Last active session in ms.
    // 0 when the port is in connected state.
    optional int64 last_connect_duration_millis = 3;
}

/**
 * Logs the reported speaker impedance.
 *
 * Logged from:
 *  Vendor audio implementation.
 */
message SpeakerImpedanceReported {
    optional int32 speaker_location = 1;
    optional int32 impedance = 2;
}

/**
 * Logs the report of a failed hardware.
 *
 * Logged from:
 *  Vendor HALs.
 *
 */
message HardwareFailed {
    enum HardwareType {
        HARDWARE_FAILED_UNKNOWN = 0;
        HARDWARE_FAILED_MICROPHONE = 1;
        HARDWARE_FAILED_CODEC = 2;
        HARDWARE_FAILED_SPEAKER = 3;
        HARDWARE_FAILED_FINGERPRINT = 4;
    }
    optional HardwareType hardware_type = 1;

   /**
    * hardware_location allows vendors to differentiate between multiple instances of
    * the same hardware_type.  The specific locations are vendor defined integers,
    * referring to board-specific numbering schemes.
    */
    optional int32 hardware_location = 2;

    /**
     * failure_code is specific to the HardwareType of the failed hardware.
     * It should use one of the enum values defined below.
     */
    enum HardwareErrorCode {
        UNKNOWN = 0;
        COMPLETE = 1;
        SPEAKER_HIGH_Z = 2;
        SPEAKER_SHORT = 3;
        FINGERPRINT_SENSOR_BROKEN = 4;
        FINGERPRINT_TOO_MANY_DEAD_PIXELS = 5;
        DEGRADE = 6;
    }
    optional int32 failure_code = 3;
}

/**
 * Log an event when the device has been physically dropped.
 * Reported from the /vendor partition.
 */
message PhysicalDropDetected {
    // Confidence that the event was actually a drop, 0 -> 100
    optional int32 confidence_pctg = 1;
    // Peak acceleration of the drop, in 1/1000s of a g.
    optional int32 accel_peak_thousandths_g = 2;
    // Duration of freefall in ms
    optional int32 freefall_time_millis = 3;
}

/**
 * Log bucketed battery charge cycles.
 *
 * Each bucket represents cycles of the battery past
 * a given charge point.  For example, if 10 cycle buckets are
 * initialized, bucket 1 is the lowest 1/10th of the battery,
 * and bucket 10 is 100%.
 *
 * Logged from:
 * /sys/class/power_supply/bms/cycle_count, via Vendor.
 */
message ChargeCyclesReported {
    optional int32 cycle_bucket_1 = 1;
    optional int32 cycle_bucket_2 = 2;
    optional int32 cycle_bucket_3 = 3;
    optional int32 cycle_bucket_4 = 4;
    optional int32 cycle_bucket_5 = 5;
    optional int32 cycle_bucket_6 = 6;
    optional int32 cycle_bucket_7 = 7;
    optional int32 cycle_bucket_8 = 8;
    optional int32 cycle_bucket_9 = 9;
    optional int32 cycle_bucket_10 = 10;
}

/**
 * Log battery health snapshot.
 *
 * Resistance, Voltage, Open Circuit Voltage, Temperature, and Charge Level
 * are snapshotted periodically over 24hrs.
 */
message BatteryHealthSnapshot {
    enum BatterySnapshotType {
        UNKNOWN = 0;
        MIN_TEMP = 1;         // Snapshot at min batt temp over 24hrs.
        MAX_TEMP = 2;         // Snapshot at max batt temp over 24hrs.
        MIN_RESISTANCE = 3;   // Snapshot at min batt resistance over 24hrs.
        MAX_RESISTANCE = 4;   // Snapshot at max batt resistance over 24hrs.
        MIN_VOLTAGE = 5;      // Snapshot at min batt voltage over 24hrs.
        MAX_VOLTAGE = 6;      // Snapshot at max batt voltage over 24hrs.
        MIN_CURRENT = 7;      // Snapshot at min batt current over 24hrs.
        MAX_CURRENT = 8;      // Snapshot at max batt current over 24hrs.
        MIN_BATT_LEVEL = 9;   // Snapshot at min battery level (SoC) over 24hrs.
        MAX_BATT_LEVEL = 10;  // Snapshot at max battery level (SoC) over 24hrs.
        AVG_RESISTANCE = 11;  // Snapshot at average battery resistance over 24hrs.
    }
    optional BatterySnapshotType type = 1;
    // Temperature, in 1/10ths of degree C.
    optional int32 temperature_deci_celsius = 2;
    // Voltage Battery Voltage, in microVolts.
    optional int32 voltage_micro_volt = 3;
    // Current Battery current, in microAmps.
    optional int32 current_micro_amps = 4;
    // OpenCircuitVoltage Battery Open Circuit Voltage, in microVolts.
    optional int32 open_circuit_micro_volt = 5;
    // Resistance Battery Resistance, in microOhms.
    optional int32 resistance_micro_ohm = 6;
    // Level Battery Level, as % of full.
    optional int32 level_percent = 7;
}

/**
 * Log slow I/O operations on the primary storage.
 */
message SlowIo {
    // Classifications of IO Operations.
    enum IoOperation {
        UNKNOWN = 0;
        READ = 1;
        WRITE = 2;
        UNMAP = 3;
        SYNC = 4;
    }
    optional IoOperation operation = 1;

    // The number of slow IO operations of this type over 24 hours.
    optional int32 count = 2;
}

/**
 * Log battery caused shutdown with the last recorded voltage.
 */
message BatteryCausedShutdown {
    // The last recorded battery voltage prior to shutdown.
    optional int32 last_recorded_micro_volt = 1;
}

/**
 * Logs when ThermalService receives throttling events.
 *
 * Logged from:
 *   frameworks/base/services/core/java/com/android/server/stats/StatsCompanionService.java
 */
message ThermalThrottlingSeverityStateChanged {
    // The type of temperature being reported (CPU, GPU, SKIN, etc)
    optional android.os.TemperatureTypeEnum sensor_type = 1;

    // The name of the temperature source. Eg. CPU0
    optional string sensor_name = 2;

    // Temperature in tenths of a degree C.
    // For BCL, it is decimillivolt, decimilliamps, and percentage * 10.
    optional int32 temperature_deci_celsius = 3;

    // Relative severity of the throttling, see enum definition.
    optional android.os.ThrottlingSeverityEnum severity = 4;
}

/**
 * Logs the duration of a davey (jank of >=700ms) when it occurs
 *
 * Logged from:
 *   frameworks/base/libs/hwui/JankTracker.cpp
 */
message DaveyOccurred {
    // The UID that logged this atom.
    optional int32 uid = 1 [(is_uid) = true];

    // Amount of time it took to render the frame. Should be >=700ms.
    optional int64 jank_duration_millis = 2;
}

/**
 * Logs phone signal strength changes.
 *
 * Logged from:
 *   frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
 */
message PhoneSignalStrengthChanged {
    // Signal strength, from frameworks/base/core/proto/android/telephony/enums.proto.
    optional android.telephony.SignalStrengthEnum signal_strength = 1;
}


/**
 * Logs when the phone state, sim state or signal strength changes
 *
 * Logged from:
 *   frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
 */
message PhoneServiceStateChanged {
    optional android.telephony.ServiceStateEnum state = 1;
    optional android.telephony.SimStateEnum sim_state = 2;
    optional android.telephony.SignalStrengthEnum signal_strength = 3;
}

/**
 * Logs when the phone becomes on or off.
 *
 * Logged from:
 *   frameworks/base/core/java/com/android/internal/os/TelephonyRegistry.java
 */
message PhoneStateChanged {
    enum State {
        OFF = 0;
        ON = 1;
    }
    optional State state = 1;
}

message BackGesture {
    enum BackType {
        DEFAULT_BACK_TYPE = 0;
        COMPLETED = 1;
        COMPLETED_REJECTED = 2; // successful because coming from rejected area
        INCOMPLETE_EXCLUDED = 3; // would have been successful but in the exclusion area
        INCOMPLETE = 4;  // Unsuccessful, for reasons other than below.
        INCOMPLETE_FAR_FROM_EDGE = 5;  // Unsuccessful, far from the edge.
        INCOMPLETE_MULTI_TOUCH = 6;  // Unsuccessful, multi touch.
        INCOMPLETE_LONG_PRESS = 7;  // Unsuccessful, long press.
        INCOMPLETE_VERTICAL_MOVE = 8;  // Unsuccessful, move vertically.
    }
    optional BackType type = 1;

    optional int32 y_coordinate = 2 [deprecated = true]; // y coordinate for ACTION_DOWN event
    optional int32 start_x = 4;  // X coordinate for ACTION_DOWN event.
    optional int32 start_y = 5;  // Y coordinate for ACTION_DOWN event.
    optional int32 end_x = 6;   // X coordinate for ACTION_MOVE event.
    optional int32 end_y = 7;  // Y coordinate for ACTION_MOVE event.
    optional int32 left_boundary = 8;  // left edge width + left inset
    optional int32 right_boundary = 9;  // screen width - (right edge width + right inset)

    enum WindowHorizontalLocation {
        DEFAULT_LOCATION = 0;
        LEFT = 1;
        RIGHT = 2;
    }
    optional WindowHorizontalLocation x_location = 3 [deprecated = true];
}

message ExclusionRectStateChanged {
    optional string component_name = 1;    // if not available, simply packageName
    optional int32 requested_height = 2;   // px
    optional int32 rejected_height = 3;    // px

    enum WindowHorizontalLocation {
        DEFAULT_LOCATION = 0;
        LEFT = 1;
        RIGHT = 2;
    }
    optional WindowHorizontalLocation x_location = 4;
    optional bool landscape = 5;
    optional bool splitscreen = 6;
    optional int32 duration_millis = 7;
}

/**
 * Logs when IME is on.
 *
 * Logged from: /packages/SystemUI/src/com/android/systemui/
                statusbar/phone/NavigationBarView.java
 *
 */
message ImeTouchReported {
    optional int32 x_coordinate = 1;  // X coordinate for ACTION_DOWN event.
    optional int32 y_coordinate = 2;  // Y coordinate for ACTION_DOWN event.
}

/**
 * Logs when Launcher (HomeScreen) UI has changed or was interacted.
 *
 * Logged from:
 *   packages/apps/Launcher3
 */
message LauncherUIChanged {
    optional android.stats.launcher.LauncherAction action = 1 [deprecated = true];
    optional android.stats.launcher.LauncherState src_state = 2;
    optional android.stats.launcher.LauncherState dst_state = 3;
    optional android.stats.launcher.LauncherExtension extension = 4 [(log_mode) = MODE_BYTES, deprecated = true];
    optional bool is_swipe_up_enabled = 5 [deprecated = true];

    // The event id (e.g., app launch, drag and drop, long press)
    optional int32 event_id = 6;
    // The event's source or target id (e.g., icon, task, button)
    optional int32 target_id = 7;
    // If the target needs to be tracked, use this id field
    optional int32 instance_id = 8;
    optional int32 uid = 9 [(is_uid) = true];
    optional string package_name = 10;
    optional string component_name = 11;

    // (x, y) coordinate and the index information of the target on the container
    optional int32 grid_x = 12 [default = -1];
    optional int32 grid_y = 13 [default = -1];
    optional int32 page_id = 14 [default = -2];

    // e.g., folder icon's (x, y) location and index information on the workspace
    optional int32 grid_x_parent = 15 [default = -1];
    optional int32 grid_y_parent = 16 [default = -1];
    optional int32 page_id_parent = 17 [default = -2];

    // e.g., SEARCHBOX_ALLAPPS, FOLDER_WORKSPACE
    optional int32 hierarchy = 18;

    optional bool is_work_profile = 19;

    // Used to store the predicted rank of the target
    optional int32 rank = 20 [default = -1];

    // e.g., folderLabelState can be captured in the following two fields
    optional int32 from_state = 21;
    optional int32 to_state = 22;

    // e.g., autofilled or suggested texts that are not user entered
    optional string edittext = 23;

    // e.g., number of contents inside a container (e.g., icons inside a folder)
    optional int32 cardinality = 24;
}

/**
 * Used for snapshot of the HomeScreen UI elements
 *
 * Logged from:
 *   packages/apps/Launcher3
 */
message LauncherStaticLayout {
    // The event id (e.g., snapshot, drag and drop)
    optional int32 event_id = 1;
    // The event's source or target id (e.g., icon, shortcut, widget)
    optional int32 target_id = 2;
    // If the target needs to be tracked, use this id field
    optional int32 instance_id = 3;
    optional int32 uid = 4 [(is_uid) = true];
    optional string package_name = 5;
    optional string component_name = 6;

    // (x, y) coordinate and the index information of the target on the container
    optional int32 grid_x = 7 [default = -1];
    optional int32 grid_y = 8 [default = -1];
    optional int32 page_id = 9 [default = -2];

    // e.g., folder icon's (x, y) location and index information on the workspace
    // e.g., when used with widgets target, use these values for (span_x, span_y)
    optional int32 grid_x_parent = 10 [default = -1];
    optional int32 grid_y_parent = 11 [default = -1];
    optional int32 page_id_parent = 12 [default = -2];

    // UNKNOWN = 0
    // HOTSEAT = 1
    // WORKSPACE = 2
    // FOLDER_HOTSEAT = 3
    // FOLDER_WORKSPACE = 4
    optional int32 hierarchy = 13;

    optional bool is_work_profile = 14;

    // e.g., PIN, WIDGET TRAY, APPS TRAY, PREDICTION
    optional int32 origin = 15;

    // e.g., number of icons inside a folder
    optional int32 cardinality = 16;

    // e.g., (x, y) span of the widget inside homescreen grid system
    optional int32 span_x = 17 [default = 1];
    optional int32 span_y = 18 [default = 1];
}

/**
 * Logs when Wallpaper or ThemePicker UI has changed.
 *
 * Logged from:
 *   packages/apps/ThemePicker
 *   packages/apps/WallpaperPicker2
 */
message StyleUIChanged {
    optional android.stats.style.Action action = 1;
    optional int32 color_package_hash = 2;
    optional int32 font_package_hash  = 3;
    optional int32 shape_package_hash = 4;
    optional int32 clock_package_hash = 5;
    optional int32 launcher_grid = 6;
    optional int32 wallpaper_category_hash = 7;
    optional int32 wallpaper_id_hash = 8;
    optional int32 color_preference = 9;
    optional android.stats.style.LocationPreference location_preference = 10;
}

/**
 * Logs when Settings UI has changed.
 *
 * Logged from:
 *   packages/apps/Settings
 */
message SettingsUIChanged {
    /**
     * Where this SettingsUIChange event comes from. For example, if
     * it's a PAGE_VISIBLE event, where the page is opened from.
     */
    optional android.app.settings.PageId attribution = 1;

    /**
     * What the UI action is.
     */
    optional android.app.settings.Action action = 2;

    /**
     * Where the action is happening
     */
    optional android.app.settings.PageId page_id = 3;

    /**
     * What preference changed in this event.
     */
    optional string changed_preference_key = 4;

    /**
     * The new value of the changed preference.
     */
    optional int64 changed_preference_int_value = 5;
}

/**
 * Logs basic timing information about touch events.
 * Reported at most every 5 minutes while device is being interacted with.
 *
 * Logged from:
 *   frameworks/native/services/inputflinger
 */
message TouchEventReported {
    /**
     * The fields latency_{min|max|mean|stdev} represent minimum, maximum, mean,
     * and the standard deviation of the time spent processing touchscreen events
     * in the kernel and inputflinger. The units are microseconds.
     *
     * On supported devices, the starting point is taken during the hard interrupt inside the
     * kernel touch driver. On all other devices, the starting point is taken inside
     * the kernel's input event subsystem upon receipt of the input event.
     * The ending point is taken inside InputDispatcher, just after the input event
     * is sent to the app.
     */
    // Minimum value
    optional float latency_min_micros = 1;
    // Maximum value
    optional float latency_max_micros = 2;
    // Average value
    optional float latency_mean_micros = 3;
    // Standard deviation
    optional float latency_stdev_micros = 4;
    // Number of touch events (input_event) in this report
    optional int32 count = 5;
}

/**
 * Logs gesture classification and timing information for touch events.
 *
 * Logged from:
 *   frameworks/base/core/java/android/view/GestureDetector.java
 *   frameworks/base/core/java/android/view/View.java
 */
message TouchGestureClassified {
    // The source of the classification (e.g. Java class name).
    optional string source = 1;

    enum Classification {
        UNKNOWN_CLASSIFICATION = 0;
        SINGLE_TAP = 1;
        DOUBLE_TAP = 2;
        LONG_PRESS = 3;
        DEEP_PRESS = 4;
        SCROLL = 5;
    }
    // The classification of the gesture.
    optional Classification classification = 2;

    // The interval from the start of a touch event stream until the
    // classification was made.
    optional int32 latency_millis = 3;

    // The distance from the location of the first touch event to the
    // location of the touch event when the classification was made.
    optional float displacement_px = 4;
}

/**
 * Logs that a setting was updated.
 * Logged from:
 *   frameworks/base/packages/SettingsProvider/src/com/android/providers/settings/SettingsState.java
 * The tag and is_default allow resetting of settings to default values based on the specified
 * tag. See Settings#putString(ContentResolver, String, String, String, boolean) for more details.
 */
message SettingChanged {
    // The name of the setting.
    optional string setting = 1;

    // The change being imposed on this setting. May represent a number, eg "3".
    optional string value = 2;

    // The new value of this setting. For most settings, this is same as value. For some settings,
    // value is +X or -X where X represents an element in a set. For example, if the previous value
    // is A,B,C and value is -B, then new_value is A,C and prev_value is A,B,C.
    // The +/- feature is currently only used for location_providers_allowed.
    optional string new_value = 3;

    // The previous value of this setting.
    optional string prev_value = 4;

    // The tag used with the is_default for resetting sets of settings. This is generally null.
    optional string tag = 5;

    // True if this setting with tag should be resettable.
    optional bool is_default = 6;

    // The associated user (for multi-user feature). Defined in android/os/UserHandle.java
    optional int32 user = 7;

    enum ChangeReason {
        UPDATED = 1; // Updated can be an insertion or an update.
        DELETED = 2;
    }
    optional ChangeReason reason = 8;
}

/**
 * Logs activity going to foreground or background
 *
 * Logged from:
  *   frameworks/base/services/core/java/com/android/server/am/ActivityRecord.java
 */
message ActivityForegroundStateChanged {
    optional int32 uid = 1 [(is_uid) = true];
    optional string pkg_name = 2;
    optional string class_name = 3;

    enum State {
        BACKGROUND = 0;
        FOREGROUND = 1;
    }
    optional State state = 4;
}

/**
 * Logs when a volume entered low Storage state.
 * Logged from:
 *      frameworks/base/services/core/java/com/android/server/storage/DeviceStorageMonitorService.java
 */
message LowStorageStateChanged {
    // Volume that ran out of storage.
    optional string volume_description = 1;

    enum State {
        UNKNOWN = 0;
        OFF = 1;
        ON = 2;
    }
    optional State state = 2;
}

/**
 * Logs when an app is downgraded.
 * Logged from:
 *      frameworks/base/services/core/java/com/android/server/pm/BackgroundDexOptService.java
 */
message AppDowngraded {
    optional string package_name = 1;
    // Size of the package (all data) before being downgraded.
    optional int64 size_in_bytes_before = 2;
    // Size of the package (all data) after being downgraded.
    optional int64 size_in_bytes_after = 3;

    optional bool aggressive = 4;
}

/**
 * Logs when an app is optimized after being downgraded.
 * Logged from:
 *      frameworks/base/services/core/java/com/android/server/pm/BackgroundDexOptService.java
 */
message AppOptimizedAfterDowngraded {
    optional string package_name = 1;
}

/**
 * Logs whenever an app is installed on external storage.
 * Logged from:
        frameworks/base/services/core/java/com/android/server/pm/PackageManagerService.java
 */
message AppInstallOnExternalStorageReported {
    // The type of external storage.
    optional android.stats.storage.ExternalStorageType storage_type = 1;
    // The name of the package that is installed on the sd card.
    optional string package_name = 2;
}

/**
 * Logs when an app crashes.
 * Logged from:
 *      frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
 */
message AppCrashOccurred {
    optional int32 uid = 1 [(is_uid) = true];

    optional string event_type = 2;

    // The name of the process.
    // system_server if it is not by an app
    optional string process_name = 3;

    // The pid if available. -1 means not available.
    optional int32 pid = 4;

    optional string package_name = 5;

    enum InstantApp {
        UNAVAILABLE = 0;
        FALSE = 1;
        TRUE = 2;
    }
    optional InstantApp is_instant_app = 6;

    enum ForegroundState {
        UNKNOWN = 0;
        BACKGROUND = 1;
        FOREGROUND = 2;
    }
    optional ForegroundState foreground_state = 7;

    optional android.server.ErrorSource error_source = 8;
}

/**
 * Logs when a WTF (What a Terrible Failure) happened.
 * Logged from:
 *      frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
 */
message WTFOccurred {
    optional int32 uid = 1 [(is_uid) = true];

    optional string tag = 2;

    // The name of the process.
    // system_server if it is not by an app
    optional string process_name = 3;

    // The pid if available. -1 means not available.
    optional int32 pid = 4;

    optional android.server.ErrorSource error_source = 5;
}

/**
 * Logs when system server reports low memory.
 * Logged from:
 *      frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
 */
message LowMemReported {
}

/**
 * Logs when an app ANR (App Not Responding) occurs.
 * Logged from:
 *      frameworks/base/services/core/java/com/android/server/am/AppErrors.java
 */
message ANROccurred {
    optional int32 uid = 1 [(is_uid) = true];

    optional string process_name = 2;

    optional string short_component_name = 3;

    optional string reason = 4;

    enum InstantApp {
        UNAVAILABLE = 0;
        FALSE = 1;
        TRUE = 2;
    }
    optional InstantApp is_instant_app = 5;

    enum ForegroundState {
        UNKNOWN = 0;
        BACKGROUND = 1;
        FOREGROUND = 2;
    }
    optional ForegroundState foreground_state = 6;

    optional android.server.ErrorSource error_source = 7;

    optional string package_name = 8;
}

/**
 * Logs when the vibrator state changes.
 * Logged from:
 *      frameworks/base/services/core/java/com/android/server/VibratorService.java
 */
message VibratorStateChanged {
    repeated AttributionNode attribution_node = 1;

    enum State {
        OFF = 0;
        ON = 1;
    }
    optional State state = 2;

    // Duration (in milliseconds) requested to keep the vibrator on.
    // Only applicable for State == ON.
    optional int64 duration_millis = 3;
}

/*
 * Allows other apps to push events into statsd.
 * Logged from:
 *      frameworks/base/core/java/android/util/StatsLog.java
 */
message AppBreadcrumbReported {
    // The uid of the application that sent this custom atom.
    optional int32 uid = 1 [(is_uid) = true];

    // An arbitrary label chosen by the developer. For Android P, the label should be in [0, 16).
    optional int32 label = 2;

    // Allows applications to easily use a custom event as start/stop boundaries (ie, define custom
    // predicates for the metrics).
    enum State {
        UNKNOWN = 0;
        UNSPECIFIED = 1;  // For events that are known to not represent START/STOP.
        STOP = 2;
        START = 3;
    }
    optional State state = 3;
}

/**
 * Logs the wall-clock time when a significant wall-clock time shift occurs.
 * For example, this could be due to the user manually changing the time.
 *
 * Logged from:
 *   frameworks/base/services/core/java/com/android/server/AlarmManagerService.java
 */
message WallClockTimeShifted {
    // New wall-clock time in milliseconds, according to System.currentTimeMillis().
    optional int64 wall_clock_timestamp_millis = 1;
}

/**
 * Logs when statsd detects an anomaly.
 *
 * Logged from:
 *   frameworks/base/cmds/statsd/src/anomaly/AnomalyTracker.cpp
 */
message AnomalyDetected {
    // Uid that owns the config whose anomaly detection alert fired.
    optional int32 config_uid = 1 [(is_uid) = true];

    // Id of the config whose anomaly detection alert fired.
    optional int64 config_id = 2;

    // Id of the alert (i.e. name of the anomaly that was detected).
    optional int64 alert_id = 3;
}

message AppStartOccurred {
    // The uid if available. -1 means not available.
    optional int32 uid = 1 [(is_uid) = true];

    // The app package name.
    optional string pkg_name = 2;

    enum TransitionType {
        UNKNOWN = 0;
        WARM = 1;
        HOT = 2;
        COLD = 3;
    }
    // The transition type.
    optional TransitionType type = 3;

    // The activity name.
    optional string activity_name = 4;

    // The name of the calling app. Empty if not set.
    optional string calling_pkg_name = 5;

    // Whether the app is an instant app.
    optional bool is_instant_app = 6;

    // Device uptime when activity started.
    optional int64 activity_start_millis = 7;

    optional android.app.AppTransitionReasonEnum reason = 8;

    optional int32 transition_delay_millis = 9;
    // -1 if not set.
    optional int32 starting_window_delay_millis = 10;
    // -1 if not set.
    optional int32 bind_application_delay_millis = 11;
    optional int32 windows_drawn_delay_millis = 12;

    // Empty if not set.
    optional string launch_token = 13;

    // The compiler filter used when when the package was optimized.
    optional int32 package_optimization_compilation_filter = 14;

    // The reason why the package was optimized.
    optional int32 package_optimization_compilation_reason = 15;
}

message AppStartCanceled {
    // The uid if available. -1 means not available.
    optional int32 uid = 1 [(is_uid) = true];

    // The app package name.
    optional string pkg_name = 2;

    enum TransitionType {
        UNKNOWN = 0;
        WARM = 1;
        HOT = 2;
        COLD = 3;
    }
    // The transition type.
    optional TransitionType type = 3;

    // The activity name.
    optional string activity_name = 4;
}

message AppStartFullyDrawn {
    // The uid if available. -1 means not available.
    optional int32 uid = 1 [(is_uid) = true];

    // The app package name.
    optional string pkg_name = 2;

    enum TransitionType {
        UNKNOWN = 0;
        WITH_BUNDLE = 1;
        WITHOUT_BUNDLE = 2;
    }
    // The transition type.
    optional TransitionType type = 3;

    // The activity name.
    optional string activity_name = 4;

    optional bool transition_process_running = 5;

    // App startup time (until call to Activity#reportFullyDrawn()).
    optional int64 app_startup_time_millis = 6;
}

/**
 * Logs a picture-in-picture action
 * Logged from:
 *      frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
 *      frameworks/base/services/core/java/com/android/server/am/ActivityStackSupervisor.java
 *      frameworks/base/packages/SystemUI/src/com/android/systemui/pip/phone/PipTouchHandler.java
 */
message PictureInPictureStateChanged {
    // -1 if it is not available
    optional int32 uid = 1 [(is_uid) = true];

    optional string short_name = 2;

    enum State {
        ENTERED = 1;
        EXPANDED_TO_FULL_SCREEN = 2;
        MINIMIZED = 3;
        DISMISSED = 4;
    }
    optional State state = 3;
}

/**
 * Logs overlay action
 * Logged from:
 *     services/core/java/com/android/server/wm/Session.java
 */
message OverlayStateChanged {
    optional int32 uid = 1 [(state_field_option).primary_field = true, (is_uid) = true];

    optional string package_name = 2 [(state_field_option).primary_field = true];

    optional bool using_alert_window = 3;

    enum State {
        ENTERED = 1;
        EXITED = 2;
    }
    optional State state = 4
            [(state_field_option).exclusive_state = true, (state_field_option).nested = false];
}

/**
 * Logs foreground service starts and stops.
 * Note that this is not when a service starts or stops, but when it is
 * considered foreground.
 * Logged from
 *     frameworks/base/services/core/java/com/android/server/am/ActiveServices.java
 */
message ForegroundServiceStateChanged {
    optional int32 uid = 1 [(is_uid) = true];
    // package_name + "/" + class_name
    optional string short_name = 2;

    enum State {
        ENTER = 1;
        EXIT = 2;
    }
    optional State state = 3;

    // Whether the fgs is allowed while-in-use permissions, i.e. is considered 'in-use' to the user.
    // (If the fgs was started while the app wasn't TOP it usually will be denied these permissions)
    optional bool allow_while_in_use_permission = 4;
}

/**
 * Logs the number of times a uid accesses a sensitive AppOp during a foreground service session.
 * A foreground service session is any continuous period during which the uid holds at least one
 * foreground service; the atom will be pushed when the uid no longer holds any foreground services.
 * Accesses initiated while the uid is in the TOP state are ignored.
 * Sessions with no attempted accesses are not logged.
 * Logged from
 *     frameworks/base/services/core/java/com/android/server/am/ActiveServices.java
 */
message ForegroundServiceAppOpSessionEnded {
    optional int32 uid = 1 [(is_uid) = true];

    // The operation's name.
    // Only following four ops are logged
    // COARSE_LOCATION = 0
    // FINE_LOCATION = 1
    // CAMERA = 26
    // RECORD_AUDIO = 27
    optional android.app.AppOpEnum app_op_name = 2 [default = APP_OP_NONE];

    // The uid's permission mode for accessing the AppOp during this fgs session.
    enum Mode {
        MODE_UNKNOWN = 0;
        MODE_ALLOWED = 1; // Always allowed
        MODE_IGNORED = 2; // Denied
        MODE_FOREGROUND = 3; // Allow-while-in-use (or allowed-one-time)
    }
    optional Mode app_op_mode = 3;

    // Number of times this AppOp was requested and allowed.
    optional int32 count_ops_accepted = 4;
    // Number of times this AppOp was requested but denied.
    optional int32 count_ops_rejected = 5;
}

/**
 * Logs creation or removal of an isolated uid. Isolated uid's are temporary uid's to sandbox risky
 * behavior in its own uid. However, the metrics of these isolated uid's almost always should be
 * attributed back to the parent (host) uid. One example is Chrome.
 *
 * Logged from:
 *   frameworks/base/core/java/com/android/internal/os/BatteryStatsImpl.java
 */
message IsolatedUidChanged {
    // The host UID. Generally, we should attribute metrics from the isolated uid to the host uid.
    // NOTE: DO NOT annotate uid field in this atom. This atom is specially handled in statsd.
    // This field is ignored when event == REMOVED.
    optional int32 parent_uid = 1;

    optional int32 isolated_uid = 2;

    // We expect an isolated uid to be removed before if it's used for another parent uid.
    enum Event {
        REMOVED = 0;
        CREATED = 1;
    }
    optional Event event = 3;
}

/*
 * Logs the reception of an incoming network packet causing the main system to wake up for
 * processing that packet. These events are notified by the kernel via Netlink NFLOG to Netd
 * and processed by WakeupController.cpp.
 */
message PacketWakeupOccurred {
    // The uid owning the socket into which the packet was delivered, or -1 if the packet was
    // delivered nowhere.
    optional int32 uid = 1 [(is_uid) = true];
    // The interface name on which the packet was received.
    optional string iface = 2;
    // The ethertype value of the packet.
    optional int32 ethertype = 3;
    // String representation of the destination MAC address of the packet.
    optional string destination_hardware_address = 4;
    // String representation of the source address of the packet if this was an IP packet.
    optional string source_ip = 5;
    // String representation of the destination address of the packet if this was an IP packet.
    optional string destination_ip = 6;
    // The value of the protocol field if this was an IPv4 packet or the value of the Next Header
    // field if this was an IPv6 packet. The range of possible values is the same for both IP
    // families.
    optional int32 ip_next_header = 7;
    // The source port if this was a TCP or UDP packet.
    optional int32 source_port = 8;
    // The destination port if this was a TCP or UDP packet.
    optional int32 destination_port = 9;
}

/*
 * Logs the memory stats for an app on startup.
 * Logged from:
 *     frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
 */
message AppStartMemoryStateCaptured {
    // The uid if available. -1 means not available.
    optional int32 uid = 1 [(is_uid) = true];

    // The process name.
    optional string process_name = 2;

    // The activity name.
    optional string activity_name = 3;

    // # of page-faults
    optional int64 page_fault = 4;

    // # of major page-faults
    optional int64 page_major_fault = 5;

    // RSS
    optional int64 rss_in_bytes = 6;

    // CACHE
    optional int64 cache_in_bytes = 7;

    // SWAP
    optional int64 swap_in_bytes = 8;
}

/*
 * Logs the change in Low Memory Killer Daemon (LMKD) state which is used as start/stop boundaries
 * for LMK event.
 * Logged from:
 *      system/core/lmkd/lmkd.c
 */
message LmkStateChanged {
    enum State {
        UNKNOWN = 0;
        START = 1;
        STOP = 2;
    }
    optional State state = 1;
}

/*
 * Logs the event when Low Memory Killer Daemon (LMKD) kills a process to reduce memory pressure.
 * Logged from:
 *      system/core/lmkd/lmkd.c
 */
message LmkKillOccurred {
    // The uid if available. -1 means not available.
    optional int32 uid = 1 [(is_uid) = true];

    // The process name.
    optional string process_name = 2;

    // oom adj score.
    optional int32 oom_adj_score = 3;

    // # of page-faults
    optional int64 page_fault = 4;

    // # of major page-faults
    optional int64 page_major_fault = 5;

    // RSS
    optional int64 rss_in_bytes = 6;

    // CACHE
    optional int64 cache_in_bytes = 7;

    // SWAP
    optional int64 swap_in_bytes = 8;

    // The elapsed real time of start of the process.
    optional int64 process_start_time_nanos = 9;

    // Min oom adj score considered by lmkd.
    optional int32 min_oom_score = 10;
}

/*
 * Logs when the ActivityManagerService detects that an app died.
 *
 * Logged from:
 *   frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
 */
message AppDied {
    // timestamp(elapsedRealtime) of record creation
    optional uint64 timestamp_millis = 1 [(state_field_option).exclusive_state = true];
}

/**
 * An atom for generic metrics logging. Available from Android Q.
 */
message GenericAtom {
    // The uid of the application that sent this custom atom.
    optional int32 uid = 1 [(is_uid) = true];

    // An event_id indicates the type of event.
    optional android.stats.EventType event_id = 2;
}

/**
 * Atom for simple logging of user interaction and impression events, such as "the user touched
 * this button" or "this dialog was displayed".
 * Keep the UI event stream clean: don't use for system or background events.
 * Log using the UiEventLogger wrapper - don't write with the StatsLog API directly.
 *
 * Logged from:
 *   frameworks/base/services/core/java/com/android/server/
 *   frameworks/base/packages/SystemUI/src/com/android/systemui/
 */
message UiEventReported {
    // The event_id.
    optional int32 event_id = 1;
    // The event's source or target uid and package, if applicable.
    // For example, the package posting a notification, or the destination package of a share.
    optional int32 uid = 2 [(is_uid) = true];
    optional string package_name = 3;
    // An identifier used to disambiguate which logs refer to a particular instance of some
    // UI element. Useful when there might be multiple instances simultaneously active.
    optional int32 instance_id = 4;
}

/**
 * Reports a notification was created or updated.
 *
 * Logged from:
 *   frameworks/base/services/core/java/com/android/server/notification/
 */
message NotificationReported {
    // The event_id (as for UiEventReported).
    optional int32 event_id = 1;
    // The notifying app's uid and package.
    optional int32 uid = 2 [(is_uid) = true];
    optional string package_name = 3;
    // A small system-assigned identifier for the notification.
    // Locally probably-unique, but expect collisions across users and/or days.
    optional int32 instance_id = 4;
    optional int32 notification_id_hash = 5;  // Small hash of the app-assigned notif ID + tag
    optional int32 channel_id_hash = 6;  // Small hash of app-assigned channel ID

    // Grouping information
    optional int32 group_id_hash = 7;  // Small hash of the group ID of the notification
    optional int32 group_instance_id = 8;  // Instance_id of the group-summary notification
    optional bool is_group_summary = 9;  // Tags the group-summary notification

    // Attributes
    optional string category = 10;   // App-assigned notification category (API-defined strings)
    optional int32 style = 11;       // App-assigned notification style
    optional int32 num_people = 12;  // Number of Person records attached to the notification

    // Ordering, importance and interruptiveness

    optional int32 position = 13;    // Position in NotificationManager's list

    optional android.stats.sysui.NotificationImportance importance = 14;
    optional int32 alerting = 15;    // Bitfield, 1=buzz 2=beep 4=blink

    enum NotificationImportanceExplanation {
        IMPORTANCE_EXPLANATION_UNKNOWN = 0;
        IMPORTANCE_EXPLANATION_APP = 1;     // App-specified channel importance.
        IMPORTANCE_EXPLANATION_USER = 2;    // User-specified channel importance.
        IMPORTANCE_EXPLANATION_ASST = 3;    // Notification Assistant override.
        IMPORTANCE_EXPLANATION_SYSTEM = 4;  // System override.
        // Like _APP, but based on pre-channels priority signal.
        IMPORTANCE_EXPLANATION_APP_PRE_CHANNELS = 5;
    }

    optional NotificationImportanceExplanation importance_source = 16;
    optional android.stats.sysui.NotificationImportance importance_initial = 17;
    optional NotificationImportanceExplanation importance_initial_source = 18;
    optional android.stats.sysui.NotificationImportance importance_asst = 19;
    optional int32 assistant_hash = 20;
    optional float assistant_ranking_score = 21;
}

message Notification {
    // The notifying app's uid and package.
    optional int32 uid = 1 [(is_uid) = true];
    optional string package_name = 2;
    // A small system-assigned identifier for the notification.
    optional int32 instance_id = 3;

    // Grouping information.
    optional int32 group_instance_id = 4;
    optional bool is_group_summary = 5;

    // The section of the shade that the notification is in.
    // See NotificationSectionsManager.PriorityBucket.
    enum NotificationSection {
        SECTION_UNKNOWN = 0;
        SECTION_HEADS_UP = 1;
        SECTION_MEDIA_CONTROLS = 2;
        SECTION_PEOPLE = 3;
        SECTION_ALERTING = 4;
        SECTION_SILENT = 5;
    }
    optional NotificationSection section = 6;
}

message NotificationList {
    repeated Notification notifications = 1;  // An ordered sequence of notifications.
}

/**
 * Reports a notification panel was displayed, e.g. from the lockscreen or status bar.
 *
 * Logged from:
 *   frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/notification/
 */
message NotificationPanelReported {
    // The event_id (as for UiEventReported).
    optional int32 event_id = 1;
    optional int32 num_notifications = 2;
    // The notifications in the panel, in the order that they appear there.
    optional NotificationList notifications = 3 [(log_mode) = MODE_BYTES];
}

/**
 * Reports a notification channel, or channel group, was created, updated, or deleted.
 *
 * Logged from:
 *   frameworks/base/services/core/java/com/android/server/notification/
 */
message NotificationChannelModified {
    // The event_id (as for UiEventReported).
    optional int32 event_id = 1;
    // The notifying app's uid and package.
    optional int32 uid = 2 [(is_uid) = true];
    optional string package_name = 3;
    // Hash of app-assigned notification channel ID or channel-group ID
    optional int32 channel_id_hash = 4;
    // Previous importance setting, if applicable
    optional android.stats.sysui.NotificationImportance old_importance = 5;
    // New importance setting
    optional android.stats.sysui.NotificationImportance importance = 6;
}


/**
 * Logs when a biometric acquire event occurs.
 *
 * Logged from:
 *   frameworks/base/services/core/java/com/android/server/biometrics
 */
message BiometricAcquired {
    // Biometric modality that was acquired.
    optional android.hardware.biometrics.ModalityEnum modality = 1;
    // The associated user. Eg: 0 for owners, 10+ for others. Defined in android/os/UserHandle.java.
    optional int32 user = 2;
    // If this acquire is for a crypto operation. e.g. Secure purchases, unlock password storage.
    optional bool is_crypto = 3;
    // Action that the device is performing. Acquired messages are only expected for enroll and
    // authenticate. Other actions may indicate an error.
    optional android.hardware.biometrics.ActionEnum action = 4;
    // The client that this acquisition was received for.
    optional android.hardware.biometrics.ClientEnum client = 5;
    // Acquired constants, e.g. ACQUIRED_GOOD. See constants defined by <Biometric>Manager.
    optional int32 acquire_info = 6;
    // Vendor-specific acquire info. Valid only if acquire_info == ACQUIRED_VENDOR.
    optional int32 acquire_info_vendor = 7;
    // Dictates if this message should trigger additional debugging.
    optional bool debug = 8;
}

/**
 * Logs when a biometric authentication event occurs.
 *
 * Logged from:
 *   frameworks/base/services/core/java/com/android/server/biometrics
 */
message BiometricAuthenticated {
    // Biometric modality that was used.
    optional android.hardware.biometrics.ModalityEnum modality = 1;
    // The associated user. Eg: 0 for owners, 10+ for others. Defined in android/os/UserHandle.java
    optional int32 user = 2;
    // If this authentication is for a crypto operation. e.g. Secure purchases, unlock password
    // storage.
    optional bool is_crypto = 3;
    // The client that this acquisition was received for.
    optional android.hardware.biometrics.ClientEnum client = 4;
    // If authentication requires user confirmation. See BiometricPrompt's
    // setRequireConfirmation(bool) method.
    optional bool require_confirmation = 5;

    enum State {
        UNKNOWN = 0;
        REJECTED = 1;
        PENDING_CONFIRMATION = 2;
        CONFIRMED = 3;
    }

    // State of the current auth attempt.
    optional State state = 6;
    // Time it took to authenticate. For BiometricPrompt where setRequireConfirmation(false) is
    // specified and supported by the biometric modality, this is from the first ACQUIRED_GOOD to
    // AUTHENTICATED. for setRequireConfirmation(true), this is from PENDING_CONFIRMATION to
    // CONFIRMED.
    optional int64 latency_millis = 7;
    // Dictates if this message should trigger additional debugging.
    optional bool debug = 8;
}

/**
 * Logs when a biometric error occurs.
 *
 * Logged from:
 *   frameworks/base/services/core/java/com/android/server/biometrics
 */
message BiometricErrorOccurred {
    // Biometric modality that was used.
    optional android.hardware.biometrics.ModalityEnum modality = 1;
    // The associated user. Eg: 0 for owners, 10+ for others. Defined in android/os/UserHandle.java
    optional int32 user = 2;
    // If this error is for a crypto operation. e.g. Secure purchases, unlock password storage.
    optional bool is_crypto = 3;
    // Action that the device is performing.
    optional android.hardware.biometrics.ActionEnum action = 4;
    // The client that this acquisition was received for.
    optional android.hardware.biometrics.ClientEnum client = 5;
    // Error constants. See constants defined by <Biometric>Manager. Enums won't work since errors
    // are unique to modality.
    optional int32 error_info = 6;
    // Vendor-specific error info. Valid only if acquire_info == ACQUIRED_VENDOR. These are defined
    // by the vendor and not specified by the HIDL interface.
    optional int32 error_info_vendor = 7;
    // Dictates if this message should trigger additional debugging.
    optional bool debug = 8;
    // Time spent during the authentication attempt.
    optional int64 latency_millis = 9;
}

/**
 * Logs when a system health issue is detected.
 * Logged from:
 *   frameworks/base/services/core/java/com/android/server/biometrics
 */
message BiometricSystemHealthIssueDetected {
    // Biometric modality.
    optional android.hardware.biometrics.ModalityEnum modality = 1;
    // Type of issue detected.
    optional android.hardware.biometrics.IssueEnum issue = 2;
    // Dictates if this message should trigger additional debugging.
    optional bool debug = 3;
}

/**
 * Logs when a biometric enrollment occurs.
 *
 * Logged from:
 *   frameworks/base/services/core/java/com/android/server/biometrics
 */
message BiometricEnrolled {
    // Biometric modality that was used.
    optional android.hardware.biometrics.ModalityEnum modality = 1;
    // The associated user. Eg: 0 for owners, 10+ for others. Defined in android/os/UserHandle.java
    optional int32 user = 2;
    // The amount of time the enrollment took in milliseconds.
    optional int64 latency_millis = 3;
    // Whether or not the enrollment was successful.
    optional bool success = 4;
}

/*
 * Logs when a flag flip update occurrs. Used for mainline modules that update via flag flips.
 */
message FlagFlipUpdateOccurred {
    // If the event is from a flag config package, specify the package name.
    optional string flag_flip_package_name = 1;

    // The order id of the package
    optional int64 order_id = 2;
}

/**
 * Potential experiment ids that goes with a train install.
 * Should be kept in sync with experiment_ids.proto.
 */
message TrainExperimentIds {
    repeated int64 experiment_id = 1;
}

/*
 * Logs when a binary push state changes.
 * Logged by the installer via public api.
 */
message BinaryPushStateChanged {
    // Name of the train.
    optional string train_name = 1;
    // Version code for a "train" of packages that need to be installed atomically
    optional int64 train_version_code = 2;
    // After installation of this package, device requires a restart.
    optional bool requires_staging = 3;
    // Rollback should be enabled for this install.
    optional bool rollback_enabled = 4;
    // Requires low latency monitoring if possible.
    optional bool requires_low_latency_monitor = 5;

    enum State {
        UNKNOWN = 0;
        INSTALL_REQUESTED = 1;
        INSTALL_STARTED = 2;
        INSTALL_STAGED_NOT_READY = 3;
        INSTALL_STAGED_READY = 4;
        INSTALL_SUCCESS = 5;
        // Replaced by INSTALL_FAILURE_DOWNLOAD, INSTALL_FAILURE_STATE_MISMATCH,
        // and INSTALL_FAILURE_COMMIT.
        INSTALL_FAILURE = 6  [deprecated = true];
        // This enum is for installs that are manually cancelled via the Manual Update UI.
        INSTALL_CANCELLED = 7;
        INSTALLER_ROLLBACK_REQUESTED = 8;
        INSTALLER_ROLLBACK_INITIATED = 9;
        INSTALLER_ROLLBACK_INITIATED_FAILURE = 10;
        INSTALLER_ROLLBACK_STAGED = 11;
        INSTALLER_ROLLBACK_STAGED_FAILURE = 12;
        INSTALLER_ROLLBACK_BOOT_TRIGGERED = 13;
        INSTALLER_ROLLBACK_BOOT_TRIGGERED_FAILURE = 14;
        INSTALLER_ROLLBACK_SUCCESS = 15;
        INSTALLER_ROLLBACK_FAILURE = 16;
        INSTALLER_ROLLBACK_STAGED_CANCEL_REQUESTED = 17;
        INSTALLER_ROLLBACK_STAGED_CANCEL_SUCCESS = 18;
        INSTALLER_ROLLBACK_STAGED_CANCEL_FAILURE = 19;
        INSTALL_STAGED_CANCEL_REQUESTED = 20;
        INSTALL_STAGED_CANCEL_SUCCESS = 21;
        INSTALL_STAGED_CANCEL_FAILURE = 22;
        INSTALL_FAILURE_DOWNLOAD = 23;
        INSTALL_FAILURE_STATE_MISMATCH = 24;
        INSTALL_FAILURE_COMMIT = 25;
        REBOOT_TRIGGERED = 26;
    }
    optional State state = 6;
    // Possible experiment ids for monitoring this push.
    optional TrainExperimentIds experiment_ids = 7 [(log_mode) = MODE_BYTES];
    // user id
    optional int32 user_id = 8;
    optional int32 reason = 9;
    // Whether or not this is a rollback event
    optional bool is_rollback = 10;
}

/* Test atom, is not logged anywhere */
message TestAtomReported {
    repeated AttributionNode attribution_node = 1;
    optional int32 int_field = 2;
    optional int64 long_field = 3;
    optional float float_field = 4;
    optional string string_field = 5;
    optional bool boolean_field = 6;
    enum State {
        UNKNOWN = 0;
        OFF = 1;
        ON = 2;
    }
    optional State state = 7;
    optional TrainExperimentIds bytes_field = 8 [(android.os.statsd.log_mode) = MODE_BYTES];
}

/** Represents USB port overheat event. */
message UsbPortOverheatEvent {
    /* Temperature of USB port at USB plug event, in 1/10ths of degree C. */
    optional int32 plug_temperature_deci_c = 1;

    /* Maximum temperature of USB port during overheat event, in 1/10ths of degree C. */
    optional int32 max_temperature_deci_c = 2;

    /* Time between USB plug event and overheat threshold trip, in seconds. */
    optional int32 time_to_overheat_secs = 3;

    /* Time between overheat threshold trip and hysteresis, in seconds. */
    optional int32 time_to_hysteresis_secs = 4;

    /* Time between hysteresis and active mitigation ending, in seconds. */
    optional int32 time_to_inactive_secs = 5;
};

/**
 * Logs total effective full charge and discharge cycles on a battery.
 * Here are some examples of one effective cycle:
 *   1) the battery charges from 0% to 100% and drains back to 0%,
 *   2) charging from 50% to 100% and draining back to 50% twice.
 * Pulled from:
 *   frameworks/base/cmds/statsd/src/external/ResourceHealthManagerPuller.cpp
 */
message BatteryCycleCount {
    /* Number of total charge and discharge cycles on the system battery. */
    optional int32 cycle_count = 1;
}

/**
 * Logs that external storage is mounted and information about it, the storage type (sd card/usb/
 * others), its type (public or private) and the size in bytes.
 * Pulled from:
 *   StatsCompanionService
 */

message ExternalStorageInfo {

    enum VolumeType {
        UNKNOWN = 0;
        PUBLIC = 1;
        PRIVATE = 2;
        OTHER = 3;
    }

    // The type of external storage.
    optional android.stats.storage.ExternalStorageType storage_type = 1;
    // Type of the volume: TYPE_PUBLIC if portable and TYPE_PRIVATE if internal.
    optional VolumeType volume_type = 2;
    // Total size of the sd card in bytes.
    optional int64 size_bytes = 3;
}

/*
 * Logs when a connection becomes available and lost.
 * Logged in StatsCompanionService.java
 */
message ConnectivityStateChanged {
  // Id of the network.
  optional int32 net_id = 1;

  enum State {
    UNKNOWN = 0;
    CONNECTED = 1;
    DISCONNECTED = 2;
  }
  // Connected state of a network.
  optional State state = 2;
}

/**
 * Logs when a service starts and stops.
 * Logged from:
 *   services/core/java/com/android/server/am/ActiveServices.java
 */
message ServiceStateChanged {

    optional int32 uid = 1 [(is_uid) = true];

    optional string package_name = 2;

    optional string service_name = 3;

    enum State {
        START = 1;
        STOP = 2;
    }

    optional State state = 4;
}

/**
 * Logs when a service is launched.
 * Logged from:
 *   services/core/java/com/android/server/am/ActiveServices.java
 */
message ServiceLaunchReported {

    optional int32 uid = 1 [(is_uid) = true];

    optional string package_name = 2;

    optional string service_name = 3;
}

/**
 * Logs when a hidden API is used.
 *
 * Logged from:
 *     libcore/libart/src/main/java/dalvik/system/VMRuntime.java
 */
message HiddenApiUsed {
    // The uid of the app making the hidden access.
    optional int32 uid = 1 [(is_uid) = true];

    // Signature of the method or field accessed.
    optional string signature = 2;

    enum AccessMethod {
        NONE = 0;
        REFLECTION = 1;
        JNI = 2;
        LINKING = 3;
    }

    // Type of access.
    optional AccessMethod access_method = 3;

    // Whether the access was prevented or not.
    optional bool access_denied = 4;
}

/**
 * Logs user interaction with the Privacy Indicators added in Q. In particular:
 * - When user sees privacy chip
 * - When user clicks privacy chip
 * - How does the user exit the Privacy Dialog
 * Logged from:
 *   packages/SystemUI/src/com/android/systemui/qs/QuickStatusBarHeader.java
 */
message PrivacyIndicatorsInteracted {

    enum Type {
        UNKNOWN = 0;
        CHIP_VIEWED = 1;
        CHIP_CLICKED = 2;
        reserved 3; // Used only in beta builds, never shipped 
        DIALOG_DISMISS = 4;
        DIALOG_LINE_ITEM = 5;
    }

    optional Type type = 1 [(state_field_option).exclusive_state = true];
}

/**
 * Logs information about a package that is moved from the internal to external storage and vice
 * versa.
 * It logs the package name, the type of the external storage where the package is installed
 * (if moved to external storage, or UNKNOWN if moved to internal storage),
 * and the move type: if it's from internal to external or the other way around.
 *
 * Logged from:
        frameworks/base/services/core/java/com/android/server/pm/PackageManagerService.java
 */
message AppMovedStorageReported {
    enum MoveType {
        UNKNOWN = 0;
        TO_EXTERNAL = 1;
        TO_INTERNAL = 2;
    }
    // The type of the external storage.
    optional android.stats.storage.ExternalStorageType external_storage_type = 1;
    // The type of move.
    optional MoveType move_type = 2;
    // The name of the package that was moved.
    optional string package_name = 3;
}

/**
 * Logs when system server watchdog occurs.
 * Logged from:
 *      frameworks/base/services/core/java/com/android/server/Watchdog.java
 */
message SystemServerWatchdogOccurred {
    optional string subject = 1;
}

/**
 * Logs when new file added to tombstones.
 * Logged from:
 *      frameworks/base/core/java/com/android/server/BootReceiver.java
 */
message TombStoneOccurred {
}

/*
 * Information about a role request
 *
 * Logged from:
 *   packages/apps/PermissionController/src/com/android/packageinstaller/role/ui/RequestRoleFragment.java
 */
message RoleRequestResultReported {
    // UID of application requesting the role
    optional int32 requesting_uid = 1;

    // Package name of application requesting the role
    optional string requesting_package_name = 2;

    // The role to be granted
    optional string role_name = 3;

    // The count of applications qualifying for the role
    optional int32 qualifying_count = 4;

    // UID of application current granted the role
    optional int32 current_uid = 5;

    // Package name of application current granted the role
    optional string current_package_name = 6;

    // UID of another application that user chose to grant the role to, instead of the requesting
    // application
    optional int32 granted_another_uid = 7;

    // Package name of another application that user chose to grant the role to, instead of the
    // requesting application
    optional string granted_another_package_name = 8;

    enum Result {
        UNDEFINED = 0;
        // role request was ignored
        IGNORED = 1;
        // role request was ignored because it's already granted
        IGNORED_ALREADY_GRANTED = 2;
        // role request was ignored because the application isn't qualified
        IGNORED_NOT_QUALIFIED = 3;
        // role request was ignored because user said it should be always denied
        IGNORED_USER_ALWAYS_DENIED = 4;
        // role was granted by user action
        USER_GRANTED = 5;
        // role was denied by user action
        USER_DENIED = 6;
        // role was denied by user granting another application the role
        USER_DENIED_GRANTED_ANOTHER = 7;
        // role was denied and set to be always denied by the user
        USER_DENIED_WITH_ALWAYS = 8;
    }
    // The result of the role request
    optional Result result = 9;
}

/**
 * Logs when a Vehicle Maps Service client's connection state has changed
 *
 * Logged from:
 *   packages/services/Car/service/src/com/android/car/stats/VmsClientLog.java
 */
message VmsClientConnectionStateChanged {
    // The UID of the VMS client app
    optional int32 uid = 1 [(is_uid) = true];

    enum State {
        UNKNOWN = 0;
        // Attempting to connect to the client
        CONNECTING = 1;
        // Client connection established
        CONNECTED = 2;
        // Client connection closed unexpectedly
        DISCONNECTED = 3;
        // Client connection closed by VMS
        TERMINATED = 4;
        // Error establishing the client connection
        CONNECTION_ERROR = 5;
    }

    optional State state  = 2;
}

message MimeTypes {
    repeated string mime_types = 1;
}

/**
 * Logs statistics regarding accesses to external storage.
 * All stats are normalized for one day period.
 *
 * Logged from:
 *   packages/providers/MediaProvider/src/com/android/providers/media/MediaProvider.java
 */
message GeneralExternalStorageAccessStats {
    optional int32 uid = 1 [(is_uid) = true];
    // Total number of accesses like creation, open, delete and rename/update.
    // Includes file path and ContentResolver accesses
    optional uint32 total_accesses = 2;
    // Number of file path accesses, as opposed to file path and ContentResolver.
    optional uint32 file_path_accesses = 3;
    // Number of accesses on secondary volumes like SD cards.
    // Includes file path and ContentResolver accesses
    optional uint32 secondary_storage_accesses = 4;
    // Comma-separated list of mime types that were accessed.
    optional MimeTypes mime_types_accessed = 5;
}

/**
 * Logs when MediaProvider has successfully finished scanning a storage volume.
 *
 * Logged from:
 *   packages/providers/MediaProvider/src/com/android/providers/media/scan/ModernMediaScanner.java
 */
message MediaProviderScanOccurred {
    enum Reason {
        // Scan triggered due to unknown reason
        UNKNOWN = 0;
        // Scan triggered due to storage volume being mounted
        MOUNTED = 1;
        // Scan triggered due to explicit user action or app request
        DEMAND = 2;
        // Scan triggered due to idle maintenance
        IDLE = 3;
    }

    // Volume type that this event pertains to
    optional android.stats.mediaprovider.VolumeType volume_type = 1;
    // Reason why this scan was triggered
    optional Reason reason = 2;
    // Total number of files scanned
    optional int64 item_count = 3;
    // Duration of scan, normalized per file
    optional float normalized_duration_millis = 4;
    // Number of database inserts, normalized per file
    optional float normalized_insert_count = 5;
    // Number of database updates, normalized per file
    optional float normalized_update_count = 6;
    // Number of database deletes, normalized per file
    optional float normalized_delete_count = 7;
}

/**
 * Logs when an app has asked MediaProvider to delete media belonging to the user.
 *
 * Logged from:
 *   packages/providers/MediaProvider/src/com/android/providers/media/MediaProvider.java
 */
message MediaContentDeleted {
    // Volume type that this event pertains to
    optional android.stats.mediaprovider.VolumeType volume_type = 1;
    // UID of app that requested deletion
    optional int32 uid = 2 [(is_uid) = true];
    // Number of items that were deleted
    optional int32 item_count = 3;
}

/**
 * Logs when an app has asked MediaProvider to grant them access to media belonging to the user.
 *
 * Logged from:
 *   packages/providers/MediaProvider/src/com/android/providers/media/PermissionActivity.java
 */
message MediaProviderPermissionRequested {
    enum Result {
        UNKNOWN = 0;
        USER_GRANTED = 1;
        AUTO_GRANTED = 2;
        USER_DENIED = 3;
        USER_DENIED_WITH_PREJUDICE = 4;
        AUTO_DENIED = 5;
    }

    // Volume type that this event pertains to
    optional android.stats.mediaprovider.VolumeType volume_type = 1;
    // UID of app that requested permission
    optional int32 uid = 2 [(is_uid) = true];
    // Number of items that were requested
    optional int32 item_count = 3;
    // Result of this request
    optional Result result = 4;
}

/**
 * Logs when MediaProvider has finished upgrading or downgrading its database schema.
 *
 * Logged from:
 *   packages/providers/MediaProvider/src/com/android/providers/media/DatabaseHelper.java
 */
message MediaProviderSchemaChanged {
    // Volume type that this event pertains to
    optional android.stats.mediaprovider.VolumeType volume_type = 1;
    // Old database version code
    optional int32 version_from = 2;
    // New database version code
    optional int32 version_to = 3;
    // Total number of files in database
    optional int64 item_count = 4;
    // Duration of schema change, normalized per file
    optional float normalized_duration_millis = 5;
}

/**
 * Logs when MediaProvider has finished an idle maintenance job.
 *
 * Logged from:
 *   packages/providers/MediaProvider/src/com/android/providers/media/MediaProvider.java
 */
message MediaProviderIdleMaintenanceFinished {
    // Volume type that this event pertains to
    optional android.stats.mediaprovider.VolumeType volume_type = 1;

    // Total number of files in database
    optional int64 item_count = 2;
    // Duration of idle maintenance, normalized per file
    optional float normalized_duration_millis = 3;
    // Number of thumbnails found to be stale, normalized per file
    optional float normalized_stale_thumbnails = 4;
    // Number of items found to be expired, normalized per file
    optional float normalized_expired_media = 5;
}

/**
 * Represents boot time event with duration in ms.
 *
 * Logged from: bootstat and various system server components. Check each enums for details.
 */
message BootTimeEventDuration {
    enum DurationEvent {
        UNKNOWN = 0;
        // Bootloader time excluding BOOTLOADER_UI_WAIT + boot complete time. Logged from bootstat.
        ABSOLUTE_BOOT_TIME = 1;
        // Bootloader's 1st stage execution time.
        // Logged from bootstat.
        BOOTLOADER_FIRST_STAGE_EXEC = 2;
        // Bootloader's 1st stage loading time.
        // Logged from bootstat.
        BOOTLOADER_FIRST_STAGE_LOAD = 3;
        // Bootloader's kernel loading time.
        // Logged from bootstat.
        BOOTLOADER_KERNEL_LOAD = 4;
        // Bootloader's 2nd stage execution time.
        // Logged from bootstat.
        BOOTLOADER_SECOND_STAGE_EXEC = 5;
        // Bootloader's 2nd stage loading time.
        // Logged from bootstat.
        BOOTLOADER_SECOND_STAGE_LOAD = 6;
        // Duration for Bootloader to show unlocked device's warning UI. This should not happen
        // for locked device.
        // Logged from bootstat.
        BOOTLOADER_UI_WAIT = 7;
        // Total time spend in bootloader. This is the sum of all BOOTLOADER_* listed above.
        // Logged from bootstat.
        BOOTLOADER_TOTAL = 8;
        // Shutdown duration inside init for the reboot before the current boot up.
        // Logged from f/b/services/.../BootReceiver.java.
        SHUTDOWN_DURATION = 9;
        // Total time for mounting of disk devices during bootup.
        // Logged from f/b/services/.../BootReceiver.java.
        MOUNT_DEFAULT_DURATION = 10;
        // Total time for early stage mounting of disk devices during bootup.
        // Logged from f/b/services/.../BootReceiver.java.
        MOUNT_EARLY_DURATION = 11;
        // Total time for late stage mounting of disk devices during bootup.
        // Logged from f/b/services/.../BootReceiver.java.
        MOUNT_LATE_DURATION = 12;
        // Average time to scan non-system app after OTA
        // Logged from f/b/services/.../PackageManagerService.java
        OTA_PACKAGE_MANAGER_INIT_TIME = 13;
        // Time to initialize Package manager after OTA
        // Logged from f/b/services/.../PackageManagerService.java
        OTA_PACKAGE_MANAGER_DATA_APP_AVG_SCAN_TIME = 14;
        // Time to scan all system app from Package manager after OTA
        // Logged from f/b/services/.../PackageManagerService.java
        OTA_PACKAGE_MANAGER_SYSTEM_APP_AVG_SCAN_TIME = 15;
        // Init's total time for cold boot stage.
        // Logged from bootstat.
        COLDBOOT_WAIT = 16;
        // Init's total time for initializing selinux.
        // Logged from bootstat.
        SELINUX_INIT = 17;
        // Time since last factory reset.
        // Logged from bootstat.
        FACTORY_RESET_TIME_SINCE_RESET = 18;
        // Init's total time spent for completing the 1st stage.
        // Logged from bootstat.
        ANDROID_INIT_STAGE_1 = 19;
    }

    // Type of the event.
    optional DurationEvent event = 1;
    // Duration of the event in ms.
    optional int64 duration_millis = 2;
}

/**
 * Represents the start of specific boot time event during bootup in ms. This is usually a time
 * since boot-up.
 *
 * Logged from: bootstat and various system server components. Check each enums for details.
 */
message BootTimeEventElapsedTime {
    enum ElapsedTimeEvent {
        UNKNOWN = 0;
        // Time when init starts 1st stage. Logged from bootstat.
        ANDROID_INIT_STAGE_1 = 1;
        // Time when sys.boot_completed prop is set.
        // Logged from bootstat.
        BOOT_COMPLETE = 2;
        // BOOT_COMPLETE for encrypted device.
        BOOT_COMPLETE_ENCRYPTION = 3;
        // BOOT_COMPLETE for device with no encryption.
        BOOT_COMPLETE_NO_ENCRYPTION = 4;
        // Adjusted BOOT_COMPLETE for encrypted device extracting decryption time.
        BOOT_COMPLETE_POST_DECRYPT = 5;
        // BOOT_COMPLETE after factory reset.
        FACTORY_RESET_BOOT_COMPLETE = 6;
        // BOOT_COMPLETE_NO_ENCRYPTION after factory reset.
        FACTORY_RESET_BOOT_COMPLETE_NO_ENCRYPTION = 7;
        // BOOT_COMPLETE_POST_DECRYPT after factory reset.
        FACTORY_RESET_BOOT_COMPLETE_POST_DECRYPT = 8;
        // BOOT_COMPLETE after OTA.
        OTA_BOOT_COMPLETE = 9;
        // BOOT_COMPLETE_NO_ENCRYPTION after OTA.
        OTA_BOOT_COMPLETE_NO_ENCRYPTION = 10;
        // BOOT_COMPLETE_POST_DECRYPT after OTA.
        OTA_BOOT_COMPLETE_POST_DECRYPT = 11;
        // Time when the system starts sending LOCKED_BOOT_COMPLETED broadcast.
        // Logged from  f/b/services/.../UserController.java
        FRAMEWORK_LOCKED_BOOT_COMPLETED = 12;
        // Time when the system starts sending BOOT_COMPLETED broadcast.
        // Logged from  f/b/services/.../UserController.java
        FRAMEWORK_BOOT_COMPLETED = 13;
        // Time when the package manager starts init.
        // Logged from f/b/services/.../SystemServer.java
        PACKAGE_MANAGER_INIT_START = 14;
        // Time when package manager is ready
        // Logged from f/b/services/.../SystemServer.java
        PACKAGE_MANAGER_INIT_READY = 15;
        // Represents the time when user has entered unlock credential for system with user pin.
        // Logged from bootstat.
        POST_DECRYPT = 16;
        // Represents the start of zygote's init.
        // Logged from zygote itself.
        ZYGOTE_INIT_START = 17;
        // Represents the start of secondary zygote's init.
        // TODO: add logging to zygote
        SECONDARY_ZYGOTE_INIT_START = 18;
        // Represents the start of system server's init.
        // Logged from f/b/services/.../SystemServer.java
        SYSTEM_SERVER_INIT_START = 19;
        // Represents the completion of system server's init.
        // Logged from f/b/services/.../SystemServer.java
        SYSTEM_SERVER_READY = 20;
        // Represents the start of launcher during boot-up.
        // TODO: add logging
        LAUNCHER_START = 21;
        // Represents the completion of launcher's initial rendering. User can use other apps from
        // launcher from this point.
        // TODO: add logging
        LAUNCHER_SHOWN = 22;
    }

    // Type of the event.
    optional ElapsedTimeEvent event = 1;
    // Time since bootup for the event.
    // It should be acquired from SystemClock elapsedRealtime() call or equivalent.
    optional int64 time_millis = 2;
}

/**
 * Boot time events with UTC time.
 *
 * Logged from: bootstat and various system server components. Check each enums for details.
 */
message BootTimeEventUtcTime {
    enum UtcTimeEvent {
        UNKNOWN = 0;
        // Time of the bootstat's marking of 1st boot after the last factory reset.
        // Logged from bootstat.
        FACTORY_RESET_RESET_TIME = 1;
        // The time when bootstat records FACTORY_RESET_* events. This is close to
        // BOOT_COMPLETE time for the current bootup.
        // Logged from bootstat.
        FACTORY_RESET_CURRENT_TIME = 2;
        // DUplicate of FACTORY_RESET_RESET_TIME added for debugging purpose.
        // Logged from bootstat.
        FACTORY_RESET_RECORD_VALUE = 3;
    }

    // Type of the event.
    optional UtcTimeEvent event = 1;
    // UTC time for the event.
    optional int64 utc_time_secs = 2;
}

/**
 * Boot time events representing specific error code during bootup.
 * Meaning of error code can be different per each event type.
 *
 * Logged from: bootstat and various system server components. Check each enums for details.
 */
message BootTimeEventErrorCode {
    enum ErrorCodeEvent {
        UNKNOWN = 0;
        // Linux error code for time() call to get the current UTC time.
        // Logged from bootstat.
        FACTORY_RESET_CURRENT_TIME_FAILURE = 1;
        // Represents UmountStat before the reboot for the current boot up. Error codes defined
        // as UMOUNT_STAT_* from init/reboot.cpp.
        // Logged from f/b/services/.../BootReceiver.java.
        SHUTDOWN_UMOUNT_STAT = 2;
        // Reprepsents fie system mounting error code of /data partition for the current boot.
        // Error codes defined as combination of FsStatFlags from system/core/fs_mgr/fs_mgr.cpp.
        // Logged from f/b/services/.../BootReceiver.java.
        FS_MGR_FS_STAT_DATA_PARTITION = 3;
    }

    // Type of the event.
    optional ErrorCodeEvent event = 1;
    // error code defined per each event type.
    // For example, this can have a value of FsStatFlags.FS_STAT_FULL_MOUNT_FAILED for the event of
    // FS_MGR_FS_STAT.
    optional int32 error_code = 2;
}

/**
 * Collects Virtual A/B statistics related to the use of dm-snapshot performed
 * after an OTA.
 *
 * Logged from:
 *  - system/update_engine/cleanup_previous_update_action.cc
 */
message SnapshotMergeReported {
    // Keep in sync with
    // system/core/fs_mgr/libsnapshot/android/snapshot/snapshot.proto
    enum UpdateState {
        // No update or merge is in progress.
        NONE = 0;
        // An update is applying; snapshots may already exist.
        INITIATED = 1;
        // An update is pending, but has not been successfully booted yet.
        UNVERIFIED = 2;
        // The kernel is merging in the background.
        MERGING = 3;
        // Post-merge cleanup steps could not be completed due to a transient
        // error, but the next reboot will finish any pending operations.
        MERGE_NEEDS_REBOOT = 4;
        // Merging is complete, and needs to be acknowledged.
        MERGE_COMPLETED = 5;
        // Merging failed due to an unrecoverable error.
        MERGE_FAILED = 6;
        // The update was implicitly cancelled, either by a rollback or a flash
        // operation via fastboot. This state can only be returned by WaitForMerge.
        CANCELLED = 7;
    };

    // Status of the update after the merge attempts.
    optional UpdateState final_state = 1;

    // Time to complete a merge operation in milliseconds.
    // A negative value corresponds to the case in which the merge operation
    // was interrupted and resumed (e.g. in case of a system reboot during the
    // merge).
    optional int64 duration_millis = 2;

    // Number of reboots that occurred after issuing and before completing the
    // merge of all the snapshot devices.
    optional int32 intermediate_reboots = 3;

    // The device has been upgraded to Virtual A/B.
    optional bool is_vab_retrofit = 4;

    // Space that has been temporarily allocated in the /data partition
    // containing the dm-snapshot's copy-on-write data generated during a
    // Virtual A/B update.
    optional int64 cow_file_size_bytes = 5;
}

/**
 * Event representing when BlobStoreManager.Session#commit() is called
 *
 * Logged from:
 *  frameworks/base/apex/blobstore/service/java/com/android/server/blob/BlobStoreManagerService.java
 */
message BlobCommitted {
    // Uid of the Blob committer
    optional int32 uid = 1 [(is_uid) = true];

    // Id of the Blob committed
    optional int64 blob_id = 2;

    // Size of the Blob
    optional int64 size = 3;

    enum Result {
        UNKNOWN = 0;
        // Commit Succeeded
        SUCCESS = 1;
        // Commit Failed: Error occurred during commit
        ERROR_DURING_COMMIT = 2;
        // Commit Failed: Digest of the data did not match Blob digest
        DIGEST_MISMATCH = 3;
        // Commit Failed: Allowed count limit exceeded
        COUNT_LIMIT_EXCEEDED = 4;
    }
    optional Result result = 4;
}

/**
 * Event representing when BlobStoreManager#acquireLease() is called
 *
 * Logged from:
 *  frameworks/base/apex/blobstore/service/java/com/android/server/blob/BlobStoreManagerService.java
 */
message BlobLeased{
    // Uid of the Blob leasee
    optional int32 uid = 1 [(is_uid) = true];

    // Id of the Blob leased or 0 if the Blob does not exist
    optional int64 blob_id = 2;

    // Size of the Blob or 0 if the Blob does not exist
    optional int64 size = 3;

    enum Result {
        UNKNOWN = 0;
        // Lease Succeeded
        SUCCESS = 1;
        // Lease Failed: Blob does not exist
        BLOB_DNE = 2;
        // Lease Failed: Leasee does not have access to the Blob
        ACCESS_NOT_ALLOWED = 3;
        // Lease Failed: Leasee requested an invalid expiry duration
        LEASE_EXPIRY_INVALID = 4;
        // Lease Failed: Leasee has exceeded the total data lease limit
        DATA_SIZE_LIMIT_EXCEEDED = 5;
        // Leasee Failed: Allowed count limit exceeded
        COUNT_LIMIT_EXCEEDED = 6;
    }
    optional Result result = 4;
}

/**
 * Event representing when BlobStoreManager#openBlob() is called
 *
 * Logged from:
 *  frameworks/base/apex/blobstore/service/java/com/android/server/blob/BlobStoreManagerService.java
 */
message BlobOpened{
    // Uid of the Blob opener
    optional int32 uid = 1 [(is_uid) = true];

    // Id of the Blob opened or 0 if the Blob does not exist
    optional int64 blob_id = 2;

    // Size of the Blob or 0 if the Blob does not exist
    optional int64 size = 3;

    enum Result {
        UNKNOWN = 0;
        // Open Succeeded
        SUCCESS = 1;
        // Open Failed: Blob does not exist
        BLOB_DNE = 2;
        // Open Failed: Opener does not have access to the Blob
        ACCESS_NOT_ALLOWED = 3;
    }
    optional Result result = 4;
}

//////////////////////////////////////////////////////////////////////
// Pulled atoms below this line //
//////////////////////////////////////////////////////////////////////

/**
 * Pulls bytes transferred via wifi (Sum of foreground and background usage).
 *
 * Pulled from:
 *   StatsCompanionService (using BatteryStats to get which interfaces are wifi)
 */
message WifiBytesTransfer {
    optional int32 uid = 1 [(is_uid) = true];

    optional int64 rx_bytes = 2;

    optional int64 rx_packets = 3;

    optional int64 tx_bytes = 4;

    optional int64 tx_packets = 5;
}

/**
 * Pulls bytes transferred via wifi (separated by foreground and background usage).
 *
 * Pulled from:
 *   StatsCompanionService (using BatteryStats to get which interfaces are wifi)
 */
message WifiBytesTransferByFgBg {
    optional int32 uid = 1 [(is_uid) = true];

    // 1 denotes foreground and 0 denotes background. This is called Set in NetworkStats.
    optional bool is_foreground = 2;

    optional int64 rx_bytes = 3;

    optional int64 rx_packets = 4;

    optional int64 tx_bytes = 5;

    optional int64 tx_packets = 6;
}

/**
 * Pulls bytes transferred via mobile networks (Sum of foreground and background usage).
 *
 * Pulled from:
 *   StatsCompanionService (using BatteryStats to get which interfaces are mobile data)
 */
message MobileBytesTransfer {
    optional int32 uid = 1 [(is_uid) = true];

    optional int64 rx_bytes = 2;

    optional int64 rx_packets = 3;

    optional int64 tx_bytes = 4;

    optional int64 tx_packets = 5;
}

/**
 * Pulls bytes transferred via mobile networks (separated by foreground and background usage).
 *
 * Pulled from:
 *   StatsCompanionService (using BatteryStats to get which interfaces are mobile data)
 */
message MobileBytesTransferByFgBg {
    optional int32 uid = 1 [(is_uid) = true];

    // 1 denotes foreground and 0 denotes background. This is called Set in
    // NetworkStats.
    optional bool is_foreground = 2;

    optional int64 rx_bytes = 3;

    optional int64 rx_packets = 4;

    optional int64 tx_bytes = 5;

    optional int64 tx_packets = 6;
}

/**
 * Used for pull network statistics via mobile|wifi networks, and sliced by interesting dimensions.
 * Note that the data is expected to be sliced into more dimensions in future. In other words,
 * the caller must not assume any row of data is one full report when filtering with a set of
 * matching conditions, because future data may represent with multiple rows what is currently
 * represented by one.
 * To avoid being broken by future slicing, callers must take care to aggregate rows even if they
 * query all the existing columns.
 *
 * Pulled from:
 *   StatsPullAtomService (using NetworkStatsService to get NetworkStats)
 */
message DataUsageBytesTransfer {
    // State of this record. Should be NetworkStats#SET_DEFAULT or NetworkStats#SET_FOREGROUND to
    // indicate the foreground state, or NetworkStats#SET_ALL to indicate the record is for all
    // states combined, not including debug states. See NetworkStats#SET_*.
    optional int32 state = 1;

    optional int64 rx_bytes = 2;

    optional int64 rx_packets = 3;

    optional int64 tx_bytes = 4;

    optional int64 tx_packets = 5;

    // Radio Access Technology (RAT) type of this record, should be one of
    // TelephonyManager#NETWORK_TYPE_* constants, or NetworkTemplate#NETWORK_TYPE_ALL to indicate
    // the record is for all rat types combined.
    optional int32 rat_type = 6;

    // Mcc/Mnc read from sim if the record is for a specific subscription, null indicates the
    // record is combined across subscriptions.
    optional string sim_mcc = 7;
    optional string sim_mnc = 8;

    // Allows mobile virtual network operators (MVNOs) to be identified with individual IDs.
    // See TelephonyManager#getSimCarrierId.
    optional int32 carrier_id = 9;

    // Enumeration of opportunistic states with an additional ALL state indicates the record is
    // combined regardless of the boolean value in its field.
    enum DataSubscriptionState {
        UNKNOWN = 0; // For server side backward compatibility.
        ALL = 1;
        OPPORTUNISTIC = 2;
        NOT_OPPORTUNISTIC = 3;
    }
    // Mark whether the subscription is an opportunistic data subscription, and ALL indicates the
    // record is combined across opportunistic data subscriptions.
    // See {@link SubscriptionManager#setOpportunistic}.
    optional DataSubscriptionState opportunistic_data_sub = 10;

    // Indicate whether NR is connected, server side could use this with RAT type to determine if
    // the record is for 5G NSA (Non Stand Alone) mode, where the primary cell is still LTE and
    // network allocates a secondary 5G cell so telephony reports RAT = LTE along with NR state as
    // connected.
    optional bool is_nr_connected = 11;
}

/**
 * Pulls bytes transferred via bluetooth. It is pulled from Bluetooth controller.
 *
 * Pulled from:
 *   StatsCompanionService
 */
message BluetoothBytesTransfer {
    optional int32 uid = 1 [(is_uid) = true];

    optional int64 rx_bytes = 2;

    optional int64 tx_bytes = 3;
}

/**
 * Pulls the kernel wakelock durations. This atom is adapted from
 * android/internal/os/KernelWakelockStats.java
 *
 * Pulled from:
 *   StatsCompanionService using KernelWakelockReader.
 */
message KernelWakelock {
    optional string name = 1;

    optional int32 count = 2;

    optional int32 version = 3;

    optional int64 time_micros = 4;
}

/**
 * Pulls low power state information. If power.stats HAL is not available, this
 * includes platform and subsystem sleep state information,
 * PowerStatePlatformSleepState, PowerStateVoter or PowerStateSubsystemSleepState
 * as defined in:
 *   hardware/interfaces/power/1.0/types.hal
 *   hardware/interfaces/power/1.1/types.hal
 * If power.stats HAL is available, this includes PowerEntityStateResidencyResult
 * as defined in:
 *   hardware/interfaces/power/stats/1.0/types.hal
 */
message SubsystemSleepState {
    // Subsystem name
    optional string subsystem_name = 1;
    // For PlatformLowPowerStats (hal 1.0), this is the voter name, which could be empty.
    // For SubsystemLowPowerStats (hal 1.1), this is the sleep state name.
    // For PowerEntityStateResidencyResult (hal power/stats/1.0) this is the
    //    powerEntityStateName from the corresponding PowerEntityStateInfo.
    optional string subname = 2;
    // The number of times it entered, or voted for entering the sleep state
    optional uint64 count = 3;
    // The length of time spent in, or spent voting for, the sleep state
    optional uint64 time_millis = 4;
}

/**
 * Pulls on-device power measurement information.
 * Data defined by hardware/interfaces/power/stats/1.0/types.hal.
 * Pulled from:
 *   frameworks/base/cmds/statsd/src/external/PowerStatsPuller.cpp
 */
message OnDevicePowerMeasurement {
    // Name of the subsystem (to which the rail belongs).
    optional string subsystem_name = 1;

    // Rail name. The rail lies within the subsystem.
    optional string rail_name = 2;

    // Time (in ms since boot) at which the rail energy value was measured.
    // This may differ slightly from the time that statsd logs this information.
    optional uint64 measurement_timestamp_millis = 3;

    // Accumulated energy used via the rail since device boot in uWs.
    optional uint64 energy_microwatt_secs = 4;
}

/**
 * Pulls Cpu time per frequency.
 * Pulls the time the cpu spend on the frequency index. Frequency index
 * starts from highest to lowest. The value should be monotonically
 * increasing since boot. However, if there is a cpu
 * hotplug event, the value would be reset as well.
 */
message CpuTimePerFreq {
    optional uint32 cluster = 1;
    optional uint32 freq_index = 2;
    optional uint64 time_millis = 3;
}

/**
 * Pulls Cpu Time Per Uid.
 * Note that isolated process uid time should be attributed to host uids.
 */
message CpuTimePerUid {
    optional int32 uid = 1 [(is_uid) = true];
    optional uint64 user_time_micros = 2;
    optional uint64 sys_time_micros = 3;
}

/**
 * Pulls Cpu Time Per Uid per frequency.
 * Note that isolated process uid time should be attributed to host uids.
 * For each uid, we order the time by descending frequencies.
 */
message CpuTimePerUidFreq {
    optional int32 uid = 1 [(is_uid) = true];
    optional uint32 freq_index = 2;
    optional uint64 time_millis = 3;
}

/**
 * Pulls Wifi Controller Activity Energy Info
 */
message WifiActivityInfo {
    // timestamp(wall clock) of record creation
    optional uint64 timestamp_millis = 1;
    // stack reported state
    // TODO: replace this with proto enum
    optional int32 stack_state = 2;
    // tx time in millis
    optional uint64 controller_tx_time_millis = 3;
    // rx time in millis
    optional uint64 controller_rx_time_millis = 4;
    // idle time in millis
    optional uint64 controller_idle_time_millis = 5;
    // product of current(mA), voltage(V) and time(ms)
    optional uint64 controller_energy_used = 6;
}

/**
 * Pulls Modem Activity Energy Info
 */
message ModemActivityInfo {
    // timestamp(wall clock) of record creation
    optional uint64 timestamp_millis = 1;
    // sleep time in millis.
    optional uint64 sleep_time_millis = 2;
    // idle time in millis
    optional uint64 controller_idle_time_millis = 3;
    /**
     * Tx power index
     * index 0 = tx_power < 0dBm
     * index 1 = 0dBm < tx_power < 5dBm
     * index 2 = 5dBm < tx_power < 15dBm
     * index 3 = 15dBm < tx_power < 20dBm
     * index 4 = tx_power > 20dBm
     */
    // tx time in ms at power level 0
    optional uint64 controller_tx_time_pl0_millis = 4;
    // tx time in ms at power level 1
    optional uint64 controller_tx_time_pl1_millis = 5;
    // tx time in ms at power level 2
    optional uint64 controller_tx_time_pl2_millis = 6;
    // tx time in ms at power level 3
    optional uint64 controller_tx_time_pl3_millis = 7;
    // tx time in ms at power level 4
    optional uint64 controller_tx_time_pl4_millis = 8;
    // rx time in ms at power level 5
    optional uint64 controller_rx_time_millis = 9;
    // product of current(mA), voltage(V) and time(ms)
    optional uint64 energy_used = 10 [deprecated=true];
}

/**
 * Pulls Bluetooth Activity Energy Info
 * Note: BluetoothBytesTransfer is pulled at the same time from the controller.
 */
message BluetoothActivityInfo {
    // timestamp(wall clock) of record creation
    optional uint64 timestamp_millis = 1;
    // bluetooth stack state
    optional int32 bluetooth_stack_state = 2;
    // tx time in millis
    optional uint64 controller_tx_time_millis = 3;
    // rx time in millis
    optional uint64 controller_rx_time_millis = 4;
    // idle time in millis
    optional uint64 controller_idle_time_millis = 5;
    // product of current(mA), voltage(V) and time(ms)
    optional uint64 energy_used = 6;
}

/*
 * Logs the memory stats for a process.
 *
 * Pulled from StatsCompanionService for all managed processes (from ActivityManagerService).
 */
message ProcessMemoryState {
    // The uid if available. -1 means not available.
    optional int32 uid = 1 [(is_uid) = true];

    // The process name.
    // Usually package name, "system" for system server.
    // Provided by ActivityManagerService.
    optional string process_name = 2;

    // Current OOM score adjustment. Value read from ProcessRecord.
    optional int32 oom_adj_score = 3;

    // # of page-faults
    optional int64 page_fault = 4;

    // # of major page-faults
    optional int64 page_major_fault = 5;

    // RSS
    // Value is read from memory.stat, field total_rss if per-app memory
    // cgroups are enabled. Otherwise, value from /proc/pid/stat.
    optional int64 rss_in_bytes = 6;

    // CACHE
    // Value is read from memory.stat, field total_cache if per-app memory
    // cgroups are enabled. Otherwise, 0.
    optional int64 cache_in_bytes = 7;

    // SWAP
    // Value is read from memory.stat, field total_swap if per-app memory
    // cgroups are enabled. Otherwise, 0.
    optional int64 swap_in_bytes = 8;

    // Deprecated: use ProcessMemoryHighWaterMark atom instead. Always -1.
    optional int64 rss_high_watermark_in_bytes = 9 [deprecated = true];

    // Deprecated: use ProcessMemorySnapshot atom instead. Always -1.
    optional int64 start_time_nanos = 10 [deprecated = true];

    // Deprecated: use ProcessMemorySnapshot atom instead. Always -1.
    optional int32 anon_rss_and_swap_in_kilobytes = 11 [deprecated = true];
}

/*
 * Logs the memory high-water mark for a process.
 *
 * Pulled from StatsCompanionService for all managed processes (from ActivityManagerServie)
 * and for selected native processes.
 *
 * Pulling this atom resets high-water mark counters for all processes.
 */
message ProcessMemoryHighWaterMark {
    // The uid if available. -1 means not available.
    optional int32 uid = 1 [(is_uid) = true];

    // The process name.
    // Usually package name or process cmdline.
    // Provided by ActivityManagerService or read from /proc/PID/cmdline.
    optional string process_name = 2;

    // Deprecated: use rss_high_water_mark_in_kilobytes instead. This field is
    // computed by converting kilobytes to bytes.
    optional int64 rss_high_water_mark_in_bytes = 3 [deprecated = true];

    // RSS high-water mark. Peak RSS usage of the process. Read from the VmHWM field in
    // /proc/PID/status.
    optional int32 rss_high_water_mark_in_kilobytes = 4;
}

/*
 * Logs the memory stats for a process.
 *
 * Pulled from StatsCompanionService for all managed processes (from ActivityManagerService)
 * and for selected native processes.
 */
message ProcessMemorySnapshot {
    // The uid if available. -1 means not available.
    optional int32 uid = 1 [(is_uid) = true];

    // The process name.
    // Usually package name or process cmdline.
    // Provided by ActivityManagerService or read from /proc/PID/cmdline.
    optional string process_name = 2;

    // The pid of the process.
    // Allows to disambiguate instances of the process.
    optional int32 pid = 3;

    // The current OOM score adjustment value.
    // Read from ProcessRecord for managed processes.
    // Placeholder -1001 (OOM_SCORE_ADJ_MIN - 1, outside of allowed range) for native ones.
    optional int32 oom_score_adj = 4;

    // The current RSS of the process.
    // VmRSS from /proc/pid/status.
    optional int32 rss_in_kilobytes = 5;

    // The current anon RSS of the process.
    // RssAnon from /proc/pid/status.
    optional int32 anon_rss_in_kilobytes = 6;

    // The current swap size of the process.
    // VmSwap from /proc/pid/status.
    optional int32 swap_in_kilobytes = 7;

    // The sum of rss_in_kilobytes and swap_in_kilobytes.
    optional int32 anon_rss_and_swap_in_kilobytes = 8;
}

/*
 * Elapsed real time from SystemClock.
 */
message SystemElapsedRealtime {
    optional uint64 time_millis = 1;
}

/*
 * Up time from SystemClock.
 */
message SystemUptime {
    // Milliseconds since the system was booted.
    // This clock stops when the system enters deep sleep (CPU off, display dark, device waiting
    // for external input).
    // It is not affected by clock scaling, idle, or other power saving mechanisms.
    optional uint64 uptime_millis = 1;
}

/*
 * Reads from /proc/uid_concurrent_active_time which has the format:
 * active: X (X is # cores)
 * [uid0]: [time-0] [time-1] [time-2] ... (# entries = # cores)
 * [uid1]: [time-0] [time-1] [time-2] ... ...
 * ...
 * Time-N means the CPU time a UID spent running concurrently with N other processes.
 * The file contains a monotonically increasing count of time for a single boot.
 */
message CpuActiveTime {
    optional int32 uid = 1 [(is_uid) = true];
    optional uint64 time_millis = 2;
}

/**
 * Reads from /proc/uid_concurrent_policy_time which has the format:
 * policy0: X policy4: Y (there are X cores on policy0, Y cores on policy4)
 * [uid0]: [time-0-0] [time-0-1] ... [time-1-0] [time-1-1] ...
 * [uid1]: [time-0-0] [time-0-1] ... [time-1-0] [time-1-1] ...
 * ...
 * Time-X-Y means the time a UID spent on clusterX running concurrently with Y other processes.
 * The file contains a monotonically increasing count of time for a single boot.
 */
message CpuClusterTime {
    optional int32 uid = 1 [(is_uid) = true];
    optional int32 cluster_index = 2;
    optional uint64 time_millis = 3;
}

/*
 * Pulls free disk space, for data, system partition and temporary directory.
 */
message DiskSpace {
    // available bytes in data partition
    optional uint64 data_available_bytes = 1;
    // available bytes in system partition
    optional uint64 system_available_bytes = 2;
    // available bytes in download cache or temp directories
    optional uint64 temp_available_bytes = 3;
}

/**
 * Pulls battery coulomb counter, which is the remaining battery charge in uAh.
 *
 * Pulled from StatsCompanionService.java
 */
message RemainingBatteryCapacity {
    optional int32 charge_micro_ampere_hour = 1;
}

/**
 * Pulls battery capacity, which is the battery capacity when full in uAh.
 * Pulled from:
 *   frameworks/base/cmds/statsd/src/external/ResourceHealthManagerPuller.cpp
 */
message FullBatteryCapacity {
    optional int32 capacity_micro_ampere_hour = 1;
}

/**
 * Pulls battery voltage.
 * Pulled from:
 *   frameworks/base/cmds/statsd/src/external/ResourceHealthManagerPuller.cpp
 */
message BatteryVoltage {
    // The voltage of the battery, in millivolts.
    optional int32 voltage_millivolt = 1;
}

/**
 * Pulls battery level (percent full, from 0 to 100).
 *
 * Pulled from:
 *   frameworks/base/cmds/statsd/src/external/ResourceHealthManagerPuller.cpp
 */
message BatteryLevel {
    // Battery level. Should be in [0, 100].
    optional int32 battery_level = 1;
}

/**
 * Pulls the temperature of various parts of the device.
 * The units are tenths of a degree Celsius. Eg: 30.3C is reported as 303.
 *
 * Pulled from StatsCompanionService.java
 */
message Temperature {
    // The type of temperature being reported. Eg. CPU, GPU, SKIN, BATTERY, BCL_.
    optional android.os.TemperatureTypeEnum sensor_location = 1;

    // The name of the temperature source. Eg. CPU0
    optional string sensor_name = 2;

    // Temperature in tenths of a degree C.
    // For BCL, it is decimillivolt, decimilliamps, and percentage * 10.
    optional int32 temperature_deci_celsius = 3;

    // Relative severity of the throttling, see enum definition.
    optional android.os.ThrottlingSeverityEnum severity = 4;
}

/**
 * Pulls the statistics of calls to Binder.
 *
 * Binder stats will be reset every time the data is pulled. It means it can only be pulled by one
 * config on the device.
 *
 * Next tag: 15
 */
message BinderCalls {
    // UID of the process responsible for the binder transaction. It will be set if the process
    // executing the binder transaction attribute the transaction to another uid using
    // Binder.setThreadWorkSource().
    //
    // If not set, the value will be -1.
    optional int32 uid = 1 [(is_uid) = true];
    // UID of the process executing the binder transaction.
    optional int32 direct_caller_uid = 14;
    // Fully qualified class name of the API call.
    //
    // This is a system server class name.
    //
    // TODO(gaillard): figure out if binder call stats includes data from isolated uids, if a uid
    // gets recycled and we have isolated uids, we might attribute the data incorrectly.
    // TODO(gaillard): there is a high dimensions cardinality, figure out if we should drop the less
    // commonly used APIs.
    optional string service_class_name = 2;
    // Method name of the API call. It can also be a transaction code if we cannot
    // resolve it to a name. See Binder#getTransactionName.
    //
    // This is a system server method name.
    optional string service_method_name = 3;
    // Total number of API calls.
    optional int64 call_count = 4;
    // True if the screen was interactive PowerManager#isInteractive at the end of the call.
    optional bool screen_interactive = 13;
    // Total number of API calls we have data recorded for. If we collected data for all the calls,
    // call_count will be equal to recorded_call_count.
    //
    // If recorded_call_count is different than call_count, it means data collection has been
    // sampled. All the fields below will be sampled in this case.
    optional int64 recorded_call_count = 12;
    // Number of exceptions thrown by the API.
    optional int64 recorded_exception_count = 5;
    // Total latency of all API calls.
    // Average can be computed using total_latency_micros / recorded_call_count.
    optional int64 recorded_total_latency_micros = 6;
    // Maximum latency of one API call.
    optional int64 recorded_max_latency_micros = 7;
    // Total CPU usage of all API calls.
    // Average can be computed using total_cpu_micros / recorded_call_count.
    // Total can be computed using total_cpu_micros / recorded_call_count * call_count.
    optional int64 recorded_total_cpu_micros = 8;
    // Maximum CPU usage of one API call.
    optional int64 recorded_max_cpu_micros = 9;
    // Maximum parcel reply size of one API call.
    optional int64 recorded_max_reply_size_bytes = 10;
    // Maximum parcel request size of one API call.
    optional int64 recorded_max_request_size_bytes = 11;
}

/**
 * Pulls the statistics of exceptions during calls to Binder.
 *
 * Binder stats are cumulative from boot unless somebody reset the data using
 * > adb shell dumpsys binder_calls_stats --reset
 */
message BinderCallsExceptions {
    // Exception class name, e.g. java.lang.IllegalArgumentException.
    //
    // This is an exception class name thrown by the system server.
    optional string exception_class_name = 1;
    // Total number of exceptions.
    optional int64 exception_count = 2;
}

/**
 * Pulls the statistics of message dispatching on HandlerThreads.
 *
 * Looper stats will be reset every time the data is pulled. It means it can only be pulled by one
 * config on the device.
 *
 * Next tag: 11
 */
message LooperStats {
    // The uid that made a call to the System Server and caused the message to be enqueued.
    optional int32 uid = 1 [(is_uid) = true];

    // Fully qualified class name of the handler target class.
    //
    // This field does not contain PII. This is a system server class name.
    optional string handler_class_name = 2;

    // The name of the thread that runs the Looper.
    //
    // This field does not contain PII. This is a system server thread name.
    optional string looper_thread_name = 3;

    // The name of the dispatched message.
    //
    // This field does not contain PII. This is a system server constant or class
    // name.
    optional string message_name = 4;

    // Total number of successfully dispatched messages.
    optional int64 message_count = 5;

    // Total number of messages that failed dispatching.
    optional int64 exception_count = 6;

    // Total number of processed messages we have data recorded for. If we
    // collected data for all the messages, message_count will be equal to
    // recorded_message_count.
    //
    // If recorded_message_count is different than message_count, it means data
    // collection has been sampled. The fields below will be sampled in this case.
    optional int64 recorded_message_count = 7;

    // Total latency of all processed messages.
    // Average can be computed using recorded_total_latency_micros /
    // recorded_message_count.
    optional int64 recorded_total_latency_micros = 8;

    // Total CPU usage of all processed message.
    // Average can be computed using recorded_total_cpu_micros /
    // recorded_message_count. Total can be computed using
    // recorded_total_cpu_micros / recorded_message_count * message_count.
    optional int64 recorded_total_cpu_micros = 9;

    // True if the screen was interactive PowerManager#isInteractive at the end of the call.
    optional bool screen_interactive = 10;

    // Max recorded CPU usage of all processed messages.
    optional int64 recorded_max_cpu_micros = 11;

    // Max recorded latency of all processed messages.
    optional int64 recorded_max_latency_micros = 12;

    // Total number of messages we tracked the dispatching delay for. If we
    // collected data for all the messages, message_count will be equal to
    // recorded_delay_message_count.
    //
    // If recorded_delay_message_count is different than message_count, it means data
    // collection has been sampled or/and not all messages specified the target dispatch time.
    // The fields below will be sampled in this case.
    optional int64 recorded_delay_message_count = 13;

    // Total dispatching delay of all processed messages.
    // Calculated as a difference between the target dispatching time (Message.when)
    // and the actual dispatching time.
    // Average can be computed using recorded_total_delay_millis / recorded_delay_message_count.
    optional int64 recorded_total_delay_millis = 14;

    // Max dispatching delay of all processed messages.
    // Calculated as a difference between the target dispatching time (Message.when)
    // and the actual dispatching time.
    optional int64 recorded_max_delay_millis = 15;
}

/**
 * Pulls disk information, such as write speed and latency.
 */
message DiskStats {
    // Time taken to open, write 512B to, and close a file.
    // -1 if error performing the check.
    optional int64 data_write_latency_millis = 1;

    optional bool file_based_encryption = 2;

    // Recent disk write speed in kB/s.
    // -1 if error querying storageed.
    // 0 if data is unavailable.
    optional int32 recent_disk_write_speed = 3;
}


/**
 * Free and total bytes of the Data, Cache, and System partition.
 */
message DirectoryUsage {
    enum Directory {
        UNKNOWN = 0;
        DATA = 1;
        CACHE = 2;
        SYSTEM = 3;
    }
    optional Directory directory = 1;
    optional int64 free_bytes = 2;
    optional int64 total_bytes = 3;
}


/**
 * Size of an application: apk size, data size, and cache size.
 * Reads from a cached file produced daily by DiskStatsLoggingService.java.
 * Information is only reported for apps with the primary user (user 0).
 * Sizes are aggregated by package name.
 */
message AppSize {
    // Including uids will involve modifying diskstats logic.
    optional string package_name = 1;
    // App size in bytes. -1 if unavailable.
    optional int64 app_size_bytes = 2;
    // App data size in bytes. -1 if unavailable.
    optional int64 app_data_size_bytes = 3;
    // App cache size in bytes. -1 if unavailable.
    optional int64 app_cache_size_bytes = 4;
    // Time that the cache file was produced.
    // Uses System.currentTimeMillis(), which is wall clock time.
    optional int64 cache_time_millis = 5;
}


/**
 * Size of a particular category. Eg: photos, videos.
 * Reads from a cached file produced daily by DiskStatsLoggingService.java.
 */
message CategorySize {
    enum Category {
        UNKNOWN = 0;
        APP_SIZE = 1;
        APP_DATA_SIZE = 2;
        APP_CACHE_SIZE = 3;
        PHOTOS = 4;
        VIDEOS = 5;
        AUDIO = 6;
        DOWNLOADS = 7;
        SYSTEM = 8;
        OTHER = 9;
    }
    optional Category category = 1;
    // Category size in bytes.
    optional int64 size_bytes = 2;
    // Time that the cache file was produced.
    // Uses System.currentTimeMillis(), which is wall clock time.
    optional int64 cache_time_millis = 3;
}

/**
 * Pulls per uid I/O stats. The stats are cumulative since boot.
 *
 * Read/write bytes are I/O events from a storage device
 * Read/write chars are data requested by read/write syscalls, and can be
 *   satisfied by caching.
 *
 * Pulled from StatsCompanionService, which reads proc/uid_io/stats.
 */
message DiskIo {
    optional int32 uid = 1 [(is_uid) = true];
    optional int64 fg_chars_read = 2;
    optional int64 fg_chars_write = 3;
    optional int64 fg_bytes_read = 4;
    optional int64 fg_bytes_write = 5;
    optional int64 bg_chars_read = 6;
    optional int64 bg_chars_write = 7;
    optional int64 bg_bytes_read = 8;
    optional int64 bg_bytes_write = 9;
    optional int64 fg_fsync = 10;
    optional int64 bg_fsync= 11;
}


/**
 * Pulls the number of fingerprints for each user.
 *
 * Pulled from StatsCompanionService, which queries <Biometric>Manager.
 */
message NumFingerprintsEnrolled {
    // The associated user. Eg: 0 for owners, 10+ for others.
    // Defined in android/os/UserHandle.java
    optional int32 user = 1;
    // Number of fingerprints registered to that user.
    optional int32 num_fingerprints_enrolled = 2;
}

/**
 * Pulls the number of faces for each user.
 *
 * Pulled from StatsCompanionService, which queries <Biometric>Manager.
 */
message NumFacesEnrolled {
    // The associated user. Eg: 0 for owners, 10+ for others.
    // Defined in android/os/UserHandle.java
    optional int32 user = 1;
    // Number of faces registered to that user.
    optional int32 num_faces_enrolled = 2;
}
/**
 * A mapping of role holder -> role
 */
message RoleHolder {
    // uid of the role holder
    optional int32 uid = 1 [(is_uid) = true];

    // package name of the role holder
    optional string package_name = 2;

    // the role held
    optional string role = 3;
}

message AggStats {
    // These are all in byte resolution.
    optional int64 min = 1 [deprecated = true];
    optional int64 average = 2 [deprecated = true];
    optional int64 max = 3 [deprecated = true];

    // These are all in kilobyte resolution. Can fit in int32, so smaller on the wire than the above
    // int64 fields.
    optional int32 mean_kb = 4;
    optional int32 max_kb = 5;
}

// A reduced subset of process states; reducing the number of possible states allows more
// aggressive device-side aggregation of statistics and hence reduces metric upload size.
enum ProcessStateAggregated {
    PROCESS_STATE_UNKNOWN = 0;
    // Persistent system process.
    PROCESS_STATE_PERSISTENT = 1;
    // Top activity; actually any visible activity.
    PROCESS_STATE_TOP = 2;
    // Process binding to top or a foreground service.
    PROCESS_STATE_BOUND_TOP_OR_FGS = 3;
    // Processing running a foreground service.
    PROCESS_STATE_FGS = 4;
    // Important foreground process (ime, wallpaper, etc).
    PROCESS_STATE_IMPORTANT_FOREGROUND = 5;
    // Important background process.
    PROCESS_STATE_BACKGROUND = 6;
    // Process running a receiver.
    PROCESS_STATE_RECEIVER = 7;
    // All kinds of cached processes.
    PROCESS_STATE_CACHED = 8;
}

// Next tag: 13
message ProcessStatsStateProto {
    optional android.service.procstats.ScreenState screen_state = 1;

    optional android.service.procstats.MemoryState memory_state = 2 [deprecated = true];

    // this enum list is from frameworks/base/core/java/com/android/internal/app/procstats/ProcessStats.java
    // and not frameworks/base/core/java/android/app/ActivityManager.java
    optional android.service.procstats.ProcessState process_state = 3 [deprecated = true];

    optional ProcessStateAggregated process_state_aggregated = 10;

    // Millisecond uptime duration spent in this state
    optional int64 duration_millis = 4 [deprecated = true];
    // Same as above, but with minute resolution so it fits into an int32.
    optional int32 duration_minutes = 11;

    // Millisecond elapsed realtime duration spent in this state
    optional int64 realtime_duration_millis = 9 [deprecated = true];
    // Same as above, but with minute resolution so it fits into an int32.
    optional int32 realtime_duration_minutes = 12;

    // # of samples taken
    optional int32 sample_size = 5;

    // PSS is memory reserved for this process
    optional AggStats pss = 6 [deprecated = true];

    // USS is memory shared between processes, divided evenly for accounting
    optional AggStats uss = 7 [deprecated = true];

    // RSS is memory resident for this process
    optional AggStats rss = 8;
}

// Next Tag: 8
message ProcessStatsProto {
    // Name of process.
    optional string process = 1;

    // Uid of the process.
    optional int32 uid = 2 [(is_uid) = true];

    // Information about how often kills occurred
    message Kill {
        // Count of excessive CPU kills
        optional int32 cpu = 1;

        // Count of kills when cached
        optional int32 cached = 2;

        // PSS stats during cached kill
        optional AggStats cached_pss = 3;
    }
    optional Kill kill = 3 [deprecated = true];

    // Time and memory spent in various states.
    repeated ProcessStatsStateProto states = 5;

    // Total time process has been running...  screen_state, memory_state, and process_state
    // will not be set.
    optional ProcessStatsStateProto total_running_state = 6;

    // Association data for this process in this state;
    // each entry here is one association.
    repeated ProcessStatsAssociationProto assocs = 7;
}

// Next Tag: 6
message ProcessStatsAssociationProto {
    // Procss Name of the associated process (client process of service binding)
    optional string assoc_process_name = 1;

    // Package Name of the associated package (client package of service binding)
    optional string assoc_package_name = 2 [deprecated = true];

    // UID of the associated process/package (client package of service binding)
    optional int32 assoc_uid = 5 [(is_uid) = true];

    // Total count of the times this association (service binding) appeared.
    optional int32 total_count = 3;

    // Uptime total duration in seconds this association (service binding) was around.
    optional int32 total_duration_secs = 4;
}

message PackageServiceOperationStatsProto {
    // Operate enum: Started, Foreground, Bound, Executing
    optional android.service.procstats.ServiceOperationState operation = 1;

    // Number of times the service was in this operation.
    optional int32 count = 2;

    // Information about a state the service can be in.
    message StateStats {
        // Screen state enum.
        optional android.service.procstats.ScreenState screen_state = 1;
        // Memory state enum.
        optional android.service.procstats.MemoryState memory_state = 2;

        // duration in milliseconds.
        optional int64 duration_millis = 3;
        // Millisecond elapsed realtime duration spent in this state
        optional int64 realtime_duration_millis = 4;
    }
    repeated StateStats state_stats = 3;
}

message PackageServiceStatsProto {
    // Name of service component.
    optional string service_name = 1;

    // The operation stats.
    // The package_name, package_uid, package_version, service_name will not be set to save space.
    repeated PackageServiceOperationStatsProto operation_stats = 2;
}

message PackageAssociationSourceProcessStatsProto {
    // Uid of the process.
    optional int32 process_uid = 1;
    // Process name.
    optional string process_name = 2;
    // Package name.
    optional string package_name = 7;
    // Total count of the times this association appeared.
    optional int32 total_count = 3;

    // Millisecond uptime total duration this association was around.
    optional int64 total_duration_millis = 4;

    // Total count of the times this association became actively impacting its target process.
    optional int32 active_count = 5;

    // Information on one source in this association.
    message StateStats {
        // Process state enum.
        optional android.service.procstats.ProcessState process_state = 1;
        // Millisecond uptime duration spent in this state
        optional int64 duration_millis = 2;
        // Millisecond elapsed realtime duration spent in this state
        optional int64 realtime_duration_mmillis = 3;
    }
    repeated StateStats active_state_stats = 6;
}

message PackageAssociationProcessStatsProto {
    // Name of the target component.
    optional string component_name = 1;
    // Information on one source in this association.
    repeated PackageAssociationSourceProcessStatsProto sources = 2;
}


message ProcessStatsPackageProto {
    // Name of package.
    optional string package = 1;

    // Uid of the package.
    optional int32 uid = 2;

    // Version of the package.
    optional int64 version = 3;

    // Stats for each process running with the package loaded in to it.
    repeated ProcessStatsProto process_stats = 4;

    // Stats for each of the package's services.
    repeated PackageServiceStatsProto service_stats = 5;

    // Stats for each association with the package.
    repeated PackageAssociationProcessStatsProto association_stats = 6;
}

message ProcessStatsSectionProto {
    // Elapsed realtime at start of report.
    optional int64 start_realtime_millis = 1;

    // Elapsed realtime at end of report.
    optional int64 end_realtime_millis = 2;

    // CPU uptime at start of report.
    optional int64 start_uptime_millis = 3;

    // CPU uptime at end of report.
    optional int64 end_uptime_millis = 4;

    // System runtime library. e.g. "libdvm.so", "libart.so".
    optional string runtime = 5;

    // whether kernel reports swapped pss.
    optional bool has_swapped_pss = 6;

    // Data completeness. e.g. "complete", "partial", shutdown", or "sysprops".
    enum Status {
        STATUS_UNKNOWN = 0;
        STATUS_COMPLETE = 1;
        STATUS_PARTIAL = 2;
        STATUS_SHUTDOWN = 3;
        STATUS_SYSPROPS = 4;
    }
    repeated Status status = 7;

    // Number of pages available of various types and sizes, representation fragmentation.
    repeated ProcessStatsAvailablePagesProto available_pages = 10;

    // Stats for each process.
    repeated ProcessStatsProto process_stats = 8;

    // Stats for each package.
    repeated ProcessStatsPackageProto package_stats = 9;
}

message ProcessStatsAvailablePagesProto {
    // Node these pages are in (as per /proc/pagetypeinfo)
    optional int32 node = 1;

    // Zone these pages are in (as per /proc/pagetypeinfo)
    optional string zone = 2;

    // Label for the type of these pages (as per /proc/pagetypeinfo)
    optional string label = 3;

    // Distribution of number of pages available by order size.  First entry in array is
    // order 0, second is order 1, etc.  Each order increase is a doubling of page size.
    repeated int32 pages_per_order = 4;
}

/**
 * Pulled from ProcessStatsService.java
 */
message ProcStats {
    optional ProcessStatsSectionProto proc_stats_section = 1;
    // Data pulled from device into this is sometimes sharded across multiple atoms to work around
    // a size limit. When this happens, this shard ID will contain an increasing 1-indexed integer
    // with the number of this shard.
    optional int32 shard_id = 2;
}

/**
 * Pulled from ProcessStatsService.java
 */
message ProcStatsPkgProc {
    optional ProcessStatsSectionProto proc_stats_section = 1;
}

// Next Tag: 2
message PackageRemoteViewInfoProto {
    optional string package_name = 1;
    // add per-package additional info here (like channels)
}

// Next Tag: 2
message NotificationRemoteViewsProto {
    repeated PackageRemoteViewInfoProto package_remote_view_info = 1;
}

/**
 * Pulled from NotificationManagerService.java
 */
message NotificationRemoteViews {
    optional NotificationRemoteViewsProto notification_remote_views = 1;
}

/**
 * Atom that contains a list of a package's preferences, pulled from NotificationManagerService.java
 */
message PackageNotificationPreferences {
    // Uid under which the package is installed.
    optional int32 uid = 1 [(is_uid) = true];
    // Notification importance, which specifies when and how a notification is displayed.
    // Specified under core/java/android/app/NotificationManager.java.
    optional int32 importance = 2;
    // Lockscreen visibility as set by the user.
    optional int32 visibility = 3;
    // Bitfield mask indicating what fields were locked by the user (see LockableAppfields in
    // PreferencesHelper.java)
    optional int32 user_locked_fields = 4;
}

/**
 * Atom that contains a list of a package's channel preferences, pulled from
 * NotificationManagerService.java.
 */
message PackageNotificationChannelPreferences {
    // Uid under which the package is installed.
    optional int32 uid = 1 [(is_uid) = true];
    // Channel's ID. Should always be available.
    optional string channel_id = 2;
    // Channel's name. Should always be available.
    optional string channel_name = 3;
    // Channel's description. Optionally set by the channel creator.
    optional string description = 4;
    // Notification importance, which specifies when and how a notification is displayed. Specified
    // under core/java/android/app/NotificationManager.java.
    optional int32 importance = 5;
    // Bitmask representing which fields have been set by the user. See field bitmask descriptions
    // at core/java/android/app/NotificationChannel.java
    optional int32 user_locked_fields = 6;
    // Indicates if the channel was deleted by the app.
    optional bool is_deleted = 7;
    // Indicates if the channel was marked as a conversation by the app.
    optional bool is_conversation = 8;
    // Indicates if the channel is a conversation that was demoted by the user.
    optional bool is_demoted_conversation = 9;
    // Indicates if the channel is a conversation that was marked as important by the user.
    optional bool is_important_conversation = 10;
}

/**
 * Atom that represents an item in the list of Do Not Disturb rules, pulled from
 * NotificationManagerService.java.
 */
message DNDModeProto {
    enum Mode {
        ROOT_CONFIG = -1;  // Used to distinguish the config (one per user) from the rules.
        ZEN_MODE_OFF = 0;
        ZEN_MODE_IMPORTANT_INTERRUPTIONS = 1;
        ZEN_MODE_NO_INTERRUPTIONS = 2;
        ZEN_MODE_ALARMS = 3;
    }
    optional int32 user = 1;  // Android user ID (0, 1, 10, ...)
    optional bool enabled = 2;  // true for ROOT_CONFIG if a manualRule is enabled
    optional bool channels_bypassing = 3; // only valid for ROOT_CONFIG
    optional Mode zen_mode = 4;
    // id is one of the system default rule IDs, or empty
    // May also be "MANUAL_RULE" to indicate app-activation of the manual rule.
    optional string id = 5;
    optional int32 uid = 6 [(is_uid) = true]; // currently only SYSTEM_UID or 0 for other
    optional DNDPolicyProto policy = 7;
}

/**
 * Atom that represents a Do Not Disturb policy, an optional detail proto for DNDModeProto.
 */
message DNDPolicyProto {
    enum State {
        STATE_UNSET = 0;
        STATE_ALLOW = 1;
        STATE_DISALLOW = 2;
    }
    optional State calls = 1;
    optional State repeat_callers = 2;
    optional State messages = 3;
    optional State conversations = 4;
    optional State reminders = 5;
    optional State events = 6;
    optional State alarms = 7;
    optional State media = 8;
    optional State system = 9;
    optional State fullscreen = 10;
    optional State lights = 11;
    optional State peek = 12;
    optional State status_bar = 13;
    optional State badge = 14;
    optional State ambient = 15;
    optional State notification_list = 16;

    enum PeopleType {
        PEOPLE_UNSET = 0;
        PEOPLE_ANYONE = 1;
        PEOPLE_CONTACTS = 2;
        PEOPLE_STARRED = 3;
        PEOPLE_NONE = 4;
    }

    optional PeopleType allow_calls_from = 17;
    optional PeopleType allow_messages_from = 18;

    enum ConversationType {
        CONV_UNSET = 0;
        CONV_ANYONE = 1;
        CONV_IMPORTANT = 2;
        CONV_NONE = 3;
    }

    optional ConversationType allow_conversations_from = 19;
}

/**
 * Atom that contains a list of a package's channel group preferences, pulled from
 * NotificationManagerService.java.
 */
message PackageNotificationChannelGroupPreferences {
    // Uid under which the package is installed.
    optional int32 uid = 1 [(is_uid) = true];
    // Channel Group's ID. Should always be available.
    optional string group_id = 2;
    // Channel Group's name. Should always be available.
    optional string group_name = 3;
    // Channel Group's description. Optionally set by group creator.
    optional string description = 4;
    // Indicates if notifications from this channel group are blocked.
    optional bool is_blocked = 5;
    // Bitmask representing which fields have been set by the user. See field bitmask descriptions
    // at core/java/android/app/NotificationChannelGroup.java
    optional int32 user_locked_fields = 6;
}

message PowerProfileProto {
    optional double cpu_suspend = 1;

    optional double cpu_idle = 2;

    optional double cpu_active = 3;

    message CpuCluster {
        optional int32 id = 1;
        optional double cluster_power = 2;
        optional int32 cores = 3;
        repeated int64 speed = 4;
        repeated double core_power = 5;
    }

    repeated CpuCluster cpu_cluster = 40;

    optional double wifi_scan = 4;

    optional double wifi_on = 5;

    optional double wifi_active = 6;

    optional double wifi_controller_idle = 7;

    optional double wifi_controller_rx = 8;

    optional double wifi_controller_tx = 9;

    repeated double wifi_controller_tx_levels = 10;

    optional double wifi_controller_operating_voltage = 11;

    optional double bluetooth_controller_idle = 12;

    optional double bluetooth_controller_rx = 13;

    optional double bluetooth_controller_tx = 14;

    optional double bluetooth_controller_operating_voltage = 15;

    optional double modem_controller_sleep = 16;

    optional double modem_controller_idle = 17;

    optional double modem_controller_rx = 18;

    repeated double modem_controller_tx = 19;

    optional double modem_controller_operating_voltage = 20;

    optional double gps_on = 21;

    repeated double gps_signal_quality_based = 22;

    optional double gps_operating_voltage = 23;

    optional double bluetooth_on = 24;

    optional double bluetooth_active = 25;

    optional double bluetooth_at_cmd = 26;

    optional double ambient_display = 27;

    optional double screen_on = 28;

    optional double radio_on = 29;

    optional double radio_scanning = 30;

    optional double radio_active = 31;

    optional double screen_full = 32;

    optional double audio = 33;

    optional double video = 34;

    optional double flashlight = 35;

    optional double memory = 36;

    optional double camera = 37;

    optional double wifi_batched_scan = 38;

    optional double battery_capacity = 39;
}

/**
 * power_profile.xml and other constants for power model calculations.
 * Pulled from PowerProfile.java
 */
message PowerProfile {
    optional PowerProfileProto power_profile = 1;
}

/**
 * Logs when a user restriction was added or removed.
 *
 * Logged from:
 *   frameworks/base/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java
 */
message UserRestrictionChanged {
    // The raw string of the user restriction as defined in UserManager.
    // Allowed values are defined in UserRestrictionsUtils#USER_RESTRICTIONS.
    optional string restriction = 1;
    // Whether the restriction is enabled or disabled.
    optional bool enabled = 2;
}

/**
 * Pulls process user time and system time. Puller takes a snapshot of all pids
 * in the system and returns cpu stats for those that are working at the time.
 * Dead pids will be dropped. Kernel processes are excluded.
 * Min cool-down is 5 sec.
 */
message ProcessCpuTime {
    optional int32 uid = 1 [(is_uid) = true];

    optional string process_name = 2;
    // Process cpu time in user space, cumulative from boot/process start
    optional int64 user_time_millis = 3;
    // Process cpu time in system space, cumulative from boot/process start
    optional int64 system_time_millis = 4;
}

/**
 * Pulls the CPU usage for each thread.
 *
 * Read from /proc/$PID/task/$TID/time_in_state files.
 *
 * TODO(mishaw): This is an experimental atom. Issues with big/little CPU frequencies, and
 * time_in_state files not being present on some phones, have not been addressed. These should be
 * considered before a public release.
 */
message CpuTimePerThreadFreq {
    // UID that owns the process.
    optional int32 uid = 1 [(is_uid) = true];
    // ID of the process.
    optional int32 process_id = 2;
    // ID of the thread.
    optional int32 thread_id = 3;
    // Name of the process taken from `/proc/$PID/cmdline`.
    optional string process_name = 4;
    // Name of the thread taken from `/proc/$PID/task/$TID/comm`
    optional string thread_name = 5;

    // Report eight different frequencies, and how much time is spent in each frequency. Frequencies
    // are given in KHz, and time is given in milliseconds since the thread started. All eight
    // frequencies are given here as the alternative is sending eight separate atoms. This method
    // significantly reduces the amount of data created
    optional int32 frequency1_khz = 6;
    optional int32 time1_millis = 7;
    optional int32 frequency2_khz = 8;
    optional int32 time2_millis = 9;
    optional int32 frequency3_khz = 10;
    optional int32 time3_millis = 11;
    optional int32 frequency4_khz = 12;
    optional int32 time4_millis = 13;
    optional int32 frequency5_khz = 14;
    optional int32 time5_millis = 15;
    optional int32 frequency6_khz = 16;
    optional int32 time6_millis = 17;
    optional int32 frequency7_khz = 18;
    optional int32 time7_millis = 19;
    optional int32 frequency8_khz = 20;
    optional int32 time8_millis = 21;
}

/**
 * Pulls information about the device's build.
 */
message BuildInformation {
    // Build.FINGERPRINT. A string that uniquely identifies this build. Do not parse.
    // E.g. may be composed of the brand, product, device, release, id, incremental, type, and tags.
    optional string fingerprint = 1;

    // Build.BRAND. The consumer-visible brand with which the product/hardware will be associated.
    optional string brand = 2;

    // Build.PRODUCT. The name of the overall product.
    optional string product = 3;

    // Build.DEVICE. The name of the industrial design.
    optional string device = 4;

    // Build.VERSION.RELEASE. The user-visible version string.  E.g., "1.0" or "3.4b5" or "bananas".
    optional string version_release = 5;

    // Build.ID. E.g. a label like "M4-rc20".
    optional string id = 6;

    // Build.VERSION.INCREMENTAL. The internal value used by the underlying source control to
    // represent this build.
    optional string version_incremental = 7;

    // Build.TYPE. The type of build, like "user" or "eng".
    optional string type = 8;

    // Build.TAGS. Comma-separated tags describing the build, like "unsigned,debug".
    optional string tags = 9;
}

/**
 * Logs information about mismatched caller for content capture.
 *
 * Logged from:
 *   frameworks/base/core/java/android/service/contentcapture/ContentCaptureService.java
 */
message ContentCaptureCallerMismatchReported {
    optional string intended_package = 1;
    optional string calling_package = 2;
}

/**
 * Logs information about content capture service events.
 *
 * Logged from:
 *   frameworks/base/services/contentcapture/java/com/android/server/contentcapture/ContentCaptureMetricsLogger.java
 */
message ContentCaptureServiceEvents {
    // The type of event.
    enum Event {
        UNKNOWN = 0;
        ON_CONNECTED = 1;
        ON_DISCONNECTED = 2;
        SET_WHITELIST = 3;
        SET_DISABLED = 4;
        ON_USER_DATA_REMOVED = 5;
        ON_DATA_SHARE_REQUEST = 6;
        ACCEPT_DATA_SHARE_REQUEST = 7;
        REJECT_DATA_SHARE_REQUEST = 8;
        DATA_SHARE_WRITE_FINISHED = 9;
        DATA_SHARE_ERROR_IOEXCEPTION = 10;
        DATA_SHARE_ERROR_EMPTY_DATA = 11;
        DATA_SHARE_ERROR_CLIENT_PIPE_FAIL = 12;
        DATA_SHARE_ERROR_SERVICE_PIPE_FAIL = 13;
        DATA_SHARE_ERROR_CONCURRENT_REQUEST = 14;
        DATA_SHARE_ERROR_TIMEOUT_INTERRUPTED = 15;
    }
    optional Event event = 1;
    // component/package of content capture service.
    optional string service_info = 2;
    // component/package of target.
    // it's a concatenated list of component/package for SET_WHITELIST event
    // separated by " ".
    optional string target_info = 3;
}

/**
 * Logs information about content capture session events.
 *
 * Logged from:
 *   frameworks/base/services/contentcapture/java/com/android/server/contentcapture/ContentCaptureMetricsLogger.java
 */
message ContentCaptureSessionEvents {
    // The type of event.
    enum Event {
        UNKNOWN = 0;
        ON_SESSION_STARTED = 1;
        ON_SESSION_FINISHED = 2;
        SESSION_NOT_CREATED = 3;
    }
    optional int32 session_id = 1;
    optional Event event = 2;
    // (n/a on session finished)
    optional int32 state_flags = 3;
    // component/package of content capture service.
    optional string service_info = 4;
    // component/package of app.
    // (n/a on session finished)
    optional string app_info = 5;
    optional bool is_child_session = 6;
}

/**
 * Logs information about session being flushed.
 *
 * Logged from:
 *   frameworks/base/services/contentcapture/java/com/android/server/contentcapture/ContentCaptureMetricsLogger.java
 */
message ContentCaptureFlushed {
    optional int32 session_id = 1;
    // component/package of content capture service.
    optional string service_info = 2;
    // component/package of app.
    optional string app_info = 3;
    // session start/finish events
    optional int32 child_session_started = 4;
    optional int32 child_session_finished = 5;
    // count of view events.
    optional int32 view_appeared_count = 6;
    optional int32 view_disappeared_count = 7;
    optional int32 view_text_changed_count = 8;

    // Flush stats.
    optional int32 max_events = 9;
    optional int32 idle_flush_freq = 10;
    optional int32 text_flush_freq = 11;
    optional int32 flush_reason = 12;
}

/**
 * Pulls on-device BatteryStats power use calculations for the overall device.
 */
message DeviceCalculatedPowerUse {
    // Power used by the device in nAs (i.e. nanocoulombs (nC)), as computed by BatteryStats, since
    // BatteryStats last reset (i.e. roughly since device was last significantly charged).
    // Currently, this is from BatteryStatsHelper.getComputedPower() (not getTotalPower()).
    optional int64 computed_power_nano_amp_secs = 1;
}

/**
 * Pulls on-device BatteryStats power use calculations broken down by uid.
 * This atom should be complemented by DeviceCalculatedPowerBlameOther, which contains the power use
 * that is attributed to non-uid items. They must all be included to get the total power use.
 */
message DeviceCalculatedPowerBlameUid {
    // Uid being blamed. Note: isolated uids have already been mapped to host uid.
    optional int32 uid = 1 [(is_uid) = true];

    // Power used by this uid in nAs (i.e. nanocoulombs (nC)), as computed by BatteryStats, since
    // BatteryStats last reset (i.e. roughly since device was last significantly charged).
    optional int64 power_nano_amp_secs = 2;
}

/**
 * Pulls on-device BatteryStats power use calculations that are not due to a uid, broken down by
 * drain type.
 * This atom should be complemented by DeviceCalculatedPowerBlameUid, which contains the blame that
 * is attributed uids. They must all be included to get the total power use.
 */
message DeviceCalculatedPowerBlameOther {
    // The type of item whose power use is being reported.
    enum DrainType {
        AMBIENT_DISPLAY = 0;
        // reserved 1; reserved "APP"; // Logged instead in DeviceCalculatedPowerBlameUid.
        BLUETOOTH = 2;
        CAMERA = 3;
        // Cell-standby
        CELL = 4;
        FLASHLIGHT = 5;
        IDLE = 6;
        MEMORY = 7;
        // Amount that total computed drain exceeded the drain estimated using the
        // battery level changes and capacity.
        OVERCOUNTED = 8;
        PHONE = 9;
        SCREEN = 10;
        // Amount that total computed drain was below the drain estimated using the
        // battery level changes and capacity.
        UNACCOUNTED = 11;
        // reserved 12; reserved "USER"; // Entire drain for a user. This is NOT supported.
        WIFI = 13;
    }
    optional DrainType drain_type = 1;

    // Power used by this item in nAs (i.e. nanocoulombs (nC)), as computed by BatteryStats, since
    // BatteryStats last reset (i.e. roughly since device was last significantly charged).
    optional int64 power_nano_amp_secs = 2;
}

/**
 * Logs device policy features.
 *
 * Logged from:
 *   frameworks/base/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java
 *   packages/apps/ManagedProvisioning/src/com/android/managedprovisioning/
 */
message DevicePolicyEvent {
    // The event id - unique for each event.
    optional android.stats.devicepolicy.EventId event_id = 1;
    // The admin package name.
    optional string admin_package_name = 2;
    // A generic integer parameter.
    optional int32 integer_value = 3;
    // A generic boolean parameter.
    optional bool boolean_value = 4;
    // A parameter specifying a time period in milliseconds.
    optional uint64 time_period_millis = 5;
    // A parameter specifying a list of package names, bundle extras or string parameters.
    optional android.stats.devicepolicy.StringList string_list_value = 6 [(log_mode) = MODE_BYTES];
}

/**
 * Logs when DocumentsUI is started, and how. Call this when DocumentsUI first starts up.
 *
 * Logged from:
 *     package/app/DocumentsUI/src/com/android/documentsui/Metrics.java
 */
message DocsUILaunchReported {
    optional android.stats.docsui.LaunchAction launch_action = 1;
    optional bool has_initial_uri = 2;
    optional android.stats.docsui.MimeType mime_type = 3;
    optional android.stats.docsui.Root initial_root = 4;
}

/**
 * Logs root/app visited event in file managers/picker. Call this when the user
 * taps on root/app in hamburger menu.
 *
 * Logged from:
 *     package/app/DocumentsUI/src/com/android/documentsui/Metrics.java
 */
message DocsUIRootVisitedReported {
    optional android.stats.docsui.ContextScope scope = 1;
    optional android.stats.docsui.Root root = 2;
}

/**
 * Logs file operation stats. Call this when a file operation has completed.
 *
 * Logged from:
 *     package/app/DocumentsUI/src/com/android/documentsui/Metrics.java
 */
message DocsUIFileOperationReported {
    optional android.stats.docsui.Provider provider = 1;
    optional android.stats.docsui.FileOperation file_op = 2;
}

/**
 * Logs file operation stats. Call this when a copy/move operation has completed with a specific
 * mode.
 *
 * Logged from:
 *     package/app/DocumentsUI/src/com/android/documentsui/Metrics.java
 */
message DocsUIFileOperationCopyMoveModeReported {
    optional android.stats.docsui.FileOperation file_op = 1;
    optional android.stats.docsui.CopyMoveOpMode mode = 2;
}


/**
 * Logs file sub operation stats. Call this when a file operation has failed.
 *
 * Logged from:
 *     package/app/DocumentsUI/src/com/android/documentsui/Metrics.java
 */
message DocsUIFileOperationFailureReported {
    optional android.stats.docsui.Authority authority = 1;
    optional android.stats.docsui.SubFileOperation sub_op = 2;
}

/**
* Logs the cancellation of a file operation. Call this when a job is canceled
*
* Logged from:
*     package/app/DocumentsUI/src/com/android/documentsui/Metrics.java
*/
message DocsUIFileOperationCanceledReported {
    optional android.stats.docsui.FileOperation file_op = 1;
}

/**
 * Logs startup time in milliseconds.
 *
 * Logged from:
 *     package/app/DocumentsUI/src/com/android/documentsui/Metrics.java
 */
message DocsUIStartupMsReported {
    optional int32 startup_millis = 1;
}

/**
 * Logs the action that was started by user.
 *
 * Logged from:
 *     package/app/DocumentsUI/src/com/android/documentsui/Metrics.java
 */
message DocsUIUserActionReported {
    optional android.stats.docsui.UserAction action = 1;
}

/**
 * Logs the invalid type when invalid scoped access is requested.
 *
 * Logged from:
 *     package/app/DocumentsUI/src/com/android/documentsui/ScopedAccessMetrics.java
 */
message DocsUIInvalidScopedAccessRequestReported {
    optional android.stats.docsui.InvalidScopedAccess type = 1;
}

/**
 * Logs the package name that launches docsui picker mode.
 *
 * Logged from:
 *     package/app/DocumentsUI/src/com/android/documentsui/Metrics.java
 */
message DocsUIPickerLaunchedFromReported {
    optional string package_name = 1;
}

/**
 * Logs the search type.
 *
 * Logged from:
 *     package/app/DocumentsUI/src/com/android/documentsui/Metrics.java
 */
message DocsUISearchTypeReported {
    optional android.stats.docsui.SearchType search_type = 1;
}

/**
 * Logs the search mode.
 *
 * Logged from:
 *     package/app/DocumentsUI/src/com/android/documentsui/Metrics.java
 */
message DocsUISearchModeReported {
    optional android.stats.docsui.SearchMode search_mode = 1;
}

/**
 * Logs the pick result information.
 *
 * Logged from:
 *     package/app/DocumentsUI/src/com/android/documentsui/Metrics.java
 */
message DocsUIPickResultReported {
    optional int32 total_action_count = 1;
    optional int64 duration_millis = 2;
    optional int32 file_count= 3;
    optional bool is_searching = 4;
    optional android.stats.docsui.Root picked_from = 5;
    optional android.stats.docsui.MimeType mime_type = 6;
    optional int32 repeatedly_pick_times = 7;
}

/** Logs the drag and drop of files.

 * Logged from:
 *     package/app/DocumentsUI/src/com/android/documentsui/Metrics.java
 */
message DocsUIDragAndDropReported {
    optional bool drag_initiated_from_docsui = 1;
}

/**
 * Logs when an app's memory is compacted.
 *
 * Logged from:
 *   frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
 */
message AppCompacted {
  // The pid of the process being compacted.
  optional int32 pid = 1;

  // The name of the process being compacted.
  optional string process_name = 2;

  // The type of compaction.
  enum Action {
    UNKNOWN = 0;
    SOME = 1;
    FULL = 2;
    PERSISTENT = 3;
    BFGS = 4;
  }
  optional Action action = 3;

  // Total RSS in kilobytes consumed by the process prior to compaction.
  optional int64 before_rss_total_kilobytes = 4;

  // File RSS in kilobytes consumed by the process prior to compaction.
  optional int64 before_rss_file_kilobytes = 5;

  // Anonymous RSS in kilobytes consumed by the process prior to compaction.
  optional int64 before_rss_anon_kilobytes = 6;

  // Swap in kilobytes consumed by the process prior to compaction.
  optional int64 before_swap_kilobytes = 7;

  // Total RSS in kilobytes consumed by the process after compaction.
  optional int64 after_rss_total_kilobytes = 8;

  // File RSS in kilobytes consumed by the process after compaction.
  optional int64 after_rss_file_kilobytes = 9;

  // Anonymous RSS in kilobytes consumed by the process after compaction.
  optional int64 after_rss_anon_kilobytes = 10;

  // Swap in kilobytes consumed by the process after compaction.
  optional int64 after_swap_kilobytes = 11;

  // The time taken to perform compaction in milliseconds.
  optional int64 time_to_compact_millis = 12;

  // The last compaction action performed for this app.
  optional Action last_action = 13;

  // The last time that compaction was attempted on this process in milliseconds
  // since boot, not including sleep (see SystemClock.uptimeMillis()).
  optional int64 last_compact_timestamp_ms_since_boot = 14;

  // The "setAdj" (i.e. previous) oom_score_adj at the time of compaction.
  optional int32 oom_score_adj = 15;

  // The process state at the time of compaction.
  optional android.app.ProcessStateEnum process_state = 16 [default = PROCESS_STATE_UNKNOWN];

  // Free ZRAM in kilobytes before compaction.
  optional int64 before_zram_free_kilobytes = 17;

  // Free ZRAM in kilobytes after compaction.
  optional int64 after_zram_free_kilobytes = 18;
}

/**
 * Logs when a Tethering event occurs.
 *
 */
message NetworkTetheringReported {
  // tethering error code
  optional android.stats.connectivity.ErrorCode error_code = 1;

  // tethering downstream type
  optional android.stats.connectivity.DownstreamType downstream_type = 2;

  // transport type of upstream network
  optional android.stats.connectivity.UpstreamType upstream_type = 3;

  // The user type of Tethering
  optional android.stats.connectivity.UserType user_type= 4;
}

/**
 * Logs a DNS lookup operation initiated by the system resolver on behalf of an application
 * invoking native APIs such as getaddrinfo() or Java APIs such as Network#getAllByName().
 *
 * The NetworkDnsEventReported message represents the entire lookup operation, which may
 * result one or more queries to the recursive DNS resolvers. Those are individually logged
 * in DnsQueryEvents to enable computing error rates and network latency and timeouts
 * broken up by query type, transport, network interface, etc.
 */
message NetworkDnsEventReported {
    optional android.stats.dnsresolver.EventType event_type = 1;

    optional android.stats.dnsresolver.ReturnCode return_code = 2;

    // The latency in microseconds of the entire DNS lookup operation.
    optional int32 latency_micros = 3;

    // Only valid for event_type = EVENT_GETADDRINFO.
    optional int32 hints_ai_flags = 4;

    // Flags passed to android_res_nsend() defined in multinetwork.h
    // Only valid for event_type = EVENT_RESNSEND.
    optional int32 res_nsend_flags = 5;

    optional android.stats.dnsresolver.NetworkType network_type = 6;

    // The DNS over TLS mode on a specific netId.
    optional android.stats.dnsresolver.PrivateDnsModes private_dns_modes = 7;

    // Additional pass-through fields opaque to statsd.
    // The DNS resolver Mainline module can add new fields here without requiring an OS update.
    optional android.stats.dnsresolver.DnsQueryEvents dns_query_events = 8 [(log_mode) = MODE_BYTES];

    // The sample rate of DNS stats (to statsd) is 1/sampling_rate_denom.
    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.
 *
 * Log from:
 *     packages/modules/NetworkStack/src/com/android/server/connectivity/NetworkMonitor.java
 */
message DataStallEvent {
    // Data stall evaluation type.
    // See packages/modules/NetworkStack/src/com/android/server/connectivity/NetworkMonitor.java
    // Refer to the definition of DATA_STALL_EVALUATION_TYPE_*.
    optional int32 evaluation_type = 1;
    // See definition in data_stall_event.proto.
    optional com.android.server.connectivity.ProbeResult validation_result = 2;
    // See definition in data_stall_event.proto.
    optional android.net.NetworkCapabilitiesProto.Transport network_type = 3;
    // See definition in data_stall_event.proto.
    optional com.android.server.connectivity.WifiData wifi_info = 4 [(log_mode) = MODE_BYTES];
    // See definition in data_stall_event.proto.
    optional com.android.server.connectivity.CellularData cell_info = 5 [(log_mode) = MODE_BYTES];
    // See definition in data_stall_event.proto.
    optional com.android.server.connectivity.DnsEvent dns_event = 6 [(log_mode) = MODE_BYTES];
    // The tcp packets fail rate from the latest tcp polling.
    optional int32 tcp_fail_rate = 7;
    // Number of packets sent since the last received packet.
    optional int32 tcp_sent_since_last_recv = 8;
}

/*
 * Logs when RescueParty resets some set of experiment flags.
 *
 * Logged from:
 *     frameworks/base/services/core/java/com/android/server/RescueParty.java
 */
message RescuePartyResetReported {
    // The rescue level of this reset. A value of 0 indicates missing or unknown level information.
    optional int32 rescue_level = 1;
}

/**
 * Logs when signed config is received from an APK, and if that config was applied successfully.
 * Logged from:
 *   frameworks/base/services/core/java/com/android/server/signedconfig/SignedConfigService.java
 */
message SignedConfigReported {
    enum Type {
        UNKNOWN_TYPE = 0;
        GLOBAL_SETTINGS = 1;
    }
    optional Type type = 1;

    // The final status of the signed config received.
    enum Status {
        UNKNOWN_STATUS = 0;
        APPLIED = 1;
        BASE64_FAILURE_CONFIG = 2;
        BASE64_FAILURE_SIGNATURE = 3;
        SECURITY_EXCEPTION = 4;
        INVALID_CONFIG = 5;
        OLD_CONFIG = 6;
        SIGNATURE_CHECK_FAILED = 7;
        NOT_APPLICABLE = 8;
        SIGNATURE_CHECK_FAILED_PROD_KEY_ABSENT = 9;
    }
    optional Status status = 2;

    // The version of the signed config processed.
    optional int32 version = 3;

    // The package name that the config was extracted from.
    optional string from_package = 4;

    enum Key {
        NO_KEY = 0;
        DEBUG = 1;
        PRODUCTION = 2;
    }
    // Which key was used to verify the config.
    optional Key verified_with = 5;
}

/*
 * Logs GNSS Network-Initiated (NI) location events.
 *
 * Logged from:
 *   frameworks/base/services/core/java/com/android/server/location/GnssLocationProvider.java
 */
message GnssNiEventReported {
    // The type of GnssNiEvent.
    enum EventType {
        UNKNOWN = 0;
        NI_REQUEST = 1;
        NI_RESPONSE = 2;
    }
    optional EventType event_type = 1;

    // An ID generated by HAL to associate NI notifications and UI responses.
    optional int32 notification_id = 2;

    // A type which distinguishes different categories of NI request, such as VOICE, UMTS_SUPL etc.
    optional android.server.location.GnssNiType ni_type = 3;

    // NI requires notification.
    optional bool need_notify = 4;

    // NI requires verification.
    optional bool need_verify = 5;

    // NI requires privacy override, no notification/minimal trace.
    optional bool privacy_override = 6;

    // Timeout period to wait for user response. Set to 0 for no timeout limit. Specified in
    // seconds.
    optional int32 timeout = 7;

    // Default response when timeout.
    optional android.server.location.GnssUserResponseType default_response = 8;

    // String representing the requester of the network inititated location request.
    optional string requestor_id = 9;

    // Notification message text string representing the service(for eg. SUPL-service) who sent the
    // network initiated location request.
    optional string text = 10;

    // requestorId decoding scheme.
    optional android.server.location.GnssNiEncodingType requestor_id_encoding = 11;

    // Notification message text decoding scheme.
    optional android.server.location.GnssNiEncodingType text_encoding = 12;

    // True if SUPL ES is enabled.
    optional bool is_supl_es_enabled = 13;

    // True if GNSS location is enabled.
    optional bool is_location_enabled = 14;

    // GNSS NI responses which define the response in NI structures.
    optional android.server.location.GnssUserResponseType user_response = 15;
}

/**
 * Logs GNSS non-framework (NFW) location notification.
 *
 * Logged from:
 *   frameworks/base/services/core/java/com/android/server/location/GnssLocationProvider.java
 */
message GnssNfwNotificationReported {
    // Package name of the Android proxy application representing the non-framework entity that
    // requested location. Set to empty string if unknown.
    optional string proxy_app_package_name = 1;

    // Protocol stack that initiated the non-framework location request.
    optional android.server.location.NfwProtocolStack protocol_stack = 2;

    // Name of the protocol stack if protocol_stack field is set to OTHER_PROTOCOL_STACK. Otherwise,
    // set to empty string. This field is opaque to the framework and used for logging purposes.
    optional string other_protocol_stack_name = 3;

    // Source initiating/receiving the location information.
    optional android.server.location.NfwRequestor requestor = 4;

    // Identity of the endpoint receiving the location information. For example, carrier name, OEM
    // name, SUPL SLP/E-SLP FQDN, chipset vendor name, etc. This field is opaque to the framework
    // and used for logging purposes.
    optional string requestor_id = 5;

    // Indicates whether location information was provided for this request.
    optional android.server.location.NfwResponseType response_type = 6;

    // True if the device is in user initiated emergency session.
    optional bool in_emergency_mode = 7;

    // True if cached location is provided.
    optional bool is_cached_location = 8;

    // True if proxy app permission mismatch between framework and GNSS HAL.
    optional bool is_permission_mismatched = 9;
}

/**
 * Logs GNSS configuration as defined in IGnssConfiguration.hal.
 *
 * Logged from:
 *   frameworks/base/services/core/java/com/android/server/location/GnssConfiguration.java
 */
message GnssConfigurationReported {
    // SUPL host name.
    optional string supl_host = 1;

    // SUPL port number.
    optional int32 supl_port = 2;

    // C2K host name.
    optional string c2k_host = 3;

    // C2K port number.
    optional int32 c2k_port = 4;

    // The SUPL version requested by Carrier.
    optional int32 supl_ver = 5;

    // The SUPL mode.
    optional android.server.location.SuplMode supl_mode = 6;

    // True if NI emergency SUPL restrictions is enabled.
    optional bool supl_es = 7;

    // LTE Positioning Profile settings
    optional android.server.location.LppProfile lpp_profile = 8;

    // Positioning protocol on A-Glonass system.
    optional android.server.location.GlonassPosProtocol a_glonass_pos_protocol_select = 9;

    // True if emergency PDN is used. Otherwise, regular PDN is used.
    optional bool use_emergency_pdn_for_emergency_supl= 10;

    // Configurations of how GPS functionalities should be locked when user turns off GPS On setting.
    optional android.server.location.GpsLock gps_lock = 11;

    // Number of seconds to extend the emergency session duration post emergency call.
    optional int32 es_extension_sec = 12;

    // The full list of package names of proxy Android applications representing the non-framework
    // location access entities (on/off the device) for which the framework user has granted
    // non-framework location access permission. The package names are concatenated in one string
    // with spaces as separators.
    optional string enabled_proxy_app_package_name_list = 13;
}

/**
 * Logs when a NFC device's error occurred.
 * Logged from:
 *     system/nfc/src/nfc/nfc/nfc_ncif.cc
 *     packages/apps/Nfc/src/com/android/nfc/cardemulation/AidRoutingManager.java
 */
message NfcErrorOccurred {
    enum Type {
        UNKNOWN = 0;
        CMD_TIMEOUT = 1;
        ERROR_NOTIFICATION = 2;
        AID_OVERFLOW = 3;
    }
    optional Type type = 1;
    // If it's nci cmd timeout, log the timeout command.
    optional uint32 nci_cmd = 2;

    optional uint32 error_ntf_status_code = 3;
}

/**
 * Logs when a NFC device's state changed event
 * Logged from:
 *     packages/apps/Nfc/src/com/android/nfc/NfcService.java
 */
message NfcStateChanged {
    enum State {
        UNKNOWN = 0;
        OFF = 1;
        ON = 2;
        ON_LOCKED = 3; // Secure Nfc enabled.
        CRASH_RESTART = 4; // NfcService watchdog timeout restart.
    }
    optional State state = 1;
}

/**
 * Logs when a NFC Beam Transaction occurred.
 * Logged from:
 *     packages/apps/Nfc/src/com/android/nfc/P2pLinkManager.java
 */
message NfcBeamOccurred {
    enum Operation {
        UNKNOWN = 0;
        SEND = 1;
        RECEIVE = 2;
    }
    optional Operation operation = 1;
}

/**
 * Logs when a NFC Card Emulation Transaction occurred.
 * Logged from:
 *     packages/apps/Nfc/src/com/android/nfc/cardemulation/HostEmulationManager.java
 *     packages/apps/Nfc/src/com/android/nfc/cardemulation/HostNfcFEmulationManager.java
 */
message NfcCardemulationOccurred {
    enum Category {
        UNKNOWN = 0;
        HCE_PAYMENT = 1;
        HCE_OTHER = 2;
        OFFHOST = 3;
    }
    // Transaction belongs to HCE payment or HCE other category, or offhost.
    optional Category category = 1;
    // SeName from transaction: SIMx, eSEx, HCE, HCEF.
    optional string se_name = 2;
}

/**
 * Logs when a NFC Tag event occurred.
 * Logged from:
 *     packages/apps/Nfc/src/com/android/nfc/NfcDispatcher.java
 */
message NfcTagOccurred {
    enum Type {
        UNKNOWN = 0;
        URL = 1;
        BT_PAIRING = 2;
        PROVISION = 3;
        WIFI_CONNECT = 4;
        APP_LAUNCH = 5;
        OTHERS = 6;
    }
    optional Type type = 1;
}

/**
 * Logs when Hce transaction triggered
 * Logged from:
 *     system/nfc/src/nfc/nfc/nfc_ncif.cc
 */
message NfcHceTransactionOccurred {
    // The latency period(in microseconds) it took for the first HCE data
    // exchange.
    optional uint32 latency_micros = 1;
}

/**
 * Logs when SecureElement state event changed
 * Logged from:
 *     packages/apps/SecureElement/src/com/android/se/Terminal.java
 */
message SeStateChanged {
    enum State {
        UNKNOWN = 0;
        INITIALIZED = 1;
        DISCONNECTED = 2;
        CONNECTED = 3;
        HALCRASH = 4;
    }
    optional State state = 1;

    optional string state_change_reason = 2;
    // SIMx or eSEx.
    optional string terminal = 3;
}

/**
 * Information about a permission grant request
 */
message PermissionGrantRequestResultReported {
    // unique value identifying an API call. A API call might result in multiple of these atoms
    optional int64 request_id = 1;

    // UID of package requesting the permission grant
    optional int32 uid = 2 [(is_uid) = true];

    // Name of package requesting the permission grant
    optional string package_name = 3;

    // The permission to be granted
    optional string permission_name = 4;

    // If the permission was explicitly requested via the API or added by the system
    optional bool is_implicit = 5;

    enum Result {
        UNDEFINED = 0;
        // permission request was ignored
        IGNORED = 1;
        // permission request was ignored because it was user fixed
        IGNORED_USER_FIXED = 2;
        // permission request was ignored because it was policy fixed
        IGNORED_POLICY_FIXED = 3;
        // permission was granted by user action
        USER_GRANTED = 4;
        // permission was automatically granted
        AUTO_GRANTED = 5;
        // permission was denied by user action
        USER_DENIED = 6;
        // permission was denied with prejudice by the user
        USER_DENIED_WITH_PREJUDICE = 7;
        // permission was automatically denied
        AUTO_DENIED = 8;
        // permission request was ignored because permission is restricted
        IGNORED_RESTRICTED_PERMISSION = 9;
        // one time permission was granted by user action
        USER_GRANTED_ONE_TIME = 10;
        // user ignored request by leaving the request screen without choosing any option
        USER_IGNORED = 11;
        // user granted the permission after being linked to settings
        USER_GRANTED_IN_SETTINGS = 12;
        // user denied the permission after being linked to settings
        USER_DENIED_IN_SETTINGS = 13;
        // user denied the permission with prejudice after being linked to settings
        USER_DENIED_WITH_PREJUDICE_IN_SETTINGS = 14;
        // permission was automatically revoked after one-time permission expired
        AUTO_ONE_TIME_PERMISSION_REVOKED = 15;
        // permission was automatically revoked for unused app
        AUTO_UNUSED_APP_PERMISSION_REVOKED = 16;
    }
    // The result of the permission grant
    optional Result result = 6;
}

/**
 * Logs when Omapi API used
 * Logged from:
 *     packages/apps/SecureElement/src/com/android/se/Terminal.java
 */
message SeOmapiReported {
    enum Operation {
        UNKNOWN = 0;
        OPEN_CHANNEL = 1;
    }
    optional Operation operation = 1;
    // SIMx or eSEx.
    optional string terminal = 2;

    optional string package_name = 3;
}

/**
  * Logs the dispatch latency of a broadcast during processing of BOOT_COMPLETED.
  * The dispatch latency is the dispatchClockTime - enqueueClockTime.
  * Logged from:
  *   frameworks/base/services/core/java/com/android/server/am/BroadcastQueue.java
  */
message BroadcastDispatchLatencyReported {
    optional int64 dispatch_latency_millis = 1;
}

/**
   * Logs AttentionManagerService attention check result.
   *
   * Logged from:
   *   frameworks/base/services/core/java/com/android/server/attention/AttentionManagerService.java
   */
message AttentionManagerServiceResultReported {
    // See core/java/android/service/attention/AttentionService.java
    enum AttentionCheckResult {
        UNKNOWN = 20;
        ATTENTION_SUCCESS_ABSENT = 0;
        ATTENTION_SUCCESS_PRESENT = 1;
        ATTENTION_FAILURE_UNKNOWN = 2;
        ATTENTION_FAILURE_CANCELLED = 3;
        ATTENTION_FAILURE_PREEMPTED = 4;
        ATTENTION_FAILURE_TIMED_OUT = 5;
        ATTENTION_FAILURE_CAMERA_PERMISSION_ABSENT = 6;
    }
    optional AttentionCheckResult attention_check_result = 1 [default = UNKNOWN];
}

/**
 * Logs when an adb connection changes state.
 *
 * Logged from:
 *     frameworks/base/services/core/java/com/android/server/adb/AdbDebuggingManager.java
 */
message AdbConnectionChanged {
    // The last time this system connected via adb, or 0 if the 'always allow' option was not
    // previously selected for this system.
    optional int64 last_connection_time_millis = 1;

    // The time in ms within which a subsequent connection from an 'always allow' system is allowed
    // to reconnect via adb without user interaction.
    optional int64 auth_window_millis = 2;

    // The state of the adb connection from frameworks/base/core/proto/android/debug/enums.proto.
    optional android.debug.AdbConnectionStateEnum state = 3;

    // True if the 'always allow' option was selected for this system.
    optional bool always_allow = 4;
}

/*
 * Logs the reported speech DSP status.
 *
 * Logged from:
 *  Vendor audio implementation.
 */
message SpeechDspStatReported {
    // The total Speech DSP uptime in milliseconds.
    optional int32 total_uptime_millis = 1;
    // The total Speech DSP downtime in milliseconds.
    optional int32 total_downtime_millis = 2;
    optional int32 total_crash_count = 3;
    optional int32 total_recover_count = 4;
}

/**
 * Logs USB connector contaminant status.
 *
 * Logged from: USB Service.
 */
message UsbContaminantReported {
    optional string id = 1;
    optional android.service.usb.ContaminantPresenceStatus status = 2;
}

/**
 * This atom is for debugging purpose.
 */
message DebugElapsedClock {
    // Monotically increasing value for each pull.
    optional int64 pull_count = 1;
    // Time from System.elapsedRealtime.
    optional int64 elapsed_clock_millis = 2;
    // Time from System.elapsedRealtime.
    optional int64 same_elapsed_clock_millis = 3;
    // Diff between current elapsed time and elapsed time from previous pull.
    optional int64 elapsed_clock_diff_millis = 4;

    enum Type {
      TYPE_UNKNOWN = 0;
      ALWAYS_PRESENT = 1;
      PRESENT_ON_ODD_PULLS = 2;
    }
    // Type of behavior for the pulled data.
    optional Type type = 5;
}

/**
 * This atom is for debugging purpose.
 */
message DebugFailingElapsedClock {
    // Monotically increasing value for each pull.
    optional int64 pull_count = 1;
    // Time from System.elapsedRealtime.
    optional int64 elapsed_clock_millis = 2;
    // Time from System.elapsedRealtime.
    optional int64 same_elapsed_clock_millis = 3;
    // Diff between current elapsed time and elapsed time from previous pull.
    optional int64 elapsed_clock_diff_millis = 4;
}

/** Logs System UI bubbles event changed.
 *
 * Logged from:
 *     frameworks/base/packages/SystemUI/src/com/android/systemui/bubbles
 */
message BubbleUIChanged {

    // The app package that is posting the bubble.
    optional string package_name = 1;

    // The notification channel that is posting the bubble.
    optional string notification_channel = 2;

    // The notification id associated with the posted bubble.
    optional int32 notification_id = 3;

    // The position of the bubble within the bubble stack.
    optional int32 position = 4;

    // The total number of bubbles within the bubble stack.
    optional int32 total_number = 5;

    // User interactions with the bubble.
    enum Action {
        UNKNOWN = 0;
        POSTED = 1;
        UPDATED = 2;
        EXPANDED = 3;
        COLLAPSED = 4;
        DISMISSED = 5;
        STACK_DISMISSED = 6;
        STACK_MOVED = 7;
        HEADER_GO_TO_APP = 8;
        HEADER_GO_TO_SETTINGS = 9;
        PERMISSION_OPT_IN = 10;
        PERMISSION_OPT_OUT = 11;
        PERMISSION_DIALOG_SHOWN = 12;
        SWIPE_LEFT = 13;
        SWIPE_RIGHT = 14;
        STACK_EXPANDED = 15;
        FLYOUT = 16;
    }
    optional Action action = 6;

    // Normalized screen position of the bubble stack. The range is between 0 and 1.
    optional float normalized_x_position = 7;
    optional float normalized_y_position = 8;

    // Whether the bubble is unread. If it is unread, a dot is shown in the bubble stack icon.
    optional bool is_unread = 9;

    // Whether the bubble is an on-going one.
    optional bool is_ongoing = 10;

    // Whether the bubble is produced by an app running in foreground.
    // This is deprecated and the value should be ignored.
    optional bool is_foreground = 11 [deprecated = true];
}

/**
  * Logs System UI bubbles developer errors.
  *
  * Logged from:
  *   frameworks/base/packages/SystemUI/src/com/android/systemui/bubbles/BubbleController.java
  */
message BubbleDeveloperErrorReported {

    // The app package that is posting the bubble.
    optional string package_name = 1;

    // Bubble developer error type enums.
    enum Error {
        UNKNOWN = 0;
        ACTIVITY_INFO_MISSING = 1;
        ACTIVITY_INFO_NOT_RESIZABLE = 2;
        DOCUMENT_LAUNCH_NOT_ALWAYS = 3;
    }
    optional Error error = 2 [default = UNKNOWN];
}

/**
 * Logs that a constraint for a scheduled job has changed.
 *
 * Logged from:
 *     frameworks/base/services/core/java/com/android/server/job/controllers/JobStatus.java
 */
message ScheduledJobConstraintChanged {
    repeated AttributionNode attribution_node = 1;

    // Name of the job.
    optional string job_name = 2;

    optional com.android.server.job.ConstraintEnum constraint = 3;

    enum State {
        UNKNOWN = 0;
        UNSATISFIED = 1;
        SATISFIED = 2;
    }
    optional State state = 4;
}

/**
 * Logs PowerManagerService screen timeout resets (extensions) that happen when an attention check
 * returns true.
 *
 * Logged from:
 *   frameworks/base/services/core/java/com/android/server/power/PowerManagerService.java
 */
message ScreenTimeoutExtensionReported {
    // Describes how many times in a row did the power manager reset the screen off timeout.
    optional uint32 consecutive_timeout_extended_count = 1;
}

/*
* Logs number of milliseconds it takes to start a process.
* The definition of app process start time is from the app launch time to
* the time that Zygote finished forking the app process and loaded the
* application package's java classes.

* This metric is different from AppStartOccurred which is for foreground
* activity only.

* ProcessStartTime can report all processes (both foreground and background)
* start time.
*
* Logged from:
*   frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
*/
message ProcessStartTime {
    // The uid of the ProcessRecord.
    optional int32 uid = 1 [(is_uid) = true];

    // The process pid.
    optional int32 pid = 2;

    // The process name.
    // Usually package name, "system" for system server.
    // Provided by ActivityManagerService.
    optional string process_name = 3;

    enum StartType {
        UNKNOWN = 0;
        WARM = 1;
        HOT = 2;
        COLD = 3;
    }

    // The start type.
    optional StartType type = 4;

    // The elapsed realtime at the start of the process.
    optional int64 process_start_time_millis = 5;

    // Number of milliseconds it takes to reach bind application.
    optional int32 bind_application_delay_millis = 6;

    // Number of milliseconds it takes to finish start of the process.
    optional int32 process_start_delay_millis = 7;

    // hostingType field in ProcessRecord, the component type such as "activity",
    // "service", "content provider", "broadcast" or other strings.
    optional string hosting_type = 8;

    // hostingNameStr field in ProcessRecord. The component class name that runs
    // in this process.
    optional string hosting_name = 9;
}

/**
 * Track Media Codec usage
 * Logged from:
 *   frameworks/av/media/libstagefright/MediaCodec.cpp
 *   frameworks/av/services/mediaanalytics/statsd_codec.cpp
 */
message MediametricsCodecReported {
    optional int64 timestamp_nanos = 1;
    optional string package_name = 2;
    optional int64 package_version_code = 3;
    optional int64 media_apex_version = 4;

    optional android.stats.mediametrics.CodecData codec_data = 5 [(android.os.statsd.log_mode) = MODE_BYTES];
}

/**
 * Track Media Extractor (pulling video/audio streams out of containers) usage
 * Logged from:
 *   frameworks/av/media/libstagefright/RemoteMediaExtractor.cpp
 *   frameworks/av/services/mediaanalytics/statsd_extractor.cpp
 */
message MediametricsExtractorReported {
    optional int64 timestamp_nanos = 1;
    optional string package_name = 2;
    optional int64 package_version_code = 3;
    optional int64 media_apex_version = 4;

    optional android.stats.mediametrics.ExtractorData extractor_data = 5 [(android.os.statsd.log_mode) = MODE_BYTES];
}

/**
 * Track how we arbitrate between microphone/input requests.
 * Logged from
 *   frameworks/av/services/audiopolicy/service/AudioPolicyInterfaceImpl.cpp
 *   frameworks/av/services/mediaanalytics/statsd_audiopolicy.cpp
 */
message MediametricsAudiopolicyReported {
    optional int64 timestamp_nanos = 1;
    optional string package_name = 2;
    optional int64 package_version_code = 3;
    optional int64 media_apex_version = 4;

    optional android.stats.mediametrics.AudioPolicyData audiopolicy_data = 5 [(android.os.statsd.log_mode) = MODE_BYTES];
}

/**
 * Track how we arbitrate between microphone requests.
 * Logged from
 *   frameworks/av/media/libaudioclient/AudioRecord.cpp
 *   frameworks/av/services/mediaanalytics/statsd_audiorecord.cpp
 */
message MediametricsAudiorecordReported {
    optional int64 timestamp_nanos = 1;
    optional string package_name = 2;
    optional int64 package_version_code = 3;
    optional int64 media_apex_version = 4;

    optional android.stats.mediametrics.AudioRecordData audiorecord_data = 5 [(android.os.statsd.log_mode) = MODE_BYTES];
}

/**
 * Track how we arbitrate between microphone/input requests.
 * Logged from
 *   frameworks/av/media/libnblog/ReportPerformance.cpp
 *   frameworks/av/services/mediaanalytics/statsd_audiothread.cpp
 */
message MediametricsAudiothreadReported {
    optional int64 timestamp_nanos = 1;
    optional string package_name = 2;
    optional int64 package_version_code = 3;
    optional int64 media_apex_version = 4;

    optional android.stats.mediametrics.AudioThreadData audiothread_data = 5 [(android.os.statsd.log_mode) = MODE_BYTES];
}

/**
 * Track how we arbitrate between microphone/input requests.
 * Logged from
 *   frameworks/av/media/libaudioclient/AudioTrack.cpp
 *   frameworks/av/services/mediaanalytics/statsd_audiotrack.cpp
 */
message MediametricsAudiotrackReported {
    optional int64 timestamp_nanos = 1;
    optional string package_name = 2;
    optional int64 package_version_code = 3;
    optional int64 media_apex_version = 4;

    optional android.stats.mediametrics.AudioTrackData audiotrack_data = 5 [(android.os.statsd.log_mode) = MODE_BYTES];
}

/**
 * Track information about DRM framework performance
 * Logged from
 *   frameworks/av/drm/libmediadrm/DrmHal.cpp
 *   frameworks/av/services/mediaanalytics/statsd_drm.cpp
 */
message MediametricsMediadrmReported {
    optional int64 timestamp_nanos = 1;
    optional string package_name = 2;
    optional int64 package_version_code = 3;
    optional int64 media_apex_version = 4;

    // vendor+description tell about which DRM plugin is in use on this device
    optional string vendor = 5;
    optional string description = 6;
    // from frameworks/av/drm/libmediadrm/protos/metrics.proto
    optional bytes framework_stats = 7 [(android.os.statsd.log_mode) = MODE_BYTES];
}

/**
 * Track information about the widevine DRM plugin performance
 * Logged from
 *   vendor/widevine/libwvdrmengine/cdm/metrics
 *   frameworks/av/services/mediaanalytics/statsd_drm.cpp
 */
message MediametricsDrmWidevineReported {
    optional int64 timestamp_nanos = 1;
    optional string package_name = 2;
    optional int64 package_version_code = 3;
    optional int64 media_apex_version = 4;

    optional bytes vendor_specific_stats = 5 [(android.os.statsd.log_mode) = MODE_BYTES];
}

/**
 * Track information about recordings (e.g. camcorder)
 * Logged from
 *   frameworks/av/media/libmediaplayerservice/StagefrightRecorder.cpp
 *   frameworks/av/services/mediaanalytics/statsd_recorder.cpp
 */
message MediametricsRecorderReported {
    optional int64 timestamp_nanos = 1;
    optional string package_name = 2;
    optional int64 package_version_code = 3;
    optional int64 media_apex_version = 4;

    optional android.stats.mediametrics.RecorderData recorder_data = 5 [(android.os.statsd.log_mode) = MODE_BYTES];
}

/**
 * Track Media Player usage
 * Logged from:
 *   frameworks/av/media/libmediaplayerservice/nuplayer/NuPlayerDriver.cpp
 *   frameworks/av/services/mediaanalytics/statsd_nuplayer.cpp
 */
message MediametricsNuPlayerReported {
    optional int64 timestamp_nanos = 1;
    optional string package_name = 2;
    optional int64 package_version_code = 3;
    optional int64 media_apex_version = 4;

    optional android.stats.mediametrics.NuPlayerData nuplayer_data = 5 [(android.os.statsd.log_mode) = MODE_BYTES];
}

/**
 * Track Legacy DRM usage
 * Logged from
 *   frameworks/av/drm/drmserver/DrmManager.cpp
 */
message MediametricsDrmManagerReported {
    optional int64 timestamp_nanos = 1;
    optional string package_name = 2;
    optional int64 package_version_code = 3;
    optional int64 media_apex_version = 4;

    enum Method {
        METHOD_NOT_FOUND       = -1;
        GET_CONSTRAINTS        =  0;
        GET_METADATA           =  1;
        CAN_HANDLE             =  2;
        PROCESS_DRM_INFO       =  3;
        ACQUIRE_DRM_INFO       =  4;
        SAVE_RIGHTS            =  5;
        GET_ORIGINAL_MIME_TYPE =  6;
        GET_DRM_OBJECT_TYPE    =  7;
        CHECK_RIGHTS_STATUS    =  8;
        REMOVE_RIGHTS          =  9;
        REMOVE_ALL_RIGHTS      = 10;
        OPEN_CONVERT_SESSION   = 11;
        OPEN_DECRYPT_SESSION   = 12;
    }

    // plugin_id+description inform which Legacy DRM plugins are still in use on device
    optional string plugin_id = 5;
    optional string description = 6;
    optional Method method = 7;
    optional string mime_types = 8;

    optional int64 get_constraints_count =  9;
    optional int64 get_metadata_count = 10;
    optional int64 can_handle_count = 11;
    optional int64 process_drm_info_count = 12;
    optional int64 acquire_drm_info_count = 13;
    optional int64 save_rights_count = 14;
    optional int64 get_original_mime_type_count = 15;
    optional int64 get_drm_object_type_count = 16;
    optional int64 check_rights_status_count = 17;
    optional int64 remove_rights_count = 18;
    optional int64 remove_all_rights_count = 19;
    optional int64 open_convert_session_count = 20;
    optional int64 open_decrypt_session_count = 21;
}

/**
 * State of a dangerous permission requested by a package
 * Pulled from: StatsCompanionService
*/
message DangerousPermissionState {
    // Name of the permission
    optional string permission_name = 1;

    // Uid of the package
    optional int32 uid = 2 [(is_uid) = true];

    // Package requesting the permission
    optional string package_name = 3;

    // If the permission is granted to the uid
    optional bool is_granted = 4;

    // Permission flags as per android.content.pm.PermissionFlags
    optional int32 permission_flags = 5;
}

/**
 * Logs when a package is denied access to a device identifier based on the new access requirements.
 *
 * Logged from:
 *     frameworks/base/telephony/java/com/android/internal/telephony/TelephonyPermissions.java
 */
message DeviceIdentifierAccessDenied {
    // The name of the package denied access to the requested device identifier.
    optional string package_name = 1;

    // The name of the device identifier method the package attempted to invoke.
    optional string method_name = 2;

    // True if the package is preinstalled.
    // Starting from Android 11, this boolean is not set and will always be false.
    optional bool is_preinstalled = 3 [deprecated = true];

    // True if the package is privileged.
    // Starting from Android 11, this boolean is not set and will always be false.
    optional bool is_priv_app = 4 [deprecated = true];
}

/**
 * Pulls the ongoing mainline install train version code.
 * Pulled from StatsCompanionService
 */
message TrainInfo {
    optional int64 train_version_code = 1;

    optional TrainExperimentIds train_experiment_id = 2;

    optional string train_name = 3;

    enum Status {
        UNKNOWN = 0;
        INSTALL_REQUESTED = 1;
        INSTALL_STARTED = 2;
        INSTALL_STAGED_NOT_READY = 3;
        INSTALL_STAGED_READY = 4;
        INSTALL_SUCCESS = 5;
        // Replaced by INSTALL_FAILURE_DOWNLOAD, INSTALL_FAILURE_STATE_MISMATCH,
        // and INSTALL_FAILURE_COMMIT.
        INSTALL_FAILURE = 6  [deprecated = true];
        // This enum is for installs that are manually cancelled via the Manual Update UI.
        INSTALL_CANCELLED = 7;
        INSTALLER_ROLLBACK_REQUESTED = 8;
        INSTALLER_ROLLBACK_INITIATED = 9;
        INSTALLER_ROLLBACK_INITIATED_FAILURE = 10;
        INSTALLER_ROLLBACK_STAGED = 11;
        INSTALLER_ROLLBACK_STAGED_FAILURE = 12;
        INSTALLER_ROLLBACK_BOOT_TRIGGERED = 13;
        INSTALLER_ROLLBACK_BOOT_TRIGGERED_FAILURE = 14;
        INSTALLER_ROLLBACK_SUCCESS = 15;
        INSTALLER_ROLLBACK_FAILURE = 16;
        INSTALLER_ROLLBACK_STAGED_CANCEL_REQUESTED = 17;
        INSTALLER_ROLLBACK_STAGED_CANCEL_SUCCESS = 18;
        INSTALLER_ROLLBACK_STAGED_CANCEL_FAILURE = 19;
        INSTALL_STAGED_CANCEL_REQUESTED = 20;
        INSTALL_STAGED_CANCEL_SUCCESS = 21;
        INSTALL_STAGED_CANCEL_FAILURE = 22;
        INSTALL_FAILURE_DOWNLOAD = 23;
        INSTALL_FAILURE_STATE_MISMATCH = 24;
        INSTALL_FAILURE_COMMIT = 25;
        REBOOT_TRIGGERED = 26;
    }
    optional Status status = 4;
}

/**
 * Logs the gesture stage changed event.
 *
 * Logged from:
 *   frameworks/base/packages/SystemUI/
 */
message AssistGestureStageReported {
    optional android.hardware.sensor.assist.AssistGestureStageEnum gesture_stage = 1;
}

/**
 * Logs the feedback type.
 *
 * Logged from:
 *   frameworks/base/packages/SystemUI/
 */
message AssistGestureFeedbackReported {
    // Whether or not the gesture was used.
    optional android.hardware.sensor.assist.AssistGestureFeedbackEnum feedback_type = 1;
}

/**
 * Logs the progress.
 *
 * Logged from:
 *   frameworks/base/packages/SystemUI/
 */
message AssistGestureProgressReported {
    // [0,100] progress for the assist gesture.
    optional int32 progress = 1;
}

/*
 * Information about the time zone data on a device.
 */
message TimeZoneDataInfo {
    // A version identifier for the data set on device. e.g. "2018i"
    optional string tzdb_version = 1;
}

/**
 * Logs the GPU stats global health information.
 *
 * Logged from:
 *   frameworks/native/services/gpuservice/gpustats/
 */
message GpuStatsGlobalInfo {
    // Package name of the gpu driver.
    optional string driver_package_name = 1;

    // Version name of the gpu driver.
    optional string driver_version_name = 2;

    // Version code of the gpu driver.
    optional int64 driver_version_code = 3;

    // Build time of the gpu driver in UTC as seconds since January 1, 1970.
    optional int64 driver_build_time = 4;

    // Total count of the gl driver gets loaded.
    optional int64 gl_loading_count = 5;

    // Total count of the gl driver fails to be loaded.
    optional int64 gl_loading_failure_count = 6;

    // Total count of the Vulkan driver gets loaded.
    optional int64 vk_loading_count = 7;

    // Total count of the Vulkan driver fails to be loaded.
    optional int64 vk_loading_failure_count = 8;

    // Api version of the system Vulkan driver.
    optional int32 vulkan_version = 9;

    // Api version of the system CPU Vulkan driver.
    optional int32 cpu_vulkan_version = 10;

    // Api version of the system GLES driver.
    optional int32 gles_version = 11;

    // Total count of the angle driver gets loaded.
    optional int64 angle_loading_count = 12;

    // Total count of the angle driver fails to be loaded.
    optional int64 angle_loading_failure_count = 13;
}

/**
 * GPU driver loading time info.
 */
message GpuDriverLoadingTime {
    // List of all the driver loading times for this app. The list size is
    // capped at 50.
    repeated int64 driver_loading_time = 1;
}

/**
 * Logs the GPU stats per app health information.
 *
 * Logged from:
 *   frameworks/native/services/gpuservice/gpustats/
 */
message GpuStatsAppInfo {
    // Package name of the application that loads the gpu driver. Total number
    // of different packages is capped at 100.
    optional string app_package_name = 1;

    // Version code of the gpu driver this app loads.
    optional int64 driver_version_code = 2;

    // gl driver loading time info.
    optional GpuDriverLoadingTime gl_driver_loading_time = 3
            [(android.os.statsd.log_mode) = MODE_BYTES];

    // Vulkan driver loading time info.
    optional GpuDriverLoadingTime vk_driver_loading_time = 4
            [(android.os.statsd.log_mode) = MODE_BYTES];

    // Angle driver loading time info.
    optional GpuDriverLoadingTime angle_driver_loading_time = 5
            [(android.os.statsd.log_mode) = MODE_BYTES];

    // CPU Vulkan implementation is in use.
    optional bool cpu_vulkan_in_use = 6;

    // App is not doing pre-rotation correctly.
    optional bool false_prerotation = 7;

    // App creates GLESv1 context.
    optional bool gles_1_in_use = 8;
}

/*
 * Logs the size of the system ion heap.
 *
 * Pulled from StatsCompanionService.
 */
message SystemIonHeapSize {
    // Deprecated due to limited support of ion stats in debugfs.
    // Use `IonHeapSize` instead.
    option deprecated = true;

    // Size of the system ion heap in bytes.
    // Read from debugfs.
    optional int64 size_in_bytes = 1;
}

/*
 * Logs the total size of the ion heap.
 *
 * Pulled from StatsCompanionService.
 */
message IonHeapSize {
    // Total size of all ion heaps in kilobytes.
    // Read from: /sys/kernel/ion/total_heaps_kb.
    optional int32 total_size_kb = 1;
}

/*
 * Logs the per-process size of the system ion heap.
 *
 * Pulled from StatsCompanionService.
 */
message ProcessSystemIonHeapSize {
    // The uid if available. -1 means not available.
    optional int32 uid = 1 [(is_uid) = true];

    // The process name (from /proc/PID/cmdline).
    optional string process_name = 2;

    // Sum of sizes of all allocations.
    optional int32 total_size_in_kilobytes = 3;

    // Number of allocations.
    optional int32 allocation_count = 4;

    // Size of the largest allocation.
    optional int32 max_size_in_kilobytes = 5;
}

/**
 * Push network stack events.
 *
 * Log from:
 *     frameworks/base/packages/NetworkStack/
 */
message NetworkStackReported {
    // The id that indicates the event reported from NetworkStack.
    optional int32 event_id = 1;
    // The data for the reported events.
    optional android.stats.connectivity.NetworkStackEventData network_stack_event = 2 [(log_mode) = MODE_BYTES];
}

/**
 * Logs the apps that are installed on the external storage.
 * Pulled from:
 *   StatsCompanionService
 */
message AppsOnExternalStorageInfo {
    // The type of the external storage.
    optional android.stats.storage.ExternalStorageType external_storage_type = 1;
    // The name of the package that is installed on the external storage.
    optional string package_name = 2;
}

/**
 * Logs the settings related to Face.
 * Logged from:
 *   frameworks/base/services/core/java/com/android/server/stats
 */
message FaceSettings {
    // Whether or not face unlock is allowed on Keyguard.
    optional bool unlock_keyguard_enabled = 1;
    // Whether or not face unlock dismisses the Keyguard.
    optional bool unlock_dismisses_keyguard = 2;
    // Whether or not face unlock requires attention.
    optional bool unlock_attention_required = 3;
    // Whether or not face unlock is allowed for apps (through BiometricPrompt).
    optional bool unlock_app_enabled = 4;
    // Whether or not face unlock always requires user confirmation.
    optional bool unlock_always_require_confirmation = 5;
    // Whether or not a diverse set of poses are required during enrollment.
    optional bool unlock_diversity_required = 6;
}

/**
 * Logs cooling devices maintained by the kernel.
 *
 * Pulled from StatsCompanionService.java
 */
message CoolingDevice {
    // The type of cooling device being reported. Eg. CPU, GPU...
    optional android.os.CoolingTypeEnum device_location = 1;
    // The name of the cooling device source. Eg. CPU0
    optional string device_name = 2;
    // Current throttle state of the cooling device. The value can any unsigned
    // integer between 0 and max_state defined in its driver. 0 means device is
    // not in throttling, higher value means deeper throttling.
    optional int32 state = 3;
}

/**
 * Intelligence has several counter-type events that don't warrant a
 * full separate atom. These are primarily API call counters but also include
 * counters for feature usage and specific failure modes.
 *
 * Logged from the Intelligence mainline module.
 */
message IntelligenceEventReported {
  // The event type.
  optional android.stats.intelligence.EventType event_id = 1;
  // Success, failure.
  optional android.stats.intelligence.Status status = 2;
  // How many times the event occured (to report a batch of high frequency events).
  optional int32 count = 3;
  // How long the event took (sum of durations if count > 1)
  optional int64 duration_millis = 4;
}

/**
 * Logs when Car Power state changed.
 *
 * Logged from:
 *   packages/services/Car/service/src/com/android/car/CarStatsLog.java
 */
message CarPowerStateChanged {
    // States come from CpmsState in CarPowerManagementService.java.
    enum State {
       WAIT_FOR_VHAL = 0;
       ON = 1;
       SHUTDOWN_PREPARE = 2;
       WAIT_FOR_FINISH = 3;
       SUSPEND = 4;
       SIMULATE_SLEEP = 5;
    }
    optional State state = 1;
}

/**
 * Logs when Car User Hal is requested to switch/create/remove user.
 *
 * Logged from:
 *   packages/services/Car/service/src/com/android/car/hal/UserHalService.java
 */
message CarUserHalModifyUserRequestReported {
    // Request id for the request.
    optional int32 request_id = 1;
    // Request type.
    enum RequestType {
        UNKNOWN = 0;
        // Car user manager requested user switch.
        SWITCH_REQUEST_ANDROID = 1;
        // OEM requested User switch.
        SWITCH_REQUEST_OEM = 2;
        // Hal switch requested after android switch using activity manager.
        SWITCH_REQUEST_LEGACY = 3;
        // Create User
        CREATE_REQUEST = 4;
        // Remove User
        REMOVE_REQUEST = 5;
    }
    optional RequestType request_type = 2;
    // Android User id of the current user which can only be 0, 10, 11 and so on.
    // -1 if not available.
    optional int32 user_id = 3;
    // VHAL flags of the current user. (-1 if not available)
    optional int32 user_flags = 4;
    // Android User id of the target user for switch/create/remove. It can only
    // be 0, 10, 11 and so on. -1 if not available.
    optional int32 target_user_id = 5;
    // VHAL flags of the target user for switch/create/remove. (-1 if not available)
    optional int32 target_user_flags = 6;
    // Request timeout Milliseconds (-1 if not available)
    optional int32 timeout_millis = 7;
}

/**
 * Logs when Car User Hal responds to switch/create user request.
 *
 * Logged from:
 *   packages/services/Car/service/src/com/android/car/hal/UserHalService.java
 */
message CarUserHalModifyUserResponseReported {
    // Request id of the request associated with the response.
    optional int32 request_id = 1;
    // Car user hal callback status.
    enum CallbackStatus {
        UNKNOWN = 0;
        // Hal response was invalid.
        INVALID = 1;
        // Hal response was ok.
        OK = 2;
        // Hal timeout during set call.
        HAL_SET_TIMEOUT = 3;
        // Hal response timeout.
        HAL_RESPONSE_TIMEOUT = 4;
        // Hal responded with wrong info.
        WRONG_HAL_RESPONSE = 5;
        // Hal is processing multiple requests simultaneously.
        CONCURRENT_OPERATION = 6;
    }
    optional CallbackStatus callback_status = 2;

    // Hal request status for user switch/create/remove.
    enum HalRequestStatus {
        UNSPECIFIED = 0;
        // Hal request for user switch/create is successful.
        SUCCESS = 1;
        // Hal request for user switch/create failed.
        FAILURE = 2;
    }
    optional HalRequestStatus request_status = 3;
}

/**
 * Logs when post switch response is posted to Car User Hal.
 *
 * Logged from:
 *   packages/services/Car/service/src/com/android/car/hal/UserHalService.java
 */
message CarUserHalPostSwitchResponseReported {
    // Request id.
    optional int32 request_id = 1;

    // Android user switch status.
    enum UserSwitchStatus {
        UNKNOWN = 0;
        // Android user switch is successful.
        SUCCESS = 1;
        // Android user switch failed.
        FAILURE = 2;
    }
    optional UserSwitchStatus switch_status = 2;
}

/**
 * Logs when initial user information is requested from Car User Hal.
 *
 * Logged from:
 *   packages/services/Car/service/src/com/android/car/hal/UserHalService.java
 */
message CarUserHalInitialUserInfoRequestReported {
    // Request id for the request.
    optional int32 request_id = 1;

    // Request type for initial user information.
    enum InitialUserInfoRequestType {
        UNKNOWN = 0;
        // At the first time Android was booted (or after a factory reset).
        FIRST_BOOT = 1;
        // At the first time Android was booted after the system was updated.
        FIRST_BOOT_AFTER_OTA = 2;
        // When Android was booted "from scratch".
        COLD_BOOT = 3;
        // When Android was resumed after the system was suspended to memory.
        RESUME = 4;
    }
    optional InitialUserInfoRequestType request_type = 2;
    // Request timeout Milliseconds (-1 if not available)
    optional int32 timeout_millis = 3;
}

/**
 * Logs when Car User Hal responds to initial user information requests.
 *
 * Logged from:
 *   packages/services/Car/service/src/com/android/car/hal/UserHalService.java
 */
message CarUserHalInitialUserInfoResponseReported {
    // Request id of the request associated with the response.
    optional int32 request_id = 1;
    // Car user hal callback status.
    enum CallbackStatus {
        UNKNOWN = 0;
        // Hal response was invalid.
        INVALID = 1;
        // Hal response was ok.
        OK = 2;
        // Hal timeout during set call.
        HAL_SET_TIMEOUT = 3;
        // Hal response timeout.
        HAL_RESPONSE_TIMEOUT = 4;
        // Hal responded with wrong info.
        WRONG_HAL_RESPONSE = 5;
        // Hal is processing multiple requests simultaneously.
        CONCURRENT_OPERATION = 6;
    }
    optional CallbackStatus callback_status = 2;
    // Response for initial user information request.
    enum InitialUserInfoResponseAction {
        UNSPECIFIED = 0;
        // Let the Android System decide what to do.
        DEFAULT = 1;
        // Switch to an existing Android user.
        SWITCH = 2;
        // Create a new Android user (and switch to it).
        CREATE = 3;
    }
    optional InitialUserInfoResponseAction response_action = 3;
    // Android User id of the target user which can only be 0, 10, 11 and so on.
    // -1 if not available.
    optional int32 target_user = 4;
    // VHAL flags of the current user. (-1 if not available)
    optional int32 target_user_flags = 5;
    // User locales
    optional string user_locales = 6;
}

/**
 * Logs when set user association is requested from Car User Hal.
 *
 * Logged from:
 *   packages/services/Car/service/src/com/android/car/hal/UserHalService.java
 */
message CarUserHalUserAssociationRequestReported {
    // Request id for the request.
    optional int32 request_id = 1;
    // Request type.
    enum RequestType {
        UNKNOWN = 0;
        // For setting user association information.
        SET = 1;
        // For getting user association information.
        GET = 2;
    }
    optional RequestType request_type = 2;
    // Android User id of the current user which can only be 0, 10, 11 and so on.
    // -1 if not available.
    optional int32 current_user_id = 3;
    // VHAL flags of the current user. (-1 if not available)
    optional int32 current_user_flags = 4;
    // Number of the set associations requested.
    optional int32 number_associations = 5;
    // Concatenated string for the types from set associations request.
    // This is a string converted from an array of integers.
    optional string user_identification_association_types = 6;
    // Concatenated string for the values from set associations request.
    // This is a string converted from an array of integers.
    optional string user_identification_association_values = 7;
}

/**
 * Logs when Car User Hal responds to set user association requests.
 *
 * Logged from:
 *   packages/services/Car/service/src/com/android/car/hal/UserHalService.java
 */
message CarUserHalSetUserAssociationResponseReported {
    // Request id of the request associated with the response.
    optional int32 request_id = 1;
    // Car user hal callback status.
    enum CallbackStatus {
        UNKNOWN = 0;
        // Hal response was invalid.
        INVALID = 1;
        // Hal response was ok.
        OK = 2;
        // Hal timeout during set call.
        HAL_SET_TIMEOUT = 3;
        // Hal response timeout.
        HAL_RESPONSE_TIMEOUT = 4;
        // Hal responded with wrong info.
        WRONG_HAL_RESPONSE = 5;
        // Hal is processing multiple requests simultaneously.
        CONCURRENT_OPERATION = 6;
    }
    optional CallbackStatus callback_status = 2;
    // Number of the set associations in the response.
    optional int32 number_associations = 3;
    // Concatenated string for the types from set associations request.
    // This is a string converted from an array of integers.
    optional string user_identification_association_types = 4;
    // Concatenated string for the values from set associations request.
    // This is a string converted from an array of integers.
    optional string user_identification_association_values = 5;
}

/**
 * Logs whether GarageMode is entered.
 *
 * Logged from:
 *   packages/services/Car/service/src/com/android/car/CarStatsLog.java
 */
message GarageModeInfo {
    // Whether GarageMode is entered.
    optional bool is_garage_mode = 1;
}

/**
 * Historical app ops data per package.
 */
message AppOps {
    // Uid of the package requesting the op
    optional int32 uid = 1 [(is_uid) = true];

    // Name of the package performing the op
    optional string package_name = 2;

    // operation id
    optional android.app.AppOpEnum op_id = 3 [default = APP_OP_NONE];

    // The number of times the op was granted while the app was in the
    // foreground (only for trusted requests)
    optional int64 trusted_foreground_granted_count = 4;

    // The number of times the op was granted while the app was in the
    // background (only for trusted requests)
    optional int64 trusted_background_granted_count = 5;

    // The number of times the op was rejected while the app was in the
    // foreground (only for trusted requests)
    optional int64 trusted_foreground_rejected_count = 6;

    // The number of times the op was rejected while the app was in the
    // background (only for trusted requests)
    optional int64 trusted_background_rejected_count = 7;

    // For long-running operations, total duration of the operation
    // while the app was in the foreground (only for trusted requests)
    optional int64 trusted_foreground_duration_millis = 8;

    // For long-running operations, total duration of the operation
    // while the app was in the background (only for trusted requests)
    optional int64 trusted_background_duration_millis = 9;

    // Whether AppOps is guarded by Runtime permission
    optional bool is_runtime_permission = 10;
}

/**
 * Historical app ops data per package and attribution tag.
 */
message AttributedAppOps {
    // Uid of the package requesting the op
    optional int32 uid = 1 [(is_uid) = true];

    // Name of the package performing the op
    optional string package_name = 2;

    // tag; provided by developer when accessing related API, limited at 50 chars by API.
    // Attributions must be provided through manifest using <attribution> tag available in R and
    // above.
    optional string tag = 3;

    // operation id
    optional android.app.AppOpEnum op = 4 [default = APP_OP_NONE];

    // The number of times the op was granted while the app was in the
    // foreground (only for trusted requests)
    optional int64 trusted_foreground_granted_count = 5;

    // The number of times the op was granted while the app was in the
    // background (only for trusted requests)
    optional int64 trusted_background_granted_count = 6;

    // The number of times the op was rejected while the app was in the
    // foreground (only for trusted requests)
    optional int64 trusted_foreground_rejected_count = 7;

    // The number of times the op was rejected while the app was in the
    // background (only for trusted requests)
    optional int64 trusted_background_rejected_count = 8;

    // For long-running operations, total duration of the operation
    // while the app was in the foreground (only for trusted requests)
    optional int64 trusted_foreground_duration_millis = 9;

    // For long-running operations, total duration of the operation
    // while the app was in the background (only for trusted requests)
    optional int64 trusted_background_duration_millis = 10;

    // Whether AppOps is guarded by Runtime permission
    optional bool is_runtime_permission = 11;

    // Sampling rate used on device, from 0 to 100
    optional int32 sampling_rate = 12;
}

/**
 * Location Manager API Usage information(e.g. API under usage,
 * API call's parameters).
 * Logged from:
 *  frameworks/base/services/core/java/com/android/server/LocationManagerService.java
 */
message LocationManagerApiUsageReported {

    // Indicating if usage starts or usage ends.
    optional android.stats.location.UsageState state = 1;

    // LocationManagerService's API in use.
    // We can identify which API from LocationManager is
    // invoking current LMS API by the combination of
    // API parameter(e.g. is_listener_null, is_intent_null,
    // is_location_request_null)
    optional android.stats.location.LocationManagerServiceApi api_in_use = 2;

    // Name of the package calling the API.
    optional string calling_package_name = 3;

    // Type of the location provider.
    optional android.stats.location.ProviderType provider = 4;

    // Quality of the location request
    optional android.stats.location.LocationRequestQuality quality = 5;

    // The desired interval for active location updates, in milliseconds.
    // Bucketized to reduce cardinality.
    optional android.stats.location.LocationRequestIntervalBucket bucketized_interval = 6;

    // Minimum distance between location updates, in meters.
    // Bucketized to reduce cardinality.
    optional android.stats.location.SmallestDisplacementBucket
            bucketized_smallest_displacement = 7;

    // The number of location updates.
    optional int64 num_updates = 8;

    // The request expiration time, in millisecond since boot.
    // Bucketized to reduce cardinality.
    optional android.stats.location.ExpirationBucket
            bucketized_expire_in = 9;

    // Type of Callback passed in for this API.
    optional android.stats.location.CallbackType callback_type = 10;

    // The radius of the central point of the alert
    // region, in meters. Only for API REQUEST_GEOFENCE.
    // Bucketized to reduce cardinality.
    optional android.stats.location.GeofenceRadiusBucket bucketized_radius = 11;

    // Activity Importance of API caller.
    // Categorized to 3 types that are interesting from location's perspective.
    optional android.stats.location.ActivityImportance activiy_importance = 12;
}

/**
 * Information about a permission grant or denial made by user inside ReviewPermissionsFragment
 */
message ReviewPermissionsFragmentResultReported {
    // unique value identifying a permission group change. A permission group change might result
    // in multiple of these atoms
    optional int64 change_id = 1;

    // UID of package the permission belongs to
    optional int32 uid = 2 [(is_uid) = true];

    // Name of package the permission belongs to
    optional string package_name = 3;

    // The permission to be granted
    optional string permission_name = 4;

    // The result of the permission grant
    optional bool permission_granted = 5;
}

/**
* Information about results of permission upgrade by RuntimePermissionsUpgradeController
* Logged from: RuntimePermissionUpdgradeController
*/
message RuntimePermissionsUpgradeResult {
    // Permission granted as result of upgrade
    optional string permission_name = 1;

    // UID of package granted permission
    optional int32 uid = 2 [(is_uid) = true];

    // Name of package granted permission
    optional string package_name = 3;
}

/**
* Information about a buttons presented in GrantPermissionsActivty and choice made by user
*/
message GrantPermissionsActivityButtonActions {
    // Permission granted as result of upgrade
    optional string permission_group_name = 1;

    // UID of package granted permission
    optional int32 uid = 2 [(is_uid) = true];

    // Name of package requesting permission
    optional string package_name = 3;

    // Buttons presented in the dialog - bit flags, bit numbers are in accordance with
    // LABEL_ constants in GrantPermissionActivity.java
    optional int32 buttons_presented = 4;

    // Button clicked by user - same as bit flags in buttons_presented with only single bit set
    optional int32 button_clicked = 5;

    // id which identifies single session of user interacting with permission controller
    optional int64 session_id = 6;
}

/**
 * Information about LocationAccessCheck notification presented to user
 */
message LocationAccessCheckNotificationAction {

    // id which identifies single session of user interacting with permission controller
    optional int64 session_id = 1;

    // Uid of package for which location access check is presented
    optional int32 package_uid = 2;

    // Name of package for which location access check is presented
    optional string package_name = 3;

    enum Result {
        UNDEFINED = 0;
        // notification was presented to the user
        NOTIFICATION_PRESENTED = 1;
        // notification was declined by the user
        NOTIFICATION_DECLINED = 2;
        // notification was clicked by the user
        NOTIFICATION_CLICKED = 3;
    }

    // View / interaction recorded
    optional Result result = 4;
}

/**
 * Information about a permission grant or revoke made by user inside AppPermissionFragment
 */
message AppPermissionFragmentActionReported {
    // id which identifies single session of user interacting with permission controller
    optional int64 session_id = 1;

    // unique value identifying a permission group change. A permission group change might result
    // in multiple of these atoms
    optional int64 change_id = 2;

    // UID of package the permission belongs to
    optional int32 uid = 3 [(is_uid) = true];

    // Name of package the permission belongs to
    optional string package_name = 4;

    // The permission to be granted
    optional string permission_name = 5;

    // The result of the permission grant
    optional bool permission_granted = 6;

    // State of Permission Flags after grant as per android.content.pm.PermissionFlags
    optional int32 permission_flags = 7;

    enum Button {
        UNDEFINED = 0;
        // Allow button
        ALLOW = 1;
        // Deny button
        DENY = 2;
        // Ask every time button
        ASK_EVERY_TIME = 3;
        // Allow all the time button
        ALLOW_ALWAYS = 4;
        // Allow only while using the app button
        ALLOW_FOREGROUND = 5;
        // Same is Deny button but shown in while in use dialog
        DENY_FOREGROUND = 6;
    }

    // Button pressed in the dialog
    optional Button button_pressed = 8;
}

/**
* Information about a AppPermissionFragment viewed by user
*/
message AppPermissionFragmentViewed {
    // id which identifies single session of user interacting with permission controller
    optional int64 session_id = 1;

    // UID of package for which permissions are viewed
    optional int32 uid = 2 [(is_uid) = true];

    // Name of package for which permissions are viewed
    optional string package_name = 3;

    // Permission group viewed
    optional string permission_group_name = 4;
}

/**
* Information about a AppPermissionGroupsFragment viewed by user. Fragment has been renamed, but
* the log retains the old fragment name.
*/
message AppPermissionsFragmentViewed {
    // id which identifies single session of user interacting with permission controller
    optional int64 session_id = 1;

    // id which identifies single view as every view might have several logging records
    // with different package information attached
    optional int64 view_id = 2;

    // Permission group viewed
    optional string permission_group_name = 3;

    // UID of package for which permissions are viewed
    optional int32 uid = 4 [(is_uid) = true];

    // Name of package for which permissions are viewed
    optional string package_name = 5;

    // Category in which permission is included
    enum Category {
      UNDEFINED = 0;
      ALLOWED = 1;
      ALLOWED_FOREGROUND = 2;
      DENIED = 3;
    }
    optional Category category = 6;
}
/**
* Information about a PermissionAppsFragment viewed by user.
* Logged from ui/handheld/PermissionAppsFragment.java
*/
message PermissionAppsFragmentViewed {
    // id which identifies single session of user interacting with permission controller
    optional int64 session_id = 1;

    // id which identifies single view as every view might have several logging records
    // with different package information attached
    optional int64 view_id = 2;

    // Permission group viewed
    optional string permission_group_name = 3;

    // UID of package for which permissions are viewed
    optional int32 uid = 4 [(is_uid) = true];

    // Name of package for which permissions are viewed
    optional string package_name = 5;

    // Category in which app is included
    enum Category {
        UNDEFINED = 0;
        ALLOWED = 1;
        ALLOWED_FOREGROUND = 2;
        DENIED = 3;
    }
    optional Category category = 6;
}

/**
* Log that the Auto Revoke notification has been clicked
* Logged from ui/ManagePermissionsActivity
*/
message AutoRevokeNotificationClicked {
    // id which identifies single session of user interacting with permission controller
    optional int64 session_id = 1;
}

/**
* Log that an app has been displayed on the auto revoke page, and lists one permission that was
* auto revoked for it.
* Logged from ui/handheld/AutoRevokeFragment
*/
message AutoRevokeFragmentAppViewed {
    // id which identifies single session of user interacting with permission controller
    optional int64 session_id = 1;

    // UID of package for which permissions are viewed
    optional int32 uid = 2 [(is_uid) = true];

    // Name of package for which permissions are viewed
    optional string package_name = 3;

    // The name of a permission group that has been revoked
    optional string permission_group_name = 4;

    // The age of the app- more than three months old, or more than six months
    enum Age {
        UNDEFINED = 0;
        NEWER_BUCKET = 1;
        OLDER_BUCKET = 2;
    }

    // How long the app has been unused. Currently, newer bucket is 3 months, older is 6 months
    optional Age age = 5;
}

/**
* Log that the user has interacted with an app on the auto revoke fragment
* Logged from ui/handheld/AutoRevokeFragment
*/
message AutoRevokedAppInteraction {
    // id which identifies single session of user interacting with permission controller
    optional int64 session_id = 1;

    // UID of package for which permissions are viewed
    optional int32 uid = 2 [(is_uid) = true];

    // Name of package for which permissions are viewed
    optional string package_name = 3;

    enum Action {
        UNDEFINED = 0;
        REMOVE = 1;
        OPEN = 2;
        APP_INFO = 3;
        PERMISSIONS = 4;
        REMOVE_IN_SETTINGS = 5;
        OPEN_IN_SETTINGS = 6;
    }

    // The action the user took to interact with the app
    optional Action action = 4;
}

/**
* Log that the AppPermissionGroupsFragment has been interacted with for the possible purposes of
* auto revoke, or that the auto revoke switch has been changed
* Logged from ui/handheld/AppPermissionGroupsFragment
 */
message AppPermissionGroupsFragmentAutoRevokeAction {
    // id which identifies single session of user interacting with permission controller
    optional int64 session_id = 1;

    // UID of package for which permissions are viewed
    optional int32 uid = 2 [(is_uid) = true];

    // Name of package for which permissions are viewed
    optional string package_name = 3;

    enum Action {
        UNDEFINED = 0;
        OPENED_FOR_AUTO_REVOKE = 1;
        OPENED_FROM_INTENT = 2;
        SWITCH_ENABLED = 3;
        SWITCH_DISABLED = 4;
    }

    // The action the user took to interact with the fragment
    optional Action action = 4;
}

/**
 * Logs when there is a smart selection related event.
 * See frameworks/base/core/java/android/view/textclassifier/TextClassifierEvent.java
 * Logged from: TextClassifierEventLogger.java
 */
message TextSelectionEvent {
    // A session ID.
    optional string session_id = 1;

    // Event type of this event.
    optional android.stats.textclassifier.EventType event_type = 2;

    // Name of the annotator model that is involved in this event.
    optional string model_name = 3;

    // Type of widget that was involved in triggering this event.
    optional android.stats.textclassifier.WidgetType widget_type = 4;

    // Index of this event in a session.
    optional int32 event_index = 5;

    // Entity type that is involved.
    optional string entity_type = 6;

    // Relative word index of the start of the selection.
    optional int32 relative_word_start_index = 7;

    // Relative word (exclusive) index of the end of the selection.
    optional int32 relative_word_end_index = 8;

    // Relative word index of the start of the smart selection.
    optional int32 relative_suggested_word_start_index = 9;

    // Relative word (exclusive) index of the end of the smart selection.
    optional int32 relative_suggested_word_end_index = 10;

    // Name of source package.
    optional string package_name = 11;

    // Name of the LangID model that is involved in this event.
    optional string langid_model_name = 12;
}

/**
 * Logs when there is a smart linkify related event.
 * See frameworks/base/core/java/android/view/textclassifier/TextClassifierEvent.java
 * Logged from: TextClassifierEventLogger.java
 */
message TextLinkifyEvent {
    // A session ID.
    optional string session_id = 1;

    // Event type of this event.
    optional android.stats.textclassifier.EventType event_type = 2;

    // Name of the annotator model that is involved in this event.
    optional string model_name = 3;

    // Type of widget that was involved in triggering this event.
    optional android.stats.textclassifier.WidgetType widget_type = 4;

    // Index of this event in a session.
    optional int32 event_index = 5;

    // Entity type that is involved.
    optional string entity_type = 6;

    // Number of links detected.
    optional int32 num_links = 7;

    // The total length of all links.
    optional int32 linked_text_length = 8;

    // Length of input text.
    optional int32 text_length = 9;

    // Time spent on generating links in ms.
    optional int64 latency_millis = 10;

    // Name of source package.
    optional string package_name = 11;

    // Name of the LangID model that is involved in this event.
    optional string langid_model_name = 12;
}

/**
 * Logs when there is a conversation actions related event.
 * See frameworks/base/core/java/android/view/textclassifier/TextClassifierEvent.java
 * Logged from: TextClassifierEventLogger.java
 */
message ConversationActionsEvent {
    // A session ID.
    optional string session_id = 1;

    // Event type of this event.
    optional android.stats.textclassifier.EventType event_type = 2;

    // Name of the actions model that is involved in this event.
    optional string model_name = 3;

    // Type of widget that was involved in triggering this event.
    optional android.stats.textclassifier.WidgetType widget_type = 4;

    // The first entity type that is involved.
    optional string first_entity_type = 5;

    // The second entity type that is involved.
    optional string second_entity_type = 6;

    // The third entity type that is involved.
    optional string third_entity_type = 7;

    // The score of the first entity type.
    optional float score = 8;

    // Name of source package.
    optional string package_name = 9;

    // Name of the annotator model that is involved in this event.
    optional string annotator_model_name = 10;

    // Name of the LangID model that is involved in this event.
    optional string langid_model_name = 11;
}

/**
 * Logs when there is a language detection related event.
 * See frameworks/base/core/java/android/view/textclassifier/TextClassifierEvent.java
 * Logged from: TextClassifierEventLogger.java
 */
message LanguageDetectionEvent {
    // A session ID.
    optional string session_id = 1;

    // Event type of this event.
    optional android.stats.textclassifier.EventType event_type = 2;

    // Name of the language detection model that is involved in this event.
    optional string model_name = 3;

    // Type of widget that was involved in triggering this event.
    optional android.stats.textclassifier.WidgetType widget_type = 4;

    // Detected language.
    optional string language_tag = 5;

    // Score of the detected language.
    optional float score = 6;

    // Position of this action.
    optional int32 action_index = 7;

    // Name of source package.
    optional string package_name = 8;
}

/**
 * Information about an OTA update attempt by update_engine.
 * Logged from platform/system/update_engine/metrics_reporter_android.cc
 */
message UpdateEngineUpdateAttemptReported {
    // The number of attempts for the update engine to apply a given payload.
    optional int32 attempt_number = 1;

    optional android.stats.otaupdate.PayloadType payload_type = 2;

    // The total time in minutes for the update engine to apply a given payload.
    // The time is calculated by calling clock_gettime() / CLOCK_BOOTTIME; and
    // it's increased when the system is sleeping.
    optional int32 duration_boottime_in_minutes = 3;

    // The total time in minutes for the update engine to apply a given payload.
    // The time is calculated by calling clock_gettime() / CLOCK_MONOTONIC_RAW;
    // and it's not increased when the system is sleeping.
    optional int32 duration_monotonic_in_minutes = 4;

    // The size of the payload in MiBs.
    optional int32 payload_size_mib = 5;

    // The attempt result reported by the update engine for an OTA update.
    optional android.stats.otaupdate.AttemptResult attempt_result = 6;

    // The error code reported by the update engine after an OTA update attempt
    // on A/B devices.
    optional android.stats.otaupdate.ErrorCode error_code = 7;

    // The build fingerprint of the source system. The value is read from a
    // system property when the device takes the update. e.g.
    // Android/aosp_sailfish/sailfish:10/QP1A.190425.004/5507117:userdebug/test-keys
    optional string source_fingerprint = 8;

    // Size of super partition.
    optional int64 super_partition_size_bytes = 9;

    // Size of current slot within the super partition.
    optional int64 slot_size_bytes = 10;

    // Free space available in the super partition.
    optional int64 super_free_space_bytes = 11;
}

/**
 * Information about all the attempts the device make before finishing the
 * successful update.
 * Logged from platform/system/update_engine/metrics_reporter_android.cc
 */
message UpdateEngineSuccessfulUpdateReported {
    // The number of attempts for the update engine to apply the payload for a
    // successful update.
    optional int32 attempt_count = 1;

    optional android.stats.otaupdate.PayloadType payload_type = 2;

    optional int32 payload_size_mib = 3;

    // The total number of bytes downloaded by update_engine since the last
    // successful update.
    optional int32 total_bytes_downloaded_mib = 4;

    // The ratio in percentage of the over-downloaded bytes compared to the
    // total bytes needed to successfully install the update. e.g. 200 if we
    // download 200MiB in total for a 100MiB package.
    optional int32 download_overhead_percentage = 5;

    // The total time in minutes for the update engine to apply the payload for a
    // successful update.
    optional int32 total_duration_minutes = 6;

    // The number of reboot of the device during a successful update.
    optional int32 reboot_count = 7;
}

/**
 * Reported when the RebootEscrow HAL has attempted to recover the escrowed
 * key to indicate whether it was successful or not.
 *
 * Logged from:
 *   frameworks/base/services/core/java/com/android/server/locksettings/RebootEscrowManager.java
 */
message RebootEscrowRecoveryReported {
    optional bool successful = 1;
}

/**
 * Global display pipeline metrics reported by SurfaceFlinger.
 * Pulled from:
 *    frameworks/native/services/surfaceflinger/TimeStats/TimeStats.cpp
 */
message SurfaceflingerStatsGlobalInfo {
    // Total number of frames presented during the tracing period
    optional int64 total_frames = 1;
    // Total number of frames missed
    optional int64 missed_frames = 2;
    // Total number of frames that fell back to client composition
    optional int64 client_composition_frames = 3;
    // Total time the display was turned on
    optional int64 display_on_millis = 4;
    // Total time that was spent performing animations.
    // This is derived from the present-to-present layer histogram
    optional int64 animation_millis = 5;
    // Total number of event connections tracked by SurfaceFlinger at the time
    // of this pull. If this number grows prohibitively large, then this can
    // cause jank due to resource contention.
    optional int32 event_connection_count = 6;
    // Set of timings measured from when SurfaceFlinger began compositing a
    // frame, until the frame was requested to be presented to the display. This
    // measures SurfaceFlinger's total CPU walltime on the critical path per
    // frame.
    optional FrameTimingHistogram frame_duration = 7
        [(android.os.statsd.log_mode) = MODE_BYTES];
    // Set of timings measured from when SurfaceFlinger first began using the
    // GPU to composite a frame, until the GPU has finished compositing that
    // frame. This measures the total additional time SurfaceFlinger needed to
    // perform due to falling back into GPU composition.
    optional FrameTimingHistogram render_engine_timing = 8
        [(android.os.statsd.log_mode) = MODE_BYTES];
}

/**
 * Per-layer display pipeline metrics reported by SurfaceFlinger.
 * The number of layers uploaded will be restricted due to size limitations.
 * Pulled from:
 *    frameworks/native/services/surfaceflinger/TimeStats/TimeStats.cpp
 */
message SurfaceflingerStatsLayerInfo {
    // The layer for this set of metrics
    // For now we can infer that the package name is included in the layer
    // name.
    optional string layer_name = 1;
    // Total number of frames presented
    optional int64 total_frames = 2;
    // Total number of dropped frames while latching a buffer for this layer.
    optional int64 dropped_frames = 3;
    // Set of timings measured between successive presentation timestamps.
    optional FrameTimingHistogram present_to_present = 4
        [(android.os.statsd.log_mode) = MODE_BYTES];
    // Set of timings measured from when an app queued a buffer for
    // presentation, until the buffer was actually presented to the
    // display.
    optional FrameTimingHistogram post_to_present = 5
        [(android.os.statsd.log_mode) = MODE_BYTES];
    // Set of timings measured from when a buffer is ready to be presented,
    // until the buffer was actually presented to the display.
    optional FrameTimingHistogram acquire_to_present = 6
        [(android.os.statsd.log_mode) = MODE_BYTES];
    // Set of timings measured from when a buffer was latched by
    // SurfaceFlinger, until the buffer was presented to the display
    optional FrameTimingHistogram latch_to_present = 7
        [(android.os.statsd.log_mode) = MODE_BYTES];
    // Set of timings measured from the desired presentation to the actual
    // presentation time
    optional FrameTimingHistogram desired_to_present = 8
        [(android.os.statsd.log_mode) = MODE_BYTES];
    // Set of timings measured from when an app queued a buffer for
    // presentation, until the buffer was ready to be presented.
    optional FrameTimingHistogram post_to_acquire = 9
        [(android.os.statsd.log_mode) = MODE_BYTES];
    // Frames missed latch because the acquire fence didn't fire
    optional int64 late_acquire_frames = 10;
    // Frames latched early because the desired present time was bad
    optional int64 bad_desired_present_frames = 11;
}

/**
 * Histogram of frame counts bucketed by time in milliseconds.
 * Because of size limitations, we hard-cap the number of buckets, with
 * buckets for corresponding to larger milliseconds being less precise.
 */
message FrameTimingHistogram {
    // Timings in milliseconds that describes a set of histogram buckets
    repeated int32 time_millis_buckets = 1;
    // Number of frames that match to each time_millis, i.e. the bucket
    // contents
    // It's required that len(time_millis) == len(frame_count)
    repeated int64 frame_counts = 2;
}

/**
 * Janky event as reported by SurfaceFlinger.
 * This event is intended to be consumed by a Perfetto subscriber for
 * automated trace collection.
 *
 * Logged from:
 *    frameworks/native/services/surfaceflinger/SurfaceFlinger.cpp
 */
message DisplayJankReported {
    // Informational field for how long the janky event lasted in milliseconds
    optional int64 event_duration_millis = 1;
    // Number of frame deadlines missed, where SurfaceFlinger failed to update
    // the display on time.
    optional int32 present_deadlines_missed = 2;
}

/**
 * Information about camera facing and API level usage.
 * Logged from:
 *   frameworks/base/services/core/java/com/android/server/camera/CameraServiceProxy.java
 */
message CameraActionEvent {
    // Camera session duration
    optional int64 duration_millis = 1;

    // Camera API level used
    optional int32 api_level = 2;

    // Name of client package
    optional string package_name = 3;

    // Camera facing
    enum Facing {
        UNKNOWN = 0;
        BACK = 1;
        FRONT = 2;
        EXTERNAL = 3;
    }
    optional Facing facing = 4;
}

/**
 * Logs when a compatibility change is affecting an app.
 *
 * Logged from:
 *   frameworks/base/core/java/android/app/AppCompatCallbacks.java and
 *   frameworks/base/services/core/java/com/android/server/compat/PlatformCompat.java
 */
message AppCompatibilityChangeReported {
    // The UID of the app being affected by the compatibilty change.
    optional int32 uid = 1 [(is_uid) = true];

    // The ID of the change affecting the app.
    optional int64 change_id = 2;

    enum State {
        UNKNOWN_STATE = 0;
        ENABLED = 1;
        DISABLED = 2;
        LOGGED = 3;
    }

    // The state of the change - if logged from gating whether it was enabled or disabled, or just
    // logged otherwise.
    optional State state = 3;

    enum Source {
        UNKNOWN_SOURCE = 0;
        APP_PROCESS = 1;
        SYSTEM_SERVER = 2;
    }

    // Where it was logged from.
    optional Source source = 4;

}

/**
 * Logged from
 *     external/perfetto/src/perfetto_cmd/perfetto_cmd.cc
 */
message PerfettoUploaded {
    enum Event {
        PERFETTO_UNDEFINED = 0;
        PERFETTO_TRACE_BEGIN = 1;
        PERFETTO_BACKGROUND_TRACE_BEGIN = 2;
        PERFETTO_ON_CONNECT = 3;
        PERFETTO_ON_TRACING_DISABLED = 4;
        PERFETTO_UPLOAD_DROPBOX_BEGIN = 5;
        PERFETTO_UPLOAD_DROPBOX_SUCCESS = 6;
        PERFETTO_UPLOAD_DROPBOX_FAILURE = 7;
        PERFETTO_UPLOAD_INCIDENT_BEGIN = 8;
        PERFETTO_UPLOAD_INCIDENT_SUCCESS = 9;
        PERFETTO_UPLOAD_INCIDENT_FAILURE = 10;
        PERFETTO_FINALIZE_TRACE_AND_EXIT = 11;
        PERFETTO_TRIGGER_BEGIN = 12;
        PERFETTO_TRIGGER_SUCCESS = 13;
        PERFETTO_TRIGGER_FAILURE = 14;
        PERFETTO_HIT_GUARDRAILS = 15;
        PERFETTO_ON_TIMEOUT = 16;
        PERFETTO_NOT_UPLOADING_EMPTY_TRACE = 17;
    }

    // Which stage of the pipeline we are reporting from.
    optional Event event = 1;

    // UUID matching the one set inside the SystemInfo trace packet.
    optional int64 trace_uuid_lsb = 2;
    optional int64 trace_uuid_msb = 3;
}

/**
 * Pulls client metrics on data transferred via Vehicle Maps Service.
 * Metrics are keyed by uid + layer.
 *
 * Pulled from:
 *   packages/services/Car/service/src/com/android/car/stats/CarStatsService.java
 */
message VmsClientStats {
    // UID of the VMS client app
    optional int32 uid = 1 [(is_uid) = true];

    // VMS layer definition
    optional int32 layer_type = 2;
    optional int32 layer_channel = 3;
    optional int32 layer_version = 4;

    // Bytes and packets sent by the client for the layer
    optional int64 tx_bytes = 5;
    optional int64 tx_packets = 6;

    // Bytes and packets received by the client for the layer
    optional int64 rx_bytes = 7;
    optional int64 rx_packets = 8;

    // Bytes and packets dropped due to client error
    optional int64 dropped_bytes = 9;
    optional int64 dropped_packets = 10;
}

/**
 * State of a dangerous permission requested by a package - sampled
 * Pulled from: StatsCompanionService.java with data obtained from PackageManager API
*/
message DangerousPermissionStateSampled {
    // Name of the permission
    optional string permission_name = 1;

    // Uid of the package
    optional int32 uid = 2 [(is_uid) = true];

    // If the permission is granted to the uid
    optional bool is_granted = 3;

    // Permission flags as per android.content.pm.PermissionFlags
    optional int32 permission_flags = 4;
}

/**
 * HWUI stats for a given app.
 */
message GraphicsStats {
    // The package name of the app
    optional string package_name = 1;

    // The version code of the app
    optional int64 version_code = 2;

    // The start & end timestamps in UTC as
    // milliseconds since January 1, 1970
    // Compatible with java.util.Date#setTime()
    optional int64 start_millis = 3;

    optional int64 end_millis = 4;

    // HWUI renders pipeline type: GL (1) or Vulkan (2).
    enum PipelineType {
        UNKNOWN = 0;
        GL = 1;
        VULKAN = 2;
    }

    // HWUI renders pipeline type: GL or Vulkan.
    optional PipelineType pipeline = 5;

    // Distinct frame count.
    optional int32 total_frames = 6;

    // Number of "missed vsync" events.
    optional int32 missed_vsync_count = 7;

    // Number of frames in triple-buffering scenario (high input latency)
    optional int32 high_input_latency_count = 8;

    // Number of "slow UI thread" events.
    optional int32 slow_ui_thread_count = 9;

    // Number of "slow bitmap upload" events.
    optional int32 slow_bitmap_upload_count = 10;

    // Number of "slow draw" events.
    optional int32 slow_draw_count = 11;

    // Number of frames that missed their deadline (aka, visibly janked)
    optional int32 missed_deadline_count = 12;

    // The frame time histogram for the package
    optional FrameTimingHistogram cpu_histogram = 13
    [(android.os.statsd.log_mode) = MODE_BYTES];

    // The gpu frame time histogram for the package
    optional FrameTimingHistogram gpu_histogram = 14
    [(android.os.statsd.log_mode) = MODE_BYTES];

    // UI mainline module version.
    optional int64 version_ui_module = 15;

    // If true, these are HWUI stats for up to a 24h period for a given app from today.
    // If false, these are HWUI stats for a 24h period for a given app from the last complete
    // day (yesterday). Stats from yesterday stay constant, while stats from today may change as
    // more apps are running / rendering.
    optional bool is_today = 16;
}

/**
 * Message related to dangerous (runtime) app ops access
 */
message RuntimeAppOpAccess {
    // Uid of the package accessing app op
    optional int32 uid = 1 [(is_uid) = true];

    // Name of the package accessing app op
    optional string package_name = 2;

    // deprecated - set to empty string
    optional string op_deprecated = 3 [deprecated = true];

    // attribution_tag; provided by developer when accessing related API, limited at 50 chars by
    // API. Attributions must be provided through manifest using <attribution> tag available in R
    // and above.
    optional string attribution_tag = 4;

    // message related to app op access, limited to 600 chars by API
    optional string message = 5;

    enum SamplingStrategy {
        DEFAULT = 0;
        UNIFORM = 1;
        RARELY_USED = 2;
        BOOT_TIME_SAMPLING = 3;
        UNIFORM_OPS = 4;
    }

    // sampling strategy used to collect this message
    optional SamplingStrategy sampling_strategy = 6;

    // operation id
    optional android.app.AppOpEnum op = 7 [default = APP_OP_NONE];
}

/*
 * Logs userspace reboot outcome and duration.
 *
 * Logged from:
 *   frameworks/base/core/java/com/android/server/BootReceiver.java
 */
message UserspaceRebootReported {
    // Possible outcomes of userspace reboot.
    enum Outcome {
        // Default value in case platform failed to determine the outcome.
        OUTCOME_UNKNOWN = 0;
        // Userspace reboot succeeded (i.e. boot completed without a fall back to hard reboot).
        SUCCESS = 1;
        // Userspace reboot shutdown sequence was aborted.
        FAILED_SHUTDOWN_SEQUENCE_ABORTED = 2;
        // Remounting userdata into checkpointing mode failed.
        FAILED_USERDATA_REMOUNT = 3;
        // Device didn't finish booting before timeout and userspace reboot watchdog issued a hard
        // reboot.
        FAILED_USERSPACE_REBOOT_WATCHDOG_TRIGGERED = 4;
    }
    // Outcome of userspace reboot. Always set.
    optional Outcome outcome = 1;
    // Duration of userspace reboot in case it has a successful outcome.
    // Duration is measured as time between userspace reboot was initiated and until boot completed
    // (e.g. sys.boot_completed=1).
    optional int64 duration_millis = 2;
    // State of primary user's (user0) credential encryption storage.
    enum UserEncryptionState {
        // Default value.
        USER_ENCRYPTION_STATE_UNKNOWN = 0;
        // Credential encrypted storage is unlocked.
        UNLOCKED = 1;
        // Credential encrypted storage is locked.
        LOCKED = 2;
    }
    // State of primary user's encryption storage at the moment boot completed. Always set.
    optional UserEncryptionState user_encryption_state = 3;
}

/*
 * Logs integrity check information during each install.
 *
 * Logged from:
 *   frameworks/base/services/core/java/com/android/server/integrity/AppIntegrityManagerServiceImpl.java
 */
message IntegrityCheckResultReported {
    optional string package_name = 1;
    optional string app_certificate_hash = 2;
    optional int64 version_code = 3;
    optional string installer_package_name = 4;
    enum Response {
        UNKNOWN = 0;
        ALLOWED = 1;
        REJECTED = 2;
        FORCE_ALLOWED = 3;
    }
    optional Response response = 5;
    // An estimate on the cause of the response. This will only be populated for
    // REJECTED and FORCE_ALLOWED
    optional bool caused_by_app_cert_rule = 6;
    optional bool caused_by_installer_rule = 7;
}

/**
 * Logs the information about the rules and the provider whenever rules are
 * pushed into AppIntegrityManager.
 *
 * Logged from:
 *   frameworks/base/services/core/java/com/android/server/integrity/AppIntegrityManagerServiceImpl.java
 */
message IntegrityRulesPushed {
    optional bool success = 1;
    // Package name of the app that pushed the rules.
    optional string rule_provider = 2;
    // Version string of arbitrary format provided by the rule provider to
    // identify the rules.
    optional string rule_version = 3;
}

/**
 * Logs when a cell broadcast message is received on the device.
 *
 * Logged from Cell Broadcast module and platform:
 *   packages/modules/CellBroadcastService/src/com/android/cellbroadcastservice/
 *   packages/apps/CellBroadcastReceiver/
 *   frameworks/opt/telephony/src/java/com/android/internal/telephony/CellBroadcastServiceManager.java
 */
message CellBroadcastMessageReported {
    // The type of Cell Broadcast message
    enum CbType {
        UNKNOWN_TYPE = 0;
        GSM = 1;
        CDMA = 2;
        CDMA_SPC = 3;
    }

    // The parts of the cell broadcast message pipeline
    enum ReportSource {
        UNKNOWN_SOURCE = 0;
        FRAMEWORK = 1;
        CB_SERVICE = 2;
        CB_RECEIVER_APP = 3;
    }

    // GSM, CDMA, CDMA-SCP
    optional CbType type = 1;

    // The source of the report
    optional ReportSource source = 2;
}

/**
 * Logs when a cell broadcast message is filtered out, or otherwise intentionally not sent to CBR.
 *
 * Logged from CellBroadcastService module:
 *   packages/modules/CellBroadcastService/src/com/android/cellbroadcastservice/
 */
message CellBroadcastMessageFiltered {
    enum FilterReason {
        NOT_FILTERED = 0;
        DUPLICATE_MESSAGE = 1;
        GEOFENCED_MESSAGE = 2;
        AREA_INFO_MESSAGE = 3;
    }

    // GSM, CDMA, CDMA-SCP
    optional CellBroadcastMessageReported.CbType type = 1;

    // The source of the report
    optional FilterReason filter = 2;
}

/**
 * Logs when an error occurs while handling a cell broadcast message;
 *
 * Logged from CellBroadcastService module:
 *   packages/modules/CellBroadcastService/src/com/android/cellbroadcastservice/
 */
message CellBroadcastMessageError {
    // The type of error raised when trying to handle a cell broadcast message
    enum ErrorType {
        UNKNOWN_TYPE = 0;
        CDMA_DECODING_ERROR = 1;
        CDMA_SCP_EMPTY = 2;
        CDMA_SCP_HANDLING_ERROR = 3;
        GSM_INVALID_HEADER_LENGTH = 4;
        GSM_UNSUPPORTED_HEADER_MESSAGE_TYPE = 5;
        GSM_UNSUPPORTED_HEADER_DATA_CODING_SCHEME = 6;
        GSM_INVALID_PDU = 7;
        GSM_INVALID_GEO_FENCING_DATA = 8;
        GSM_UMTS_INVALID_WAC = 9;
        FAILED_TO_INSERT_TO_DB = 10;
        UNEXPECTED_GEOMETRY_FROM_FWK = 11;
        UNEXPECTED_GSM_MESSAGE_TYPE_FROM_FWK = 12;
        UNEXPECTED_CDMA_MESSAGE_TYPE_FROM_FWK = 13;
        UNEXPECTED_CDMA_SCP_MESSAGE_TYPE_FROM_FWK = 14;
        NO_CONNECTION_TO_CB_SERVICE = 15;
    }

    // What kind of error occurred
    optional ErrorType type = 1;

    // Exception message (or log message) associated with the error (max 1000 chars)
    optional string exception_message = 2;
}

/**
 * Logs when a tune occurs through device's Frontend.
 * This is atom ID 276.
 *
 * Logged from:
 *   frameworks/base/media/java/android/media/tv/tuner/Tuner.java
 */
message TvTunerStateChanged {
    enum State {
        UNKNOWN = 0;
        TUNING = 1; // Signal is tuned
        LOCKED = 2;    // the signal is locked
        NOT_LOCKED = 3; // the signal isn’t locked.
        SIGNAL_LOST = 4; // the signal was locked, but is lost now.
        SCANNING = 5; // the signal is scanned
        SCAN_STOPPED = 6; // the scan is stopped.
    }
    // The uid of the application that sent this custom atom.
    optional int32 uid = 1 [(is_uid) = true];
    //  new state
    optional State state = 2;
}

/**
 * Logs the status of a dvr playback or record.
 * This is atom ID 279.
 *
 * Logged from:
 *   frameworks/base/media/java/android/media/tv/tuner/dvr
 */
message TvTunerDvrStatus {
    enum Type {
        UNKNOWN_TYPE = 0;
        PLAYBACK = 1; // is a playback
        RECORD = 2; // is a record
    }
    enum State {
        UNKNOWN_STATE = 0;
        STARTED = 1; // DVR is started
        STOPPED = 2; // DVR is stopped
    }
    // The uid of the application that sent this custom atom.
    optional int32 uid = 1 [(is_uid) = true];
    // DVR type
    optional Type type = 2;
    //  DVR state
    optional State state = 3;
    //  Identify the segment of a record or playback
    optional int32 segment_id = 4;
    // indicate how many overflow or underflow happened between started to stopped
    optional int32 overflow_underflow_count = 5;
}

/**
 * Logs when a cas session opened through MediaCas.
 * This is atom ID 280.
 *
 * Logged from:
 *   frameworks/base/media/java/android/media/MediaCas.java
 */
message TvCasSessionOpenStatus {
    enum State {
        UNKNOWN = 0;
        SUCCEEDED = 1; // indicate that the session is opened successfully.
        FAILED = 2; // indicate that the session isn’t opened successfully.
    }
    // The uid of the application that sent this custom atom.
    optional int32 uid = 1 [(is_uid) = true];
    //  Cas system Id
    optional int32 cas_system_id = 2;
    // State of the session
    optional State state = 3;
}

/**
 * Logs for ContactsProvider general usage.
 * This is atom ID 301.
 *
 * Logged from:
 *   packages/providers/ContactsProvider/src/com/android/providers/contacts/ContactsProvider2.java
 */
message ContactsProviderStatusReported {
    enum ApiType {
        UNKNOWN_API = 0;
        QUERY = 1;
        // INSERT includes insert and bulkInsert, and inserts triggered by applyBatch.
        INSERT = 2;
        // UPDATE and DELETE includes update/delete and the ones triggered by applyBatch.
        UPDATE = 3;
        DELETE = 4;
    }

    enum ResultType {
        UNKNOWN_RESULT = 0;
        SUCCESS = 1;
        FAIL = 2;
        ILLEGAL_ARGUMENT = 3;
        UNSUPPORTED_OPERATION = 4;
    }

    enum CallerType {
        UNSPECIFIED_CALLER_TYPE = 0;
        CALLER_IS_SYNC_ADAPTER = 1;
        CALLER_IS_NOT_SYNC_ADAPTER = 2;
    }

    optional ApiType api_type = 1;
    // Defined in
    // packages/providers/ContactsProvider/src/com/android/providers/contacts/ContactsProvider2.java
    optional int32 uri_type = 2;
    optional CallerType caller_type = 3;
    optional ResultType result_type = 4;
    optional int32 result_count = 5;
    optional int64 latency_micros = 6;
}

/**
 * Logs when an app is frozen or unfrozen.
 *
 * Logged from:
 *   frameworks/base/services/core/java/com/android/server/am/CachedAppOptimizer.java
 */
message AppFreezeChanged {
    // The type of event.
    enum Action {
        UNKNOWN = 0;
        FREEZE_APP = 1;
        UNFREEZE_APP = 2;
    }
    optional Action action = 1;

    // Pid of the process being frozen.
    optional int32 pid = 2;

    // Name of the process being frozen.
    optional string process_name = 3;

    // Time since last unfrozen.
    optional int64 time_unfrozen_millis = 4;
}

/**
 * Pulls information for a single voice call.
 *
 * Each pull creates multiple atoms, one for each call. The sequence is randomized when pulled.
 *
 * Pulled from:
 *   frameworks/opt/telephony/src/java/com/android/internal/telephony/metrics/MetricsCollector.java
 */
message VoiceCallSession {
    // Bearer (IMS or CS) when the call started.
    optional android.telephony.CallBearerEnum bearer_at_start = 1;

    // Bearer (IMS or CS) when the call ended.
    // The bearer may change during the call, e.g. due to SRVCC.
    optional android.telephony.CallBearerEnum bearer_at_end = 2;

    // Direction of the call (incoming or outgoing).
    optional android.telephony.CallDirectionEnum direction = 3;

    // Time spent setting up the call.
    optional android.telephony.CallSetupDurationEnum setup_duration = 4;

    // Whether the call ended before the setup was completed.
    optional bool setup_failed = 5;

    // IMS reason code or CS disconnect cause.
    // For IMS, see: frameworks/base/telephony/java/android/telephony/ims/ImsReasonInfo.java
    // For CS, see: frameworks/base/telephony/java/android/telephony/DisconnectCause.java
    optional int32 disconnect_reason_code = 6;

    // IMS extra code or CS precise disconnect cause.
    // For IMS, this code is vendor-specific
    // For CS, see: frameworks/base/telephony/java/android/telephony/PreciseDisconnectCause.java
    optional int32 disconnect_extra_code = 7;

    // IMS extra message or CS vendor cause.
    optional string disconnect_extra_message = 8;

    // Radio access technology (RAT) used when call started.
    optional android.telephony.NetworkTypeEnum rat_at_start = 9;

    // Radio access technology (RAT) used when call terminated.
    optional android.telephony.NetworkTypeEnum rat_at_end = 10;

    // Number of times RAT changed during the call.
    optional int64 rat_switch_count = 11;

    // A bitmask of all codecs used during the call.
    // See: frameworks/opt/telephony/src/java/com/android/internal/telephony/metrics/VoiceCallSessionStats.java
    optional int64 codec_bitmask = 12;

    // Number of other calls going on during call setup, for the same SIM slot.
    optional int32 concurrent_call_count_at_start = 13;

    // Number of other calls going on during call termination, for the same SIM slot.
    optional int32 concurrent_call_count_at_end = 14;

    // Index of the SIM is used, 0 for single-SIM devices.
    optional int32 sim_slot_index = 15;

    // Whether the device was in multi-SIM mode (with multiple active SIM profiles).
    optional bool is_multi_sim = 16;

    // Whether the call was made with an eSIM profile.
    optional bool is_esim = 17;

    // Carrier ID of the SIM card.
    // See https://source.android.com/devices/tech/config/carrierid.
    optional int32 carrier_id = 18;

    // Whether an SRVCC has been completed successfully for this call.
    optional bool srvcc_completed = 19;

    // Number of SRVCC failures.
    optional int64 srvcc_failure_count = 20;

    // Number of SRVCC cancellations.
    optional int64 srvcc_cancellation_count = 21;

    // Whether the Real-Time Text (RTT) was ever used in the call (rather than whether RTT was
    // enabled in the dialer's settings).
    optional bool rtt_enabled = 22;

    // Whether this was an emergency call.
    optional bool is_emergency = 23;

    // Whether the call was performed while roaming.
    optional bool is_roaming = 24;

    // A random number used as the dimension field to pull multiple atoms.
    optional int32 dimension = 25;
}

/**
 * Pulls voice call radio access technology (RAT) usage.
 *
 * Each pull creates multiple atoms, one for each carrier/RAT, the order of which is irrelevant to
 * time. The atom will be skipped if not enough data is available.
 *
 * Pulled from:
 *   frameworks/opt/telephony/src/java/com/android/internal/telephony/metrics/MetricsCollector.java
 */
message VoiceCallRatUsage {
    // Carrier ID (https://source.android.com/devices/tech/config/carrierid).
    optional int32 carrier_id = 1;

    // Radio access technology.
    optional android.telephony.NetworkTypeEnum rat = 2;

    // Total duration that voice calls spent on this carrier and RAT.
    optional int64 total_duration_seconds = 3;

    // Total number of calls using this carrier and RAT.
    // A call is counted once even if it used the RAT multiple times.
    optional int64 call_count = 4;
}

/**
 * Pulls the number of active SIM slots and SIMs/eSIM profiles.
 *
 * Pulled from:
 *   frameworks/opt/telephony/src/java/com/android/internal/telephony/metrics/MetricsCollector.java
 */
message SimSlotState {
    // Number of active SIM slots (both physical and eSIM profiles) in the device.
    optional int32 active_slot_count = 1;

    // Number of SIM cards (both physical and active eSIM profiles).
    // This number is always equal to or less than the number of active SIM slots.
    optional int32 sim_count = 2;

    // Number of active eSIM profiles.
    // This number is always equal to or less than the number of SIMs.
    optional int32 esim_count = 3;
}

/**
 * Pulls supported cellular radio access technologies.
 *
 * This atom reports the capabilities of the device, rather than the network it has access to.
 *
 * Pulled from:
 *   frameworks/opt/telephony/src/java/com/android/internal/telephony/metrics/MetricsCollector.java
 */
message SupportedRadioAccessFamily {
    // A bitmask of supported radio technologies.
    // See android.telephony.TelephonyManager.NetworkTypeBitMask.
    optional int64 network_type_bitmask = 1;
}

/**
 * Logs gnss stats from location service provider
 *
 * Pulled from:
 *  frameworks/base/location/java/com/android/internal/location/gnssmetrics/GnssMetrics.java
 */

message GnssStats {
    // Number of location reports since boot
    optional int64 location_reports = 1;

    // Total pulled reports of Location failures since boot
    optional int64 location_failure_reports = 2;

    // Number of time to first fix reports since boot
    optional int64 time_to_first_fix_reports = 3;

    // Total pulled reported time to first fix (in milli-seconds) since boot
    optional int64 time_to_first_fix_millis = 4;

    // Number of position accuracy reports since boot
    optional int64 position_accuracy_reports = 5;

    // Total pulled reported position accuracy (in meters) since boot
    optional int64 position_accuracy_meters = 6;

    // Number of top 4 average CN0 reports since boot
    optional int64 top_four_average_cn0_reports = 7;

    // Total pulled reported of top 4 average CN0 (dB-mHz) since boot
    optional int64 top_four_average_cn0_db_mhz = 8;

    // Number of l5 top 4 average CN0 reports since boot
    optional int64 l5_top_four_average_cn0_reports = 9;

    // Total pulled reported of l5 top 4 average CN0 (dB-mHz) since boot
    optional int64 l5_top_four_average_cn0_db_mhz = 10;

    // Total number of sv status messages reports since boot
    optional int64 sv_status_reports = 11;

    // Total number of sv status messages reports, where sv is used in fix since boot
    optional int64 sv_status_reports_used_in_fix = 12;

    // Total number of L5 sv status messages reports since boot
    optional int64 l5_sv_status_reports = 13;

    // Total number of L5 sv status messages reports, where sv is used in fix since boot
    optional int64 l5_sv_status_reports_used_in_fix = 14;
}

/**
 * Logs when an app is moved to a different standby bucket.
 *
 * Logged from:
 *   frameworks/base/apex/jobscheduler/service/java/com/android/server/usage/AppIdleHistory.java
 */
message AppStandbyBucketChanged {
    optional string package_name = 1;

    // Should be 0, 10, 11, 12, etc. where 0 is the owner. See UserHandle for more documentation.
    optional int32 user_id = 2;

    // These enum values match the constants defined in UsageStatsManager.java.
    enum Bucket {
        BUCKET_UNKNOWN = 0;
        BUCKET_EXEMPTED = 5;
        BUCKET_ACTIVE = 10;
        BUCKET_WORKING_SET = 20;
        BUCKET_FREQUENT = 30;
        BUCKET_RARE = 40;
        BUCKET_RESTRICTED = 45;
        BUCKET_NEVER = 50;
    }
    optional Bucket bucket = 3;

    enum MainReason {
        MAIN_UNKNOWN = 0;
        MAIN_DEFAULT = 0x0100;
        MAIN_TIMEOUT = 0x0200;
        MAIN_USAGE = 0x0300;
        MAIN_FORCED_BY_USER = 0x0400;
        MAIN_PREDICTED = 0x0500;
        MAIN_FORCED_BY_SYSTEM = 0x0600;
    }
    optional MainReason main_reason = 4;

    // A more detailed reason for the standby bucket change. The sub reason name is dependent on
    // the main reason. Values are one of the REASON_SUB_XXX constants defined in
    // UsageStatsManager.java.
    optional int32 sub_reason = 5;
}

/**
* Reports a started sharesheet transaction.
*
* Logged from:
*   frameworks/base/core/java/com/android/internal/app/ChooserActivity.java
*/
message SharesheetStarted {
    // The event_id (as for UiEventReported).
    optional int32 event_id = 1;
    // The calling app's package name.
    optional string package_name = 2;
    // An identifier to tie together multiple logs relating to the same share event
    optional int32 instance_id = 3;
    // The mime type of the share
    optional string mime_type = 4;
    // The number of direct targets the calling app is providing that will be shown.
    optional int32 num_app_provided_direct_targets = 5;
    // The number of app targets the calling app is providing that will be shown.
    optional int32 num_app_provided_app_targets = 6;
    // True if the share originates from the workprofile
    optional bool is_workprofile = 7;

    enum SharesheetPreviewType {  // Constants from ChooserActivity.java
        CONTENT_PREVIEW_TYPE_UNKNOWN = 0;  // Default for proto 2 / 3 compatibility.
        CONTENT_PREVIEW_IMAGE = 1;  // The preview shown in the sharesheet is an image.
        CONTENT_PREVIEW_FILE = 2;  // The preview shown in the sharesheet is a file.
        CONTENT_PREVIEW_TEXT = 3;  // The preview shown in the sharesheet is text.
    }
    // How the sharesheet preview is presented.
    optional SharesheetPreviewType preview_type = 8;

    enum ResolverActivityIntent { // Intents handled by ResolverActivity.java
        INTENT_DEFAULT = 0;
        INTENT_ACTION_VIEW = 1;
        INTENT_ACTION_EDIT = 2;
        INTENT_ACTION_SEND = 3;
        INTENT_ACTION_SENDTO = 4;
        INTENT_ACTION_SEND_MULTIPLE = 5;
        INTENT_ACTION_IMAGE_CAPTURE = 6;
        INTENT_ACTION_MAIN = 7;
    }
    // The intent being processed (only SEND and SEND_MULTIPLE are system sharesheet)
    optional ResolverActivityIntent intent_type = 9;
}

/**
 * Reports a ranking selection event.
 *
 * Logged from:
 *   frameworks/base/core/java/com/android/internal/app/ChooserActivity.java (sharesheet)
 */
message RankingSelected {
    // The event_id (as for UiEventReported).
    optional int32 event_id = 1;
    // The relevant app's package name (can be source or picked package).
    optional string package_name = 2;
    // An identifier to tie together multiple logs relating to the same share event.
    optional int32 instance_id = 3;
    // Which of the ranked targets got picked, default starting position 0.
    optional int32 position_picked = 4;
}

/**
 * Logs when TvSettings UI is interacted at.
 *
 * Logged from: packages/apps/TvSettings
 */
message TvSettingsUIInteracted {

    /** The UI action category */
    optional android.app.tvsettings.Action action = 1;

    /** The ID of the entry that the users actioned on */
    optional android.app.tvsettings.ItemId item_id = 2;
}

/**
 * Logs information about a package installation using package installer V2 APIs.
 *
 * Logged from:
 *      frameworks/base/services/core/java/com/android/server/pm/PackageInstallerSession.java
 */
message PackageInstallerV2Reported {
    // Whether this installation uses Incremental File System
    optional bool is_incremental = 1;
    // Name of the package that is intended to be installed
    optional string package_name = 2;
    // The duration between when the install was requested to when the install has completed
    optional int64 duration_millis = 3;
    // Installation result in final integer, which are SystemApi's.
    // Return_code 1 indicates success.
    // For full list, see frameworks/base/core/java/android/content/pm/PackageManager.java
    optional int32 return_code  = 4;
    // Total size of the APKs installed for this package
    optional int64 apks_size_bytes = 5;
}

/**
 * Logs settings provider values.
 *
 * Use DeviceConfig.getProperties to get a list Setting key, query the data from content provider,
 * then write the value to proto.
 *
 */
message SettingSnapshot {

    // Setting key
    optional string name = 1;

    enum SettingsValueType {
        NOTASSIGNED = 0;
        ASSIGNED_BOOL_TYPE = 1;
        ASSIGNED_INT_TYPE = 2;
        ASSIGNED_FLOAT_TYPE = 3;
        ASSIGNED_STRING_TYPE = 4;
    };
    // Setting value type
    optional SettingsValueType type = 2;

    optional bool bool_value = 3;

    optional int32 int_value = 4;

    optional float float_value = 5;

    optional string str_value = 6;

    // Android user index. 0 for primary user, 10, 11 for secondary or profile user
    optional int32 user_id = 7;
}

/**
 * An event logged to indicate that a user journey is about to be performed. This atom includes
 * relevant information about the users involved in the journey. A UserLifecycleEventOccurred event
 * will immediately follow this atom which will describe the event(s) and its state.
 *
 * Logged from:
 *   frameworks/base/services/core/java/com/android/server/am/UserController.java
 *   frameworks/base/services/core/java/com/android/server/pm/UserManagerService.java
 */
message UserLifecycleJourneyReported {
    // An identifier to track a chain of user lifecycle events occurring (referenced in the
    // UserLifecycleEventOccurred atom)
    optional int64 session_id = 1;

    // Indicates what type of user journey this session is related to
    enum Journey {
        UNKNOWN = 0; // Undefined user lifecycle journey
        USER_SWITCH_UI = 1; // A user switch journey where a UI is shown
        USER_SWITCH_FG = 2; // A user switch journey without a UI shown
        USER_START = 3; // A user start journey
        USER_CREATE = 4; // A user creation journey
    }
    optional Journey journey = 2;
    // Which user the journey is originating from - could be -1 for certain phases (eg USER_CREATE)
    // This integer is a UserIdInt (eg 0 for the system user, 10 for secondary/guest)
    optional int32 origin_user = 3;
    // Which user the journey is targeting
    // This integer is a UserIdInt (eg 0 for the system user, 10 for secondary/guest)
    optional int32 target_user = 4;

    // What is the user type of the target user
    // These should be in sync with USER_TYPE_* flags defined in UserManager.java
    enum UserType {
        TYPE_UNKNOWN = 0;
        FULL_SYSTEM = 1;
        FULL_SECONDARY = 2;
        FULL_GUEST = 3;
        FULL_DEMO = 4;
        FULL_RESTRICTED = 5;
        PROFILE_MANAGED = 6;
        SYSTEM_HEADLESS = 7;
    }
    optional UserType user_type = 5;
    // What are the flags attached to the target user
    optional int32 user_flags = 6;
}

/**
 * An event logged when a specific user lifecycle event is performed. These events should be
 * correlated with a UserLifecycleJourneyReported atom via the session_id.
 * Note: journeys can span over multiple events, hence some events may share a single session id.
 *
 * Logged from:
 *   frameworks/base/services/core/java/com/android/server/am/UserController.java
 *   frameworks/base/services/core/java/com/android/server/pm/UserManagerService.java
 */
message UserLifecycleEventOccurred {
    // An id which links back to user details (reported in the UserLifecycleJourneyReported atom)
    optional int64 session_id = 1;
    // The target user for this event (same as target_user in the UserLifecycleJourneyReported atom)
    // This integer is a UserIdInt (eg 0 for the system user, 10 for secondary/guest)
    optional int32 user_id = 2;

    enum Event {
        UNKNOWN = 0; // Indicates that the associated user journey timed-out or resulted in an error
        SWITCH_USER = 1; // Indicates that this is a user switch event
        START_USER = 2; // Indicates that this is a user start event
        CREATE_USER = 3; // Indicates that this is a user create event
        USER_RUNNING_LOCKED = 4; // Indicates that user is running in locked state
        UNLOCKING_USER = 5; // Indicates that this is a user unlocking event
        UNLOCKED_USER = 6; // Indicates that this is a user unlocked event
    }
    optional Event event = 3;

    enum State {
        NONE = 0; // Indicates the associated event has no start/end defined
        BEGIN = 1;
        FINISH = 2;
    }
    optional State state = 4; // Represents the state of an event (beginning/ending)
}

/**
 * Logs when accessibility shortcut clicked.
 *
 * Logged from:
 *   frameworks/base/services/accessibility/java/com/android/server/accessibility
 */
message AccessibilityShortcutReported {
    // The accessibility feature(including installed a11y service, framework a11y feature,
    // and installed a11y activity) package name that is assigned to the accessibility shortcut.
    optional string package_name = 1;

    // The definition of the accessibility shortcut.
    // From frameworks/base/core/proto/android/stats/accessibility/accessibility_enums.proto.
    optional android.stats.accessibility.ShortcutType shortcut_type = 2;

    // The definition of the service status.
    // From frameworks/base/core/proto/android/stats/accessibility/accessibility_enums.proto.
    optional android.stats.accessibility.ServiceStatus service_status = 3;
}

/**
 * Logs when accessibility service status changed.
 *
 * Logged from:
 *   packages/apps/Settings/src/com/android/settings/accessibility
 */
message AccessibilityServiceReported {
    // The accessibility service package name.
    optional string package_name = 1;

    // The definition of the service status.
    // From frameworks/base/core/proto/android/stats/accessibility/accessibility_enums.proto.
    optional android.stats.accessibility.ServiceStatus service_status = 2;
}

/**
 * Logs when display wake up.
 *
 * Logged from:
 *   services/core/java/com/android/server/power/Notifier.java
 */

message DisplayWakeReported {
    // Wake_up_reason code
    // If LOWORD(wake_up_reason) = 0
    //     reference to HIWORD(wake_up_reason) PowerManager.WAKE_REASON_XXX
    //     else reference wake_up_reason to
    //     services/core/java/com/android/server/power/Notifier.java#onWakeUp
    optional int32 wake_up_reason = 1;
}

/**
 * Logs app usage events.
 */
message AppUsageEventOccurred {
    optional int32 uid = 1 [(is_uid) = true];
    optional string package_name = 2;
    optional string class_name = 3;

    enum EventType {
        NONE = 0;
        MOVE_TO_FOREGROUND = 1;
        MOVE_TO_BACKGROUND = 2;
    }
    optional EventType event_type = 4;
}

/*
 * Quality metrics logged when EVS cameras are active.
 *
 * Logged from:
 *  packages/services/Car/evs/manager/1.1/Enumerator.cpp
 */
message EvsUsageStatsReported {

    // Camera identifier to distinguish the source camera device.  This is not
    // globally unique and therefore cannot be used to identify the user and/or
    // the device.
    optional int32 device_id = 1;

    // Peak number of clients during the service
    optional int32 peak_num_clients = 2;

    // Number of erroneous events during the service
    optional int32 num_errors = 3;

    // Round trip latency of the very first frame
    optional int64 first_latency_millis = 4;

    // Average frame round trip latency
    optional float avg_latency_millis = 5;

    // Peak frame round trip latency
    optional int64 peak_latency_millis = 6;

    // Total number of frames received
    optional int64 total_frames = 7;

    // Number of frames ignored
    optional int64 ignored_frames = 8;

    // Number of dropped frames to synchronize camera devices
    optional int64 dropped_frames_to_sync = 9;

    // The duration of the service
    optional int64 duration_millis = 10;
}

/**
 * Logs audio power usage stats.
 *
 * Pushed from:
 *  frameworks/av/services/mediametrics/AudioPowerUsage.cpp
 */
message AudioPowerUsageDataReported {
    /**
     * Device used for input/output
     *
     * All audio devices please refer to below file:
     * system/media/audio/include/system/audio-base.h
     *
     * Define our own enum values because we don't report all audio devices.
     * Currently, we only report built-in audio devices such as handset, speaker,
     * built-in mics, common audio devices such as wired headset, usb headset
     * and bluetooth devices.
     */
    enum AudioDevice {
        OUTPUT_EARPIECE         = 0x1; // handset
        OUTPUT_SPEAKER          = 0x2; // dual speaker
        OUTPUT_WIRED_HEADSET    = 0x4; // 3.5mm headset
        OUTPUT_USB_HEADSET      = 0x8; // usb headset
        OUTPUT_BLUETOOTH_SCO    = 0x10; // bluetooth sco
        OUTPUT_BLUETOOTH_A2DP   = 0x20; // a2dp
        OUTPUT_SPEAKER_SAFE     = 0x40; // bottom speaker

        INPUT_DEVICE_BIT        = 0x40000000; // non-negative positive int32.
        INPUT_BUILTIN_MIC       = 0x40000001; // buildin mic
        INPUT_BUILTIN_BACK_MIC  = 0x40000002; // buildin back mic
        INPUT_WIRED_HEADSET_MIC = 0x40000004; // 3.5mm headset mic
        INPUT_USB_HEADSET_MIC   = 0x40000008; // usb headset mic
        INPUT_BLUETOOTH_SCO     = 0x40000010; // bluetooth sco mic
    }
    optional AudioDevice audio_device = 1;

    // Duration of the audio in seconds
    optional int32 duration_secs = 2;

    // Average volume (0 ... 1.0)
    optional float average_volume = 3;

    enum AudioType {
        UNKNOWN_TYPE = 0;
        VOICE_CALL_TYPE = 1; // voice call
        VOIP_CALL_TYPE = 2; // voip call, including uplink and downlink
        MEDIA_TYPE = 3; // music and system sound
        RINGTONE_NOTIFICATION_TYPE = 4; // ringtone and notification
        ALARM_TYPE = 5; // alarm type
        // record type
        CAMCORDER_TYPE = 6; // camcorder
        RECORD_TYPE = 7;  // other recording
    }
    optional AudioType type = 4;
}

/**
  * Pulls bytes transferred over WiFi and mobile networks sliced by uid, is_metered, and tag.
  *
  * Pulled from:
  *   StatsPullAtomService, which uses NetworkStatsService to query NetworkStats.
  */
message BytesTransferByTagAndMetered {
    optional int32 uid = 1 [(is_uid) = true];

    optional bool is_metered = 2;

    optional int32 tag = 3;

    optional int64 rx_bytes = 4;

    optional int64 rx_packets = 5;

    optional int64 tx_bytes = 6;

    optional int64 tx_packets = 7;
}

/*
 * Logs when the Media Output Switcher finishes a media switch operation.
 *
 * Logged from:
 *  packages/apps/Settings/src/com/android/settings/media/MediaOutputSliceWorker.java
 */
message MediaOutputOpSwitchReported {
    // Source medium type before switching.
    optional android.app.settings.mediaoutput.MediumType source = 1;

    // Target medium type after switching.
    optional android.app.settings.mediaoutput.MediumType target = 2;

    // The result of switching.
    optional android.app.settings.mediaoutput.SwitchResult result = 3;

    // The detail code of a switching result.
    optional android.app.settings.mediaoutput.SubResult subresult = 4;

    /*
     * The package name of a pre-installed app, whose media session is being switched.
     */
    optional string media_session_package_name = 5;

    // The amount of available wired devices when a switching is being performed.
    optional int32 available_wired_device_count = 6;

    // The amount of available Bluetooth devices a switching is being performed.
    optional int32 available_bt_device_count = 7;

    // The amount of available remote devices when a switching is being performed.
    optional int32 available_remote_device_count = 8;

    // The amount of applied devices within a remote dynamic group after a switching is done.
    optional int32 applied_device_count_within_remote_group = 9;
}

/**
 * Logs when the Assistant is invoked.
 *
 * Logged from:
 *   frameworks/base/packages/SystemUI/src/com/android/systemui/assist/AssistManager.java
 */
message AssistantInvocationReported {

    // The event_id (as for UiEventReported).
    optional int32 event_id = 1;

    // The registered Assistant's uid and package (as for UiEventReported).
    optional int32 uid = 2 [(is_uid) = true];
    optional string package_name = 3;

    // An identifier used to disambiguate which logs refer to a particular invocation of the
    // Assistant  (as for UiEventReported).
    optional int32 instance_id = 4;

    // The state of the device at the time of invocation.
    enum DeviceState {
        UNKNOWN_DEVICE_STATE = 0;
        AOD1 = 1;
        AOD2 = 2;
        BOUNCER = 3;
        UNLOCKED_LOCKSCREEN = 4;
        LAUNCHER_HOME = 5;
        LAUNCHER_OVERVIEW = 6;
        LAUNCHER_ALL_APPS = 7;
        APP_DEFAULT = 8;
        APP_IMMERSIVE = 9;
        APP_FULLSCREEN = 10;
    }
    optional DeviceState device_state = 5;

    // Whether the Assistant handles were showing at the time of invocation.
    optional bool assistant_handles_showing = 6;
}

/**
 * Logs when an AudioRecord finishes running on an audio device
 *
 * Logged from:
 *   frameworks/av/services/mediametrics/AudioAnalytics.cpp
 */
message MediametricsAudioRecordDeviceUsageReported {
    // The devices connected to this AudioRecord.
    // A string OR of various input device categories, e.g. "DEVICE1|DEVICE2".
    // See lookup<INPUT_DEVICE>() in frameworks/av/services/mediametrics/AudioTypes.cpp
    // See audio_device_t in system/media/audio/include/system/audio-base.h
    optional string devices = 1;

    // The name of the remote device attached to the device, typically available for USB or BT.
    // This may be empty for a fixed device, or separated by "|" if more than one.
    optional string device_names = 2;

    // The amount of time spent in the device as measured by the active track in AudioFlinger.
    optional int64 device_time_nanos = 3;

    // The audio data format used for encoding.
    // An enumeration from system/media/audio/include/system/audio-base.h audio_format_t
    optional string encoding = 4;

    // The client-server buffer framecount.
    // The framecount is generally between 960 - 48000 for PCM encoding.
    // The framecount represents raw buffer size in bytes for non-PCM encoding.
    optional int32 frame_count = 5;

    // The number of audio intervals (contiguous, continuous playbacks).
    optional int32 interval_count = 6;

    // The sample rate of the AudioRecord.
    // A number generally between 8000-96000 (frames per second).
    optional int32 sample_rate = 7;

    // The audio input flags used to construct the AudioRecord.
    // A string OR from system/media/audio/include/system/audio-base.h audio_input_flags_t
    optional string flags = 8;

    // The santized package name of the audio client associated with the AudioRecord.
    // See getSanitizedPackageNameAndVersionCode() in
    // frameworks/av/services/mediametrics/MediaMetricsService.cpp
    optional string package_name = 9;

    // The selected device id (nonzero if a non-default device is selected)
    optional int32 selected_device_id = 10;

    // The caller of the AudioRecord.
    // See lookup<CALLER_NAME>() in frameworks/av/services/mediametrics/AudioTypes.cpp
    optional string caller = 11;

    // The audio source for AudioRecord.
    // An enumeration from system/media/audio/include/system/audio-base.h audio_source_t
    optional string source = 12;
}

/**
 * Logs when an AudioThread finishes running on an audio device
 *
 * Logged from:
 *   frameworks/av/services/mediametrics/AudioAnalytics.cpp
 */
message MediametricsAudioThreadDeviceUsageReported {
    // The devices connected to this audio thread.
    // A string OR of various input device categories, e.g. "DEVICE1|DEVICE2".
    // (for record threads):
    // See lookup<INPUT_DEVICE> in frameworks/av/services/mediametrics/AudioTypes.cpp
    // (for playback threads):
    // See lookup<OUTPUT_DEVICE>() in frameworks/av/services/mediametrics/AudioTypes.cpp
    // See audio_device_t in system/media/audio/include/system/audio-base.h
    optional string devices = 1;

    // The name of the remote device attached to the device, typically available for USB or BT.
    // This may be empty for a fixed device, or separated by "|" if more than one.
    optional string device_names = 2;

    // The amount of time spent in the device as measured by the active track in AudioFlinger.
    optional int64 device_time_nanos = 3;

    // The audio data format used for encoding.
    // An enumeration from system/media/audio/include/system/audio-base.h audio_format_t
    optional string encoding = 4;

    // The framecount of the buffer delivered to (or from) the HAL.
    // The framecount is generally ~960 for PCM encoding.
    // The framecount represents raw buffer size in bytes for non-PCM encoding.
    optional int32 frame_count = 5;

    // The number of audio intervals (contiguous, continuous playbacks).
    optional int32 interval_count = 6;

    // The sample rate of the audio thread.
    // A number generally between 8000-96000 (frames per second).
    optional int32 sample_rate = 7;

    // The audio flags used to construct the thread
    // (for record threads):
    // A string OR from system/media/audio/include/system/audio-base.h audio_input_flags_t
    // (for playback threads):
    // A string OR from system/media/audio/include/system/audio-base.h audio_output_flags_t
    optional string flags = 8;

    // The number of underruns encountered for a playback thread or the
    // number of overruns encountered for a capture thread.
    optional int32 xruns = 9;

    // The type of thread
    // A thread type enumeration from
    // frameworks/av/mediametrics/services/Translate.h
    optional string type = 10;
}

/**
 * Logs when an AudioTrack finishes running on an audio device
 *
 * Logged from:
 *   frameworks/av/services/mediametrics/AudioAnalytics.cpp
 */
message MediametricsAudioTrackDeviceUsageReported {
    // The output devices connected to this AudioTrack.
    // A string OR of various output device categories, e.g. "DEVICE1|DEVICE2".
    // See lookup<OUTPUT_DEVICE>() in frameworks/av/services/mediametrics/AudioTypes.cpp
    // See audio_device_t in system/media/audio/include/system/audio-base.h
    optional string devices = 1;

    // The name of the remote device attached to the device, typically available for USB or BT.
    // This may be empty for a fixed device, or separated by "|" if more than one.
    optional string device_names = 2;

    // The amount of time spent in the device as measured by the active track in AudioFlinger.
    optional int64 device_time_nanos = 3;

    // The audio data format used for encoding.
    // An enumeration from system/media/audio/include/system/audio-base.h audio_format_t
    optional string encoding = 4;

    // The client-server buffer framecount.
    // The framecount is generally between 960 - 48000 for PCM encoding.
    // The framecount represents raw buffer size in bytes for non-PCM encoding.
    // A static track (see traits) may have a very large framecount.
    optional int32 frame_count = 5;

    // The number of audio intervals (contiguous, continuous playbacks).
    optional int32 interval_count = 6;

    // The sample rate of the AudioTrack.
    // A number generally between 8000-96000 (frames per second).
    optional int32 sample_rate = 7;

    // The audio flags used to construct the AudioTrack.
    // A string OR from system/media/audio/include/system/audio-base.h audio_output_flags_t
    optional string flags = 8;

    // The number of underruns encountered.
    optional int32 xruns = 9;

    // The santized package name of the audio client associated with the AudioTrack.
    // See getSanitizedPackageNameAndVersionCode() in
    // frameworks/av/services/mediametrics/MediaMetricsService.cpp
    optional string package_name = 10;

    // The latency of the last sample in the buffer in milliseconds.
    optional float device_latency_millis = 11;

    // The startup time in milliseconds from start() to sample played.
    optional float device_startup_millis = 12;

    // The average volume of the track on the device [ 0.f - 1.f ]
    optional float device_volume = 13;

    // The selected device id (nonzero if a non-default device is selected)
    optional int32 selected_device_id = 14;

    // The stream_type category for the AudioTrack.
    // An enumeration from system/media/audio/include/system/audio-base.h audio_stream_type_t
    optional string stream_type = 15;

    // The usage for the AudioTrack.
    // An enumeration from system/media/audio/include/system/audio-base.h audio_usage_t
    optional string usage = 16;

    // The content type of the AudioTrack.
    // An enumeration from system/media/audio/include/system/audio-base.h audio_content_type_t
    optional string content_type = 17;

    // The caller of the AudioTrack.
    // See lookup<CALLER_NAME>() in frameworks/av/services/mediametrics/AudioTypes.cpp
    optional string caller = 18;

    // The traits of the AudioTrack.
    // A string OR of different traits, may be empty string.
    // Only "static" is supported for R.
    // See lookup<TRACK_TRAITS>() in frameworks/av/services/mediametrics/AudioTypes.cpp
    optional string traits = 19;
}

/**
 * Logs the status of an audio device connection attempt.
 *
 * Logged from:
 *   frameworks/av/services/mediametrics/AudioAnalytics.cpp
 */
message MediametricsAudioDeviceConnectionReported {
    // The input devices represented by this report.
    // A string OR of various input device categories, e.g. "DEVICE1|DEVICE2".
    // See lookup<INPUT_DEVICE>() in frameworks/av/services/mediametrics/AudioTypes.cpp
    // See audio_device_t in system/media/audio/include/system/audio-base.h
    optional string input_devices = 1;

    // The output devices represented by this report.
    // A string OR of various output device categories.
    // See lookup<OUTPUT_DEVICE>() in frameworks/av/services/mediametrics/AudioTypes.cpp
    // See audio_device_t in system/media/audio/include/system/audio-base.h
    optional string output_devices = 2;

    // The name of the remote device attached to the device, typically available for USB or BT.
    // This may be empty for a fixed device, or separated by "|" if more than one.
    optional string device_names = 3;

    // The result of the audio device connection.
    // 0 indicates success: connection verified.
    // 1 indicates unknown: connection not verified or not known if diverted properly.
    // Other values indicate specific status.
    // See DeviceConnectionResult in frameworks/av/services/mediametrics/AudioTypes.h
    optional int32 result = 4;

    // Average milliseconds of time to connect
    optional float time_to_connect_millis = 5;

    // Number of connections if aggregated statistics, otherwise 1.
    optional int32 connection_count = 6;
}

/**
 * Logs: i) creation of different types of cryptographic keys in the keystore,
 * ii) operations performed using the keys,
 * iii) attestation of the keys
 * Logged from: system/security/keystore/key_event_log_handler.cpp
 */
message KeystoreKeyEventReported {

    enum Algorithm {
        /** Asymmetric algorithms. */
        RSA = 1;
        // 2 removed, do not reuse.
        EC = 3;
        /** Block cipher algorithms */
        AES = 32;
        TRIPLE_DES = 33;
        /** MAC algorithms */
        HMAC = 128;
    };
    /** Algorithm associated with the key */
    optional Algorithm algorithm = 1;

    /** Size of the key */
    optional int32 key_size = 2;

    enum KeyOrigin {
        /** Generated in keymaster.  Should not exist outside the TEE. */
        GENERATED = 0;
        /** Derived inside keymaster.  Likely exists off-device. */
        DERIVED = 1;
        /** Imported into keymaster.  Existed as cleartext in Android. */
        IMPORTED = 2;
        /** Keymaster did not record origin. */
        UNKNOWN = 3;
        /** Securely imported into Keymaster. */
        SECURELY_IMPORTED = 4;
    };
    /* Logs whether the key was generated, imported, securely imported, or derived.*/
    optional KeyOrigin key_origin = 3;

    enum HardwareAuthenticatorType {
        NONE = 0;
        PASSWORD = 1;
        FINGERPRINT = 2;
        // Additional entries must be powers of 2.
    };
    /**
     * What auth types does this key require? If none,
     * then no auth required.
     */
    optional HardwareAuthenticatorType user_auth_type = 4;

    /**
     * If user authentication is required, is the requirement time based? If it
     * is not time based then this field will not be used and the key is per
     * operation. Per operation keys must be user authenticated on each usage.
     */
    optional int32 user_auth_key_timeout_secs = 5;

    /**
     * padding mode, digest, block_mode and purpose should ideally be repeated
     * fields. However, since statsd does not support repeated fields in
     * pushed atoms, they are represented using bitmaps.
     */

    /** Track which padding mode is being used.*/
    optional int32 padding_mode_bitmap = 6;

    /** Track which digest is being used. */
    optional int32 digest_bitmap = 7;

    /** Track what block mode is being used (for encryption). */
    optional int32 block_mode_bitmap = 8;

    /** Track what purpose is this key serving. */
    optional int32 purpose_bitmap = 9;

    enum EcCurve {
        P_224 = 0;
        P_256 = 1;
        P_384 = 2;
        P_521 = 3;
    };
    /** Which ec curve was selected if elliptic curve cryptography is in use **/
    optional EcCurve ec_curve = 10;

    enum KeyBlobUsageRequirements {
        STANDALONE = 0;
        REQUIRES_FILE_SYSTEM = 1;
    };
    /** Standalone or is a file system required */
    optional KeyBlobUsageRequirements key_blob_usage_reqs = 11;

    enum Type {
        key_operation = 0;
        key_creation = 1;
        key_attestation = 2;
    }
    /** Key creation event, operation event or attestation event? */
    optional Type type = 12;

    /** Was the key creation, operation, or attestation successful? */
    optional bool was_successful = 13;

    /** Response code or error code */
    optional int32 error_code = 14;
}

// Blob Committer stats
// Keep in sync between:
//     frameworks/base/core/proto/android/server/blobstoremanagerservice.proto
//     frameworks/base/cmds/statsd/src/atoms.proto
message BlobCommitterProto {
    // Committer app's uid
    optional int32 uid = 1 [(is_uid) = true];

    // Unix epoch timestamp of the commit in milliseconds
    optional int64 commit_timestamp_millis = 2;

    // Flags of what access types the committer has set for the Blob
    optional int32 access_mode = 3;

    // Number of packages that have been whitelisted for ACCESS_TYPE_WHITELIST
    optional int32 num_whitelisted_package = 4;
}

// Blob Leasee stats
// Keep in sync between:
//     frameworks/base/core/proto/android/server/blobstoremanagerservice.proto
//     frameworks/base/cmds/statsd/src/atoms.proto
message BlobLeaseeProto {
    // Leasee app's uid
    optional int32 uid = 1 [(is_uid) = true];

    // Unix epoch timestamp for lease expiration in milliseconds
    optional int64 lease_expiry_timestamp_millis = 2;
}

// List of Blob Committers
// Keep in sync between:
//     frameworks/base/core/proto/android/server/blobstoremanagerservice.proto
//     frameworks/base/cmds/statsd/src/atoms.proto
message BlobCommitterListProto {
    repeated BlobCommitterProto committer = 1;
}

// List of Blob Leasees
// Keep in sync between:
//     frameworks/base/core/proto/android/server/blobstoremanagerservice.proto
//     frameworks/base/cmds/statsd/src/atoms.proto
message BlobLeaseeListProto {
    repeated BlobLeaseeProto leasee = 1;
}

/**
 * Logs the current state of a Blob committed with BlobStoreManager
 *
 * Pulled from:
 *  frameworks/base/apex/blobstore/service/java/com/android/server/blob/BlobStoreManagerService.java
 */
message BlobInfo {
    // Id of the Blob
    optional int64 blob_id = 1;

    // Size of the Blob data
    optional int64 size = 2;

    // Unix epoch timestamp of the Blob's expiration in milliseconds
    optional int64 expiry_timestamp_millis = 3;

    // List of committers of this Blob
    optional BlobCommitterListProto committers = 4;

    // List of leasees of this Blob
    optional BlobLeaseeListProto leasees = 5;
}