File: test.proto

package info (click to toggle)
android-platform-frameworks-base 1%3A10.0.0%2Br36-3
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 321,788 kB
  • sloc: java: 962,234; cpp: 274,314; xml: 242,770; python: 5,060; sh: 1,432; ansic: 494; makefile: 47; sed: 19
file content (236 lines) | stat: -rw-r--r-- 6,311 bytes parent folder | download | duplicates (2)
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
/*
 * 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";

import "frameworks/base/cmds/statsd/src/atoms.proto";
import "frameworks/base/cmds/statsd/src/atom_field_options.proto";

package android.stats_log_api_gen;

message IntAtom {
    optional int32 field1 = 1;
}

message AnotherIntAtom {
    optional int32 field1 = 1;
}

message OutOfOrderAtom {
    optional int32 field2 = 2;
    optional int32 field1 = 1;
}

enum AnEnum {
    VALUE0 = 0;
    VALUE1 = 1;
}

message AllTypesAtom {
  repeated android.os.statsd.AttributionNode attribution_chain = 1;
  optional double double_field = 2;
  optional float float_field = 3;
  optional int64 int64_field = 4;
  optional uint64 uint64_field = 5;
  optional int32 int32_field = 6;
  optional fixed64 fixed64_field = 7;
  optional fixed32 fixed32_field = 8;
  optional bool bool_field = 9;
  optional string string_field = 10;
  optional uint32 uint32_field = 11;
  optional AnEnum enum_field = 12;
  optional sfixed32 sfixed32_field = 13;
  optional sfixed64 sfixed64_field = 14;
  optional sint32 sint32_field = 15;
  optional sint64 sint64_field = 16;
}

message Event {
    oneof event {
        OutOfOrderAtom out_of_order_atom = 2;
        IntAtom int_atom = 1;
        AnotherIntAtom another_int_atom = 3;
        AllTypesAtom all_types_atom = 4;
    }
}

message BadTypesAtom {
    optional IntAtom bad_int_atom = 1;
    optional bytes bad_bytes = 2;
}

message BadTypesEvent {
    oneof event {
        BadTypesAtom bad_types_atom = 1;
    }
}

message BadSkippedFieldSingleAtom {
    optional int32 field2 = 2;
}

message BadSkippedFieldSingle {
    oneof event {
        BadSkippedFieldSingleAtom bad = 1;
    }
}

message BadSkippedFieldMultipleAtom {
    optional int32 field1 = 1;
    optional int32 field3 = 3;
    optional int32 field5 = 5;
}

message BadSkippedFieldMultiple {
    oneof event {
        BadSkippedFieldMultipleAtom bad = 1;
    }
}

message BadAttributionNodePositionAtom {
  optional int32 field1 = 1;
  repeated android.os.statsd.AttributionNode attribution = 2;
}

message BadAttributionNodePosition {
  oneof event { BadAttributionNodePositionAtom bad = 1; }
}

message GoodEventWithBinaryFieldAtom {
    oneof event { GoodBinaryFieldAtom field1 = 1; }
}

message ComplexField {
    optional string str = 1;
}

message GoodBinaryFieldAtom {
    optional int32 field1 = 1;
    optional ComplexField bf = 2 [(android.os.statsd.log_mode) = MODE_BYTES];
}

message BadEventWithBinaryFieldAtom {
    oneof event { BadBinaryFieldAtom field1 = 1; }
}

message BadBinaryFieldAtom {
    optional int32 field1 = 1;
    optional ComplexField bf = 2;
}

message BadStateAtoms {
    oneof event {
        BadStateAtom1 bad1 = 1;
        BadStateAtom2 bad2 = 2;
        BadStateAtom3 bad3 = 3;
    }
}

message GoodStateAtoms {
    oneof event {
        GoodStateAtom1 good1 = 1;
        GoodStateAtom2 good2 = 2;
    }
}

// The atom has only primary field but no exclusive state field.
message BadStateAtom1 {
    optional int32 uid = 1
            [(android.os.statsd.state_field_option).option = PRIMARY];
}

// Only primative types can be annotated.
message BadStateAtom2 {
    repeated android.os.statsd.AttributionNode attribution = 1
            [(android.os.statsd.state_field_option).option = PRIMARY];
    optional int32 state = 2
            [(android.os.statsd.state_field_option).option = EXCLUSIVE];
}

// Having 2 exclusive state field in the atom means the atom is badly designed.
// E.g., putting bluetooth state and wifi state in the same atom.
message BadStateAtom3 {
    optional int32 uid = 1
            [(android.os.statsd.state_field_option).option = PRIMARY];
    optional int32 state = 2
            [(android.os.statsd.state_field_option).option = EXCLUSIVE];
    optional int32 state2 = 3
            [(android.os.statsd.state_field_option).option = EXCLUSIVE];
}

message GoodStateAtom1 {
    optional int32 uid = 1
            [(android.os.statsd.state_field_option).option = PRIMARY];
    optional int32 state = 2
            [(android.os.statsd.state_field_option).option = EXCLUSIVE];
}

// Atoms can have exclusive state field, but no primary field. That means
// the state is globally exclusive (e.g., DisplayState).
message GoodStateAtom2 {
    optional int32 uid = 1;
    optional int32 state = 2
            [(android.os.statsd.state_field_option).option = EXCLUSIVE];
}

// We can have more than one primary fields. That means their combination is a
// primary key.
message GoodStateAtom3 {
    optional int32 uid = 1
            [(android.os.statsd.state_field_option).option = PRIMARY];
    optional int32 tid = 2
            [(android.os.statsd.state_field_option).option = PRIMARY];
    optional int32 state = 3
            [(android.os.statsd.state_field_option).option = EXCLUSIVE];
}

message WhitelistedAtom {
  optional int32 field = 1;
}

message NonWhitelistedAtom {
  optional int32 field = 1;
}

message ListedAtoms {
  oneof event {
    // Atoms can be whitelisted i.e. they can be triggered by any source
    WhitelistedAtom whitelisted_atom = 1 [(android.os.statsd.allow_from_any_uid) = true];
    // Atoms are not whitelisted by default, so they can only be triggered
    // by whitelisted sources
    NonWhitelistedAtom non_whitelisted_atom = 2;
  }
}

message ModuleOneAtom {
    optional int32 field = 1;
}

message ModuleTwoAtom {
    optional int32 field = 1;
}

message NoModuleAtom {
    optional string field = 1;
}

message ModuleAtoms {
    oneof event {
        ModuleOneAtom module_one_atom = 1 [(android.os.statsd.log_from_module) = "module1"];
        ModuleTwoAtom module_two_atom = 2 [(android.os.statsd.log_from_module) = "module2"];
        NoModuleAtom no_module_atom = 3;
    }
}