解决方案:
Runtime runtime = Runtime.getRuntime();
Process proc = runtime.exec("sh");
DataOutputStream os = new DataOutputStream(proc.getOutputStream());
os.writeBytes("su\n");
os.writeBytes("./deviceinfo > /data/test.txt\n");
os.writeBytes("exit\n");
os.flush();