| /* | |
| * Copyright 2026 The Android Open Source Project | |
| * | |
| * Licensed under the Apache License, Version 2.0 (the "License"); | |
| * you may not use this file except in compliance with the License. | |
| * You may obtain a copy of the License at | |
| * | |
| * http://www.apache.org/licenses/LICENSE-2.0 | |
| * | |
| * Unless required by applicable law or agreed to in writing, software | |
| * distributed under the License is distributed on an "AS IS" BASIS, | |
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
| * See the License for the specific language governing permissions and | |
| * limitations under the License. | |
| */ | |
| #pragma once | |
| #include <cstdint> | |
| #include <input/Input.h> | |
| #include <input/InputTransport.h> | |
| namespace android { | |
| /** | |
| * Enum representation of the InputDeviceUsageSource. | |
| */ | |
| enum class InputDeviceUsageSource : int32_t { | |
| UNKNOWN = 0, | |
| BUTTONS = 1, | |
| KEYBOARD = 2, | |
| DPAD = 3, | |
| GAMEPAD = 4, | |
| JOYSTICK = 5, | |
| MOUSE = 6, | |
| MOUSE_CAPTURED = 7, | |
| TOUCHPAD = 8, | |
| TOUCHPAD_CAPTURED = 9, | |
| ROTARY_ENCODER = 10, | |
| STYLUS_DIRECT = 11, | |
| STYLUS_INDIRECT = 12, | |
| STYLUS_FUSED = 13, | |
| TOUCH_NAVIGATION = 14, | |
| TOUCHSCREEN = 15, | |
| TRACKBALL = 16, | |
| ftl_first = UNKNOWN, | |
| ftl_last = TRACKBALL, | |
| kMaxValue = ftl_last | |
| }; | |
| /** | |
| * Derives the fine-grained InputDeviceUsageSource from raw input source and toolType. | |
| */ | |
| InputDeviceUsageSource getUsageSourceForMotion(uint32_t source, ToolType toolType); | |
| InputDeviceUsageSource getUsageSourceForMotion(const InputMessage::Body::Motion& motion); | |
| InputDeviceUsageSource getUsageSourceForMotion(const MotionEvent& event); | |
| /** | |
| * Derives the fine-grained InputDeviceUsageSource for a Key event. | |
| */ | |
| InputDeviceUsageSource getUsageSourceForKey(uint32_t source, int32_t keyCode, int32_t keyboardType); | |
| InputDeviceUsageSource getUsageSourceForKey(const KeyEvent& event, int32_t keyboardType); | |
| } // namespace android |