event类型:
#define EV_SYN 0x00
#define EV_KEY 0x01
#define EV_REL 0x02
#define EV_ABS 0x03
#define EV_MSC 0x04
#define EV_SW 0x05
#define EV_LED 0x11
#define EV_SND 0x12
#define EV_REP 0x14
#define EV_FF 0x15
#define EV_PWR 0x16
#define EV_FF_STATUS 0x17
code 值 :
https://cs.android.com/android/platform/superproject/+/master:frameworks/base/core/java/android/view/KeyEvent.java
比如回车键:
KEYCODE_ENTER = 66
但是在 EventHub的scancode是 scanCode=28 , 肯定有个转的过程。
输入设备的类别:
frameworks/native/services/inputflinger/reader/include/EventHub.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42/* * Input device classes. */ enum class InputDeviceClass : uint32_t { /* The input device is a keyboard or has buttons. */ KEYBOARD = 0x00000001, /* The input device is an alpha-numeric keyboard (not just a dial pad). */ ALPHAKEY = 0x00000002, /* The input device is a touchscreen or a touchpad (either single-touch or multi-touch). */ TOUCH = 0x00000004, /* The input device is a cursor device such as a trackball or mouse. */ CURSOR = 0x00000008, /* The input device is a multi-touch touchscreen. */ TOUCH_MT = 0x00000010, /* The input device is a directional pad (implies keyboard, has DPAD keys). */ DPAD = 0x00000020, /* The input device is a gamepad (implies keyboard, has BUTTON keys). */ GAMEPAD = 0x00000040, /* The input device has switches. */ SWITCH = 0x00000080, /* The input device is a joystick (implies gamepad, has joystick absolute axes). */ JOYSTICK = 0x00000100, /* The input device has a vibrator (supports FF_RUMBLE). */ VIBRATOR = 0x00000200, /* The input device has a microphone. */ MIC = 0x00000400, /* The input device is an external stylus (has data we want to fuse with touch data). */ EXTERNAL_STYLUS = 0x00000800, /* The input device has a rotary encoder */ ROTARY_ENCODER = 0x00001000, /* The input device has a sensor like accelerometer, gyro, etc */ SENSOR = 0x00002000, /* The input device has a battery */ BATTERY = 0x00004000, /* The input device has sysfs controllable lights */ LIGHT = 0x00008000, /* The input device is virtual (not a real device, not part of UI configuration). */ VIRTUAL = 0x40000000, /* The input device is external (not built-in). */ EXTERNAL = 0x80000000, };
https://cs.android.com/android/platform/superproject/+/master:bionic/libc/kernel/uapi/linux/input-event-codes.h
InputListenerInterface 的作用:
android.view.PointerIcon
private PointerIcon mIcon;
PointerController.setCustomPointerIcon(icon);
void MouseCursorController::setCustomPointerIcon(const SpriteIcon& icon) {
std::scoped_lock lock(mLock);
1
2
3
4
5
6const int32_t iconId = mContext.getPolicy()->getCustomPointerIconId(); mLocked.additionalMouseResources[iconId] = icon; mLocked.requestedPointerType = iconId; mLocked.updatePointerIcon = true; updatePointerLocked();
}
MousePositionTracker 的 updatePosition 方法是被哪里调用的?
InputManagerService.setPointerIconVisible(visible, displayId);
InputManager.getInstance().setPointerIconType(pointerType); InputManager.getInstance().setCustomPointerIcon(mCustomPointerIcon);
事件是调用
base/services/core/jni/com_android_server_input_InputManagerService.cpp 的
nativeSetCustomPointerIcon 函数
最终是要解决 MouseCursorController 是做什么的 ?
SpriteController::doUpdateSprites() 调用 surface的 接口来 draw cursor的 。
最后
以上就是糟糕冷风最近收集整理的关于android系统鼠标的光标是如何显示的?的全部内容,更多相关android系统鼠标内容请搜索靠谱客的其他文章。
发表评论 取消回复