• 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/atoms.proto";
22import "frameworks/proto_logging/stats/atom_field_options.proto";
23import "frameworks/proto_logging/stats/enums/input/enums.proto";
24
25option java_package = "com.android.os.input";
26option java_multiple_files = true;
27
28extend Atom {
29    optional KeyboardConfigured keyboard_configured = 682 [(module) = "framework"];
30    optional KeyboardSystemsEventReported keyboard_systems_event_reported = 683 [(module) = "framework"];
31    optional InputDeviceUsageReported inputdevice_usage_reported = 686 [(module) = "framework"];
32
33    optional TouchpadUsage touchpad_usage = 10191 [(module) = "framework"];
34}
35
36// Keyboard layout configured when the device is connected
37message KeyboardLayoutConfig {
38    // Keyboard configuration details provided by device
39    // Layout type mappings found at:
40    // frameworks/base/core/res/res/values/attrs.xml
41    optional int32 keyboard_layout_type = 1;
42    // Keyboard language tag (e.g. en-US, ru-Cyrl, etc) provided by device.
43    // This will follow BCP-47 language tag standards.
44    optional string keyboard_language_tag = 2;
45    // Selected PK layout name (e.g. English(US), English(Dvorak), etc.)
46    optional string keyboard_layout_name = 3;
47    // Criteria for layout selection
48    optional int32 layout_selection_criteria = 4;
49    // Keyboard layout type provided by IME
50    optional int32 ime_layout_type = 5;
51    // Language tag provided by IME (e.g. en-US, ru-Cyrl etc.)
52    optional string ime_language_tag = 6;
53}
54
55// Message containing the repeated field for KeyboardLayoutConfig
56message RepeatedKeyboardLayoutConfig {
57     repeated KeyboardLayoutConfig keyboard_layout_config = 1;
58}
59
60/**
61 * Logged when an external physical keyboard (PK) is connected and configured
62 * Also logs every time there is a configuration change for the keyboard,
63 * and the current configuration
64 *
65 * Logged from:
66 *   frameworks/base/services/core/java/com/android/server/input
67 */
68message KeyboardConfigured {
69    // Tracking if this is the first time the device is configured
70    optional bool is_first_time_configuration = 1;
71    // The Input Device Vendor ID
72    optional int32 vendor_id = 2;
73    // The Input Device Product ID
74    optional int32 product_id = 3;
75    // Keyboard configuration details
76    optional RepeatedKeyboardLayoutConfig repeated_keyboard_layout_config = 4 [(log_mode) = MODE_BYTES];
77}
78
79/**
80 * Logs shortcut usage on the physical keyboard
81 * Atom pushed when shortcut is used
82 *
83 * Logged from:
84 *   frameworks/base/.../PhoneWindowManager.java
85 *   frameworks/base/.../PhoneWindow.java
86 *   frameworks/native/inputflinger
87 */
88message KeyboardSystemsEventReported {
89    // The Input Device Vendor ID
90    optional int32 vendor_id = 1;
91    // The Input Device Product ID
92    optional int32 product_id = 2;
93    // Key event that occurred
94    optional android.input.KeyboardSystemEvent keyboard_system_event = 3;
95    // Key pressed to trigger the keyboard event
96    repeated int32 key_code = 4;
97    // Flag based modifier state when keyboard event was triggered
98    optional int32 modifier_state = 5;
99}
100
101/**
102 * Logs input device usage information when a usage session is detected.
103 * Pushed when the system identifies the end of a usage session.
104 *
105 * Logged from:
106 *   frameworks/native/services/inputflinger
107 */
108message InputDeviceUsageReported {
109    // The Input Device Vendor ID
110    // Note that the meaning of the vendor ID may depend on the bus through
111    // which the device is connected. For example, the identifiers used for USI
112    // styluses are different than those for USB or Bluetooth devices.
113    optional int32 vendor_id = 1;
114    // The Input Device Product ID
115    // Note that the meaning of the product ID may depend on the bus through
116    // which the device is connected. For example, the identifiers used for USI
117    // styluses are different than those for USB or Bluetooth devices.
118    optional int32 product_id = 2;
119    // The Input Device Version ID
120    optional int32 version_id = 3;
121    // The Input Device Bus ID
122    optional android.input.InputDeviceBus device_bus = 4;
123
124    // The duration of the aggregated usage session for this Input Device.
125    // (The int32_t will overflow at ~25 days)
126    optional int32 usage_duration_millis = 5;
127
128    // The breakdown of this usage session by source.
129    repeated android.input.InputDeviceUsageType usage_sources = 6;
130    // The breakdown of usage duration for each of the {@link usage_sources}
131    // reported above.
132    repeated int32 usage_durations_per_source = 7;
133
134    // The breakdown of this usage session by uid.
135    repeated int32 uids = 8 [(is_uid) = true];
136    // The breakdown of usage duration for each of the {@link uids} reported above.
137    repeated int32 usage_durations_per_uid = 9;
138}
139
140/**
141 * Logs information about the usage of a touchpad.
142 *
143 * Logged from:
144 *   frameworks/native/services/inputflinger
145 */
146message TouchpadUsage {
147    // The Input Device Vendor ID
148    optional int32 vendor_id = 1;
149    // The Input Device Product ID
150    optional int32 product_id = 2;
151    // The Input Device Version ID
152    optional int32 version_id = 3;
153    // The Input Device Bus ID
154    optional android.input.InputDeviceBus device_bus = 4;
155
156    // The number of touches that are classified as fingers by the touchpad for
157    // their entire duration (i.e. from the touch down event until the lift
158    // event).
159    optional int32 finger_count = 5;
160    // The number of touches that are classified as palms by the touchpad at
161    // least once during their duration.
162    optional int32 palm_count = 6;
163
164    // The number of two-finger swipes recognized by the framework.
165    optional int32 two_finger_swipe_gesture_count = 7;
166    // The number of three-finger swipes recognized by the framework.
167    optional int32 three_finger_swipe_gesture_count = 8;
168    // The number of four-finger swipes recognized by the framework.
169    optional int32 four_finger_swipe_gesture_count = 9;
170    // The number of pinch gestures recognized by the framework.
171    optional int32 pinch_gesture_count = 10;
172}
173