需要root执行shell命令&QUOT;输入的KeyEvent&LT;#&GT;&QUOT;通过在运行的应用程序? [英] Need root to execute shell command "input keyevent <#>" through an app at runtime?
问题描述
我想执行的adb shell命令输入的KeyEvent 5
回答在运行时通过我的应用程序的调用。
I'm trying to execute the adb shell command input keyevent 5
to answer a call through my app at run time.
如果我这样做:
Runtime.getRuntime().exec("input keyevent 5");
它似乎没有执行(什么也没有发生)。但是,当我这样做:
It doesn't seem to execute (nothing is happening). But when I do this:
Runtime.getRuntime().exec(new String[] {"su", "-c", "input keyevent 5"});
在屏幕上的应答按钮预期的模拟自来水发生。这是很好的。
The expected simulated tap on the answer button on-screen happens. Which is good.
但有一个问题是,在其上使用超级用户扎根某些设备,该命令将需要一段时间才能获得超级用户权限。它正常工作与具有Chainfire的SuperSU苏二进制设备。
However one problem is that on some devices which are rooted using Superuser, the command takes a while to get the superuser permission. It works fine with devices which have Chainfire's SuperSU su binary.
我的问题是:
是否有可能没有根通过Java code运行时执行这个命令?
My question is: Is it possible to execute this command without root through Java code at runtime?
在此先感谢!
推荐答案
绝对没有!
这将是绝对重要的安全问题,ERGO你必须要扎根。
That would an absolute major security issue, ergo you have to be rooted.
这篇关于需要root执行shell命令&QUOT;输入的KeyEvent&LT;#&GT;&QUOT;通过在运行的应用程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!