我是靠谱客的博主 糟糕冷风,最近开发中收集的这篇文章主要介绍android系统鼠标的光标是如何显示的?,觉得挺不错的,现在分享给大家,希望可以做个参考。

概述

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

/*
* 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);

const 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系统鼠标的光标是如何显示的?所遇到的程序开发问题。

如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(38)

评论列表共有 0 条评论

立即
投稿
返回
顶部