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 optional InputEventLatencyReported input_event_latency_reported = 932 [(module) = "framework"]; 33 34 optional TouchpadUsage touchpad_usage = 10191 [(module) = "framework"]; 35} 36 37// Keyboard layout configured when the device is connected 38message KeyboardLayoutConfig { 39 // Keyboard configuration details provided by device 40 // Layout type mappings found at: 41 // frameworks/base/core/res/res/values/attrs.xml 42 optional int32 keyboard_layout_type = 1; 43 // Keyboard language tag (e.g. en-US, ru-Cyrl, etc) provided by device. 44 // This will follow BCP-47 language tag standards. 45 optional string keyboard_language_tag = 2; 46 // Selected PK layout name (e.g. English(US), English(Dvorak), etc.) 47 optional string keyboard_layout_name = 3; 48 // Criteria for layout selection 49 optional int32 layout_selection_criteria = 4; 50 // Keyboard layout type provided by IME 51 optional int32 ime_layout_type = 5; 52 // Language tag provided by IME (e.g. en-US, ru-Cyrl etc.) 53 optional string ime_language_tag = 6; 54} 55 56// Message containing the repeated field for KeyboardLayoutConfig 57message RepeatedKeyboardLayoutConfig { 58 repeated KeyboardLayoutConfig keyboard_layout_config = 1; 59} 60 61/** 62 * Logged when an external physical keyboard (PK) is connected and configured 63 * Also logs every time there is a configuration change for the keyboard, 64 * and the current configuration 65 * 66 * Logged from: 67 * frameworks/base/services/core/java/com/android/server/input 68 */ 69message KeyboardConfigured { 70 // Tracking if this is the first time the device is configured 71 optional bool is_first_time_configuration = 1; 72 // The Input Device Vendor ID 73 optional int32 vendor_id = 2; 74 // The Input Device Product ID 75 optional int32 product_id = 3; 76 // Keyboard configuration details 77 optional RepeatedKeyboardLayoutConfig repeated_keyboard_layout_config = 4 [(log_mode) = MODE_BYTES]; 78 // The Input Device Bus ID 79 optional android.input.InputDeviceBus device_bus = 5; 80} 81 82/** 83 * Logs shortcut usage on the physical keyboard 84 * Atom pushed when shortcut is used 85 * 86 * Logged from: 87 * frameworks/base/.../PhoneWindowManager.java 88 * frameworks/base/.../PhoneWindow.java 89 * frameworks/native/inputflinger 90 */ 91message KeyboardSystemsEventReported { 92 // The Input Device Vendor ID 93 optional int32 vendor_id = 1; 94 // The Input Device Product ID 95 optional int32 product_id = 2; 96 // Key event that occurred 97 optional android.input.KeyboardSystemEvent keyboard_system_event = 3; 98 // Key pressed to trigger the keyboard event 99 repeated int32 key_code = 4; 100 // Flag based modifier state when keyboard event was triggered 101 // This field represents the decimal version of the flag in binary 102 optional int32 modifier_state = 5; 103 // The Input Device Bus ID 104 optional android.input.InputDeviceBus device_bus = 6; 105} 106 107/** 108 * Logs input device usage information when a usage session is detected. 109 * Pushed when the system identifies the end of a usage session. 110 * 111 * Logged from: 112 * frameworks/native/services/inputflinger 113 */ 114message InputDeviceUsageReported { 115 // The Input Device Vendor ID 116 // Note that the meaning of the vendor ID may depend on the bus through 117 // which the device is connected. For example, the identifiers used for USI 118 // styluses are different than those for USB or Bluetooth devices. 119 optional int32 vendor_id = 1; 120 // The Input Device Product ID 121 // Note that the meaning of the product ID may depend on the bus through 122 // which the device is connected. For example, the identifiers used for USI 123 // styluses are different than those for USB or Bluetooth devices. 124 optional int32 product_id = 2; 125 // The Input Device Version ID 126 optional int32 version_id = 3; 127 // The Input Device Bus ID 128 optional android.input.InputDeviceBus device_bus = 4; 129 130 // The duration of the aggregated usage session for this Input Device, in 131 // milliseconds. 132 // (The int32_t will overflow at ~25 days) 133 optional int32 usage_duration_millis = 5; 134 135 // The breakdown of this usage session by source. 136 repeated android.input.InputDeviceUsageType usage_sources = 6; 137 // The breakdown of usage duration for each of the {@link usage_sources} 138 // reported above, in milliseconds. 139 repeated int32 usage_durations_per_source = 7; 140 141 // The breakdown of this usage session by uid. 142 repeated int32 uids = 8 [(is_uid) = true]; 143 // The breakdown of usage duration for each of the {@link uids} reported 144 // above, in milliseconds. 145 repeated int32 usage_durations_per_uid = 9; 146} 147 148/** 149 * Logs information about the usage of a touchpad. 150 * 151 * Logged from: 152 * frameworks/native/services/inputflinger 153 */ 154message TouchpadUsage { 155 // The Input Device Vendor ID 156 optional int32 vendor_id = 1; 157 // The Input Device Product ID 158 optional int32 product_id = 2; 159 // The Input Device Version ID 160 optional int32 version_id = 3; 161 // The Input Device Bus ID 162 optional android.input.InputDeviceBus device_bus = 4; 163 164 // The number of touches that are classified as fingers by the touchpad for 165 // their entire duration (i.e. from the touch down event until the lift 166 // event). 167 optional int32 finger_count = 5; 168 // The number of touches that are classified as palms by the touchpad at 169 // least once during their duration. 170 optional int32 palm_count = 6; 171 172 // The number of two-finger swipes recognized by the framework. 173 optional int32 two_finger_swipe_gesture_count = 7; 174 // The number of three-finger swipes recognized by the framework. 175 optional int32 three_finger_swipe_gesture_count = 8; 176 // The number of four-finger swipes recognized by the framework. 177 optional int32 four_finger_swipe_gesture_count = 9; 178 // The number of pinch gestures recognized by the framework. 179 optional int32 pinch_gesture_count = 10; 180} 181 182/** 183 * Logs input event latency statistics using histograms on a per device granular level. 184 * 185 * This atom will be pushed every 6 hours. 186 * The data gathered is cleared and the counters (histogram_counts) are reset after each push. 187 * 188 * If an input device was used and then disconnected, the latency data related to it is stored on 189 * the Android device until the atom is pushed. 190 * Histograms are created in memory for an input device only if that device is connected and 191 * produces input events. If an input device is connected and disconnected multiple times before 192 * pushing the atom, counters aren't reset, so we continue counting the latencies where we left 193 * off before the device was disconnected. 194 * 195 * Logged from: 196 * frameworks/native/services/inputflinger 197 */ 198 199message InputEventLatencyReported { 200 // The input device Vendor ID 201 optional int32 vendor_id = 1; 202 // The input device Product ID 203 optional int32 product_id = 2; 204 // Source(s) of the input device 205 repeated android.input.InputDeviceUsageType sources = 3; 206 // Type of Input Event: can be either a Key Event (Up and Down), or some specific Motion Event 207 // action type (Down/Move/Up/...) 208 optional android.input.InputEventType input_event_type = 4; 209 // The latency stage for which latency metric is collected 210 optional android.input.LatencyStage latency_stage = 5; 211 // Histogram version. This version number is mapped to an array 212 // containing the boundary values between histogram bins. 213 // Each bucket represents a range of latency values (in hundreds of microseconds). 214 optional int32 histogram_version = 6; 215 // The latency value counts for each of the histogram bins 216 // Expected number of fields: 20 217 repeated int32 histogram_counts = 7; 218} 219