需安卓系统已root
String cmd = "busybox chmod 666 /dev/tty1";//要执行的shell命令
try {
Process process = Runtime.getRuntime().exec("su");
DataOutputStream os = new DataOutputStream(process.getOutputStream());
os.write(cmd.getBytes());
os.writeBytes("\nexit\n");
os.flush();
} catch (IOException e) {
e.printStackTrace();
}