使用了Root Tools 来招待命令。https://code.google.com/p/roottools/
复制代码 代码如下:
/**
* 接听来电
*/
private void answerRingingCall()
{
try
{
Command command = new Command(0, "input keyevent 5")
{
@Override
public void output(int id, String line)
{
Log.d(Tag, line);
}
};
RootTools.getShell(true).add(command).waitForFinish();
}
catch (InterruptedException e)
{
e.printStackTrace();
}
catch (IOException e)
{
e.printStackTrace();
}
catch (TimeoutException e)
{
e.printStackTrace();
}
catch (RootDeniedException e)
{
e.printStackTrace();
}
}