[英]set mouse position on rooted android device
Kind of related to this . 与此相关的那种。
On a rooted Android phone, how do I set the position of the mouse from within an app. 在有根的Android手机上,如何在应用程序中设置鼠标的位置。 (The mouse is a bluetooth mouse.) (鼠标是蓝牙鼠标。)
The other question mentioned it's possible with root or ADB, but not how. 另一个问题提到它可能是root或ADB,但不是如何。
You can use this library to inject events: https://github.com/radhoo/android-event-injector 您可以使用此库来注入事件: https : //github.com/radhoo/android-event-injector
And add mouse move event method in Events.java
, below is a example to send a relative mouse move event: 并在Events.java
添加鼠标移动事件方法,下面是一个发送相对鼠标移动事件的示例:
public int sendMouseMove(int deltaX, int deltaY) {
intSendEvent(m_nId, EV_REL, REL_X, deltaX);
intSendEvent(m_nId, 0, 0, 0);
intSendEvent(m_nId, EV_REL, REL_Y, deltaY);
intSendEvent(m_nId, 0, 0, 0);
return 0;
}
A workaround, until android gets fixed, might be to have the app connect to localhost as adb client and issue adb commands. 解决方法,直到android得到修复,可能是让应用程序连接到localhost作为adb客户端并发出adb命令。
On the adb shell you can open /dev/input/uevent device to write mouse events include, absolute position 在adb shell上你可以打开/ dev / input / uevent设备写入鼠标事件包括,绝对位置
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.