Android跨进程事件注入 Injecting to another application requires INJECT_EVENTS permission
2017-06-10 20:51
423 查看
Android跨进程事件注入
Android跨进程事件注入时会出现如下错误Injecting to another application requires INJECT_EVENTS permission
测试机 :root的XIMO MI 3, 系统4.4.4
解决方案,使用sendevent绕过权限检查机制
如果想知道原理可阅读参考文档
example ,跨进程模拟屏幕点击
将/dev/input/下的所有文件权限修改为666(每次重启后都要修改权限)
chmod 666 event1
也可以用re文件管理器修改文件权限
进入cmd,输入
adb shell getevent
在手机屏幕上点击,会得到一个完整的点击命令,如下所示
code
private static Handler mFinalizeHandler; HandlerThread finalizeThread = new HandlerThread("MyFinalizeThread"); finalizeThread.start(); mFinalizeHandler = new Handler(finalizeThread.getLooper()); private static void simuClick() { // TODO 不同的手机命令不同 // 将上面的一次点击命令全部写到字符串数组s中, 注意将上述十六进制改为十进制 String[] s = {"/dev/input/event1 3 57 815", "/dev/input/event1 3 53 517",剩余的点击命令.... }; for (String cmd : s) { cmd = "sendevent " + cmd; try { final Process p = Runtime.getRuntime().exec(cmd); mFinalizeHandler.post(new Runnable() { @Override public void run() { try { p.waitFor(); } catch (InterruptedException e) { } finally { p.destroy(); } } }); } catch (Throwable t) { t.printStackTrace(); } }
参考网址
http://blog.csdn.net/u010164190/article/details/50550805
http://blog.csdn.net/zhubaitian/article/details/40430053
http://blog.csdn.net/hellowxwworld/article/details/10732863/
http://blog.csdn.net/mad1989/article/details/38109689/
http://blog.csdn.net/u010164190/article/details/50550805
http://blog.bihe0832.com/adb-shell-input.html
相关文章推荐
- Appium click事件 报错 Injecting to another application requires INJECT_EVENTS permission解决
- Robotium 自动化测试报错:Injecting to another application requires INJECT_EVENT permission
- Androd :java.lang.SecurityException: Injecting to another application requires INJECT_EVENTS permis
- Injecting to another application requires INJECT_EVENTS permission
- android跨进程事件注入(程序模拟用户输入)
- android跨进程事件注入(程序模拟用户输入)
- android跨进程事件注入(程序模拟用户输入)
- android 进程注入动态库 inject
- android跨进程事件注入(程序模拟用户输入)
- android跨进程事件注入——直接往linux底层写事件
- 【android学习】安卓设备实现触摸事件的监听,跨进程事件注入
- android进程inject注入
- android跨进程事件注入(程序模拟用户输入)
- Android inject 进程注入
- Android错误之--Platform MNC is a preview and requires application manifest to set minSdkVersion to 'MNC
- Android inject input events 注入Touch 点(x, y) 触摸输入事件
- android跨进程事件注入(程序模拟用户输入)
- android跨进程事件注入(程序模拟用户输入)
- android跨进程事件注入(程序模拟用户输入)
- android跨进程事件注入(程序模拟用户输入,getevent与sendevent)