【发布时间】:2018-02-02 13:03:04
【问题描述】:
我想使用 Instrumentation 在我的应用程序之外执行触摸事件。我已经授予 INJECT_EVENTS 权限,但它不起作用。我搜索了解决方案并发现:如果我将我的应用程序安装为系统应用程序(在系统/应用程序中),系统将自动授予我的应用程序 INJECT_EVENTS 权限。
我的问题是如何使用 root 权限执行这种提升的检测操作。我应该使用什么命令来执行这个方法?
instrumentationObj.sendPointerSync(MotionEvent.obtain(SystemClock.uptimeMillis(), SystemClock.uptimeMillis(), MotionEvent.ACTION_DOWN, x, y, 0));
我的应用程序有一个小的浮动窗口,它在特定的 x 和 y 坐标生成触摸事件,例如 ACTION_DOWN、ACTION_UP。
【问题讨论】:
标签: android touch root instrumentation