1/*
2 * Copyright (C) 2022 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 *      http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17syntax = "proto2";
18
19import "frameworks/proto_logging/stats/atom_field_options.proto";
20
21package android.stats_log_api_gen;
22
23message Atom {
24    oneof pushed {
25        VendorAtom1 vendorAtom1 = 105501 [(android.os.statsd.module) = "test"];
26        VendorAtom2 vendorAtom2 = 105502 [(android.os.statsd.module) = "test"];
27        VendorAtom3 vendorAtom3 = 105503 [(android.os.statsd.module) = "test"];
28        VendorAtom4 vendorAtom4 = 105504 [(android.os.statsd.module) = "test"];
29        VendorAtom5 vendorAtom5 = 105505 [(android.os.statsd.module) = "test"];
30        VendorAtom6 vendorAtom6 = 105513 [(android.os.statsd.module) = "test"];
31        VendorAtom5WithAnnotation vendorAtom5WithAnnotation = 105514 [
32            (android.os.statsd.module) = "test"
33        ];
34        VendorAtom5WithState vendorAtom5WithState = 105515 [(android.os.statsd.module) = "test"];
35        VendorAtomWithState stateAtom1 = 105506 [(android.os.statsd.module) = "test"];
36        VendorAtomWithState2 stateAtom2 = 105507 [(android.os.statsd.module) = "test"];
37        VendorAtomWithState3 stateAtom3 = 105508 [(android.os.statsd.module) = "test"];
38        VendorAtomWithState4 stateAtom4 = 105509 [(android.os.statsd.module) = "test"];
39        VendorAtomWithTruncateTimestamp truncateTimestampAtom1 = 105510 [
40            (android.os.statsd.module) = "test",
41            (android.os.statsd.truncate_timestamp) = true
42        ];
43        VendorAtomWithTruncateTimestamp2 truncateTimestampAtom2 = 105511 [
44            (android.os.statsd.module) = "test",
45            (android.os.statsd.truncate_timestamp) = true
46        ];
47        VendorAtomWithTruncateTimestamp3 truncateTimestampAtom3 = 105512 [
48            (android.os.statsd.module) = "test",
49            (android.os.statsd.truncate_timestamp) = true
50        ];
51    }
52}
53
54message VendorAtom1 {
55    enum EnumType {
56        TYPE_UNKNOWN = 0;
57        TYPE_1 = 1;
58        TYPE_2 = 2;
59        TYPE_3 = 3;
60    }
61
62    enum EnumType2 {
63        ANOTHER_TYPE_UNKNOWN = 0;
64        ANOTHER_TYPE_1 = 1;
65        ANOTHER_TYPE_2 = 2;
66        ANOTHER_TYPE_3 = 3;
67    }
68
69    optional string reverse_domain_name = 1;
70    optional EnumType enumField1 = 2;
71    optional EnumType enumField2 = 3;
72    optional int32 int_value32 = 4;
73    optional int64 int_value64 = 5;
74    optional float float_value = 6;
75    optional bool bool_value = 7;
76    optional EnumType2 enumField3 = 8;
77    optional EnumType2 enumField4 = 9;
78}
79
80message VendorAtom2 {
81    enum EnumType {
82        TYPE_UNKNOWN = 0;
83        TYPE_1 = 1;
84        TYPE_2 = 2;
85        TYPE_3 = 3;
86    }
87
88    enum EnumType2 {
89        ANOTHER_TYPE_UNKNOWN = 0;
90        ANOTHER_TYPE_1 = 1;
91        ANOTHER_TYPE_2 = 2;
92        ANOTHER_TYPE_3 = 3;
93    }
94
95    optional string reverse_domain_name = 1;
96    optional int32 intField = 2;
97    optional EnumType enumField1 = 3;
98    optional EnumType enumField2 = 4;
99    optional EnumType2 enumField3 = 5;
100    optional EnumType2 enumField4 = 6;
101}
102
103message VendorAtom3 {
104    optional string reverse_domain_name = 1;
105    optional int32 int_field = 2;
106}
107
108message VendorAtom4 {
109    enum EnumType4 {
110        TYPE_UNKNOWN = 0;
111        TYPE_1 = 1;
112    }
113
114    optional string reverse_domain_name = 1;
115    optional float float_field = 2;
116    optional int32 int_field = 3;
117    optional int64 long_field = 4;
118    optional bool bool_field = 5;
119    optional EnumType4 type4 = 6;
120
121    repeated bool bool_repeated = 7;
122    repeated float float_repeated = 8;
123    repeated int32 int_repeated = 9;
124    repeated int64 long_repeated = 10;
125    repeated string string_repeated = 11;
126    repeated EnumType4 enum_repeated = 12;
127}
128
129message TestNestedMessage {
130    optional float float_field = 1;
131    optional int32 int_field = 2;
132    optional int64 long_field = 3;
133}
134
135message VendorAtom5 {
136    optional string reverse_domain_name = 1;
137    optional float float_field = 2;
138    optional int32 int_field = 3;
139    optional int64 long_field = 4;
140    optional TestNestedMessage nested_message_field = 5 [(android.os.statsd.log_mode) = MODE_BYTES];
141}
142
143message VendorAtom5WithAnnotation {
144    optional string reverse_domain_name = 1;
145    optional float float_field = 2;
146    optional int32 int_field = 3 [(android.os.statsd.state_field_option).primary_field = true];
147    optional int64 long_field = 4 [(android.os.statsd.state_field_option).exclusive_state = true];
148    optional TestNestedMessage nested_message_field = 5 [(android.os.statsd.log_mode) = MODE_BYTES];
149}
150
151enum TestState {
152    TEST_STATE_UNKNOWN = 0;
153    TEST_STATE_1 = 1;
154    TEST_STATE_2 = 2;
155    TEST_STATE_3 = 3;
156}
157
158message VendorAtom5WithState {
159    optional string reverse_domain_name = 1;
160    optional float float_field = 2;
161    optional TestState state_field = 3 [(android.os.statsd.state_field_option).exclusive_state = true];
162    optional int64 long_field = 4 [(android.os.statsd.state_field_option).primary_field = true];
163    optional TestNestedMessage nested_message_field = 5 [(android.os.statsd.log_mode) = MODE_BYTES];
164}
165
166message VendorAtom6 {
167    optional string reverse_domain_name = 1;
168    optional TestState state_field = 2;
169}
170
171message VendorAtomWithState {
172    optional string reverse_domain_name = 1;
173    optional int32 uid = 2 [(android.os.statsd.state_field_option).primary_field = true];
174    optional TestState state = 3 [(android.os.statsd.state_field_option).exclusive_state = true];
175}
176
177message VendorAtomWithState2 {
178    optional string reverse_domain_name = 1;
179    optional int32 uid = 2 [(android.os.statsd.state_field_option).primary_field = true];
180    optional int32 pid = 3 [(android.os.statsd.state_field_option).primary_field = true];
181    optional TestState state = 4 [(android.os.statsd.state_field_option).exclusive_state = true];
182}
183
184message VendorAtomWithState3 {
185    optional string reverse_domain_name = 1;
186    optional TestState state = 2 [(android.os.statsd.state_field_option).exclusive_state = true];
187}
188
189message VendorAtomWithState4 {
190    optional string reverse_domain_name = 1;
191
192    enum State {
193        OFF = 0;
194        ON = 1;
195        RESET = 2;
196    }
197
198    optional State state = 2 [
199        (android.os.statsd.state_field_option).exclusive_state = true,
200        (android.os.statsd.state_field_option).default_state_value = 0 /* State.OFF */,
201        (android.os.statsd.state_field_option).trigger_state_reset_value = 2 /* State.RESET */,
202        (android.os.statsd.state_field_option).nested = true
203    ];
204
205    optional bool some_flag = 3 [(android.os.statsd.state_field_option).primary_field = true];
206}
207
208message VendorAtomWithTruncateTimestamp {
209    optional string reverse_domain_name = 1;
210    optional TestState state = 2;
211}
212
213message VendorAtomWithTruncateTimestamp2 {
214    optional string reverse_domain_name = 1;
215    optional TestState state = 2;
216}
217
218message VendorAtomWithTruncateTimestamp3 {
219    optional string reverse_domain_name = 1;
220    optional int32 int_value = 2;
221}
222