• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 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
19package android.os.statsd.input;
20
21import "frameworks/proto_logging/stats/atom_field_options.proto";
22
23option java_package = "com.android.os.input";
24option java_multiple_files = true;
25
26/**
27 * Logs input device information when input device is registered with Android device.
28 * Reported at when a new input device is found by EventHub.
29 *
30 * Logged from:
31 *   frameworks/native/services/inputflinger
32 */
33message InputDeviceRegistered {
34    // The Input Device Name
35    optional string name = 1;
36    // The Input Device Vendor ID
37    optional int32 vendor_id = 2;
38    // The Input Device Product ID
39    optional int32 product_id = 3;
40    // The Input Device Version ID
41    optional int32 version_id = 4;
42    // The Input Device Bus ID
43    optional int32 bus_id = 5;
44    // The Input Device identifier generated from kernel device.
45    // Hash algorithm: HMAC-SHA256
46    optional string obfuscated_id = 6;
47    // The Input Device Classes
48    optional int32 device_classes = 7;
49}
50
51/**
52 * Logs basic timing information about touch events.
53 * Reported at most every 5 minutes while device is being interacted with.
54 *
55 * Logged from:
56 *   frameworks/native/services/inputflinger
57 */
58message TouchEventReported {
59    /**
60     * The fields latency_{min|max|mean|stdev} represent minimum, maximum, mean,
61     * and the standard deviation of the time spent processing touchscreen events
62     * in the kernel and inputflinger. The units are microseconds.
63     *
64     * On supported devices, the starting point is taken during the hard interrupt inside the
65     * kernel touch driver. On all other devices, the starting point is taken inside
66     * the kernel's input event subsystem upon receipt of the input event.
67     * The ending point is taken inside InputDispatcher, just after the input event
68     * is sent to the app.
69     */
70    // Minimum value
71    optional float latency_min_micros = 1;
72    // Maximum value
73    optional float latency_max_micros = 2;
74    // Average value
75    optional float latency_mean_micros = 3;
76    // Standard deviation
77    optional float latency_stdev_micros = 4;
78    // Number of touch events (input_event) in this report
79    optional int32 count = 5;
80}
81
82/**
83 * Logs slow input events.
84 * The reports are rate-limited via a configurable server flag.
85 *
86 * Logged from:
87 *   frameworks/native/services/inputflinger
88 */
89message SlowInputEventReported {
90    /**
91     * This is logged when a slow input event occurs. The threshold for what is considered a slow
92     * event is applied to the 'end_to_end' latency number, and is configurable via a server flag.
93     *
94     * The goal of this data is to identify the bottlenecks in processing of input events.
95     * All of the *_micros fields below are durations. The start and end points for each value
96     * are described in the comments.
97     */
98    // Whether or not this is a DOWN event. If false, this is a MOVE event
99    optional bool is_down = 1;
100    // Start: the input event was created (touch events: the touch interrupt received in the driver)
101    // End: the event was read in userspace (in EventHub)
102    optional int32 event_to_read_micros = 2;
103    // Start: the event was read in EventHub
104    // End: the event was send to the app via the InputChannel (written to the socket)
105    optional int32 read_to_deliver_micros = 3;
106    // Start: the input event was sent to the app
107    // End: the app consumed the input event
108    optional int32 deliver_to_consume_micros = 4;
109    // Start: the app consumed the event
110    // End: the app's 'finishInputEvent' call was received in inputflinger
111    // The end point can also be called "the app finished processing input event"
112    optional int32 consume_to_finish_micros = 5;
113    // Start: the app consumed the input event
114    // End: the app produced a buffer
115    optional int32 consume_to_gpu_complete_micros = 6;
116    // Start: the app produced a buffer
117    // End: the frame was shown on the display
118    optional int32 gpu_complete_to_present_micros = 7;
119    // The end-to-end touch latency
120    // Start: the input event was created (touch events: the touch interrupt received in the driver)
121    // End: the frame was presented on the display
122    optional int32 end_to_end_micros = 8;
123    // Since the last time this atom was reported, how many total events occurred?
124    optional int32 num_events_since_last_report = 9;
125    // Since the last time this atom was reported, how many slow events did not get reported
126    // due to rate limiting?
127    optional int32 num_skipped_slow_events_since_last_report = 10;
128}
129
130/**
131 * Logs gesture classification and timing information for touch events.
132 *
133 * Logged from:
134 *   frameworks/base/core/java/android/view/GestureDetector.java
135 *   frameworks/base/core/java/android/view/View.java
136 */
137message TouchGestureClassified {
138    // The source of the classification (e.g. Java class name).
139    optional string source = 1;
140
141    enum Classification {
142        UNKNOWN_CLASSIFICATION = 0;
143        SINGLE_TAP = 1;
144        DOUBLE_TAP = 2;
145        LONG_PRESS = 3;
146        DEEP_PRESS = 4;
147        SCROLL = 5;
148    }
149    // The classification of the gesture.
150    optional Classification classification = 2;
151
152    // The interval from the start of a touch event stream until the
153    // classification was made.
154    optional int32 latency_millis = 3;
155
156    // The distance from the location of the first touch event to the
157    // location of the touch event when the classification was made.
158    optional float displacement_px = 4;
159}
160
161/**
162 * Logs input event statistics.
163 * Pulls the statistics.
164 *
165 * Logged from:
166 *   frameworks/native/services/inputflinger
167 */
168message InputEventLatencySketch {
169    /**
170     * The 'bytes' field is the serialized KLL sketch. It is to be deserialized into an object of
171     * KLL proto, which would then be converted into a KLL sketch. The KLL sketch is a histogram
172     * of the data.
173     *
174     * The goal of this data is to identify the bottlenecks in processing of input events.
175     * All sketches measure durations in a streaming fashion.
176     * The units are "hundreds of microseconds", or 0.1 ms. They are chosen like this in order
177     * to reduce the occupied space.
178     * The start and end points for each value are described in the comments.
179     *
180     * We distinguish between 'DOWN' event latency (when the pointer first goes down), and 'MOVE'
181     * event latency, which characterizes the scrolling experience.
182     */
183
184    // -------------------------- DOWN event sketches ------ START ---------------------------------
185    // Start: the input event was created (touch events: the touch interrupt received in the driver)
186    // End: the event was read in userspace (in EventHub)
187    optional bytes event_to_read_100micros_down_sketch = 1 [(android.os.statsd.log_mode) = MODE_BYTES];
188    // Start: the event was read in EventHub
189    // End: the event was send to the app via the InputChannel (written to the socket)
190    optional bytes read_to_deliver_100micros_down_sketch = 2 [(android.os.statsd.log_mode) = MODE_BYTES];
191    // Start: the input event was sent to the app
192    // End: the app consumed the input event
193    optional bytes deliver_to_consume_100micros_down_sketch = 3 [(android.os.statsd.log_mode) = MODE_BYTES];
194    // Start: the app consumed the event
195    // End: the app's 'finishInputEvent' call was received in inputflinger
196    // The end point can also be called "the app finished processing input event"
197    optional bytes consume_to_finish_100micros_down_sketch = 4 [(android.os.statsd.log_mode) = MODE_BYTES];
198    // Start: the app consumed the input event
199    // End: the app produced a buffer
200    optional bytes consume_to_gpu_complete_100micros_down_sketch = 5 [(android.os.statsd.log_mode) = MODE_BYTES];
201    // Start: the app produced a buffer
202    // End: the frame was shown on the display
203    optional bytes gpu_complete_to_present_100micros_down_sketch = 6 [(android.os.statsd.log_mode) = MODE_BYTES];
204    // The end-to-end touch latency
205    // Start: the input event was created (touch events: the touch interrupt received in the driver)
206    // End: the frame was presented on the display
207    optional bytes end_to_end_100micros_down_sketch = 7 [(android.os.statsd.log_mode) = MODE_BYTES];
208    // -------------------------- DOWN event sketches ------ END -----------------------------------
209
210    // -------------------------- MOVE event sketches ------ START ---------------------------------
211    // Start: the input event was created (touch events: the touch interrupt received in the driver)
212    // End: the event was read in userspace (in EventHub)
213    optional bytes event_to_read_100micros_move_sketch = 8 [(android.os.statsd.log_mode) = MODE_BYTES];
214    // Start: the event was read in EventHub
215    // End: the event was send to the app via the InputChannel (written to the socket)
216    optional bytes read_to_deliver_100micros_move_sketch = 9 [(android.os.statsd.log_mode) = MODE_BYTES];
217    // Start: the input event was sent to the app
218    // End: the app consumed the input event
219    optional bytes deliver_to_consume_100micros_move_sketch = 10 [(android.os.statsd.log_mode) = MODE_BYTES];
220    // Start: the app consumed the event
221    // End: the app's 'finishInputEvent' call was received in inputflinger
222    // The end point can also be called "the app finished processing input event"
223    optional bytes consume_to_finish_100micros_move_sketch = 11 [(android.os.statsd.log_mode) = MODE_BYTES];
224    // Start: the app consumed the input event
225    // End: the app produced a buffer
226    optional bytes consume_to_gpu_complete_100micros_move_sketch = 12 [(android.os.statsd.log_mode) = MODE_BYTES];
227    // Start: the app produced a buffer
228    // End: the frame was shown on the display
229    optional bytes gpu_complete_to_present_100micros_move_sketch = 13 [(android.os.statsd.log_mode) = MODE_BYTES];
230    // The end-to-end touch latency
231    // Start: the input event was created (touch events: the touch interrupt received in the driver)
232    // End: the frame was presented on the display
233    optional bytes end_to_end_100micros_move_sketch = 14 [(android.os.statsd.log_mode) = MODE_BYTES];
234    // -------------------------- MOVE event sketches ------ END -----------------------------------
235}
236