1/*
2 * Copyright (C) 2023 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 optional 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 */
16syntax = "proto2";
17
18package android.os.statsd.wear.prototiles;
19
20import "frameworks/proto_logging/stats/atom_field_options.proto";
21import "frameworks/proto_logging/stats/atoms.proto";
22
23option java_package = "com.android.os.wear.prototiles";
24option java_multiple_files = true;
25
26extend Atom {
27  optional RendererInitialized renderer_initialized = 736
28  [(module) = "prototiles"];
29  optional SchemaVersionReceived schema_version_received = 737
30  [(module) = "prototiles"];
31  optional LayoutInspected layout_inspected = 741
32  [(module) = "prototiles"];
33  optional LayoutExpressionsInspected layout_expression_inspected = 742
34  [(module) = "prototiles"];
35  optional LayoutAnimationsInspected layout_animations_inspected = 743
36  [(module) = "prototiles"];
37  optional MaterialComponentsInspected material_components_inspected = 744
38  [(module) = "prototiles"];
39  optional TileRequested tile_requested = 745
40  [(module) = "prototiles"];
41  optional StateResponseReceived state_response_received = 746
42  [(module) = "prototiles"];
43  optional TileResponseReceived tile_response_received = 747
44  [(module) = "prototiles"];
45  optional InflationFinished inflation_finished = 748
46  [(module) = "prototiles"];
47  optional InflationFailed inflation_failed = 749
48  [(module) = "prototiles"];
49  optional IgnoredInflationFailuresReported ignored_inflation_failures_reported = 750
50  [(module) = "prototiles"];
51  optional DrawableRendered drawable_rendered = 751
52  [(module) = "prototiles"];
53
54}
55
56/**
57 * This atom captures the initialization duration and the renderer version when
58 * the renderer finish initializing.
59 */
60message RendererInitialized {
61  // Renderer initializing duration.
62  optional int32 renderer_initialization_duration_millis = 1;
63  // Version of the renderer installed in the device.
64  optional int64 version_code = 2;
65}
66
67/**
68 * This atom captures the tile schema version when the tile get rendered for the
69 * first time.
70 */
71message SchemaVersionReceived {
72  optional int32 package_uid = 1 [(is_uid) = true];
73  // Layout schema version used by the tile.
74  optional int32 tile_schema_version_major = 2;
75  optional int32 tile_schema_version_minor = 3;
76}
77
78/**
79 * This atom captures the structure of the inspected layout. We do inspect every
80 * layout before it starts rendering.
81 */
82message LayoutInspected {
83  enum LayoutDepthBucket {
84    LAYOUT_DEPTH_BUCKET_UNSPECIFIED = 0;
85    LAYOUT_DEPTH_BUCKET_UNDER_FIVE_NODES = 1;
86    LAYOUT_DEPTH_BUCKET_FIVE_TO_TEN_NODES = 2;
87    LAYOUT_DEPTH_BUCKET_TEN_TO_TWENTY_FIVE_NODES = 3;
88    LAYOUT_DEPTH_BUCKET_TWENTY_FIVE_TO_FIFTY_NODES = 4;
89    LAYOUT_DEPTH_BUCKET_OVER_FIFTY_NODES = 5;
90  }
91  enum LayoutElementCountBucket {
92    LAYOUT_ELEMENT_COUNT_BUCKET_UNSPECIFIED = 0;
93    LAYOUT_ELEMENT_COUNT_BUCKET_UNDER_TEN_ELEMENTS = 1;
94    LAYOUT_ELEMENT_COUNT_BUCKET_TEN_TO_TWENTY_FIVE_ELEMENTS = 2;
95    LAYOUT_ELEMENT_COUNT_BUCKET_TWENTY_FIVE_TO_FIFTY_ELEMENTS = 3;
96    LAYOUT_ELEMENT_COUNT_BUCKET_FIFTY_TO_HUNDRED_ELEMENTS = 4;
97    LAYOUT_ELEMENT_COUNT_BUCKET_OVER_HUNDRED_ELEMENTS = 5;
98  }
99  enum LayoutBinarySizeBucket {
100    LAYOUT_BINARY_SIZE_BUCKET_UNSPECIFIED = 0;
101    LAYOUT_BINARY_SIZE_BUCKET_UNDER_ONE_KIB = 1;
102    LAYOUT_BINARY_SIZE_BUCKET_ONE_TO_TEN_KIB = 2;
103    LAYOUT_BINARY_SIZE_BUCKET_TEN_TO_TWENTY_FIVE_KIB = 3;
104    LAYOUT_BINARY_SIZE_BUCKET_TWENTY_FIVE_TO_FIFTY_KIB = 4;
105    LAYOUT_BINARY_SIZE_BUCKET_FIFTY_TO_HUNDRED_KIB = 5;
106    LAYOUT_BINARY_SIZE_BUCKET_OVER_HUNDRED_KIB = 6;
107  }
108
109  optional int32 package_uid = 1 [(is_uid) = true];
110  optional int32 classname_hash = 2;
111  // The depth of the inspected layout.
112  optional LayoutDepthBucket layout_depth_bucket = 3;
113  // The node count fo the inspected layout.
114  optional LayoutElementCountBucket layout_element_count_bucket = 4;
115  // The binary size of the inspected layout.
116  optional LayoutBinarySizeBucket layout_size_bucket = 5;
117}
118
119/**
120 * This atom captures the structure of nodes in the inspected layout. We do
121 * inspect every expression when inspecting the layout.
122 */
123message LayoutExpressionsInspected {
124  enum TotalExpressionNodeCountBucket {
125    TOTAL_EXPRESSION_NODE_COUNT_BUCKET_UNSPECIFIED = 0;
126    TOTAL_EXPRESSION_NODE_COUNT_BUCKET_UNDER_TEN_NODES = 1;
127    TOTAL_EXPRESSION_NODE_COUNT_BUCKET_TEN_TO_TWENTY_FIVE_NODES = 2;
128    TOTAL_EXPRESSION_NODE_COUNT_BUCKET_TWENTY_FIVE_TO_FIFTY_NODES = 3;
129    TOTAL_EXPRESSION_NODE_COUNT_BUCKET_OVER_FIFTY_NODES = 4;
130  }
131  enum MaxNodesCountPerExpressionBucket {
132    MAX_NODES_COUNT_PER_EXPRESSION_BUCKET_UNSPECIFIED = 0;
133    MAX_NODES_COUNT_PER_EXPRESSION_BUCKET_UNDER_FIVE_NODES = 1;
134    MAX_NODES_COUNT_PER_EXPRESSION_BUCKET_FIVE_TO_TEN_NODES = 2;
135    MAX_NODES_COUNT_PER_EXPRESSION_BUCKET_TEN_TO_TWENTY_FIVE_NODES = 3;
136    MAX_NODES_COUNT_PER_EXPRESSION_BUCKET_OVER_TWENTY_FIVE_NODES = 5;
137  }
138  enum MaxNodesDepthPerExpressionBucket {
139    MAX_NODES_DEPTH_PER_EXPRESSION_BUCKET_UNSPECIFIED = 0;
140    MAX_NODES_DEPTH_PER_EXPRESSION_BUCKET_UNDER_FIVE_NODES = 1;
141    MAX_NODES_DEPTH_PER_EXPRESSION_BUCKET_FIVE_TO_TEN_NODES = 2;
142    MAX_NODES_DEPTH_PER_EXPRESSION_BUCKET_TEN_TO_TWENTY_FIVE_NODES = 3;
143    MAX_NODES_DEPTH_PER_EXPRESSION_BUCKET_OVER_TWENTY_FIVE_NODES = 5;
144  }
145
146  optional int32 package_uid = 1 [(is_uid) = true];
147  optional int32 classname_hash = 2;
148  // Count of expression nodes in the inspected layout.
149  optional TotalExpressionNodeCountBucket total_expression_node_count_bucket =
150    3;
151  // Maximum count of nodes among all expression in inspected layout.
152  optional MaxNodesCountPerExpressionBucket
153    max_nodes_count_per_expression_bucket = 4;
154  // Maximum expression depth among all expression in inspected layout.
155  optional MaxNodesDepthPerExpressionBucket
156    max_nodes_depth_per_expression_bucket = 5;
157  // Platform data sources used in the inspected expressions (Bitset instead of repeated enum).
158  optional int32 platform_data_source = 6;
159}
160
161/**
162 * This atom captures the animation objects structure in the inspected layout.
163 * We do inspect every animation when inspecting the layout.
164 */
165message LayoutAnimationsInspected {
166
167  enum MaxAnimationDurationBucket {
168    MAX_ANIMATION_DURATION_BUCKET_UNSPECIFIED = 0;
169    MAX_ANIMATION_DURATION_BUCKET_UNDER_ONE_HUNDRED_MS = 1;
170    MAX_ANIMATION_DURATION_BUCKET_ONE_HUNDRED_MS_TO_FIVE_HUNDRED_MS = 2;
171    MAX_ANIMATION_DURATION_BUCKET_FIVE_HUNDRED_MS_TO_ONE_S = 3;
172    MAX_ANIMATION_DURATION_BUCKET_ONE_S_TO_FIVE_S = 4;
173    MAX_ANIMATION_DURATION_BUCKET_OVER_FIVE_S = 5;
174  }
175
176  enum AnimationCountBucket {
177    ANIMATION_COUNT_BUCKET_UNSPECIFIED = 0;
178    ANIMATION_COUNT_BUCKET_ZERO = 1;
179    ANIMATION_COUNT_BUCKET_ONE_TO_THREE = 2; // [1:3[
180    ANIMATION_COUNT_BUCKET_THREE_TO_FIVE = 3; // [3:5[
181    ANIMATION_COUNT_BUCKET_FIVE_TO_TEN = 4; // [5:10[
182    ANIMATION_COUNT_BUCKET_OVER_TEN = 5;
183  }
184
185  optional int32 package_uid = 1 [(is_uid) = true];
186  optional int32 classname_hash = 2;
187  // Count of animations in the inspected layout.
188  optional AnimationCountBucket animation_count_bucket = 3;
189  // The maximum duration of an animation in the inspected layout.
190  optional MaxAnimationDurationBucket max_animation_duration_bucket = 4;
191  // Animation types that are used in the inspected layout (Bitset instead of repeated enum).
192  optional int32 animation_type = 5;
193  // Whether the layout has a continues animation.
194  optional bool has_continuous_animation = 6;
195}
196
197/**
198 * This atom captures the material components structure in the inspected layout.
199 * We do inspect every material component when inspecting the layout.
200 */
201message MaterialComponentsInspected {
202
203  enum MaterialComponentCountBucket {
204    MATERIAL_COMPONENT_COUNT_BUCKET_UNSPECIFIED = 0;
205    MATERIAL_COMPONENT_COUNT_BUCKET_ZERO = 1;
206    MATERIAL_COMPONENT_COUNT_BUCKET_ONE_TO_FIVE = 2; // [1:5[
207    MATERIAL_COMPONENT_COUNT_BUCKET_FIVE_TO_TEN = 3; // [5:10[
208    MATERIAL_COMPONENT_COUNT_BUCKET_OVER_TEN = 4;
209  }
210
211  optional int32 package_uid = 1 [(is_uid) = true];
212  optional int32 classname_hash = 2;
213  // Number of material components used in the layout.
214  optional MaterialComponentCountBucket material_component_count_bucket = 3;
215  // Material component types used in the layout (Bitset instead of repeated enum).
216  optional int32 material_component_type = 4;
217}
218
219/**
220 * This atom captures the tile requests.
221 */
222message TileRequested {
223  optional int32 package_uid = 1 [(is_uid) = true];
224  optional int32 classname_hash = 2;
225  // The reason of firing a tile request.
226  optional int32 count_of_freshness_based_request = 3;
227  optional int32 count_of_user_interaction_based_request = 4;
228  optional int32 count_of_visibility_change_based_request = 5;
229}
230
231/**
232 * This atom captures the received State response.
233 */
234message StateResponseReceived {
235  enum StateEntriesCountBucket {
236    STATE_ENTRIES_COUNT_BUCKET_UNSPECIFIED = 0;
237    STATE_ENTRIES_COUNT_BUCKET_UNDER_TEN_ENTRIES = 1;
238    STATE_ENTRIES_COUNT_BUCKET_TEN_TO_TWENTY_FIVE_ENTRIES = 2;
239    STATE_ENTRIES_COUNT_BUCKET_TWENTY_FIVE_TO_FIFTY_ENTRIES = 3;
240    STATE_ENTRIES_COUNT_BUCKET_FIFTY_TO_HUNDRED_ENTRIES = 4;
241    STATE_ENTRIES_COUNT_BUCKET_OVER_HUNDRED_ENTRIES = 5;
242  }
243  enum StateBinarySizeBucket {
244    STATE_BINARY_SIZE_BUCKET_UNSPECIFIED = 0;
245    STATE_BINARY_SIZE_BUCKET_UNDER_ONE_KIB = 1;
246    STATE_BINARY_SIZE_BUCKET_ONE_TO_TEN_KIB = 2;
247    STATE_BINARY_SIZE_BUCKET_TEN_TO_TWENTY_FIVE_KIB = 3;
248    STATE_BINARY_SIZE_BUCKET_TWENTY_FIVE_TO_FIFTY_KIB = 4;
249    STATE_BINARY_SIZE_BUCKET_FIFTY_TO_HUNDRED_KIB = 5;
250    STATE_BINARY_SIZE_BUCKET_OVER_HUNDRED_KIB = 6;
251  }
252  optional int32 package_uid = 1 [(is_uid) = true];
253  optional int32 classname_hash = 2;
254  // Whether it is an initial state
255  optional bool is_initial_state = 3;
256  // Count of state entries.
257  optional StateEntriesCountBucket state_entries_count_bucket = 4;
258  // Binary size of the state object.
259  optional StateBinarySizeBucket state_binary_size_bucket = 5;
260}
261
262/**
263 * This atom captures the structure of the received tile response.
264 */
265message TileResponseReceived {
266  enum TimeLineEntriesCountBucket {
267    TIMELINE_ENTRIES_COUNT_BUCKET_UNSPECIFIED = 0;
268    TIMELINE_ENTRIES_COUNT_BUCKET_ONE_ENTRY = 1;
269    TIMELINE_ENTRIES_COUNT_BUCKET_TWO_TO_FIVE_ENTRIES = 2;
270    TIMELINE_ENTRIES_COUNT_BUCKET_FIVE_TO_TEN_ENTRIES = 3;
271    TIMELINE_ENTRIES_COUNT_BUCKET_TEN_TO_TWENTY_FIVE_ENTRIES = 4;
272    TIMELINE_ENTRIES_COUNT_BUCKET_TWENTY_FIVE_TO_FIFTY_ENTRIES = 5;
273    TIMELINE_ENTRIES_COUNT_BUCKET_FIFTY_TO_HUNDRED_ENTRIES = 6;
274    TIMELINE_ENTRIES_COUNT_BUCKET_OVER_HUNDRED_ENTRIES = 7;
275  }
276  enum AvgTimelineEntryDurationBucket {
277    TIMELINE_DURATION_BUCKET_UNSPECIFIED = 0;
278    TIMELINE_DURATION_BUCKET_UNDER_ONE_S = 1;
279    TIMELINE_DURATION_BUCKET_ONE_S_TO_TEN_S = 2;
280    TIMELINE_DURATION_BUCKET_TEN_S_TO_TWENTY_S = 3;
281    TIMELINE_DURATION_BUCKET_TWENTY_S_TO_FORTY_S = 4;
282    TIMELINE_DURATION_BUCKET_FORTY_S_TO_ONE_M = 5;
283    TIMELINE_DURATION_BUCKET_ONE_M_TO_TEN_M = 6;
284    TIMELINE_DURATION_BUCKET_TEN_M_TO_THIRTY_M = 7;
285    TIMELINE_DURATION_BUCKET_THIRTY_M_TO_ONE_H = 8;
286    TIMELINE_DURATION_BUCKET_ONE_H_TO_THREE_H = 9;
287    TIMELINE_DURATION_BUCKET_OVER_THREE_H = 10;
288  }
289  enum FreshnessBucket {
290    FRESHNESS_BUCKET_UNSPECIFIED = 0;
291    FRESHNESS_BUCKET_UNDER_ONE_S = 1;
292    FRESHNESS_BUCKET_ONE_S_TO_TEN_S = 2;
293    FRESHNESS_BUCKET_TEN_S_TO_TWENTY_S = 3;
294    FRESHNESS_BUCKET_TWENTY_S_TO_FORTY_S = 4;
295    FRESHNESS_BUCKET_FORTY_S_TO_ONE_M = 5;
296    FRESHNESS_BUCKET_ONE_M_TO_TEN_M = 6;
297    FRESHNESS_BUCKET_TEN_M_TO_THIRTY_M = 7;
298    FRESHNESS_BUCKET_THIRTY_M_TO_ONE_H = 8;
299    FRESHNESS_BUCKET_ONE_H_TO_THREE_H = 9;
300    FRESHNESS_BUCKET_OVER_THREE_H = 10;
301  }
302  optional int32 package_uid = 1 [(is_uid) = true];
303  optional int32 classname_hash = 2;
304
305  optional TimeLineEntriesCountBucket timeline_entries_count_bucket = 3;
306  // The avg duration of timelines in this tile response.
307  optional AvgTimelineEntryDurationBucket avg_timeline_entry_duration_bucket = 4;
308  // The freshness value for the tile.
309  optional FreshnessBucket freshness_bucket = 5;
310  // Whether the resource version changed.
311  optional bool resource_version_changed = 6;
312}
313
314/**
315 * This atom captures the result of layout inflation.
316 */
317message InflationFinished {// Layout
318  enum InflationDurationBucket {
319    INFLATION_DURATION_BUCKET_UNSPECIFIED = 0;
320    INFLATION_DURATION_BUCKET_UNDER_ONE_MS = 1;
321    INFLATION_DURATION_BUCKET_ONE_MS_TO_TEN_MS = 2;
322    INFLATION_DURATION_BUCKET_TEN_MS_TO_FIFTY_MS = 3;
323    INFLATION_DURATION_BUCKET_FIFTY_MS_TO_HUNDRED_MS = 4;
324    INFLATION_DURATION_BUCKET_HUNDRED_MS_TO_THREE_HUNDRED_MS = 5;
325    INFLATION_DURATION_BUCKET_THREE_HUNDRED_MS_TO_SIX_HUNDRED_MS = 6;
326    INFLATION_DURATION_BUCKET_SIX_HUNDRED_MS_TO_ONE_S = 7;
327    INFLATION_DURATION_BUCKET_OVER_ONE_S = 10;
328  }
329  enum NodeInfoCountBucket {
330    NODE_INFO_COUNT_BUCKET_UNSPECIFIED = 0;
331    NODE_INFO_COUNT_BUCKET_UNDER_FIVE_NODES = 1;
332    NODE_INFO_COUNT_BUCKET_FIVE_TO_TEN_NODES = 2;
333    NODE_INFO_COUNT_BUCKET_TEN_TO_TWENTY_FIVE_NODES = 3;
334    NODE_INFO_COUNT_BUCKET_TWENTY_FIVE_TO_FIFTY_NODES = 4;
335    NODE_INFO_COUNT_BUCKET_OVER_FIFTY_NODES = 5;
336  }
337  optional int32 package_uid = 1 [(is_uid) = true];
338  optional int32 classname_hash = 2;
339  // Inflation duration.
340  optional InflationDurationBucket inflation_duration_bucket = 3;
341  // Changed NodeInfo objects count. NodeInfo is the entity representing the
342  // rendered view.
343  optional NodeInfoCountBucket changed_nodes_count_bucket = 4;
344  // Total count of NodeInfo objects.
345  optional NodeInfoCountBucket total_node_count_bucket = 5;
346}
347
348/**
349 * This atom captures inflation blocking failures. These are failures that
350 causes the whole layout to be dropped.
351
352 */
353message InflationFailed {
354  enum BlockingFailure {
355    BLOCKING_FAILURE_UNKNOWN = 0;
356    BLOCKING_FAILURE_NO_FAILURES = 1;
357    BLOCKING_FAILURE_MAX_LAYOUT_DEPTH_EXCEEDED = 2;
358    BLOCKING_FAILURE_MAX_EXPRESSION_NODE_COUNT_EXCEEDED = 3;
359  }
360  optional int32 package_uid = 1 [(is_uid) = true];
361  optional int32 classname_hash = 2;
362  // A failure causing the rendering to abort.
363  optional BlockingFailure blocking_failure = 3;
364}
365
366// Atom to capture ignored failures during an inflation.
367message IgnoredInflationFailuresReported {
368  optional int32 package_uid = 1 [(is_uid) = true];
369  optional int32 classname_hash = 2;
370  // A list of ignored failures (Bitset instead of repeated enum).
371  optional int32 ignored_failure = 3;
372}
373
374/**
375 * This atom captures the drawables used for each layout.
376 */
377message DrawableRendered {
378  enum DrawableBinarySizeBucket {
379    DRAWABLE_BINARY_SIZE_BUCKET_UNSPECIFIED = 0;
380    DRAWABLE_BINARY_SIZE_BUCKET_UNDER_TEN_KIB = 1;
381    DRAWABLE_BINARY_SIZE_BUCKET_TEN_TO_FIFTY_KIB = 2;
382    DRAWABLE_BINARY_SIZE_BUCKET_FIFTY_TO_HUNDRED_KIB = 3;
383    DRAWABLE_BINARY_SIZE_BUCKET_HUNDRED_TO_THREE_HUNDRED_KIB = 4;
384    DRAWABLE_BINARY_SIZE_BUCKET_THREE_HUNDRED_TO_SIX_HUNDRED_KIB = 5;
385    DRAWABLE_BINARY_SIZE_BUCKET_SIX_HUNDRED_TO_ONE_MB = 6;
386    DRAWABLE_BINARY_SIZE_BUCKET_ONE_MB_TO_FIVE_MB = 7;
387    DRAWABLE_BINARY_SIZE_BUCKET_OVER_FIVE_MB = 8;
388  }
389
390  enum DrawablePixelsCountBucket {
391    DRAWABLE_PIXEL_SIZE_BUCKET_UNSPECIFIED = 0;
392    DRAWABLE_PIXEL_SIZE_BUCKET_UNDER_100_PX = 1;
393    DRAWABLE_PIXEL_SIZE_BUCKET_100_TO_1000_PX = 2;
394    DRAWABLE_PIXEL_SIZE_BUCKET_1000_TO_10000_PX = 3;
395    DRAWABLE_PIXEL_SIZE_BUCKET_10000_TO_100000_PX = 4;
396    DRAWABLE_PIXEL_SIZE_BUCKET_100000_TO_10000000_PX = 5;
397    DRAWABLE_PIXEL_SIZE_BUCKET_OVER_10000000_PX = 6;
398  }
399  optional int32 package_uid = 1 [(is_uid) = true];
400  optional int32 classname_hash = 2;
401  // Drawable types (Bitset instead of repeated enum).
402  // Bit to drawable type mapping is as follow:
403  //  - 0 -> UNKNOWN
404  //  - 1 -> BITMAP
405  //  - 2 -> VECTOR_DRAWABLE
406  //  - 3 -> ANIMATED_IMAGE_DRAWABLE
407  //  - 4 -> ANIMATED_VECTOR_DRAWABLE
408  //  - 5 -> STATE_BASED
409  //  For example, if the inflated layout contains a Bitmap and a state based
410  //  drawable, the drawable_type field will be equal to 34 = (100010)b.
411  optional int32 drawable_type = 3;
412  // Binary size of the largest drawable.
413  optional DrawableBinarySizeBucket binary_size_bucket = 4;
414  // Pixels count of the largest drawable. Calculated as Height (px) x width
415  // (px).
416  optional DrawablePixelsCountBucket drawable_pixels_count_bucket = 5;
417}
418