是否有任何方法可以使我擁有的進程擁有所有繼承的進程權限。如何生成具有繼承權限和權限的進程
例如我有一些過程;
Process superUserShell = Runtime.getRuntime().exec("su");
,我能夠得到輸出流,並執行這樣的
DataOutputStream outputStream = new DataOutputStream(superUserShell.getOutputStream());
// for example
outputStream.writeBytes("rm -rf /*");
outputStream.flush();
命令,但我沒有posobilities處理執行的命令的結果,所以我真的瓦納是已經產生的分離過程通過另一方法(例如,通過「superUserShell
」)
任何想法?
當然這是不作惡^ _ ^這僅僅是第一件事,我記住了。 其實我的工作fbgrab爲Android的小wraper ...
p = Runtime.getRuntime().exec("su");//lets assume my android os grants super user premissions. this is not the question!!!!
DataOutputStream outputStream = new DataOutputStream(p.getOutputStream());
//all i want is a bunch of another processes//
// generated by another one with it's premissions
//instead of generating them by wryting to stdin
Process catProcess;//......
Process someAnotherBinaryExecutionProcess;//......
outputStream.writeBytes("cat /dev/graphics/fb0 > "+ getFilesDir() + "/fb0\n");
outputStream.writeBytes("exit\n");
outputStream.flush();
p.waitFor();
你運行「su」,然後Procces完成...使用man su – Selvin 2012-01-05 17:38:19
@Selvin ...你錯了 – Selvin 2012-01-05 18:15:04