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 // The Input Device Bus ID 78 optional android.input.InputDeviceBus device_bus = 5; 79} 80 81/** 82 * Logs shortcut usage on the physical keyboard 83 * Atom pushed when shortcut is used 84 * 85 * Logged from: 86 * frameworks/base/.../PhoneWindowManager.java 87 * frameworks/base/.../PhoneWindow.java 88 * frameworks/native/inputflinger 89 */ 90message KeyboardSystemsEventReported { 91 // The Input Device Vendor ID 92 optional int32 vendor_id = 1; 93 // The Input Device Product ID 94 optional int32 product_id = 2; 95 // Key event that occurred 96 optional android.input.KeyboardSystemEvent keyboard_system_event = 3; 97 // Key pressed to trigger the keyboard event 98 repeated int32 key_code = 4; 99 // Flag based modifier state when keyboard event was triggered 100 // This field represents the decimal version of the flag in binary 101 optional int32 modifier_state = 5; 102 // The Input Device Bus ID 103 optional android.input.InputDeviceBus device_bus = 6; 104} 105 106/** 107 * Logs input device usage information when a usage session is detected. 108 * Pushed when the system identifies the end of a usage session. 109 * 110 * Logged from: 111 * frameworks/native/services/inputflinger 112 */ 113message InputDeviceUsageReported { 114 // The Input Device Vendor ID 115 // Note that the meaning of the vendor 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 vendor_id = 1; 119 // The Input Device Product ID 120 // Note that the meaning of the product ID may depend on the bus through 121 // which the device is connected. For example, the identifiers used for USI 122 // styluses are different than those for USB or Bluetooth devices. 123 optional int32 product_id = 2; 124 // The Input Device Version ID 125 optional int32 version_id = 3; 126 // The Input Device Bus ID 127 optional android.input.InputDeviceBus device_bus = 4; 128 129 // The duration of the aggregated usage session for this Input Device, in 130 // milliseconds. 131 // (The int32_t will overflow at ~25 days) 132 optional int32 usage_duration_millis = 5; 133 134 // The breakdown of this usage session by source. 135 repeated android.input.InputDeviceUsageType usage_sources = 6; 136 // The breakdown of usage duration for each of the {@link usage_sources} 137 // reported above, in milliseconds. 138 repeated int32 usage_durations_per_source = 7; 139 140 // The breakdown of this usage session by uid. 141 repeated int32 uids = 8 [(is_uid) = true]; 142 // The breakdown of usage duration for each of the {@link uids} reported 143 // above, in milliseconds. 144 repeated int32 usage_durations_per_uid = 9; 145} 146 147/** 148 * Logs information about the usage of a touchpad. 149 * 150 * Logged from: 151 * frameworks/native/services/inputflinger 152 */ 153message TouchpadUsage { 154 // The Input Device Vendor ID 155 optional int32 vendor_id = 1; 156 // The Input Device Product ID 157 optional int32 product_id = 2; 158 // The Input Device Version ID 159 optional int32 version_id = 3; 160 // The Input Device Bus ID 161 optional android.input.InputDeviceBus device_bus = 4; 162 163 // The number of touches that are classified as fingers by the touchpad for 164 // their entire duration (i.e. from the touch down event until the lift 165 // event). 166 optional int32 finger_count = 5; 167 // The number of touches that are classified as palms by the touchpad at 168 // least once during their duration. 169 optional int32 palm_count = 6; 170 171 // The number of two-finger swipes recognized by the framework. 172 optional int32 two_finger_swipe_gesture_count = 7; 173 // The number of three-finger swipes recognized by the framework. 174 optional int32 three_finger_swipe_gesture_count = 8; 175 // The number of four-finger swipes recognized by the framework. 176 optional int32 four_finger_swipe_gesture_count = 9; 177 // The number of pinch gestures recognized by the framework. 178 optional int32 pinch_gesture_count = 10; 179} 180